Changeset 3162596
- Timestamp:
- 10/04/2024 09:17:33 AM (18 months ago)
- Location:
- sukellos-enable-classic-editor/trunk
- Files:
-
- 17 edited
-
assets/banner-772x250.jpeg (modified) (previous)
-
assets/icon-256x256.jpeg (modified) (previous)
-
assets/screenshot-1.png (modified) (previous)
-
vendor/wp-sukellos-fw/admin-builder/class-item-factory.php (modified) (10 diffs)
-
vendor/wp-sukellos-fw/admin-builder/class-item-type.php (modified) (2 diffs)
-
vendor/wp-sukellos-fw/admin-builder/containers/abstract-admin-page.php (modified) (7 diffs)
-
vendor/wp-sukellos-fw/admin-builder/containers/abstract-container.php (modified) (2 diffs)
-
vendor/wp-sukellos-fw/admin-builder/containers/class-admin-page-simple.php (modified) (4 diffs)
-
vendor/wp-sukellos-fw/admin-builder/css/sk-fw-admin.css (modified) (1 diff)
-
vendor/wp-sukellos-fw/admin-builder/items/abstract-item.php (modified) (2 diffs)
-
vendor/wp-sukellos-fw/admin-builder/items/class-content.php (modified) (2 diffs)
-
vendor/wp-sukellos-fw/admin-builder/items/fields/abstract-field.php (modified) (4 diffs)
-
vendor/wp-sukellos-fw/admin-builder/items/fields/handlers/class-option-handler.php (modified) (2 diffs)
-
vendor/wp-sukellos-fw/autoload.php (modified) (2 diffs)
-
vendor/wp-sukellos-fw/utils/class-wp-helper.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/utils/class-wp-sukellos-plugins-manager.php (modified) (1 diff)
-
vendor/wp-sukellos-fw/wp-sukellos-fw-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/class-item-factory.php
r2925170 r3162596 3 3 namespace Sukellos\WPFw\AdminBuilder; 4 4 5 use Cassandra\Date;6 5 use Sukellos\WPFw\AdminBuilder\Fields\Checkbox_Field; 7 6 use Sukellos\WPFw\AdminBuilder\Fields\Custom_Choices; … … 13 12 use Sukellos\WPFw\AdminBuilder\Fields\Text_Field; 14 13 use Sukellos\WPFw\AdminBuilder\Fields\Textarea_Field; 15 use Sukellos\WPFw\AdminBuilder\Fields\Upload_Field; 16 use Sukellos\WPFw\AdminBuilder\Item_Type; 14 use Sukellos\WPFw\AdminBuilder\Fields\Form_Field_Handler; 17 15 use Sukellos\WPFw\AdminBuilder\Items\Ajax_Button; 18 16 use Sukellos\WPFw\AdminBuilder\Items\Header; … … 47 45 // Use type of option, user_meta, post_meta 48 46 const OPTION = 'option'; 47 const FORM_FIELD = 'form_field'; 49 48 50 49 … … 58 57 private $item_instances = array( 59 58 self::OPTION => array(), 59 self::FORM_FIELD => array(), 60 60 ); 61 61 … … 110 110 if ( array_key_exists( $item_id, $this->item_instances ) 111 111 || array_key_exists( $item_id, $this->item_instances[ self::OPTION ] ) 112 || array_key_exists( $item_id, $this->item_instances[ self::FORM_FIELD ] ) 112 113 ) { 113 114 … … 138 139 case self::OPTION: 139 140 $handler = new Option_Handler( $item_id, $default ); 141 break; 142 case self::FORM_FIELD: 143 $handler = new Form_Field_Handler( $item_id, $default ); 140 144 break; 141 145 default: … … 267 271 ) ); 268 272 return null; 273 case Item_Type::ADMIN_ITEM_FORM: 274 $item = new Admin_Item_Form( $settings ); 275 break; 269 276 case Item_Type::NOTE: 270 277 … … 300 307 301 308 // Enqueue / init once scripts 302 if ( !in_array( $item_type, $this->enabled_once_scripts ) ) { 309 $enqueue_once = $item->get_enqueue_once(); 310 WP_Log::debug(__METHOD__, ['$item_type'=>$item_type, '$item'=>$item, '$enqueue_once'=>$enqueue_once]); 311 312 if ( $enqueue_once && !in_array( $item_type, $this->enabled_once_scripts ) ) { 303 313 304 314 // Enqueue JS / CSS and init Javascript … … 308 318 // Fixed use of color picker 309 319 $this->enabled_once_scripts[] = $item_type; 320 } elseif ( !$enqueue_once ) { 321 322 // Enqueue JS / CSS and init Javascript 323 add_action( 'admin_enqueue_scripts', array( $item, 'enqueue_scripts' ), 100 ); 324 add_action( 'admin_footer', array( $item, 'init_scripts' ), 100 ); 310 325 } 311 326 … … 360 375 } else { 361 376 362 $all_fields = array_merge( $this->item_instances[ self::USER_META ], $this->item_instances[ self::POST_META ], $this->item_instances[ self::OPTION ] );377 $all_fields = $this->item_instances[ self::OPTION ]; 363 378 $returned_fields = $all_fields; 364 379 } -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/class-item-type.php
r2705157 r3162596 19 19 const ADMIN_TAB = 'admin-tab'; 20 20 const ADMIN_ITEM_GROUP = 'admin-item-group'; 21 const ADMIN_ITEM_FORM = 'admin-item-form'; 21 22 const META_BOX = 'meta-box'; 22 23 const USER_PROFILE = 'user-profile'; … … 97 98 self::AJAX_BUTTON, 98 99 self::ADMIN_ITEM_GROUP, 100 self::ADMIN_ITEM_FORM, 99 101 self::CONTENT, 100 102 self::HEADER, -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/containers/abstract-admin-page.php
r2705157 r3162596 78 78 public function verify_security() { 79 79 80 WP_Log::debug( 'Admin_Page->verify_security', ['POST'=>$_POST]);80 WP_Log::debug(__METHOD__, ['POST'=>$_POST]); 81 81 if ( empty( $_POST ) || empty( $_POST['action'] ) ) { 82 82 83 WP_Log::debug( 'Admin_Page->verify_security- POST is empty, aborted', []);83 WP_Log::debug(__METHOD__.' - POST is empty, aborted', []); 84 84 return false; 85 85 } 86 86 87 WP_Log::debug(__METHOD__.' - Before get_current_screen', []); 87 88 $screen = get_current_screen(); 89 WP_Log::debug(__METHOD__.' - After get_current_screen', []); 88 90 if ( $screen->id != $this->wp_menu_page_hook_suffix ) { 89 91 90 WP_Log::debug( 'Admin_Page->verify_security- Not the current screen ', ['screen'=>$screen, 'wp_menu_page_hook_suffix'=>$this->wp_menu_page_hook_suffix]);92 WP_Log::debug(__METHOD__.' - Not the current screen ', ['screen'=>$screen, 'wp_menu_page_hook_suffix'=>$this->wp_menu_page_hook_suffix]); 91 93 return false; 92 94 } … … 94 96 if ( ! current_user_can( $this->get_capability() ) ) { 95 97 96 WP_Log::debug( 'Admin_Page->verify_security- User not authorized ', ['capability'=>$this->get_capability()]);98 WP_Log::debug(__METHOD__.' - User not authorized ', ['capability'=>$this->get_capability()]); 97 99 return false; 98 100 } … … 100 102 if ( ! check_admin_referer( $this->get_id(), self::NONCE_PREFIX . '_nonce' ) ) { 101 103 102 WP_Log::debug( 'Admin_Page->verify_security- Admin referer not good ', ['nonce'=>self::NONCE_PREFIX . '_nonce']);104 WP_Log::debug(__METHOD__.' - Admin referer not good ', ['nonce'=>self::NONCE_PREFIX . '_nonce']); 103 105 return false; 104 106 } 105 107 106 WP_Log::debug( 'Admin_Page->verify_security- Accepted', []);108 WP_Log::debug(__METHOD__.' - Accepted', []); 107 109 return true; 108 110 } … … 233 235 WP_Log::debug('Admin_Page->action_reset_fields called', ['name' => $this->get_name()]); 234 236 237 if ( empty( $_POST ) || empty( $_POST['action'] ) ) { 238 239 return; 240 } 241 242 if ( $_POST['action'] !== 'reset_fields' ) { 243 244 return; 245 } 246 235 247 if ( ! $this->verify_security() ) { 236 248 return; … … 238 250 239 251 $message = ''; 240 241 if ( $_POST['action'] !== 'reset_fields' ) {242 243 return;244 }245 252 246 253 do_action( 'sukellos_fw/admin_builder/admin_page/reset_field' ); … … 277 284 public function action_save_fields() { 278 285 279 WP_Log::debug('Admin_Page->action_save_fields called', ['name' => $this->get_name()]); 286 WP_Log::debug(__METHOD__, ['name' => $this->get_name(), 'GET'=>$_GET, 'POST'=>$_POST]); 287 288 // Is the container concerned ? 289 if ( empty( $_GET ) || !isset( $_GET['page'] ) || ( $_GET['page'] != $this->get_id() ) ) { 290 291 WP_Log::debug(__METHOD__.' - Container is not concerned by this action_save_fields hook', ['name' => $this->get_name(), 'GET'=>$_GET, 'id'=>$this->get_id()]); 292 return; 293 } 294 295 if ( empty( $_POST ) || empty( $_POST['action'] ) ) { 296 297 return; 298 } 299 if ( $_POST['action'] !== 'save_fields' ) { 300 301 WP_Log::debug(__METHOD__.' - Not save_fields then not treated', []); 302 return; 303 } 280 304 281 305 if ( ! $this->verify_security() ) { 282 return; 283 }284 285 $message = '';306 307 WP_Log::debug(__METHOD__.' - verify_security not OK, abort', []); 308 return; 309 } 286 310 287 311 /* 288 312 * Save 289 313 */ 290 291 if ( $_POST['action'] !== 'save_fields' ) {292 293 return;294 }295 296 314 do_action( 'sukellos_fw/admin_builder/admin_page/save_field' ); 297 298 $message = 'saved';299 300 301 /*302 * Redirect to prevent refresh saving303 */304 $url = wp_get_referer();305 306 // urlencode to allow special characters in the url307 $url = add_query_arg( 'page', urlencode( $this->get_id() ), $url );308 309 if ( ! empty( $message ) ) {310 311 $url = add_query_arg( 'message', $message, $url );312 }313 314 $this->add_query_args( $url );315 315 316 316 /** … … 320 320 do_action( 'sukellos_fw/admin_builder/admin_page/fields_saved' ); 321 321 322 $message = apply_filters( 'sukellos_fw/admin_builder/admin_page/get_message', 'saved' ); 323 WP_Log::debug( __METHOD__, ['message'=>$message]); 324 325 /* 326 * Redirect to prevent refresh saving 327 */ 328 $url = wp_get_referer(); 329 330 // urlencode to allow special characters in the url 331 $url = add_query_arg( 'page', urlencode( $this->get_id() ), $url ); 332 333 if ( ! empty( $message ) ) { 334 335 $url = add_query_arg( 'message', $message, $url ); 336 } 337 WP_Log::debug( __METHOD__, ['$url'=>$url]); 338 339 $this->add_query_args( $url ); 340 341 322 342 wp_redirect( esc_url_raw( $url ) ); 323 343 } -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/containers/abstract-container.php
r2705157 r3162596 4 4 5 5 use Sukellos\WPFw\AdminBuilder\Items\Item; 6 use Sukellos\WPFw\Utils\WP_Log; 6 7 7 8 defined( 'ABSPATH' ) or exit; … … 94 95 protected function create_item( $settings ) { 95 96 97 WP_Log::debug( __METHOD__, ['$settings'=>$settings] ); 96 98 $item = Item_Factory::instance()->create_item( $settings ); 97 99 $this->item_instances[] = $item; -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/containers/class-admin-page-simple.php
r2705157 r3162596 6 6 use Sukellos\WPFw\Utils\WP_Helper; 7 7 use Sukellos\WPFw\Utils\WP_Log; 8 use Sukellos\WPFw\AdminBuilder\Item_Type;9 8 10 9 defined( 'ABSPATH' ) or exit; … … 79 78 80 79 $html_content .= WP_Admin_Notices_Manager::instance()->format_notice( WP_Helper::sk__('Settings reset to default.' ), esc_html( $_GET['message'] ) ); 81 } 80 } else { 81 82 $message = $_GET['message']; 83 $type = WP_Admin_Notices_Manager::TYPE_SAVED; 84 if ( strpos( $message, '!!' ) !== false ) { 85 86 WP_Log::debug( __METHOD__.' - Separator !! found', ['$message'=>$message]); 87 88 $parts = explode( '!!', $message ); 89 $message = $parts[0]; 90 WP_Log::debug( __METHOD__, ['$parts'=>$parts]); 91 92 if ( ( $parts[1] == WP_Admin_Notices_Manager::TYPE_SAVED ) 93 || ( $parts[1] == WP_Admin_Notices_Manager::TYPE_ERROR ) 94 || ( $parts[1] == WP_Admin_Notices_Manager::TYPE_NOTICE ) 95 || ( $parts[1] == WP_Admin_Notices_Manager::TYPE_RESET ) 96 || ( $parts[1] == WP_Admin_Notices_Manager::TYPE_UPDATED ) 97 ) { 98 $type = $parts[1]; 99 } 100 101 } 102 $html_content .= WP_Admin_Notices_Manager::instance()->format_notice( $message, $type ); 103 } 82 104 } 83 105 … … 156 178 157 179 /** 180 * Create a crud 181 * 182 * @param array $settings depending on item 183 */ 184 public function create_crud( $settings ) { 185 186 // Not supported in Basic version 187 return null; 188 } 189 190 /** 158 191 * Create a group 159 192 * … … 164 197 // Not supported in Basic version 165 198 return null; 199 } 200 201 /** 202 * Create a simple form. 203 * No otion, post_meta... submitted values are checked and forwarded to hook sukellos_fw/admin_builder/item_form/fields_submitted 204 * 205 * @param array $settings depending on option 206 */ 207 public function create_form( $settings ) { 208 209 WP_Log::debug( __METHOD__, [] ); 210 $settings['type'] = Item_Type::ADMIN_ITEM_FORM; 211 $settings['parent_id'] = $this->get_id(); 212 213 $item = $this->create_item( $settings ); 214 return $item; 166 215 } 167 216 -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/css/sk-fw-admin.css
r2954827 r3162596 144 144 line-height: 18px; 145 145 margin-top: 10px; 146 text-wrap: wrap; 146 147 } 147 148 .sk-content-panel-column .sk-content-panel-column-content.body p strong { -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/items/abstract-item.php
r2705157 r3162596 63 63 64 64 /** 65 * Used to know if the script of the Item can be enqueued once 66 * 67 * @since 1.3.0 68 */ 69 'enqueue_once' => true, 70 71 /** 65 72 * Set to true is the item need a form to work, like a field 66 73 * This option may be automatically set to true if the item is containing other items that have this option set to true … … 165 172 foreach ( $new_settings as $setting_name => $value ) { 166 173 167 if ( ( array_key_exists( $setting_name, $ref_settings ) ) || ( 'sukellos_rule_exception' === $setting_name ) ) {174 if ( ( array_key_exists( $setting_name, $ref_settings ) ) || ( 'sukellos_rule_exception' === $setting_name ) || ( 'mandatory' === $setting_name ) ) { 168 175 169 176 // Remove it from new settings... -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/items/class-content.php
r2705157 r3162596 4 4 5 5 use Sukellos\WPFw\AdminBuilder\Item_Type; 6 use Sukellos\WPFw\Utils\WP_Log; 6 7 7 8 defined( 'ABSPATH' ) or exit; … … 50 51 $html_content = '<div id="'.$id.'" class="sk-admin-builder-item-content '.( ( $class !== '' )?$class:'' ).'" >'; 51 52 52 $html_content .= $this->get_content(); 53 /** 54 * Allow to add content that can be treted only after admin_menu hook execution context 55 * 56 * @since 1.3.2 57 */ 58 WP_Log::debug( __METHOD__, [] ); 59 $html_content .= apply_filters( 'sukellos_fw/admin_builder/field/'.$this->get_id(), $this->get_content() ); 53 60 54 61 if ( ! empty( $this->get_desc() ) ) { -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/items/fields/abstract-field.php
r2705157 r3162596 159 159 } 160 160 161 $ this->handler->save();161 $saved = $this->handler->save(); 162 162 163 163 /** … … 167 167 * @param $value the raw value 168 168 */ 169 do_action( 'sukellos_fw/admin_builder/field/field_saved_'.$this->get_id(), $this->get_value() );169 if ( $saved ) do_action( 'sukellos_fw/admin_builder/field/field_saved_'.$this->get_id(), $this->get_value() ); 170 170 } 171 171 … … 200 200 return; 201 201 } 202 $ this->handler->reset();202 $reseted = $this->handler->reset(); 203 203 204 204 /** … … 208 208 * @param $value the raw value 209 209 */ 210 do_action( 'sukellos_fw/admin_builder/field/field_reseted_'.$this->get_id(), $this->get_value() );210 if ( $reseted ) do_action( 'sukellos_fw/admin_builder/field/field_reseted_'.$this->get_id(), $this->get_value() ); 211 211 } 212 212 -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/admin-builder/items/fields/handlers/class-option-handler.php
r2705157 r3162596 57 57 update_option( $this->field_id, $this->value ); 58 58 59 return true; 59 60 } 60 61 62 return false; 61 63 } 62 64 … … 98 100 99 101 update_option( $this->field_id, $this->value ); 102 103 return true; 100 104 } 101 105 106 return false; 102 107 } 103 108 } -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/autoload.php
r2763350 r3162596 42 42 'Sukellos\\WPFw\\AdminBuilder\\Admin_Page' => 'admin-builder/containers/abstract-admin-page.php', 43 43 'Sukellos\\WPFw\\AdminBuilder\\Admin_Page_Simple' => 'admin-builder/containers/class-admin-page-simple.php', 44 'Sukellos\\WPFw\\AdminBuilder\\Admin_Item_Form' => 'admin-builder/containers/class-admin-item-form.php', 44 45 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Sanitize_Manager' => 'admin-builder/items/fields/class-sanitize-manager.php', 45 46 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Data_Strategy' => 'admin-builder/items/fields/data-strategies/interface-data-strategy.php', … … 49 50 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Field_Handler' => 'admin-builder/items/fields/handlers/abstract-field-handler.php', 50 51 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Option_Handler' => 'admin-builder/items/fields/handlers/class-option-handler.php', 52 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Form_Field_Handler' => 'admin-builder/items/fields/handlers/class-form-field-handler.php', 51 53 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Field' => 'admin-builder/items/fields/abstract-field.php', 52 54 'Sukellos\\WPFw\\AdminBuilder\\Fields\\Choices_Field' => 'admin-builder/items/fields/abstract-choices-field.php', -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/utils/class-wp-helper.php
r2925170 r3162596 167 167 foreach ( (array) $wp_filter[ $hook_name ][ $priority ] as $unique_id => $filter_array ) { 168 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 ] ); 169 if ( isset( $filter_array['function'] ) ) { 170 if (is_array($filter_array['function'])) { 171 // Test if object is a class and method is equal to param ! 172 if (is_object($filter_array['function'][0]) && get_class($filter_array['function'][0]) && $filter_array['function'][1] == $method_name) { 173 // Test for WordPress >= 4.7 WP_Hook class (https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/) 174 if (is_a($wp_filter[$hook_name], 'WP_Hook')) { 175 unset($wp_filter[$hook_name]->callbacks[$priority][$unique_id]); 176 } else { 177 unset($wp_filter[$hook_name][$priority][$unique_id]); 178 } 179 } 180 } 181 // Else this is a static call 182 else { 183 if (is_a($wp_filter[$hook_name], 'WP_Hook')) { 184 unset($wp_filter[$hook_name]->callbacks[$priority][$unique_id]); 175 185 } else { 176 unset( $wp_filter[ $hook_name ][ $priority ][ $unique_id ]);186 unset($wp_filter[$hook_name][$priority][$unique_id]); 177 187 } 178 188 } -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/utils/class-wp-sukellos-plugins-manager.php
r2784637 r3162596 110 110 'is_licensed' => true, 111 111 ), 112 'sukellos-email-tracker/sukellos-email-tracker.php' => array( 113 'name' => 'Sukellos - Email Tracker', 114 'is_tool' => true, 115 'description' => 'Allows you to track email openings, clicks on links, etc.', 116 'button_label' => 'FREE DOWNLOAD', 117 'url' => 'https://wp-adminbuilder.com/email-tracker/', 118 'is_active' => false, 119 'is_full_version' => true, 120 'is_licensed' => false, 121 ), 122 'sukellos-scrapio/sukellos-scrapio.php' => array( 123 'name' => 'Sukellos - Scrapio', 124 'is_tool' => true, 125 'description' => 'Connects to Scrap.io\'s API to fetch Google Places based on criteria. Selected results are imported as Custom Post Types, with ACF fields generated from Scrap.io data.', 126 'button_label' => 'FREE DOWNLOAD', 127 'url' => 'https://wp-adminbuilder.com/scrapio/', 128 'is_active' => false, 129 'is_full_version' => true, 130 'is_licensed' => false, 131 ), 112 132 ); 113 133 -
sukellos-enable-classic-editor/trunk/vendor/wp-sukellos-fw/wp-sukellos-fw-loader.php
r2705157 r3162596 77 77 public function get_documentation_url() { 78 78 79 return $this->plugin_info( WP_PLoad::AUTHOR_URI ).'/tutorial/sukellos-fw-minimum-requirements/';79 return 'https://wp-adminbuilder.com/tutorial/sukellos-fw-minimum-requirements/'; 80 80 } 81 81 … … 143 143 144 144 // CSS 145 wp_enqueue_style('sukellos_fw_css', $this->get_plugin_dir_url().'assets/css/plugin.css', array(), '1.0', 'all');145 //wp_enqueue_style('sukellos_fw_css', $this->get_plugin_dir_url().'assets/css/plugin.css', array(), '1.0', 'all'); 146 146 } 147 147 }
Note: See TracChangeset
for help on using the changeset viewer.