Changeset 1156496
- Timestamp:
- 05/08/2015 08:43:01 PM (11 years ago)
- Location:
- seo-enforcer/trunk
- Files:
-
- 4 edited
-
admin.js (modified) (4 diffs)
-
readme.txt (modified) (5 diffs)
-
seoe.php (modified) (7 diffs)
-
seoe_admin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
seo-enforcer/trunk/admin.js
r1141029 r1156496 1 1 jQuery(document).ready(function($) { 2 2 function seoe_title_check(field) { 3 var max = 59;3 var max = seoe_ajax.title_length; 4 4 var len = $('#'+field).val().length; 5 5 var char = max - len; 6 6 7 if(len > =max) {8 return false;7 if(len > max) { 8 return len - max; 9 9 } 10 10 else { … … 18 18 } 19 19 function seoe_desc_check(field) { 20 var max = 156;20 var max = seoe_ajax.desc_length; 21 21 var len = $('#'+field).val().length; 22 22 var char = max - len; 23 23 24 if(len > =max) {25 return false;24 if(len > max) { 25 return len - max; 26 26 } 27 27 else { … … 50 50 $('#seoe_title_error').show(); 51 51 } 52 if(title_check === false) { 52 else if(title_check !== true) { 53 $('#title_length_set_notice').html(seoe_ajax.title_length); 54 $('#title_length_char_notice').html(title_check); 53 55 $('#seoe_title_length').show(); 54 56 } … … 70 72 $('#seoe_desc_error').show(); 71 73 } 72 if(desc_check === false) { 74 else if(desc_check !== true) { 75 $('#desc_length_set_notice').html(seoe_ajax.desc_length); 76 $('#desc_length_char_notice').html(desc_check); 73 77 $('#seoe_desc_length').show(); 74 78 } -
seo-enforcer/trunk/readme.txt
r1156413 r1156496 4 4 Requires at least: 3.9 5 5 Tested up to: 4.2.2 6 Stable tag: 1.2. 26 Stable tag: 1.2.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 38 38 == Changelog == 39 39 40 = 1.2.3 = 41 42 Released: May 8th, 2015 43 44 * **Updates** 45 46 * If using SEO notices then the length checks will now properly use the lengths you've defined in settings. It will also respect any exceptions you've given. 47 * The SEO notices will now show the recommended lengths and how many characters in excess when it's too long. 48 49 * **Bug Fixes** 50 51 * Fixed an issue where lengths would be shorter than defined if using the ... truncation method. 52 * You can now turn off the SEO notices in settings. It was getting stuck on and wouldn't allow you to disable it. 53 * The SEO notice check will not give an error if length is at the recommended length, only when longer than it. 54 40 55 = 1.2.2 = 41 56 42 57 Released: May 4th, 2015 43 58 44 * **Added** 59 * **New Features** 60 45 61 * Link for rate & review, as well as SEO Enforcer settings, appears on the plugins page. 46 62 47 * **Bug Fix** 63 * **Bug Fixes** 64 48 65 * Cleaned up some PHP notices about undefined variables. 49 66 … … 52 69 Released: April 30th, 2015 53 70 54 * **Bug Fix **71 * **Bug Fixes** 55 72 56 73 * The title and description length checks will now properly truncate after whole words instead of in the middle of a word. … … 64 81 * Added an option in settings to display SEO notices on admin screens where WordPress SEO or [Shopp SEO](https://wordpress.org/plugins/shopp-seo/) are used. This will give a reminder to manually enter in the SEO fields and will also give errors when content is saved and exceeds the recommended length. 65 82 66 * **Update d**83 * **Updates** 67 84 68 85 * Changed the default title length to 59 characters and description length to 156 to match with WordPress SEO's recommendations. … … 76 93 Released: March 31st, 2015 77 94 78 * **Update d**95 * **Updates** 79 96 80 97 * The deactivation of SEO Enforcer if WordPress SEO is deactivated has been removed and instead replaced with an admin notice. The problem was that when WordPress SEO was being upgraded it would in turn deactivate SEO Enforcer. If you did not realize this then you may have had SEO Enforcer deactivated for a while, maybe even now. 81 98 82 * **Bug Fix **99 * **Bug Fixes** 83 100 84 101 * Title and description lengths could be negative in certain situations and in turn create oddities. I now check for negative values to prevent those oddities. -
seo-enforcer/trunk/seoe.php
r1153070 r1156496 7 7 Author: Maine Hosting Solutions 8 8 Author URI: http://mainehost.com/ 9 Version: 1.2. 29 Version: 1.2.3 10 10 */ 11 11 … … 34 34 add_action('admin_menu', array($this,'menu')); 35 35 add_action('current_screen', array($this,'check_screen')); 36 add_action('plugins_loaded', array($this,'upgrade_check')); 36 37 37 38 add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this,'add_action_link')); 38 39 40 define('SEOE_SETTINGS_VER', 1); 39 41 define('SEOE_NAME','SEO Enforcer'); 40 42 define('SEOE_MENU_NAME','SEO Enforcer'); … … 61 63 62 64 return array_merge($mylinks, $links); 63 } 65 } 66 function upgrade_check() { 67 $version = get_option('seoe_settings_version'); 68 69 if(!$version) { 70 update_option('seoe_settings_version', SEOE_SETTINGS_VER); 71 } 72 elseif($version && $version != SEOE_SETTINGS_VER) { 73 update_option('seoe_settings_version', SEOE_SETTINGS_VER); 74 } 75 } 64 76 /** 65 77 * Creates the menu in WP admin for the plugin. … … 79 91 80 92 if(is_admin() && in_array($screen->base, $notice_types) && get_option('seoe_post_notices')) { 93 $title_check = get_option('seoe_title'); 94 $desc_check = get_option('seoe_desc'); 95 96 if($title_check) { 97 $title_trunc_type = get_option('seoe_title_trunc_type'); 98 $title_length = get_option('seoe_title_length'); 99 $title_exceptions = get_option('seoe_title_trunc_ex'); 100 101 if($title_exceptions) { 102 $ex = array_map('trim', explode(',', $title_exceptions)); 103 $post_id = $_GET['post']; 104 105 if($screen->base == 'post' && in_array($post_id, $ex)) $title_length = 9999; 106 } 107 } 108 else { 109 $title_length = SEOE_TITLE_LENGTH; 110 } 111 if($desc_check) { 112 $desc_trunc_type = get_option('seoe_desc_trunc_type'); 113 $desc_length = get_option('seoe_desc_length'); 114 $desc_exceptions = get_option('seoe_desc_trunc_ex'); 115 116 if($desc_exceptions) { 117 $ex = array_map('trim', explode(',', $desc_exceptions)); 118 $post_id = $_GET['post']; 119 120 if($screen->base == 'post' && in_array($post_id, $ex)) $desc_length = 9999; 121 } 122 } 123 else { 124 $desc_length = SEOE_DESC_LENGTH; 125 } 126 81 127 wp_enqueue_script('mhs_seoe_admin', plugin_dir_url( __FILE__ ) . 'admin.js', array( 'jquery'), false, true); 82 wp_localize_script('mhs_seoe_admin', 'seoe_ajax', array('ajaxurl' => admin_url('admin-ajax.php') ));128 wp_localize_script('mhs_seoe_admin', 'seoe_ajax', array('ajaxurl' => admin_url('admin-ajax.php'),'title_length'=>$title_length,'desc_length'=>$desc_length)); 83 129 84 130 add_action('admin_notices', array($this,'post_notice')); … … 91 137 echo '<div class="update-nag" style="display: none;" id="seoe_title_error">The SEO Title field should be manually filled in.</div>'; 92 138 echo '<div class="update-nag" style="display: none;" id="seoe_desc_error">The Meta Description field should be manually filled in.</div>'; 93 echo '<div class="error" style="display: none;" id="seoe_title_length"><p>The SEO Title field is longer than the recommended length .</p></div>';94 echo '<div class="error" style="display: none;" id="seoe_desc_length"><p>The Meta Description is longer than the recommended length .</p></div>';139 echo '<div class="error" style="display: none;" id="seoe_title_length"><p>The SEO Title field is longer than the recommended length of <span id="title_length_set_notice"></span> by <span id="title_length_char_notice"></span> characters</p></div>'; 140 echo '<div class="error" style="display: none;" id="seoe_desc_length"><p>The Meta Description is longer than the recommended length of <span id="desc_length_set_notice"></span> by <span id="desc_length_char_notice"></span> characters</p></div>'; 95 141 } 96 142 /** … … 176 222 177 223 if($type == 2) { 178 $length = $length -3;224 $length -= 3; 179 225 180 226 if($length < 0) $length = SEOE_TITLE_LENGTH; # If it would be 0 characters or less then give it the default length … … 237 283 238 284 if($type == 2) { 239 $length = $length -3;285 $length -= 3; 240 286 241 287 if($length < 0) $length = SEOE_DESC_LENGTH; # If it would be 0 characters or less then give it the default length -
seo-enforcer/trunk/seoe_admin.php
r1153070 r1156496 34 34 <div style="' . $left_style . '"> 35 35 <p> 36 <input type="checkbox" name="seoe_post_notices" value="1"' . ((get_option('seoe_post_notices')) ? ' checked' : '') . '> Enable SEO notices on the admin screens where WordPress SEO or Shopp SEO are used. 36 Enable SEO notices on the admin screens where WordPress SEO or Shopp SEO are used.<br /> 37 <input type="radio" name="seoe_post_notices" value="1"' . ((get_option('seoe_post_notices')) ? ' checked' : '') . '> Yes <input type="radio" name="seoe_post_notices" value="0"' . ((!get_option('seoe_post_notices')) ? ' checked' : '') . '> No 37 38 </p> 38 39 <h2>Frontend</h2>
Note: See TracChangeset
for help on using the changeset viewer.