Changeset 2918278
- Timestamp:
- 05/28/2023 06:15:37 PM (3 years ago)
- Location:
- redirect-editor/trunk
- Files:
-
- 3 edited
-
form.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
redirect-editor.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
redirect-editor/trunk/form.php
r2918111 r2918278 3 3 } 4 4 ?> 5 5 <style> body { background-color:#fff; }</style> 6 6 <div id="banner"> 7 7 <div class='wrap'> -
redirect-editor/trunk/readme.txt
r2918208 r2918278 14 14 15 15 == Description == 16 SEO done right is what we do. We provide SEO description, 301 redirects so people don't have to see 404's and we allow you to redirect the broken links to where you think they should go. This improves your SEO, bounce rate, and over all user experience with your site. Ever worried your url won't be unique or it'll be a bunch of numbers? Worry no more, we automatically generate unique urls as links for you when you type in your title. 17 18 Unlock the true potential of your website's search engine optimization with our comprehensive suite of tools. We understand the importance of optimizing your online presence, and that's why we provide you with cutting-edge features designed to maximize your website's visibility and drive organic traffic. Allow us to introduce our XML sitemap and 301 redirect editor, two indispensable tools that will revolutionize your SEO strategy. 19 20 Our XML sitemap, seamlessly integrated with WordPress, offers unparalleled accessibility and efficiency. By providing a structured map of your website's content to search engines, it ensures that your pages are promptly and accurately indexed. With this essential tool at your disposal, you can effortlessly improve your website's search engine rankings and attract a broader audience. 16 SEO done right is the best type of seo, redirects help seo, descriptions search see's help SEO and your customer know what they're looking for. SEO generated urls for your blog posts? We do that too! Get unique links optimized for SEO. 17 18 Unlock SEO with our comprehensive suite of tools. We understand the importance of optimizing your online presence, and that's why we provide you with cutting-edge features designed to maximize your website's visibility and drive organic traffic. Allow us to introduce our XML sitemap, 301 redirect editor, seo description of your posts and pages, and automatically generated seo optimized links for your blog posts and pages. This brings your SEO game to a whole new level, with your xml sitemap easy to access, redirects improving your bounce rate, so people stay on your site longer, seo optimized links help with showing up on google and explaining what you're doing, seo descriptions are of key importance for people to know what your posts and pages are about and also helps search engines. 21 19 22 20 Now, let's delve into the extraordinary capabilities of our 301 redirect editor. Have you ever encountered the predicament of renaming a post or page, only to realize that users visiting the old link are greeted with the dreaded error 404 page? Our 301 redirect editor eliminates this inconvenience entirely. Simply enter the old link and its corresponding new name, and voila! Users who land on the old URL will be seamlessly redirected to the new one, reducing bounce traffic and preventing potential customer loss. Say goodbye to error 404s and optimize your website's user experience effortlessly. … … 56 54 It adds in some protection from certain SEO software that has flaws which we patched. 57 55 == Screenshots == 56 == 3.1.2 == 57 fixes inability to see redirect editor due to page being all black. 58 58 == 3.1.1 == 59 59 Now automatically creates unique, seo friendly urls based off the title of the page -
redirect-editor/trunk/redirect-editor.php
r2918208 r2918278 2 2 3 3 /* 4 Plugin Name: S EO &Redirect Editor5 Version: 3.1. 14 Plugin Name: Search Engine Optimization Redirect Editor 5 Version: 3.1.2 6 6 Plugin URI: https://planetzuda.com 7 Description: add seo description to your sites posts or pages so it can be seen easier by search engines, like Google or if you need to 301 redirect a broken link to a new page for search engine optimization purposes, decrease your bounce rate and make a better site expecrence, this is the app you need you can use our app to redirect to any page. We make it easy to submit your xml map to search engines manually from our plugin. We patch flawed SEO plugins, automatically. More search features are coming. Our redirect editor is extremely useful and highly secure, which has been tested in bug bounties by white hat hackers, including our security and seo company. Additionally it has been enhanced yet again by the security company Planet Zuda in conjunction with AI.7 Description: If you need to redirect whether for search engine optimization purposes or otherwise you can use our app to redirect to any page. We provide a direct link to your xml sitemap which you can submit to search engines manually. We protect you against popular SEO plugins that damage your rankings by making your sitemap invisible to Google's bots by telling them to not index it, which is a free and automatically applied feature. More search features are coming. Our redirect editor is extremely useful and highly secure, which has been tested in bug bounties by white hat hackers, including our security and seo company. 8 8 Author: Planet Zuda 9 9 Author URI: https://planetzuda.com … … 26 26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 27 */ 28 if ( ! defined( 'ABSPATH' ) ) {29 exit;30 }31 28 $redirectEditorPlugin = new Redirect_Editor_Plugin(); 32 29 … … 34 31 { 35 32 36 37 public function add_seo_meta_box() {38 add_meta_box(39 'seo_meta_box',40 'SEO Description',41 array($this, 'render_seo_description_meta_box'),42 'post',43 'advanced',44 'default'45 );46 }47 48 public function render_seo_description_meta_box($post) {49 wp_nonce_field('seo_meta_box', 'seo_meta_box_nonce');50 $seo_description = get_post_meta($post->ID, 'seo_description', true);51 ?>52 <textarea name="seo_description" rows="5" style="width:100%;"><?php echo esc_textarea($seo_description); ?></textarea>53 <?php54 }55 56 public function save_seo_meta_data($post_id) {57 if (!isset($_POST['seo_meta_box_nonce']) || !wp_verify_nonce($_POST['seo_meta_box_nonce'], 'seo_meta_box')) {58 return;59 }60 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {61 return;62 }63 if (!current_user_can('edit_post', $post_id)) {64 return;65 }66 if (isset($_POST['seo_description'])) {67 update_post_meta($post_id, 'seo_description', sanitize_text_field($_POST['seo_description']));68 }69 }70 71 72 33 const NOTICES_OPTION_KEY = 'airtight_notices'; 73 34 … … 84 45 85 46 86 public function add_custom_meta_tags() { 87 if (is_single() || is_page()) { 88 $description = get_post_meta(get_the_ID(), 'seo_description', true); 89 if (!empty($description)) { 90 echo '<meta name="description" content="' . esc_attr($description) . '">'; 91 } 92 } 93 } 47 94 48 public function __construct() 95 49 { 96 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 97 add_action( 'post_submitbox_misc_actions', array( $this, 'display_reading_ease_score' ) ); 98 add_action( 'save_post', array( $this, 'save_reading_ease_score' ) ); 99 add_filter( 'wp_unique_post_slug', array( $this, 'generate_seo_friendly_url' ), 10, 4 ); 100 101 102 add_action('wp_head', array($this, 'add_custom_meta_tags')); 103 add_action('add_meta_boxes', array($this, 'add_seo_meta_box')); 104 add_action('save_post', array($this, 'save_seo_meta_data')); 105 50 106 51 // TODO:Check for instanceId if it is not present, generate one and save it to settings. 107 52 … … 146 91 147 92 } 148 public function generate_seo_friendly_url( $slug, $post_id, $post_status, $post_type ) { 149 if ( in_array( $post_type, array( 'post', 'page' ) ) && preg_match( '/%([a-z\-_]+)%/', $slug ) ) { 150 $post = get_post( $post_id ); 151 if ( $post ) { 152 $slug = sanitize_title( $post->post_title ); 153 } 154 } 155 return $slug; 156 } 93 157 94 public function css_style() 158 95 { … … 199 136 } 200 137 138 201 139 public function plugin_settings_page_content() { 202 140 $redirects = $this->get_setting('redirects_raw'); … … 311 249 ]); 312 250 313 require_once (plugin_dir_path(__FILE__) .'form.php');251 require_once ('form.php'); 314 252 } 315 253 … … 363 301 } 364 302 */ 365 // Enqueue necessary scripts and styles366 public function enqueue_scripts() {367 wp_enqueue_script( 'flesch-reading-ease', plugin_dir_url( __FILE__ ) . 'flesch-reading-ease.js', array( 'jquery' ), '1.0.0', true );368 }369 370 // Calculate the Flesch Reading Ease score371 public function calculate_reading_ease_score( $post_id ) {372 $post = get_post( $post_id );373 $content = $post->post_content;374 $word_count = str_word_count( strip_tags( $content ) );375 $sentence_count = preg_match_all( '/[^\s](\.|\?|\!)(?!\w)/', $content, $matches );376 377 if ( $word_count > 0 && $sentence_count > 0 ) {378 $average_words_per_sentence = $word_count / $sentence_count;379 $average_syllables_per_word = $this->count_average_syllables_per_word( $content );380 381 $reading_ease_score = 206.835 - ( 1.015 * $average_words_per_sentence ) - ( 84.6 * $average_syllables_per_word );382 383 return round( $reading_ease_score );384 }385 386 return 0;387 }388 389 // Count the average number of syllables per word390 private function count_average_syllables_per_word( $content ) {391 $syllables = 0;392 $words = preg_split( '/\s+/', strip_tags( $content ) );393 394 foreach ( $words as $word ) {395 $syllables += $this->count_syllables( $word );396 }397 398 if ( count( $words ) > 0 ) {399 return $syllables / count( $words );400 }401 402 return 0;403 }404 405 // Count the number of syllables in a word406 private function count_syllables( $word ) {407 $word = strtolower( $word );408 $word = preg_replace( '/(?:[^laeiouy]es|ed|[^laeiouy]e)$/', '', $word );409 $word = preg_replace_callback( '/[aeiouy]{1,2}/', function ( $matches ) {410 return isset( $matches[0] ) ? 'x' : '';411 }, $word );412 413 return strlen( $word );414 }415 416 // Display the Flesch Reading Ease score on the post editor screen417 public function display_reading_ease_score() {418 $post_id = get_the_ID();419 $reading_ease_score = $this->calculate_reading_ease_score( $post_id );420 421 ?>422 <div class="misc-pub-section misc-pub-reading-ease-score">423 <label for="reading-ease-score"><?php _e( 'Reading Ease Score:', 'flesch-reading-ease' ); ?></label>424 <span id="reading-ease-score"><?php echo esc_html( $reading_ease_score ); ?></span>425 </div>426 <?php427 }428 429 // Save the Flesch Reading Ease score when the post is saved or updated430 public function save_reading_ease_score( $post_id ) {431 if ( isset( $_POST['post_type'] ) && in_array( $_POST['post_type'], array( 'post', 'page' ) ) ) {432 $reading_ease_score = $this->calculate_reading_ease_score( $post_id );433 update_post_meta( $post_id, '_reading_ease_score', $reading_ease_score );434 }435 }436 437 438 439 303 440 304 public function save_data() … … 443 307 444 308 // run if we're actually processing data for the redirect_editor. Researchers we secured this, if you do find a flaw, please let us know. Also we did not write the original code. We made a security update, adopted it, fixed it, released security update. 445 if (current_user_can('manage_options') && is_user_logged_in()) {309 if (current_user_can('manage_options')) { 446 310 if (! isset($_POST['function']) || $_POST['function'] != $this->_redirectEditorSaveActionFunctionName) { 447 311 if (isset($_POST['function']) && $_POST['function'] == $this->_redirectEditorSaveExperimentalActionName) { 448 312 if ($this->checkNonce($this->_redirectEditorSaveExperimentalActionNonceName, $this->_redirectEditorSaveExperimentalActionName)) { 449 wp_die('failed, that nonce was incorrect.');450 313 print 'Sorry, your nonce did not verify.'; 314 exit(); 451 315 } else { 452 316 $this->save_experimental(); 453 317 } 454 318 } 319 // edirect-editor-activate 455 320 if (isset($_POST['function']) && $_POST['function'] == $this->_redirectEditorActivateActionName) { 456 321 if ($this->checkNonce($this->_redirectEditorActivateActionNonceName, $this->_redirectEditorActivateActionName)) { 457 wp_die('Sorry, your nonce did not verify.');458 322 print 'Sorry, your nonce did not verify.'; 323 exit(); 459 324 } else { 460 325 $this->activate(); … … 465 330 466 331 if ($this->checkNonce($this->_redirectEditorSaveActionNonceName, $this->_redirectEditorSaveActionName)) { 467 wp_die('Sorry, your nonce did not verify.');468 332 print 'Sorry, your nonce did not verify.'; 333 exit(); 469 334 } else { 470 335 if (isset($_POST['redirects'])) { … … 524 389 } 525 390 526 527 528 391 529 392 public function redirect($query) … … 545 408 546 409 547 548 410 ?>
Note: See TracChangeset
for help on using the changeset viewer.