Changeset 2925170
- Timestamp:
- 06/13/2023 09:26:58 AM (3 years ago)
- Location:
- sukellos-enable-classic-editor/trunk
- Files:
-
- 8 edited
-
readme.txt (modified) (2 diffs)
-
sukellos-enable-classic-editor.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/admin-builder/class-admin-builder.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/admin-builder/class-item-factory.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/admin-builder/inc/edd-licensing/EDD_SL_Plugin_Updater.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/admin-builder/items/fields/abstract-choices-field.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/admin-builder/items/fields/class-upload-field.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/utils/class-wp-helper.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sukellos-enable-classic-editor/trunk/readme.txt
r2784637 r2925170 4 4 Tags: admin, admin builder, custom admin panel, custom admin pages, option, user meta, post meta, gutenberg, classic editor 5 5 Requires at least: 5.2 6 Tested up to: 6. 0.27 Stable tag: 1.1. 26 Tested up to: 6.2.2 7 Stable tag: 1.1.4 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 126 126 == Changelog == 127 127 128 = 1.1.4 = 129 * WordPress 6.2.2 compatibility 130 * Basic Sukellos Fw evolutions 1.2.0 131 132 = 1.1.3 = 133 * WordPress 6.0.3 compatibility 134 128 135 = 1.1.2 = 129 136 * WordPress 6.0.2 compatibility -
sukellos-enable-classic-editor/trunk/sukellos-enable-classic-editor.php
r2784637 r2925170 4 4 * Plugin URI: https://wp-adminbuilder.com/enable-classic-editor/ 5 5 * Description: Sukellos Framework Tools - Enable Classic Editor 6 * Version: 1.1. 26 * Version: 1.1.4 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/class-admin-builder.php
r2705157 r2925170 150 150 case self::ADMIN_PAGE: 151 151 152 WP_Log::debug('Admin_Builder->create_container', ['use_tabs' => $settings[ 'use_tabs' ], 'is true? '=> ( $settings[ 'use_tabs' ] !== TRUE )?'false':'true']);153 154 152 // Type is depending on 'use_tabs' setting 155 153 if ( array_key_exists( 'use_tabs', $settings ) && ( $settings[ 'use_tabs' ] === TRUE ) ) { -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/class-item-factory.php
r2763350 r2925170 134 134 // Determine handler 135 135 $handler = null; 136 $default = ( array_key_exists( 'default', $settings ) ? $settings['default'] : '' ); 136 137 switch( $handler_type ) { 137 138 case self::OPTION: 138 $handler = new Option_Handler( $item_id, $ settings['default']);139 $handler = new Option_Handler( $item_id, $default ); 139 140 break; 140 141 default: -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/inc/edd-licensing/EDD_SL_Plugin_Updater.php
r2705165 r2925170 52 52 $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; 53 53 $this->failed_request_cache_key = 'edd_sl_failed_http_' . md5( $this->api_url ); 54 $this->use_basic_authorization = $_api_data['use_basic_authorization'];55 $this->basic_authorization_name = $_api_data['basic_authorization_name'];56 $this->basic_authorization_password = $_api_data['basic_authorization_password'];54 $this->use_basic_authorization = ( array_key_exists( 'use_basic_authorization', $_api_data ) ? $_api_data['use_basic_authorization'] : false ); 55 $this->basic_authorization_name = ( array_key_exists( 'basic_authorization_name', $_api_data ) ? $_api_data['basic_authorization_name'] : '' ); 56 $this->basic_authorization_password = ( array_key_exists( 'basic_authorization_password', $_api_data ) ? $_api_data['basic_authorization_password'] : '' ); 57 57 58 58 $edd_plugin_data[ $this->slug ] = $this->api_data; -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/items/fields/abstract-choices-field.php
r2705157 r2925170 63 63 64 64 /** 65 * Get field value depending on its specific type 66 * Handler implementation 67 */ 68 public function get_value() { 69 70 if ( is_null( $this->handler ) ) { 71 72 return array(); 73 } 74 $value = $this->handler->get_value(); 75 if ( !is_array( $value ) ) { 76 77 return array(); 78 } 79 return $this->handler->get_value(); 80 } 81 82 /** 65 83 * =============== 66 84 * ======================= -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/items/fields/class-upload-field.php
r2705157 r2925170 80 80 // Gives us an array with the first element as the src or false on fail. 81 81 $image_infos = wp_get_attachment_image_src( $value, array( 150, 150 ) ); 82 $url = $image_infos[0]; 82 $url = ''; 83 if ( $image_infos !== false ) { 84 85 $url = $image_infos[0]; 86 } 83 87 84 88 $preview_image = ''; -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/utils/class-wp-helper.php
r2705165 r2925170 32 32 33 33 return utf8_encode(strftime($format, $datetime->getTimestamp())); 34 } 35 36 37 /** 38 * Function which can be used in array_walk_recursive as callback to reduced huge string values in an array 39 * 40 * @param $string 41 * @param $index 42 * @return void 43 */ 44 public static function reduce_array_value ( &$string, $index ) { 45 46 if ( is_string( $string ) && ( strlen( $string ) > 2048 ) ) { 47 48 $string = substr( $string, 0, 4800 ).' [HUGE STRING REDUCED...]'; 49 } 34 50 } 35 51 … … 136 152 } 137 153 154 155 /** 156 * Allow to remove method for an hook when, it's a class method used and class don't have global for instanciation ! 157 */ 158 public static function remove_filters_with_method_name( $hook_name = '', $method_name = '', $priority = 0 ) { 159 global $wp_filter; 160 161 // Take only filters on right hook name and priority 162 if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) { 163 return false; 164 } 165 166 // Loop on filters registered 167 foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) { 168 // Test if filter is an array ! (always for class/method) 169 if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) { 170 // Test if object is a class and method is equal to param ! 171 if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && $filter_array['function'][1] == $method_name ) { 172 // Test for WordPress >= 4.7 WP_Hook class (https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/) 173 if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) { 174 unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] ); 175 } else { 176 unset( $wp_filter[ $hook_name ][ $priority ][ $unique_id ] ); 177 } 178 } 179 } 180 181 } 182 183 return false; 184 } 185 186 /** 187 * Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :) 188 */ 189 public static function remove_filters_for_anonymous_class( $hook_name = '', $class_name = '', $method_name = '', $priority = 0 ) { 190 global $wp_filter; 191 192 // Take only filters on right hook name and priority 193 if ( ! isset( $wp_filter[ $hook_name ][ $priority ] ) || ! is_array( $wp_filter[ $hook_name ][ $priority ] ) ) { 194 return false; 195 } 196 197 // Loop on filters registered 198 foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) { 199 // Test if filter is an array ! (always for class/method) 200 if ( isset( $filter_array['function'] ) && is_array( $filter_array['function'] ) ) { 201 // Test if object is a class, class and method is equal to param ! 202 if ( is_object( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) && get_class( $filter_array['function'][0] ) == $class_name && $filter_array['function'][1] == $method_name ) { 203 // Test for WordPress >= 4.7 WP_Hook class (https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/) 204 if ( is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) { 205 unset( $wp_filter[ $hook_name ]->callbacks[ $priority ][ $unique_id ] ); 206 } else { 207 unset( $wp_filter[ $hook_name ][ $priority ][ $unique_id ] ); 208 } 209 } 210 } 211 212 } 213 214 return false; 215 } 216 217 138 218 /** 139 219 * Check if a image already exist in media … … 142 222 * @return type 143 223 */ 144 public static function media_file_already_exists( $filename ) { 145 global $wpdb; 146 147 $query = "SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_value LIKE '%/$filename' "; 224 public static function media_file_already_exists( $filename, $boolean_response=true ) { 148 225 149 226 // Must consider a -1.jpeg or -2.jpeg in file name, for example … … 154 231 155 232 $filename = str_replace($ext, "", $filename); 233 } 234 } 235 require_once( ABSPATH . 'wp-admin/includes/post.php' ); 236 $image_exists = post_exists( $filename, '', '', 'attachment' ); 237 if ( $boolean_response ) return ( $image_exists > 0 ); 238 else return $image_exists; 239 /* 240 global $wpdb; 241 242 $select = '*'; 243 if ( $boolean_response ) { 244 $select = 'COUNT(*)'; 245 } 246 // Very slow query -> Better search in posts on KEY post_name 247 //$query = "SELECT ".$select." FROM {$wpdb->postmeta} WHERE meta_value LIKE '%$filename' "; 248 // Image is stored as post : 249 // - post_name -> name without extension .png or .jpeg ... 250 // - post_type -> attachment 251 252 // Must consider a -1.jpeg or -2.jpeg in file name, for example 253 $exts = array(".png", ".jpg", ".gif", ".jpeg"); 254 foreach ( $exts as $ext ) { 255 256 if ( FALSE !== strpos( $filename, $ext ) ) { 257 258 $filename = str_replace($ext, "", $filename); 156 259 $query .= " OR meta_value LIKE '%/$filename-%".$ext."'"; 157 260 } 158 261 } 159 $result = $wpdb->get_var($query); 160 return ($result > 0) ; 161 } 162 262 263 if ( $boolean_response ) { 264 $result = $wpdb->get_var($query); 265 return ( $result > 0 ); 266 } else { 267 268 $result = $wpdb->get_results($query); 269 return $result ; 270 } 271 */ 272 } 273 274 275 /** 276 * Replace accent characters with non accentued ones 277 * Eg. é becomes e 278 * @param $string 279 * @return array|string|string[] 280 */ 281 public static function replace_accents( $string ) { 282 283 $search = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'à', 'á', 'â', 'ã', 'ä', 'å', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ'); 284 $replace = array('A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y'); 285 $string = str_replace($search, $replace, $string); 286 return $string; 287 } 288 163 289 /** 164 290 * Get the filename from the URL, without that after ?
Note: See TracChangeset
for help on using the changeset viewer.