Plugin Directory

Changeset 3185072


Ignore:
Timestamp:
11/10/2024 11:26:10 AM (17 months ago)
Author:
tsinf
Message:

v1.0.4 WP Plugin Check related fixes

Location:
ts-search-slug
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • ts-search-slug/trunk/plugin.php

    r2669765 r3185072  
    33 Plugin Name: TS Search Slug
    44 Plugin URI: https://www.spiess-informatik.de/wordpress-plugins/
    5  License: GPLv3 (license.txt)
     5 License: GPLv3
    66 Description: Search for Slug in Admin Post/Page Overview and add Slug Column to Post/Page Overview
    77 Author: Tobias Spiess
    88 Author URI: https://www.spiess-informatik.de
    9  Version: 1.0.3
    10  Text-Domain: tsinf_search_plugin_textdomain
     9 Version: 1.0.4
     10 Text-Domain: ts-search-slug
    1111 Domain Path: /languages
    1212*/
     
    1616 */
    1717function tsinf_search_slug_load_plugin_textdomain() {
    18     load_plugin_textdomain( 'tsinf_search_plugin_textdomain', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     18    load_plugin_textdomain( 'ts-search-slug', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    1919}
    2020add_action( 'plugins_loaded', 'tsinf_search_slug_load_plugin_textdomain' );
     
    7070        public static function render_main_page() {
    7171            if ( !current_user_can( 'edit_posts' ) )  {
    72                 wp_die( __('You do not have sufficient permissions to access this page.', 'tsinf_customstyle_plugin_textdomain'));
     72                wp_die( esc_html__('You do not have sufficient permissions to access this page.', 'ts-search-slug'));
    7373            }
    7474               
    7575            ?>
    76             <h1><?php _e('TS Search Slug', 'tsinf_search_plugin_textdomain'); ?></h1>
     76            <h1><?php esc_html_e('TS Search Slug', 'ts-search-slug'); ?></h1>
    7777           
    7878            <form method="POST" action="options.php">
     
    9090            add_settings_section(
    9191                    'ts_search_slug_plugin_main_section',
    92                     __('Allgemein', 'tsinf_search_plugin_textdomain'),
     92                    __('Allgemein', 'ts-search-slug'),
    9393                    array('TS_Search_Slug', 'render_options_page_main_section'),
    9494                    'ts_search_slug'
     
    9797            add_settings_field(
    9898                    'ts_search_slug_post_types',
    99                     __('Enable Post Slug Functionality for Custom Post Types', 'tsinf_search_plugin_textdomain'),
     99                    __('Enable Post Slug Functionality for Custom Post Types', 'ts-search-slug'),
    100100                    array('TS_Search_Slug', 'render_options_page_field_post_types'),
    101101                    'ts_search_slug',
     
    140140            ?>
    141141                <div class="tsinf_search_slug_line">
    142                     <input type="checkbox" name="ts_search_slug_settings[post_types][]" <?php echo $checked; ?> value="<?php echo $post_type->name; ?>" />
    143                     <span class="label"><?php echo $post_type->label; ?> (<?php echo $post_type->name; ?>)</span>
     142                    <input type="checkbox" name="ts_search_slug_settings[post_types][]" <?php echo esc_attr($checked); ?> value="<?php echo esc_attr($post_type->name); ?>" />
     143                    <span class="label"><?php echo esc_html($post_type->label); ?> (<?php echo esc_attr($post_type->name); ?>)</span>
    144144                </div>
    145145            <?php
     
    157157         */
    158158        public static function append_admin_columns($columns) {
    159             $columns['ts_search_slug_post_name'] = __('Postname/Slug', 'tsinf_search_plugin_textdomain');
     159            $columns['ts_search_slug_post_name'] = __('Postname/Slug', 'ts-search-slug');
    160160       
    161161            return $columns;
     
    172172       
    173173                case 'ts_search_slug_post_name':
    174                     echo basename(get_permalink());
     174                    echo esc_attr(basename(get_permalink()));
    175175                    break;
    176176       
     
    202202            if(isset($_GET['post_type']))
    203203            {
    204                 $post_type = htmlspecialchars(strip_tags($_GET['post_type']));
     204                $post_type = wp_strip_all_tags(wp_unslash($_GET['post_type']));
    205205            }
    206206           
     
    212212            }
    213213           
    214             if(is_admin() && 'edit.php' === $pagenow && isset($_GET['s']) && is_string($_GET['s']) && strlen($_GET['s']) && ($post_type === 'post' || $post_type === 'page' || in_array($post_type, $activated_cpts)))
     214            $search = (isset($_GET['s'])) ? sanitize_text_field(wp_unslash($_GET['s'])) : '';
     215            if(is_admin() && 'edit.php' === $pagenow && is_string($search) && strlen($search) > 0 && ($post_type === 'post' || $post_type === 'page' || in_array($post_type, $activated_cpts)))
    215216            {
    216217                global $wpdb;
    217218               
    218                 $like = '%' . $wpdb->esc_like($_GET['s']) . '%';
     219                $like = '%' . $wpdb->esc_like($search) . '%';
    219220                $like_term = $wpdb->prepare("({$wpdb->posts}.post_name LIKE %s)", $like);
    220221               
  • ts-search-slug/trunk/readme.txt

    r3130337 r3185072  
    33Tags: post, slug
    44Requires at least: 4.8
    5 Tested up to: 6.5
    6 Stable Tag: 4.9
     5Tested up to: 6.6
     6Stable Tag: 1.0.4
     7License: GPLv3
    78Creation time: 01.05.2018
    8 Last updated time: 21.01.2022
     9Last updated time: 10.11.2024
    910
    1011Search for Slug in Admin Post/Page Overview and add Slug Column to Post/Page Overview.
     
    2021
    2122== Changelog ==
     23* 1.0.4
     24WP Plugin Check related fixes
     25
    2226* 1.0.3
    2327Fix PHP Warning "Parameter 2 to posts_where() expected to be a reference, value given"
Note: See TracChangeset for help on using the changeset viewer.