Changeset 3113814
- Timestamp:
- 07/07/2024 03:52:55 PM (4 weeks ago)
- Location:
- site-toolkit
- Files:
-
- 38 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
site-toolkit/trunk/.wp-env.json
r3058080 r3113814 5 5 ], 6 6 "plugins": [ 7 8 7 9 "https://downloads.wordpress.org/plugin/wordpress-beta-tester.zip", 8 "https://downloads.wordpress.org/plugin/query-monitor.zip",9 10 "." 10 11 ], -
site-toolkit/trunk/composer.json
r3058080 r3113814 18 18 "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", 19 19 "wptrt/wpthemereview": "^0.2.1", 20 "php-parallel-lint/php-parallel-lint": "^1. 3.2",20 "php-parallel-lint/php-parallel-lint": "^1.", 21 21 "wp-cli/i18n-command": "^2.6.1", 22 22 "wpreadme2markdown/wp2md": "^4.0.2" -
site-toolkit/trunk/phpcs.xml.dist
r3058080 r3113814 19 19 </rule> 20 20 21 <arg name="cache" value="./phpcs. cache"/>21 <arg name="cache" value="./phpcs.cache"/> 22 22 23 23 <rule ref="WordPress-Docs"/> … … 25 25 <rule ref="WordPress.WP.I18n"> 26 26 <properties> 27 <property name="text_domain" type="array" value=" digital-catalogue"/>27 <property name="text_domain" type="array" value=""/> 28 28 </properties> 29 29 </rule> -
site-toolkit/trunk/readme.txt
r3058080 r3113814 2 2 Contributors: xlthlx 3 3 Donate link: https://paypal.me/xlthlx 4 Tags: archives,columns,emoji,header,tools ,widgets4 Tags: archives,columns,emoji,header,tools 5 5 Requires at least: 5.9 6 Tested up to: 6. 56 Tested up to: 6. 7 7 Requires PHP: 7.4 8 Stable tag: 1. 0.48 Stable tag: 1. 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 32 32 = Archives = 33 33 1. 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. 34 2. Redirect Archives: Redirects authors archive, dates archive, tags archive to the homepage. 36 35 37 36 = Dashboard = … … 77 76 == Changelog == 78 77 78 79 80 81 82 79 83 = 1.0.4 = 80 84 * Tested up to 6.5 -
site-toolkit/trunk/site-toolkit.php
r3058080 r3113814 14 14 * Plugin URI: https://wordpress.org/plugins/site-toolkit/ 15 15 * Description: Sets of tools for WordPress admin and frontend. 16 * Version: 1. 0.416 * Version: 1. 17 17 * Requires at least: 5.9 18 18 * Requires PHP: 7.4 … … 61 61 'stk_archives' => array( 62 62 'remove_title' => 'yes', 63 'media_redirect' => 'yes',64 63 'redirect_author' => 'no', 65 64 'redirect_date' => 'no', -
site-toolkit/trunk/toolkit/admin/class-site-toolkit-options-page.php
r3058080 r3113814 123 123 } 124 124 125 $group = sanitize_text_field( $_POST['option_page'] );125 $group = ; 126 126 127 127 switch ( $group ) { 128 128 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 ); 130 134 $this->stk_show_message( 'general_options', __( 'Header Options saved.', 'site-toolkit' ), 'message' ); 131 135 break; 132 136 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 ); 134 142 $this->stk_show_message( 'seo_options', __( 'SEO Options saved.', 'site-toolkit' ), 'message' ); 135 143 break; 136 144 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 ); 138 150 $this->stk_show_message( 'archives_options', __( 'Archives Options saved.', 'site-toolkit' ), 'message' ); 139 151 break; 140 152 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 ); 142 158 $this->stk_show_message( 'dashboard_options', __( 'Dashboard Options saved.', 'site-toolkit' ), 'message' ); 143 159 break; 144 160 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 ); 146 166 $this->stk_show_message( 'listing_options', __( 'Listing Options saved.', 'site-toolkit' ), 'message' ); 147 167 break; 148 168 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 ); 150 174 $this->stk_show_message( 'login_options', __( 'Login Options saved.', 'site-toolkit' ), 'message' ); 151 175 break; 152 176 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 ); 154 182 $this->stk_show_message( 'uploads_options', __( 'Uploads Options saved.', 'site-toolkit' ), 'message' ); 155 183 break; … … 157 185 } 158 186 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'; 161 188 162 189 echo '<div class="wrap option-stk_options">'; … … 167 194 168 195 if ( isset( $_REQUEST['message'] ) && ! empty( $_REQUEST['message'] ) ) { 169 $text = sanitize_text_field( $_REQUEST['message']);196 $text = sanitize_text_field( ); 170 197 $id = 'settings-success'; 171 198 $class = 'notice-success'; 172 199 } 173 200 if ( isset( $_REQUEST['error'] ) && ! empty( $_REQUEST['error'] ) ) { 174 $text = sanitize_text_field( $_REQUEST['error']);201 $text = sanitize_text_field( ); 175 202 $id = 'settings-error'; 176 203 $class = 'notice-error'; … … 360 387 ); 361 388 362 363 389 add_settings_field( 364 390 'wp_version', … … 469 495 __( 'Remove Archive Title Prefix', 'site-toolkit' ), 470 496 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' ),479 497 'stk_archives_group', 480 498 'archives_section' … … 772 790 public function stk_title_callback() { 773 791 $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 void780 */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' ) );783 792 } 784 793 … … 876 885 echo '<p>'; 877 886 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>' : '' ); 879 888 } else { 880 889 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 13 13 * @return string The modified title. 14 14 */ 15 function stk_remove_archive_title_prefix( $title ) { 15 function stk_remove_archive_title_prefix( $title ) { 16 16 $single_cat_title = single_term_title( '', false ); 17 17 if ( is_category() || is_tag() || is_tax() || is_date() ) { -
site-toolkit/trunk/toolkit/inc/clean-uploads-names.php
r2845968 r3113814 13 13 * @return array The file information with the cleaned or original filename. 14 14 */ 15 function stk_upload_filter( $file ) { 15 function stk_upload_filter( $file ) { 16 16 $original_filename = pathinfo( $file['name'] ); 17 17 set_transient( … … 34 34 $file['name'] = sanitize_title( $new_filename ) . '.' . $path['extension']; 35 35 36 37 36 return $file; 38 37 } … … 45 44 * @return void 46 45 */ 47 function stk_update_attachment_title( $attachment_id ) { 46 function stk_update_attachment_title( $attachment_id ) { 48 47 $original_filename = get_transient( '_clean_image_filenames_original_filename' ); 49 48 -
site-toolkit/trunk/toolkit/inc/custom-login-url.php
r2993746 r3113814 40 40 global $pagenow,$stk_url_login,$wp_login_php; 41 41 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' ) ) ) ) { 45 45 $wp_login_php = true; 46 46 $_SERVER['REQUEST_URI'] = stk_user_trailingslashit( … … 52 52 // @codingStandardsIgnoreStart 53 53 $pagenow = 'index.php'; 54 // @codingStandardsIgnoreEnd55 54 56 55 } 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' ) ) ) { 57 56 58 // @codingStandardsIgnoreStart59 57 $pagenow = 'wp-login.php'; 60 58 // @codingStandardsIgnoreEnd … … 78 76 } 79 77 80 $request = parse_url( esc_url_raw( $_SERVER['REQUEST_URI'] ) );78 $request = ; 81 79 82 80 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( ) : '' ) ); 84 82 die; 85 83 } … … 87 85 if ( $wp_login_php ) { 88 86 $referer = wp_get_referer(); 89 $i_referer = parse_url( $referer );87 $i_referer = parse_url( $referer ); 90 88 if ( isset( $i_referer['query'] ) && false !== strpos( $referer, 'wp-activate.php' ) ) { 91 89 $referer = (array) $referer; … … 93 91 94 92 $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' ) 97 95 ) { 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( ) : '' ) ); 99 97 die; 100 98 } … … 127 125 wp(); 128 126 129 if ( stk_user_trailingslashit( str_repeat( '-/', 10 ) ) === $_SERVER['REQUEST_URI'] ) {127 if ( stk_user_trailingslashit( str_repeat( '-/', 10 ) ) === $_SERVER['REQUEST_URI'] ) { 130 128 $_SERVER['REQUEST_URI'] = stk_user_trailingslashit( '/wp-login-php/' ); 131 129 } … … 205 203 } 206 204 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 208 210 } 209 211 … … 233 235 * @return array 234 236 */ 235 function stk_admin_bar_body_class( $wp_classes, $extra_classes ) { 237 function stk_admin_bar_body_class( $wp_classes, $extra_classes ) { 236 238 if ( ( is_404() ) && ( ! is_user_logged_in() ) ) { 237 239 $wp_nobar_classes = array_diff( $wp_classes, array( 'admin-bar' ) ); -
site-toolkit/trunk/toolkit/inc/dashboard-custom-widget.php
r2845968 r3113814 18 18 'dashboard', 19 19 sanitize_key( $stk_dashboard['custom_widgets_context'] ), 20 'high' 20 'high' 21 21 ); 22 22 } -
site-toolkit/trunk/toolkit/inc/files-version.php
r2993746 r3113814 13 13 * @return string 14 14 */ 15 function stk_change_version_from_style_js( $src ) { 15 function stk_change_version_from_style_js( $src ) { 16 16 if ( ! is_admin() ) { 17 17 -
site-toolkit/trunk/toolkit/inc/header-links.php
r2993746 r3113814 32 32 * @return void 33 33 */ 34 function stk_disable_links() { 34 function stk_disable_links() { 35 35 remove_action( 'wp_head', 'adjacent_posts_rel_link' ); 36 36 remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); -
site-toolkit/trunk/toolkit/inc/images-alt.php
r2845968 r3113814 30 30 preg_match_all( '/<img [^>]*src="([^"]+)"[^>]*>/m', $value, $urls, PREG_SET_ORDER ); 31 31 32 32 33 $attachment_id = $wpdb->get_col( 33 34 $wpdb->prepare( … … 36 37 ) 37 38 ); 39 38 40 $attachment = get_post( $attachment_id[0] ); 39 41 $alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ); -
site-toolkit/trunk/toolkit/inc/pretty-search.php
r2845968 r3113814 19 19 $search_base = $wp_rewrite->search_base; 20 20 $needle = '/' . $search_base . '/'; 21 $uri = esc_url_raw( $_SERVER['REQUEST_URI'] );21 $uri = ; 22 22 23 23 if ( is_search() && strpos( $uri, $needle ) === false && strpos( $uri, '&' ) === false ) { -
site-toolkit/trunk/toolkit/inc/rest-api.php
r2845968 r3113814 35 35 * @return void 36 36 */ 37 function stk_disable_rest_api() { 37 function stk_disable_rest_api() { 38 38 remove_action( 'template_redirect', 'rest_output_link_header', 11 ); 39 39 remove_action( 'wp_head', 'rest_output_link_wp_head' ); -
site-toolkit/trunk/toolkit/inc/rss-feeds.php
r2845968 r3113814 25 25 function stk_remove_feed_comments() { 26 26 $pattern = '/.*' . preg_quote( esc_url( get_feed_link( 'comments_' . get_default_feed() ) ), '/' ) . '.*[\r\n]+/'; 27 echo preg_replace( $pattern, '', ob_get_clean() );27 echo ) ); 28 28 } -
site-toolkit/trunk/toolkit/inc/wordpress-version.php
r2845968 r3113814 40 40 * @return void 41 41 */ 42 function stk_remove_wordpress_version() { 42 function stk_remove_wordpress_version() { 43 43 remove_action( 'wp_head', 'wp_generator' ); 44 44 add_filter( 'the_generator', '__return_empty_string' ); -
site-toolkit/trunk/toolkit/index.php
r2993746 r3113814 100 100 add_filter( 'get_the_archive_title', 'stk_remove_archive_title_prefix' ); 101 101 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;109 102 case 'redirect_author': 110 103 add_action( 'template_redirect', 'stk_redirect_archives_author' ); … … 116 109 add_action( 'template_redirect', 'stk_redirect_archives_tag' ); 117 110 break; 118 }119 } elseif ( 'media_redirect' === $key ) {120 if ( false !== get_option( 'wp_attachment_pages_enabled' ) ) {121 update_option( 'wp_attachment_pages_enabled', 1 );122 111 } 123 112 }
Note: See TracChangeset
for help on using the changeset viewer.