Plugin Directory

Changeset 2919381


Ignore:
Timestamp:
05/31/2023 02:18:53 AM (3 years ago)
Author:
zuda
Message:

ASAP patch, fixxes prior broken code in previous versions.

Location:
redirect-editor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • redirect-editor/trunk/readme.txt

    r2919363 r2919381  
    5050It adds in some protection from certain SEO software that has flaws which we patched.
    5151== Screenshots ==
     52== 3.1.6 ==
     53ASAP patch, fixes previous plugin broken code.
    5254== 3.1.5 ==
    5355Added 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  
    11<?php
    2  
    32/*
    43Plugin Name: SEO & Redirect
    5 Version: 3.1.5
     4Version: 3.1.6
    65Plugin URI: https://planetzuda.com
    76Description:  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.
     
    3433Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    3534*/
    36 $redirectEditorPlugin = new Redirect_Editor_Plugin();
    37 
    38 class Redirect_Editor_Plugin
    39 {
     35class Redirect_Editor_Plugin {
    4036
    4137    const NOTICES_OPTION_KEY = 'airtight_notices';
     
    4339    // UI components names
    4440    public $_redirectEditorSaveActionNonceName = "redirect-editor-nonce";
    45 
    4641    public $_redirectEditorSaveActionName = "redirect-editor";
    47 
    4842    public $_redirectEditorSaveActionFunctionName = "redirect-editor-save";
    49 
    5043    public $_redirectEditorActivateActionNonceName = "redirect-editor-activate-nonce";
    51 
    5244    public $_redirectEditorActivateActionName = "redirect-editor-activate";
    5345
    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
    8253        // Yoast fix
    8354        if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
    84 
    8555            header_register_callback(function () {
    8656                $request_uri = esc_url($_SERVER['REQUEST_URI']);
    87 
    8857                if (strpos($request_uri, '.xml') !== false) {
    8958                    foreach (headers_list() as $header) {
    90 
    9159                        if (strpos($header, 'X-Robots-Tag:') !== false) {
    9260                            header_remove('X-Robots-Tag');
     
    9664            });
    9765        }
    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        }
    12792        // All stored notices have been output. Update the stored array of notices to be an empty array.
    12893        self::update_notices([]);
    12994    }
    13095
    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    }
    151123
    152124
     
    154126  $redirects = $this->get_setting('redirects_raw');
    155127       
    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');
     128wp_enqueue_script('datatables', plugin_dir_url(__FILE__) . 'data-tables.js', array('jquery'), false, true);
     129wp_enqueue_style('datatables-style', plugin_dir_url(__FILE__) . 'jquery-datatables.css');
     130wp_enqueue_style('font-awesome', plugin_dir_url(__FILE__) . 'font-awesome.css');
    165131
    166132        wp_localize_script('ajax-security', 'ajax_object', [
     
    169135        ]);
    170136
    171         require_once ('form.php');
     137        require_once('form.php');
    172138
    173139}
     
    246212    }
    247213    }
    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')) {
    252218        $redirects = $this->get_setting('redirects_raw');
    253        
    254219
    255220        wp_enqueue_script('ajax-security', plugin_dir_url(__FILE__) . 'plugin.js', [
    256221            'jquery'
    257222        ], 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');
    263226
    264227        wp_localize_script('ajax-security', 'ajax_object', [
    265228            'ajax_url' => admin_url('admin-ajax.php'),
    266             'nonce' => wp_create_nonce($this->_SaveScanIdActionName)
     229            'nonce' => wp_create_nonce($this->_redirectEditorSaveActionName)
    267230        ]);
    268231
    269         require_once ('form.php');
    270     }
    271     }
     232        require_once('form.php');
     233    }
     234}
     235 
    272236    public function get_setting($name, $default = '')
    273237    {
     
    316280        return ! $_nonceExists || ! $_nonceValid;
    317281    }
    318 /* public function meta_tags()
     282 public function meta_tags()
    319283{
    320 get_meta_tags(
    321 }
    322 */
     284get_meta_tags();
     285}
     286
    323287
    324288    public function save_data()
     
    427391    }
    428392}
     393
    429394class Custom_Sitemap_Generator {
    430395
     
    639604
    640605
    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)
    643608
    644609
Note: See TracChangeset for help on using the changeset viewer.