Changeset 2919381
- Timestamp:
- 05/31/2023 02:18:53 AM (3 years ago)
- Location:
- redirect-editor/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
redirect-editor.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
redirect-editor/trunk/readme.txt
r2919363 r2919381 50 50 It adds in some protection from certain SEO software that has flaws which we patched. 51 51 == Screenshots == 52 == 3.1.6 == 53 ASAP patch, fixes previous plugin broken code. 52 54 == 3.1.5 == 53 55 Added in automated image optimization, to try and put the title of your post or the title of your caption to be visible to the blind and deaf community, who use screen readers while also attempting to optimize your SEO. We only do this if your alt tag is blank, it's of high importance that you fill out your own alt tags, this is last resort. -
redirect-editor/trunk/redirect-editor.php
r2919363 r2919381 1 1 <?php 2 3 2 /* 4 3 Plugin Name: SEO & Redirect 5 Version: 3.1. 54 Version: 3.1.6 6 5 Plugin URI: https://planetzuda.com 7 6 Description: SEO is king, and content is queen. That's why we offer a comprehensive range of solutions to help you maximize your online visibility and drive targeted traffic to your website. From redirecting links to avoid 404 error pages to creating unique SEO-optimized links, our services are designed to enhance your website's performance and attract the attention of search engines. With our expertise, you can take your SEO strategy to new heights and stay ahead of the competition. … … 34 33 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 35 34 */ 36 $redirectEditorPlugin = new Redirect_Editor_Plugin(); 37 38 class Redirect_Editor_Plugin 39 { 35 class Redirect_Editor_Plugin { 40 36 41 37 const NOTICES_OPTION_KEY = 'airtight_notices'; … … 43 39 // UI components names 44 40 public $_redirectEditorSaveActionNonceName = "redirect-editor-nonce"; 45 46 41 public $_redirectEditorSaveActionName = "redirect-editor"; 47 48 42 public $_redirectEditorSaveActionFunctionName = "redirect-editor-save"; 49 50 43 public $_redirectEditorActivateActionNonceName = "redirect-editor-activate-nonce"; 51 52 44 public $_redirectEditorActivateActionName = "redirect-editor-activate"; 53 45 54 55 56 public function __construct() 57 { 58 59 // TODO:Check for instanceId if it is not present, generate one and save it to settings. 60 61 add_action('admin_init', array( 62 $this, 63 'save_data' 64 )); // for researchers, we adopted this code and secured the use of admin_init by requiring an admin to be logged in within function save_data. Before Planet Zuda took over, this was not required. 65 add_action('admin_menu', array( 66 $this, 67 'add_admin_menu' 68 )); 69 add_action('init', array( 70 $this, 71 'PZ_security_protection' 72 )); 73 add_action('init', array( 74 $this, 75 'css_style' 76 )); 77 78 add_action('admin_notices', array( 79 $this, 80 'output_notices' 81 )); 46 public function __construct() { 47 add_action('admin_init', array($this, 'save_data')); 48 add_action('admin_menu', array($this, 'add_admin_menu')); 49 add_action('init', array($this, 'PZ_security_protection')); 50 add_action('init', array($this, 'css_style')); 51 add_action('admin_notices', array($this, 'output_notices')); 52 82 53 // Yoast fix 83 54 if (version_compare(PHP_VERSION, '5.4.0') >= 0) { 84 85 55 header_register_callback(function () { 86 56 $request_uri = esc_url($_SERVER['REQUEST_URI']); 87 88 57 if (strpos($request_uri, '.xml') !== false) { 89 58 foreach (headers_list() as $header) { 90 91 59 if (strpos($header, 'X-Robots-Tag:') !== false) { 92 60 header_remove('X-Robots-Tag'); … … 96 64 }); 97 65 } 98 99 100 } 101 102 public function css_style() 103 { 104 wp_register_style( 'style', get_stylesheet_uri() ); 105 wp_enqueue_style( 'style' ); 106 107 } 108 109 110 public static function output_notices() 111 { 112 if(current_user_can('manage_options')) 113 { 114 $notices = self::get_notices(); 115 if (empty($notices)) { 116 return; 117 } 118 // Iterate over stored notices and output them. 119 foreach ($notices as $type => $messages) { 120 foreach ($messages as $message) { 121 printf('<div class="notice notice-%1$s is-dismissible"> 122 <p>%2$s</p> 123 </div>', esc_attr($type), esc_html($message)); 124 } 125 } 126 } 66 } 67 68 public function css_style() { 69 wp_register_style('style', get_stylesheet_uri()); 70 wp_enqueue_style('style'); 71 } 72 73 public function output_notices() { 74 if (current_user_can('manage_options')) { 75 $notices = self::get_notices(); 76 if (empty($notices)) { 77 return; 78 } 79 // Iterate over stored notices and output them. 80 foreach ($notices as $type => $messages) { 81 foreach ($messages as $message) { 82 printf( 83 '<div class="notice notice-%1$s is-dismissible"> 84 <p>%2$s</p> 85 </div>', 86 esc_attr($type), 87 esc_html($message) 88 ); 89 } 90 } 91 } 127 92 // All stored notices have been output. Update the stored array of notices to be an empty array. 128 93 self::update_notices([]); 129 94 } 130 95 131 private static function get_notices() 132 { 133 if(current_user_can('manage_options')) 134 { 135 $notices = get_option(self::NOTICES_OPTION_KEY, []); 136 return $notices; 137 } 138 } 139 public function create_plugin_settings_page() { 140 // Add the menu item and page 141 $page_title = 'SEO redirect editor'; 142 $menu_title = 'SEO redirect editor'; 143 $capability = 'manage_options'; 144 $slug = 'smashing_fields'; 145 $callback = array( $this, 'plugin_settings_page_content' ); 146 $icon = 'dashicons-admin-plugins'; 147 $position = 100; 148 149 add_menu_page( $page_title, $menu_title, $capability, $slug, $callback, $icon, $position ); 150 } 96 private static function get_notices() { 97 if (current_user_can('manage_options')) { 98 $notices = get_option(self::NOTICES_OPTION_KEY, []); 99 return $notices; 100 } 101 } 102 103 public function create_plugin_settings_page() { 104 // Add the menu item and page 105 $page_title = 'SEO redirect editor'; 106 $menu_title = 'SEO redirect editor'; 107 $capability = 'manage_options'; 108 $slug = 'smashing_fields'; 109 $callback = array($this, 'plugin_settings_page_content'); 110 $icon = 'dashicons-admin-plugins'; 111 $position = 100; 112 113 add_menu_page( 114 $page_title, 115 $menu_title, 116 $capability, 117 $slug, 118 $callback, 119 $icon, 120 $position 121 ); 122 } 151 123 152 124 … … 154 126 $redirects = $this->get_setting('redirects_raw'); 155 127 156 157 wp_enqueue_script('ajax-security', plugin_dir_url(__FILE__) . 'plugin.js', [ 158 'jquery' 159 ], false, true); 160 wp_enqueue_script('datatables', 'data-tables.css', array( 161 'jquery' 162 )); 163 wp_enqueue_style('datatables-style', 'jquery-datatables.css'); 164 wp_enqueue_style('font-awesome', 'font-awesome.css'); 128 wp_enqueue_script('datatables', plugin_dir_url(__FILE__) . 'data-tables.js', array('jquery'), false, true); 129 wp_enqueue_style('datatables-style', plugin_dir_url(__FILE__) . 'jquery-datatables.css'); 130 wp_enqueue_style('font-awesome', plugin_dir_url(__FILE__) . 'font-awesome.css'); 165 131 166 132 wp_localize_script('ajax-security', 'ajax_object', [ … … 169 135 ]); 170 136 171 require_once ('form.php');137 require_once('form.php'); 172 138 173 139 } … … 246 212 } 247 213 } 248 public function admin_page()249 {250 if(current_user_can('manage_options')) 251 {214 215 public function admin_page() 216 { 217 if (current_user_can('manage_options')) { 252 218 $redirects = $this->get_setting('redirects_raw'); 253 254 219 255 220 wp_enqueue_script('ajax-security', plugin_dir_url(__FILE__) . 'plugin.js', [ 256 221 'jquery' 257 222 ], false, true); 258 wp_enqueue_script('datatables', 'data-tables.css', array( 259 'jquery' 260 )); 261 wp_enqueue_style('datatables-style', 'jquery-datatables.css'); 262 wp_enqueue_style('font-awesome', 'font-awesome.css'); 223 wp_enqueue_script('datatables', plugin_dir_url(__FILE__) . 'data-tables.js', array('jquery'), false, true); 224 wp_enqueue_style('datatables-style', plugin_dir_url(__FILE__) . 'jquery-datatables.css'); 225 wp_enqueue_style('font-awesome', plugin_dir_url(__FILE__) . 'font-awesome.css'); 263 226 264 227 wp_localize_script('ajax-security', 'ajax_object', [ 265 228 'ajax_url' => admin_url('admin-ajax.php'), 266 'nonce' => wp_create_nonce($this->_ SaveScanIdActionName)229 'nonce' => wp_create_nonce($this->_redirectEditorSaveActionName) 267 230 ]); 268 231 269 require_once ('form.php'); 270 } 271 } 232 require_once('form.php'); 233 } 234 } 235 272 236 public function get_setting($name, $default = '') 273 237 { … … 316 280 return ! $_nonceExists || ! $_nonceValid; 317 281 } 318 /*public function meta_tags()282 public function meta_tags() 319 283 { 320 get_meta_tags( 321 } 322 */ 284 get_meta_tags(); 285 } 286 323 287 324 288 public function save_data() … … 427 391 } 428 392 } 393 429 394 class Custom_Sitemap_Generator { 430 395 … … 639 604 640 605 641 $unique_slug = UniqueSeoSlugGenerator::generate($slug, $post_id, $post_type);642 echo $unique_slug; // Output: "example-post-slug-2" (if the initial slug exists)606 //$unique_slug = UniqueSeoSlugGenerator::generate($slug, $post_id, $post_type); 607 //echo $unique_slug; // Output: "example-post-slug-2" (if the initial slug exists) 643 608 644 609
Note: See TracChangeset
for help on using the changeset viewer.