Changeset 2934823
- Timestamp:
- 07/05/2023 09:24:00 PM (21 months ago)
- Location:
- fcp-posts-by-search-query/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fcp-posts-by-search-query/trunk/inc/functions.php
r2907638 r2934823 35 35 36 36 function get_types_to_apply_to() { 37 return filter_by_public_types( get_settings()['apply-to'] );37 return filter_by_public_types( get_settings()['apply-to'] ?? [] ); 38 38 } 39 39 function get_types_to_search_among() { 40 return filter_by_public_types( get_settings()['select-from'] );40 return filter_by_public_types( get_settings()['select-from'] ?? [] ); 41 41 } 42 42 43 43 function css_minify($css) { 44 $css = preg_replace( '/\/\*(?:.*?)*\*\//', '', $css ); // remove comments 45 $css = preg_replace( '/\s+/', ' ', $css ); // one-line & only single speces 46 $css = preg_replace( '/ ?([\{\};:\>\~\+]) ?/', '$1', $css ); // remove spaces 47 $css = preg_replace( '/\+(\d)/', ' + $1', $css ); // restore spaces in functions 48 $css = preg_replace( '/(?:[^\}]*)\{\}/', '', $css ); // remove empty properties 44 $preg_replace = function($regexp, $replace, $string) { // avoid null result so that css still works even though not fully minified 45 return preg_replace( $regexp, $replace, $string ) ?: $string . '/* --- failed '.$regexp.', '.$replace.' */'; 46 }; 47 $css = $preg_replace( '/\s+/', ' ', $css ); // one-line & only single speces 48 $css = $preg_replace( '/ ?\/\*(?:.*?)\*\/ ?/', '', $css ); // remove comments 49 $css = $preg_replace( '/ ?([\{\};:\>\~\+]) ?/', '$1', $css ); // remove spaces 50 $css = $preg_replace( '/\+(\d)/', ' + $1', $css ); // restore spaces in functions 51 $css = $preg_replace( '/(?:[^\}]*)\{\}/', '', $css ); // remove empty properties 49 52 $css = str_replace( [';}', '( ', ' )'], ['}', '(', ')'], $css ); // remove last ; and spaces 53 // ++ should also remove 0 from 0.5, but not from svg-s? 54 // ++ try replacing ', ' with ',' 55 // ++ remove space between %3E %3C and before %3E and /%3E 50 56 return trim( $css ); 51 57 }; -
fcp-posts-by-search-query/trunk/inc/meta-boxes.php
r2927964 r2934823 29 29 ]; 30 30 31 32 31 $screen = get_current_screen(); 33 32 if ( !isset( $screen ) || !is_object( $screen ) || !isset( $files[ $screen->base ] ) ) { return; } 33 34 if ( $screen->base === 'post' && !in_array( $screen->post_type, get_types_to_apply_to() ) ) { return; } 34 35 35 36 $assets_path = FCPPBK_DIR.'assets'; … … 50 51 } 51 52 53 if ( $screen->base !== 'settings_page_posts-by-query' ) { return; } 54 52 55 // wp color picker 53 56 wp_enqueue_script( 'wp-color-picker' ); … … 68 71 69 72 $route_args = function($search_by) { 70 71 if ( empty( get_types_to_search_among() ) ) {72 return new \WP_Error( 'post_type_not_selected', 'Post type not selected', [ 'status' => 404 ] );73 }74 73 75 74 $wp_query_args = [ … … 100 99 'methods' => 'GET', 101 100 'callback' => function( \WP_REST_Request $request ) use ( $wp_query_args, $format_output ) { 101 102 if ( empty( get_types_to_search_among() ) ) { 103 return new \WP_Error( 'post_type_not_selected', 'Post type not selected', [ 'status' => 404 ] ); 104 } 102 105 103 106 if ( FCPPBK_DEV ) { usleep( rand(0, 1000000) ); } // simulate server responce delay -
fcp-posts-by-search-query/trunk/inc/shortcode.php
r2927964 r2934823 66 66 ]; 67 67 68 $search_by = $metas[ FCPPBK_PREF.'variants' ] ;68 $search_by = $metas[ FCPPBK_PREF.'variants' ] ?? 'list'; 69 69 70 70 switch ( $search_by ) { -
fcp-posts-by-search-query/trunk/posts-by-query.php
r2927964 r2934823 3 3 Plugin Name: FCP Posts by Search Query 4 4 Description: Implement a list of relevant posts to particular pages with a search query or exact list of posts. Easy pick and add. 5 Version: 1.0. 35 Version: 1.0.4 6 6 Requires at least: 5.8 7 7 Tested up to: 6.2 -
fcp-posts-by-search-query/trunk/readme.txt
r2927964 r2934823 5 5 Tested up to: 6.2 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 37 Stable tag: 1.0.4 8 8 Author: Firmcatalyst, Vadim Volkov, Aude Jamier 9 9 Author URI: https://firmcatalyst.com
Note: See TracChangeset
for help on using the changeset viewer.