Plugin Directory

Changeset 3113814

Timestamp:
07/07/2024 03:52:55 PM (4 weeks ago)
Author:
xlthlx
Message:

v1.1.0

Location:
site-toolkit
Files:
38 added
19 edited

Legend:

Unmodified
Added
Removed
  • site-toolkit/trunk/.wp-env.json

    r3058080 r3113814  
    55  ],
    66  "plugins": [
     7
     8
    79    "https://downloads.wordpress.org/plugin/wordpress-beta-tester.zip",
    8     "https://downloads.wordpress.org/plugin/query-monitor.zip",
    910    "."
    1011  ],
  • site-toolkit/trunk/composer.json

    r3058080 r3113814  
    1818    "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
    1919    "wptrt/wpthemereview": "^0.2.1",
    20     "php-parallel-lint/php-parallel-lint": "^1.3.2",
     20    "php-parallel-lint/php-parallel-lint": "^1.",
    2121    "wp-cli/i18n-command": "^2.6.1",
    2222    "wpreadme2markdown/wp2md": "^4.0.2"
  • site-toolkit/trunk/phpcs.xml.dist

    r3058080 r3113814  
    1919    </rule>
    2020
    21     <arg name="cache" value="./phpcs.cache"/>
     21    <arg name="cache" value="./phpcs.cache"/>
    2222
    2323    <rule ref="WordPress-Docs"/>
     
    2525    <rule ref="WordPress.WP.I18n">
    2626        <properties>
    27             <property name="text_domain" type="array" value="digital-catalogue"/>
     27            <property name="text_domain" type="array" value=""/>
    2828        </properties>
    2929    </rule>
  • site-toolkit/trunk/readme.txt

    r3058080 r3113814  
    22Contributors: xlthlx
    33Donate link: https://paypal.me/xlthlx
    4 Tags: archives,columns,emoji,header,tools,widgets
     4Tags: archives,columns,emoji,header,tools
    55Requires at least: 5.9
    6 Tested up to: 6.5
     6Tested up to: 6.
    77Requires PHP: 7.4
    8 Stable tag: 1.0.4
     8Stable tag: 1.
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3232= Archives =
    33331. Remove Archive Title Prefix: Removes the prefix in the archive title.
    34 2. Redirect Attachments Pages: Redirects the attachment pages to the file url.
    35 3. Redirect Archives: Redirects authors archive, dates archive, tags archive to the homepage.
     342. Redirect Archives: Redirects authors archive, dates archive, tags archive to the homepage.
    3635
    3736= Dashboard =
     
    7776== Changelog ==
    7877
     78
     79
     80
     81
     82
    7983= 1.0.4 =
    8084* Tested up to 6.5
  • site-toolkit/trunk/site-toolkit.php

    r3058080 r3113814  
    1414 * Plugin URI:        https://wordpress.org/plugins/site-toolkit/
    1515 * Description:       Sets of tools for WordPress admin and frontend.
    16  * Version:           1.0.4
     16 * Version:           1.
    1717 * Requires at least: 5.9
    1818 * Requires PHP:      7.4
     
    6161    'stk_archives'  => array(
    6262        'remove_title'    => 'yes',
    63         'media_redirect'  => 'yes',
    6463        'redirect_author' => 'no',
    6564        'redirect_date'   => 'no',
  • site-toolkit/trunk/toolkit/admin/class-site-toolkit-options-page.php

    r3058080 r3113814  
    123123            }
    124124
    125             $group = sanitize_text_field( $_POST['option_page'] );
     125            $group = ;
    126126
    127127            switch ( $group ) {
    128128                case 'stk_general_group':
    129                     $this->stk_save_option( 'stk_general', array_map( 'sanitize_text_field', $_POST['stk_general'] ) );
     129                    // @codingStandardsIgnoreStart
     130                    $stk_general = isset( $_POST['stk_general'] ) ? $_POST['stk_general'] : array();
     131                    // @codingStandardsIgnoreEnd
     132                    $stk_general = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_general ) );
     133                    $this->stk_save_option( 'stk_general', $stk_general );
    130134                    $this->stk_show_message( 'general_options', __( 'Header Options saved.', 'site-toolkit' ), 'message' );
    131135                    break;
    132136                case 'stk_seo_group':
    133                     update_option( 'stk_seo', array_map( 'sanitize_text_field', $_POST['stk_seo'] ) );
     137                    // @codingStandardsIgnoreStart
     138                    $stk_seo = isset( $_POST['stk_seo'] ) ? $_POST['stk_seo'] : array();
     139                    // @codingStandardsIgnoreEnd
     140                    $stk_seo = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_seo ) );
     141                    update_option( 'stk_seo', $stk_seo );
    134142                    $this->stk_show_message( 'seo_options', __( 'SEO Options saved.', 'site-toolkit' ), 'message' );
    135143                    break;
    136144                case 'stk_archives_group':
    137                     update_option( 'stk_archives', array_map( 'sanitize_text_field', $_POST['stk_archives'] ) );
     145                    // @codingStandardsIgnoreStart
     146                    $stk_archives = isset( $_POST['stk_archives'] ) ? $_POST['stk_archives'] : array();
     147                    // @codingStandardsIgnoreEnd
     148                    $stk_archives = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_archives ) );
     149                    update_option( 'stk_archives', $stk_archives );
    138150                    $this->stk_show_message( 'archives_options', __( 'Archives Options saved.', 'site-toolkit' ), 'message' );
    139151                    break;
    140152                case 'stk_dashboard_group':
    141                     $this->stk_save_option( 'stk_dashboard', array_map( 'sanitize_text_field', $_POST['stk_dashboard'] ) );
     153                    // @codingStandardsIgnoreStart
     154                    $stk_dashboard = isset( $_POST['stk_dashboard'] ) ? $_POST['stk_dashboard'] : array();
     155                    // @codingStandardsIgnoreEnd
     156                    $stk_dashboard = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_dashboard ) );
     157                    $this->stk_save_option( 'stk_dashboard', $stk_dashboard );
    142158                    $this->stk_show_message( 'dashboard_options', __( 'Dashboard Options saved.', 'site-toolkit' ), 'message' );
    143159                    break;
    144160                case 'stk_listing_group':
    145                     update_option( 'stk_listing', array_map( 'sanitize_text_field', $_POST['stk_listing'] ) );
     161                    // @codingStandardsIgnoreStart
     162                    $stk_listing = isset( $_POST['stk_listing'] ) ? $_POST['stk_listing'] : array();
     163                    // @codingStandardsIgnoreEnd
     164                    $stk_listing = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_listing ) );
     165                    update_option( 'stk_listing', $stk_listing );
    146166                    $this->stk_show_message( 'listing_options', __( 'Listing Options saved.', 'site-toolkit' ), 'message' );
    147167                    break;
    148168                case 'stk_login_group':
    149                     update_option( 'stk_login', array_map( 'sanitize_text_field', $_POST['stk_login'] ) );
     169                    // @codingStandardsIgnoreStart
     170                    $stk_login = isset( $_POST['stk_login'] ) ? $_POST['stk_login'] : array();
     171                    // @codingStandardsIgnoreEnd
     172                    $stk_login = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_login ) );
     173                    update_option( 'stk_login', $stk_login );
    150174                    $this->stk_show_message( 'login_options', __( 'Login Options saved.', 'site-toolkit' ), 'message' );
    151175                    break;
    152176                case 'stk_uploads_group':
    153                     update_option( 'stk_uploads', array_map( 'sanitize_text_field', $_POST['stk_uploads'] ) );
     177                    // @codingStandardsIgnoreStart
     178                    $stk_uploads = isset( $_POST['stk_uploads'] ) ? $_POST['stk_uploads'] : array();
     179                    // @codingStandardsIgnoreEnd
     180                    $stk_uploads = array_map( 'sanitize_text_field', array_map( 'wp_unslash', $stk_uploads ) );
     181                    update_option( 'stk_uploads', $stk_uploads );
    154182                    $this->stk_show_message( 'uploads_options', __( 'Uploads Options saved.', 'site-toolkit' ), 'message' );
    155183                    break;
     
    157185        }
    158186
    159 
    160         $active_tab = isset( $_GET['tab'] ) ? sanitize_title( $_GET['tab'] ) : 'general_options';
     187        $active_tab = isset( $_GET['tab'] ) ? sanitize_title( wp_unslash( $_GET['tab'] ) ) : 'general_options';
    161188
    162189        echo '<div class="wrap option-stk_options">';
     
    167194
    168195        if ( isset( $_REQUEST['message'] ) && ! empty( $_REQUEST['message'] ) ) {
    169             $text  = sanitize_text_field( $_REQUEST['message'] );
     196            $text  = sanitize_text_field( );
    170197            $id    = 'settings-success';
    171198            $class = 'notice-success';
    172199        }
    173200        if ( isset( $_REQUEST['error'] ) && ! empty( $_REQUEST['error'] ) ) {
    174             $text  = sanitize_text_field( $_REQUEST['error'] );
     201            $text  = sanitize_text_field( );
    175202            $id    = 'settings-error';
    176203            $class = 'notice-error';
     
    360387        );
    361388
    362 
    363389        add_settings_field(
    364390            'wp_version',
     
    469495            __( 'Remove Archive Title Prefix', 'site-toolkit' ),
    470496            array( $this, 'stk_title_callback' ),
    471             'stk_archives_group',
    472             'archives_section'
    473         );
    474 
    475         add_settings_field(
    476             'media-redirect',
    477             __( 'Redirect Attachments Pages', 'site-toolkit' ),
    478             array( $this, 'stk_media_callback' ),
    479497            'stk_archives_group',
    480498            'archives_section'
     
    772790    public function stk_title_callback() {
    773791        $this->stk_create_radio( 'stk_archives', 'remove_title', __( 'Removes the prefix in the archive title.', 'site-toolkit' ) );
    774     }
    775 
    776     /**
    777      * Callback for media redirect.
    778      *
    779      * @return void
    780      */
    781     public function stk_media_callback() {
    782         $this->stk_create_radio( 'stk_archives', 'media_redirect', __( 'Redirects the attachment pages to the file url.', 'site-toolkit' ) );
    783792    }
    784793
     
    876885        echo '<p>';
    877886        if ( get_option( 'permalink_structure' ) ) {
    878             echo '<code>' . esc_url( trailingslashit( home_url() ) ). '</code> <input type="text" name="stk_login[stk_login]" value="' . esc_html( $this->options['stk_login'] ) . '">' . ( $this->stk_use_trailing_slashes() ? ' <code>/</code>' : '' );
     887            echo '<code>' . esc_url( trailingslashit( home_url() ) ). '</code> <input type="text" name="stk_login[stk_login]" value="' . esc_html( $this->options['stk_login'] ) . '">' . ( $this->stk_use_trailing_slashes() ? ' <code>/</code>' : '' );
    879888        } else {
    880889            echo '<code>' . esc_url( trailingslashit( home_url() ) ) . '?</code> <input type="text" name="stk_login[stk_login]" value="' . esc_html( $this->options['stk_login'] ) . '">';
  • site-toolkit/trunk/toolkit/inc/archive-title.php

    r2993746 r3113814  
    1313 * @return string The modified title.
    1414 */
    15 function stk_remove_archive_title_prefix( $title ) { 
     15function stk_remove_archive_title_prefix( $title ) {
    1616    $single_cat_title = single_term_title( '', false );
    1717    if ( is_category() || is_tag() || is_tax() || is_date() ) {
  • site-toolkit/trunk/toolkit/inc/clean-uploads-names.php

    r2845968 r3113814  
    1313 * @return array The file information with the cleaned or original filename.
    1414 */
    15 function stk_upload_filter( $file ) { 
     15function stk_upload_filter( $file ) {
    1616    $original_filename = pathinfo( $file['name'] );
    1717    set_transient(
     
    3434    $file['name'] = sanitize_title( $new_filename ) . '.' . $path['extension'];
    3535
    36 
    3736    return $file;
    3837}
     
    4544 * @return void
    4645 */
    47 function stk_update_attachment_title( $attachment_id ) { 
     46function stk_update_attachment_title( $attachment_id ) {
    4847    $original_filename = get_transient( '_clean_image_filenames_original_filename' );
    4948
  • site-toolkit/trunk/toolkit/inc/custom-login-url.php

    r2993746 r3113814  
    4040    global $pagenow,$stk_url_login,$wp_login_php;
    4141
    42     $request = parse_url( esc_url_raw( $_SERVER['REQUEST_URI'] ) );
    43 
    44     if ( ! is_admin() && ( strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false || ( isset( $request['path'] ) && untrailingslashit( $request['path'] ) === site_url( 'wp-login', 'relative' ) ) ) ) {
     42    $request = ;
     43
     44    if ( ! is_admin() && ( strpos( , 'wp-login.php' ) !== false || ( isset( $request['path'] ) && untrailingslashit( $request['path'] ) === site_url( 'wp-login', 'relative' ) ) ) ) {
    4545        $wp_login_php           = true;
    4646        $_SERVER['REQUEST_URI'] = stk_user_trailingslashit(
     
    5252     // @codingStandardsIgnoreStart
    5353     $pagenow = 'index.php';
    54      // @codingStandardsIgnoreEnd
    5554
    5655    } elseif ( ( ! get_option( 'permalink_structure' ) && isset( $_GET['stk_login'] ) && empty( $_GET['stk_login'] ) ) || ( isset( $request['path'] ) && untrailingslashit( $request['path'] ) === home_url( $stk_url_login, 'relative' ) ) ) {
    5756
    58      // @codingStandardsIgnoreStart
    5957     $pagenow = 'wp-login.php';
    6058     // @codingStandardsIgnoreEnd
     
    7876    }
    7977
    80     $request = parse_url( esc_url_raw( $_SERVER['REQUEST_URI'] ) );
     78    $request = ;
    8179
    8280    if ( 'wp-login.php' === $pagenow && stk_user_trailingslashit( $request['path'] ) !== $request['path'] && get_option( 'permalink_structure' ) ) {
    83         wp_safe_redirect( stk_user_trailingslashit( stk_new_login_url() ) . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . esc_url_raw( $_SERVER['QUERY_STRING'] ) : '' ) );
     81        wp_safe_redirect( stk_user_trailingslashit( stk_new_login_url() ) . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . esc_url_raw( ) : '' ) );
    8482        die;
    8583    }
     
    8785    if ( $wp_login_php ) {
    8886        $referer   = wp_get_referer();
    89         $i_referer = parse_url( $referer );
     87        $i_referer = parse_url( $referer );
    9088        if ( isset( $i_referer['query'] ) && false !== strpos( $referer, 'wp-activate.php' ) ) {
    9189            $referer = (array) $referer;
     
    9391
    9492            $result = wpmu_activate_signup( $referer['key'] );
    95             if ( ! empty( $referer['key'] ) && is_wp_error( $result ) && ( $result->get_error_code() === 'already_active' 
    96                 || $result->get_error_code() === 'blog_taken' ) 
     93            if ( ! empty( $referer['key'] ) && is_wp_error( $result ) && ( $result->get_error_code() === 'already_active'
     94                || $result->get_error_code() === 'blog_taken' )
    9795            ) {
    98                 wp_safe_redirect( stk_new_login_url() . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . esc_url_raw( $_SERVER['QUERY_STRING'] ) : '' ) );
     96                wp_safe_redirect( stk_new_login_url() . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . esc_url_raw( ) : '' ) );
    9997                die;
    10098            }
     
    127125    wp();
    128126
    129     if ( stk_user_trailingslashit( str_repeat( '-/', 10 ) ) === $_SERVER['REQUEST_URI'] ) {
     127    if ( stk_user_trailingslashit( str_repeat( '-/', 10 ) ) === $_SERVER['REQUEST_URI'] ) {
    130128        $_SERVER['REQUEST_URI'] = stk_user_trailingslashit( '/wp-login-php/' );
    131129    }
     
    205203    }
    206204
    207     return home_url( '/', $scheme ) . '?' . esc_url_raw( $_GET['stk_login'] );
     205    // @codingStandardsIgnoreStart
     206    if ( isset( $_GET['stk_login'] ) ) {
     207        return home_url( '/', $scheme ) . '?' . esc_url_raw( wp_unslash( $_GET['stk_login'] ) );
     208    }
     209    // @codingStandardsIgnoreEnd
    208210}
    209211
     
    233235 * @return array
    234236 */
    235 function stk_admin_bar_body_class( $wp_classes, $extra_classes ) { 
     237function stk_admin_bar_body_class( $wp_classes, $extra_classes ) {
    236238    if ( ( is_404() ) && ( ! is_user_logged_in() ) ) {
    237239        $wp_nobar_classes = array_diff( $wp_classes, array( 'admin-bar' ) );
  • site-toolkit/trunk/toolkit/inc/dashboard-custom-widget.php

    r2845968 r3113814  
    1818        'dashboard',
    1919        sanitize_key( $stk_dashboard['custom_widgets_context'] ),
    20         'high' 
     20        'high'
    2121    );
    2222}
  • site-toolkit/trunk/toolkit/inc/files-version.php

    r2993746 r3113814  
    1313 * @return string
    1414 */
    15 function stk_change_version_from_style_js( $src ) { 
     15function stk_change_version_from_style_js( $src ) {
    1616    if ( ! is_admin() ) {
    1717
  • site-toolkit/trunk/toolkit/inc/header-links.php

    r2993746 r3113814  
    3232 * @return void
    3333 */
    34 function stk_disable_links() { 
     34function stk_disable_links() {
    3535    remove_action( 'wp_head', 'adjacent_posts_rel_link' );
    3636    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
  • site-toolkit/trunk/toolkit/inc/images-alt.php

    r2845968 r3113814  
    3030                preg_match_all( '/<img [^>]*src="([^"]+)"[^>]*>/m', $value, $urls, PREG_SET_ORDER );
    3131
     32
    3233                $attachment_id = $wpdb->get_col(
    3334                    $wpdb->prepare(
     
    3637                    )
    3738                );
     39
    3840                $attachment    = get_post( $attachment_id[0] );
    3941                $alt           = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true );
  • site-toolkit/trunk/toolkit/inc/pretty-search.php

    r2845968 r3113814  
    1919    $search_base = $wp_rewrite->search_base;
    2020    $needle      = '/' . $search_base . '/';
    21     $uri         = esc_url_raw( $_SERVER['REQUEST_URI'] );
     21    $uri         = ;
    2222
    2323    if ( is_search() && strpos( $uri, $needle ) === false && strpos( $uri, '&' ) === false ) {
  • site-toolkit/trunk/toolkit/inc/rest-api.php

    r2845968 r3113814  
    3535 * @return void
    3636 */
    37 function stk_disable_rest_api() { 
     37function stk_disable_rest_api() {
    3838    remove_action( 'template_redirect', 'rest_output_link_header', 11 );
    3939    remove_action( 'wp_head', 'rest_output_link_wp_head' );
  • site-toolkit/trunk/toolkit/inc/rss-feeds.php

    r2845968 r3113814  
    2525function stk_remove_feed_comments() {
    2626    $pattern = '/.*' . preg_quote( esc_url( get_feed_link( 'comments_' . get_default_feed() ) ), '/' ) . '.*[\r\n]+/';
    27     echo preg_replace( $pattern, '', ob_get_clean() );
     27    echo ) );
    2828}
  • site-toolkit/trunk/toolkit/inc/wordpress-version.php

    r2845968 r3113814  
    4040 * @return void
    4141 */
    42 function stk_remove_wordpress_version() { 
     42function stk_remove_wordpress_version() {
    4343    remove_action( 'wp_head', 'wp_generator' );
    4444    add_filter( 'the_generator', '__return_empty_string' );
  • site-toolkit/trunk/toolkit/index.php

    r2993746 r3113814  
    100100                    add_filter( 'get_the_archive_title', 'stk_remove_archive_title_prefix' );
    101101                    break;
    102                 case 'media_redirect':
    103                     if ( false === get_option( 'wp_attachment_pages_enabled' ) ) {
    104                         add_action( 'template_redirect', 'stk_attachment_pages_redirect' );
    105                     } else {
    106                         update_option( 'wp_attachment_pages_enabled', 0 );
    107                     }
    108                     break;
    109102                case 'redirect_author':
    110103                       add_action( 'template_redirect', 'stk_redirect_archives_author' );
     
    116109                    add_action( 'template_redirect', 'stk_redirect_archives_tag' );
    117110                    break;
    118             }
    119         } elseif ( 'media_redirect' === $key ) {
    120             if ( false !== get_option( 'wp_attachment_pages_enabled' ) ) {
    121                 update_option( 'wp_attachment_pages_enabled', 1 );
    122111            }
    123112        }
Note: See TracChangeset for help on using the changeset viewer.