Plugin Directory

Changeset 1013718


Ignore:
Timestamp:
10/25/2014 07:05:35 AM (11 years ago)
Author:
wallfa_hm
Message:

fixed english error

Location:
duplicate-title-validate/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • duplicate-title-validate/trunk/duplicate-title-validate.php

    r1003976 r1013718  
    11<?php
    2 
     2 
    33/*
    4 * Plugin Name: Duplicate Title validate
     4* Plugin Name: Duplicate Title Validate
    55* Description: this plugin help , not allow publish Duplicate Title .
    66* Author: hasan movahed
     
    88* Author URI: http://www.wallfa.com
    99*/
    10 
     10 
    1111/*
    1212This program is free software; you can redistribute it and/or
     
    1414as published by the Free Software Foundation; either version 2
    1515of the License, or (at your option) any later version.
    16 
     16 
    1717This program is distributed in the hope that it will be useful,
    1818but WITHOUT ANY WARRANTY; without even the implied warranty of
    1919MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2020GNU General Public License for more details.
    21 
     21 
    2222You should have received a copy of the GNU General Public License
    2323along with this program; if not, write to the Free Software
    2424Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    2525*/
    26 
     26 
    2727//jQuery to send AJAX request
    2828function duplicate_titles_enqueue_scripts( $hook ) {
    29 
     29 
    3030    if( !in_array( $hook, array( 'post.php', 'post-new.php' , 'edit.php'))) return;
    3131    wp_enqueue_script('duptitles',
     
    3636add_action( 'admin_enqueue_scripts', 'duplicate_titles_enqueue_scripts', 2000 );
    3737add_action('wp_ajax_title_checks', 'duplicate_title_checks_callback');
    38 
    39 
     38 
     39 
    4040/// callback ajax
    4141function duplicate_title_checks_callback() {
    42 
     42 
    4343        function title_checks() {
    4444           
     
    4747            $title = $_POST['post_title'];
    4848            $post_id = $_POST['post_id'];
    49 
     49 
    5050            $titles = "SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'
    5151                        AND post_title = '{$title}' AND ID != {$post_id} ";
    52 
     52 
    5353            $results = $wpdb->get_results($titles);
    54 
     54 
    5555            if($results) {
    56                 return "<span style='color:red'>". _e( 'Please enter another title it\'s already exists' , 'dublicate-title-validate' ) ." </span>";
    57              //لطفا عنوان دیگری را انتخاب کنید این عنوان ثبت شده است .   
     56                return "<span style='color:red'>". _e( 'Duplicate title detected, please change the title.' , 'dublicate-title-validate' ) ." </span>";
    5857            } else {
    59                 return '<span style="color:green">'._e('This title is unique' , 'dublicate-title-validate').'</span>';
     58                return '<span style="color:green">'._e('This title is unique.' , 'dublicate-title-validate').'</span>';
    6059            }
    61             //عنوان انتخاب شده مورد تایید است .
     60           
    6261        }       
    6362        echo title_checks();
    6463        die();
    6564    }
    66 
     65 
    6766// this chek backend title and if Duplicate update status draft .
    6867function duplicate_titles_wallfa_bc( $post )
     
    7170    $title = $_POST['post_title'] ;
    7271    $post_id = $post ;
    73 
    74 
    75 
     72 
     73 
     74 
    7675    $wtitles = "SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'
    7776                        AND post_title = '{$title}' AND ID != {$post_id} " ;
    78 
     77 
    7978    $wresults = $wpdb->get_results( $wtitles ) ;
    80 
     79 
    8180    if ( $wresults )
    8281    {
     
    9291    }
    9392}
    94 
    95 
     93 
     94 
    9695add_action( 'publish_post',
    9796    'duplicate_titles_wallfa_bc' ) ;
    98 
     97 
    9998/// handel error for back end
    10099function not_published_error_notice() {
    101100    if(isset($_GET['wallfaerror']) == 1 ){
    102                    ?>
     101               ?>
    103102               <div class="updated">
    104                <p style='color:red' ><?php _e('Posted considered to have been released as a duplicate' , 'dublicate-title-validate') ?></p>
     103               <p style='color:red' ><?php _e('Title used for this post appears to be a duplicate. Please modify the title. You may also want to revise the URL slug to make sure it is unique as well.' , 'dublicate-title-validate') ?></p>
    105104               </div>
    106105               <?php
    107                //نوشته مورد نظر به دلیل داشتن عنوان تکراری منتشر نشد
    108         }}
     106        }
     107}
    109108add_action( 'admin_notices', 'not_published_error_notice' );       
    110 
    111 
     109 
     110 
    112111function duplicate_titles_wallfa_action_init()
    113112{
     
    115114load_plugin_textdomain('dublicate-title-validate',false,dirname(plugin_basename(__FILE__)).'/langs/');
    116115}
    117 
     116 
    118117// Add actions
    119118add_action('init', 'duplicate_titles_wallfa_action_init');
    120 
    121 
    122 
    123 
     119 
     120 
     121 
     122 
    124123function disable_autosave()
    125124{
     
    127126}
    128127add_action( 'wp_print_scripts', 'disable_autosave' ) ;
    129 
     128 
    130129?>
  • duplicate-title-validate/trunk/readme.txt

    r1003999 r1013718  
    1 === duplicate-title-validation ===
     1=== Duplicate Title Validate ===
    22Tags: duplicate,title duplicate cheker
    33Requires at least: 3.0.1
     
    55License: GPLv2 or later
    66License URI: http://www.gnu.org/licenses/gpl-2.0.html
    7 
    8 this plugin help for duplicate title cheker in wordpress  .
    9 
     7 
     8This plugin tries to detect duplicate post titles and displays a warning when it detects an exact match.
     9 
    1010== Description ==
    11 this plugin help for duplicate title validation and not allow published post to resolve this issue
    12 
     11 
     12This plugin tries to detect duplicate post titles. It displays a warning notice when an exact match is detected. It also stops users from publishing a post with a duplicate title and instead saves the post as a draft. It also reminds users to review the URL slug while changing a post title to make sure that URL slug is unique as well.
     13 
    1314== Installation ==
    14151. Upload \"duplicate-title-validate\" to the \"/wp-content/plugins/\" directory.
    15161. Activate the plugin through the \"Plugins\" menu in WordPress.
    16171. Enjoy
     18 
     19== Frequently Asked Questions ==
     20 
     21= Translators =
     22 
     23* persian (fa) - [hasan movahed](http://www.wallfa.com/)
     24* English (en) - [Noumaan Yaqoob](http://www.wpbeginner.com/)
     25 
     26== Screenshots ==
     27 
     281. screenshot-1.png
     29 
     30== Upgrade Notice ==
    1731
    18 == Frequently Asked Questions ==
    19 
    20 = Translators =
    21 
    22 * persian (fa) - [hasan movahed](http://www.wallfa.com/)
    23 
    24 == Screenshots ==
    25 
    26 1. screenshot-1.png
     32= 0.1 =
     33Fixed English Error.
    2734
    2835== Changelog ==
     36
    2937= 0.1 =
    3038* Initial release.
Note: See TracChangeset for help on using the changeset viewer.