PluginProbe
Edit Flow / 0.9.2
Edit Flow v0.9.2
0.11.1 0.11.0 0.7.2 0.7.3 0.7.4 0.7.5 0.7.6 0.8 0.8.1 0.8.2 0.9 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5 0.9.6 0.9.7 0.9.8 0.9.9 trunk 0.1.5 0.10.0 0.10.1 0.10.2 All 44 releases
← All changes | edit_flow.php +174 -219 trunk0.9.2 View file →
@@ -1,23 +1,33 @@
1 1 <?php
2 -/**
3 - * Plugin Name: Edit Flow
4 - * Plugin URI: http://editflow.org/
5 - * Description: Remixing the WordPress admin for better editorial workflow options.
6 - * Author: Daniel Bachhuber, Scott Bressler, Mohammad Jangda, Automattic, and others
7 - * Version: 0.11.1
8 - * Requires at least: 6.4
9 - * Requires PHP: 7.4
10 - * License: GPLv2 or later
11 - * License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 - *
13 - * Copyright 2009-2019 Mohammad Jangda, Daniel Bachhuber, Automattic, et al.
14 - *
15 - * @package EditFlow
16 - */
2 +/*
3 +Plugin Name: Edit Flow
4 +Plugin URI: http://editflow.org/
5 +Description: Remixing the WordPress admin for better editorial workflow options.
6 +Author: Daniel Bachhuber, Scott Bressler, Mohammad Jangda, Automattic, and others
7 +Version: 0.9.2
8 +Author URI: http://editflow.org/
17 9
18 -defined( 'ABSPATH' ) || exit;
10 +Copyright 2009-2019 Mohammad Jangda, Daniel Bachhuber, Automattic, et al.
19 11
12 +GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
13 +
14 +This program is free software; you can redistribute it and/or modify
15 +it under the terms of the GNU General Public License as published by
16 +the Free Software Foundation; either version 2 of the License, or
17 +(at your option) any later version.
18 +
19 +This program is distributed in the hope that it will be useful,
20 +but WITHOUT ANY WARRANTY; without even the implied warranty of
21 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 +GNU General Public License for more details.
23 +
24 +You should have received a copy of the GNU General Public License
25 +along with this program; if not, write to the Free Software
26 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 +
28 +*/
29 +
20 30 /**
21 31 * Print admin notice regarding having an old version of PHP.
22 32 *
23 33 * @since 0.9
@@ -24,93 +34,57 @@
24 34 */
25 35 function _ef_print_php_version_admin_notice() {
26 36 ?>
27 37 <div class="notice notice-error">
28 - <p><?php esc_html_e( 'Edit Flow requires PHP 7.4+. Please contact your host to update your PHP version.', 'edit-flow' ); ?></p>
38 + <p><?php esc_html_e( 'Edit Flow requires PHP 5.6+. Please contact your host to update your PHP version.', 'edit-flow' ); ?></p>
29 39 </div>
30 40 <?php
31 41 }
32 42
33 -if ( version_compare( phpversion(), '7.4', '<' ) ) {
43 +if ( version_compare( phpversion(), '5.6', '<' ) ) {
34 44 add_action( 'admin_notices', '_ef_print_php_version_admin_notice' );
35 45 return;
36 46 }
37 47
38 -// Define constants.
39 -define( 'EDIT_FLOW_VERSION', '0.11.1' );
40 -define( 'EDIT_FLOW_ROOT', __DIR__ );
41 -define( 'EDIT_FLOW_FILE_PATH', EDIT_FLOW_ROOT . '/' . basename( __FILE__ ) );
42 -define( 'EDIT_FLOW_URL', plugins_url( '/', __FILE__ ) );
43 -define( 'EDIT_FLOW_SETTINGS_PAGE', add_query_arg( 'page', 'ef-settings', get_admin_url( null, 'admin.php' ) ) );
48 +// Define contants
49 +define( 'EDIT_FLOW_VERSION' , '0.9.2' );
50 +define( 'EDIT_FLOW_ROOT' , dirname(__FILE__) );
51 +define( 'EDIT_FLOW_FILE_PATH' , EDIT_FLOW_ROOT . '/' . basename(__FILE__) );
52 +define( 'EDIT_FLOW_URL' , plugins_url( '/', __FILE__ ) );
53 +define( 'EDIT_FLOW_SETTINGS_PAGE' , add_query_arg( 'page', 'ef-settings', get_admin_url( null, 'admin.php' ) ) );
44 54
45 -/**
46 - * Core Edit Flow class.
47 - */
48 -#[\AllowDynamicProperties]
55 +// Core class
49 56 class edit_flow {
50 57
51 - /**
52 - * Options group prefix.
53 - *
54 - * @var string
55 - */
56 - public $options_group = 'edit_flow_';
58 + // Unique identified added as a prefix to all options
59 + var $options_group = 'edit_flow_';
60 + var $options_group_name = 'edit_flow_options';
57 61
58 62 /**
59 - * Options group name.
60 - *
61 - * @var string
63 + * @var EditFlow The one true EditFlow
62 64 */
63 - public $options_group_name = 'edit_flow_options';
64 -
65 - /**
66 - * The one true EditFlow instance.
67 - *
68 - * @var edit_flow
69 - */
70 65 private static $instance;
71 66
72 67 /**
73 - * Active modules.
68 + * Main EditFlow Instance
74 69 *
75 - * @var \stdClass
76 - */
77 - public $modules;
78 -
79 - /**
80 - * Number of active modules.
81 - *
82 - * @var int
83 - */
84 - public $modules_count;
85 -
86 - /**
87 - * Helper modules.
88 - *
89 - * @var EF_Module
90 - */
91 - public $helpers;
92 -
93 - /**
94 - * Main EditFlow Instance.
95 - *
96 70 * Insures that only one instance of EditFlow exists in memory at any one
97 71 * time. Also prevents needing to define globals all over the place.
98 72 *
99 73 * @since EditFlow 0.7.4
100 74 * @staticvar array $instance
101 - * @uses EditFlow::setup_globals() Setup the globals needed.
102 - * @uses EditFlow::includes() Include the required files.
103 - * @uses EditFlow::setup_actions() Setup the hooks and actions.
75 + * @uses EditFlow::setup_globals() Setup the globals needed
76 + * @uses EditFlow::includes() Include the required files
77 + * @uses EditFlow::setup_actions() Setup the hooks and actions
104 78 * @see EditFlow()
105 - * @return edit_flow The one true EditFlow.
79 + * @return The one true EditFlow
106 80 */
107 81 public static function instance() {
108 82 if ( ! isset( self::$instance ) ) {
109 - self::$instance = new edit_flow();
83 + self::$instance = new edit_flow;
110 84 self::$instance->setup_globals();
111 85 self::$instance->setup_actions();
112 - // Backwards compat for when we promoted use of the $edit_flow global.
86 + // Backwards compat for when we promoted use of the $edit_flow global
113 87 global $edit_flow;
114 88 $edit_flow = self::$instance;
115 89 }
116 90 return self::$instance;
@@ -115,66 +89,72 @@
115 89 }
116 90 return self::$instance;
117 91 }
118 92
119 - /**
120 - * Constructor.
121 - */
122 93 private function __construct() {
123 - // Do nothing.
94 + /** Do nothing **/
124 95 }
125 96
126 - /**
127 - * Set up global variables.
128 - */
129 97 private function setup_globals() {
130 - $this->modules = new stdClass();
98 + $this->modules = new stdClass();
131 99 $this->modules_count = 0;
132 100 }
133 101
134 102 /**
135 - * Include the common resources to Edit Flow and dynamically load the modules.
103 + * Include the common resources to Edit Flow and dynamically load the modules
136 104 */
137 105 private function load_modules() {
138 106
139 - // We use the WP_List_Table API for some of the table gen.
140 - if ( ! class_exists( 'WP_List_Table' ) ) {
141 - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
142 - }
107 + // We use the WP_List_Table API for some of the table gen
108 + if ( !class_exists( 'WP_List_Table' ) )
109 + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
143 110
144 - // Edit Flow base module.
145 - require_once EDIT_FLOW_ROOT . '/common/php/class-module.php';
111 + // Edit Flow base module
112 + require_once( EDIT_FLOW_ROOT . '/common/php/class-module.php' );
146 113
147 - // Scan the modules directory and include any modules that exist there.
114 + // Edit Flow Block Editor Compat trait
115 + require_once( EDIT_FLOW_ROOT . '/common/php/trait-block-editor-compatible.php' );
116 +
117 + // Scan the modules directory and include any modules that exist there
148 118 $module_dirs = scandir( EDIT_FLOW_ROOT . '/modules/' );
149 119 $class_names = array();
150 - foreach ( $module_dirs as $module_dir ) {
120 + foreach( $module_dirs as $module_dir ) {
151 121 if ( file_exists( EDIT_FLOW_ROOT . "/modules/{$module_dir}/$module_dir.php" ) ) {
152 - include_once EDIT_FLOW_ROOT . "/modules/{$module_dir}/$module_dir.php";
122 + include_once( EDIT_FLOW_ROOT . "/modules/{$module_dir}/$module_dir.php" );
153 123
154 - // Prepare the class name because it should be standardized.
155 - $tmp = explode( '-', $module_dir );
124 + // Try to load Gutenberg compat files
125 + if ( file_exists( EDIT_FLOW_ROOT . "/modules/{$module_dir}/compat/block-editor.php" ) ) {
126 + include_once( EDIT_FLOW_ROOT . "/modules/{$module_dir}/compat/block-editor.php" );
127 + }
128 + // Prepare the class name because it should be standardized
129 + $tmp = explode( '-', $module_dir );
156 130 $class_name = '';
157 - $slug_name = '';
158 - foreach ( $tmp as $word ) {
131 + $slug_name = '';
132 + foreach( $tmp as $word ) {
159 133 $class_name .= ucfirst( $word ) . '_';
160 - $slug_name .= $word . '_';
134 + $slug_name .= $word . '_';
161 135 }
162 - $slug_name = rtrim( $slug_name, '_' );
163 - $class_names[ $slug_name ] = 'EF_' . rtrim( $class_name, '_' );
136 + $slug_name = rtrim( $slug_name, '_' );
137 + $class_names[$slug_name] = 'EF_' . rtrim( $class_name, '_' );
164 138 }
165 139 }
166 140
167 - // Instantiate EF_Module as $helpers for back compat and so we can use it in this class.
141 + // Instantiate EF_Module as $helpers for back compat and so we can
142 + // use it in this class
168 143 $this->helpers = new EF_Module();
169 144
170 - // Other utils.
171 - require_once EDIT_FLOW_ROOT . '/common/php/util.php';
145 + // Other utils
146 + require_once( EDIT_FLOW_ROOT . '/common/php/util.php' );
172 147
173 - // Instantiate all of our classes onto the Edit Flow object but make sure they exist too.
174 - foreach ( $class_names as $slug => $class_name ) {
148 + // Instantiate all of our classes onto the Edit Flow object
149 + // but make sure they exist too
150 + foreach( $class_names as $slug => $class_name ) {
175 151 if ( class_exists( $class_name ) ) {
176 152 $this->$slug = new $class_name();
153 + $compat_class_name = "{$class_name}_Block_Editor_Compat";
154 + if ( class_exists( $compat_class_name ) ) {
155 + $this->$slug->compat = new $compat_class_name( $this->$slug, $this->$slug->get_compat_hooks() );
156 + }
177 157 }
178 158 }
179 159
180 160 /**
@@ -180,18 +160,20 @@
180 160 /**
181 161 * Fires after edit_flow has loaded all Edit Flow internal modules.
182 162 *
183 163 * Plugin authors can hook into this action, include their own modules add them to the $edit_flow object
164 + *
184 165 */
185 166 do_action( 'ef_modules_loaded' );
167 +
186 168 }
187 169
188 170 /**
189 - * Setup the default hooks and actions.
171 + * Setup the default hooks and actions
190 172 *
191 173 * @since EditFlow 0.7.4
192 174 * @access private
193 - * @uses add_action() To add various actions.
175 + * @uses add_action() To add various actions
194 176 */
195 177 private function setup_actions() {
196 178 add_action( 'init', array( $this, 'action_init' ) );
197 179 add_action( 'init', array( $this, 'action_init_after' ), 1000 );
@@ -209,122 +191,112 @@
209 191 }
210 192
211 193 /**
212 194 * Inititalizes the Edit Flows!
213 - *
214 - * Loads options for each registered module and then initializes it if it's active.
195 + * Loads options for each registered module and then initializes it if it's active
215 196 */
216 - public function action_init() {
197 + function action_init() {
217 198
218 - load_plugin_textdomain( 'edit-flow', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
199 + load_plugin_textdomain( 'edit-flow', null, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
219 200
220 201 $this->load_modules();
221 202
222 - // Load all of the module options.
203 + // Load all of the module options
223 204 $this->load_module_options();
224 205
225 - // Load all of the modules that are enabled. Modules won't have an options value if they aren't enabled.
226 - foreach ( $this->modules as $mod_name => $mod_data ) {
227 - if ( isset( $mod_data->options->enabled ) && 'on' == $mod_data->options->enabled ) {
206 + // Load all of the modules that are enabled.
207 + // Modules won't have an options value if they aren't enabled
208 + foreach ( $this->modules as $mod_name => $mod_data )
209 + if ( isset( $mod_data->options->enabled ) && $mod_data->options->enabled == 'on' )
228 210 $this->$mod_name->init();
229 - }
230 - }
231 211
232 212 /**
233 213 * Fires after edit_flow has loaded all modules and module options.
234 214 *
235 215 * Plugin authors can hook into this action to trigger functionaltiy after all Edit Flow module's have been loaded.
216 + *
236 217 */
237 218 do_action( 'ef_init' );
238 219 }
239 220
240 221 /**
241 - * Initialize the plugin for the admin.
222 + * Initialize the plugin for the admin
242 223 */
243 - public function action_admin_init() {
224 + function action_admin_init() {
244 225
245 - // Upgrade if need be but don't run the upgrade if the plugin has never been used.
226 + // Upgrade if need be but don't run the upgrade if the plugin has never been used
246 227 $previous_version = get_option( $this->options_group . 'version' );
247 228 if ( $previous_version && version_compare( $previous_version, EDIT_FLOW_VERSION, '<' ) ) {
248 229 foreach ( $this->modules as $mod_name => $mod_data ) {
249 - if ( method_exists( $this->$mod_name, 'upgrade' ) ) {
230 + if ( method_exists( $this->$mod_name, 'upgrade' ) )
250 231 $this->$mod_name->upgrade( $previous_version );
251 - }
252 232 }
253 233 update_option( $this->options_group . 'version', EDIT_FLOW_VERSION );
254 - } elseif ( ! $previous_version ) {
234 + } else if ( !$previous_version ) {
255 235 update_option( $this->options_group . 'version', EDIT_FLOW_VERSION );
256 236 }
257 237
258 - // For each module that's been loaded, auto-load data if it's never been run before.
238 + // For each module that's been loaded, auto-load data if it's never been run before
259 239 foreach ( $this->modules as $mod_name => $mod_data ) {
260 - // If the module has never been loaded before, run the install method if there is one.
261 - if ( ! isset( $mod_data->options->loaded_once ) || ! $mod_data->options->loaded_once ) {
262 - if ( method_exists( $this->$mod_name, 'install' ) ) {
240 + // If the module has never been loaded before, run the install method if there is one
241 + if ( !isset( $mod_data->options->loaded_once ) || !$mod_data->options->loaded_once ) {
242 + if ( method_exists( $this->$mod_name, 'install' ) )
263 243 $this->$mod_name->install();
264 - }
265 244 $this->update_module_option( $mod_name, 'loaded_once', true );
266 245 }
267 246 }
268 247
269 248 $this->register_scripts_and_styles();
249 +
270 250 }
271 251
272 252 /**
273 - * Register a new module with Edit Flow.
274 - *
275 - * @param string $name Module name.
276 - * @param array $args Module arguments.
277 - * @return object|false Module object on success, false on failure.
253 + * Register a new module with Edit Flow
278 254 */
279 255 public function register_module( $name, $args = array() ) {
280 256
281 - // A title and name is required for every module.
282 - if ( ! isset( $args['title'], $name ) ) {
257 + // A title and name is required for every module
258 + if ( !isset( $args['title'], $name ) )
283 259 return false;
284 - }
285 260
286 261 $defaults = array(
287 - 'title' => '',
288 - 'short_description' => '',
262 + 'title' => '',
263 + 'short_description' => '',
289 264 'extended_description' => '',
290 - 'img_url' => false,
291 - 'slug' => '',
292 - 'post_type_support' => '',
293 - 'default_options' => array(),
294 - 'options' => false,
295 - 'configure_page_cb' => false,
296 - 'configure_link_text' => __( 'Configure', 'edit-flow' ),
297 - // These messages are applied to modules and can be overridden if custom messages are needed.
298 - 'messages' => array(
299 - 'settings-updated' => __( 'Settings updated.', 'edit-flow' ),
300 - 'form-error' => __( 'Please correct your form errors below and try again.', 'edit-flow' ),
301 - 'nonce-failed' => __( 'Cheatin’ uh?', 'edit-flow' ),
265 + 'img_url' => false,
266 + 'slug' => '',
267 + 'post_type_support' => '',
268 + 'default_options' => array(),
269 + 'options' => false,
270 + 'configure_page_cb' => false,
271 + 'configure_link_text' => __( 'Configure', 'edit-flow' ),
272 + // These messages are applied to modules and can be overridden if custom messages are needed
273 + 'messages' => array(
274 + 'settings-updated' => __( 'Settings updated.', 'edit-flow' ),
275 + 'form-error' => __( 'Please correct your form errors below and try again.', 'edit-flow' ),
276 + 'nonce-failed' => __( 'Cheatin&#8217; uh?', 'edit-flow' ),
302 277 'invalid-permissions' => __( 'You do not have necessary permissions to complete this action.', 'edit-flow' ),
303 - 'missing-post' => __( 'Post does not exist', 'edit-flow' ),
278 + 'missing-post' => __( 'Post does not exist', 'edit-flow' ),
304 279 ),
305 - 'autoload' => false, // Autoloading a module will remove the ability to enable or disable it.
280 + 'autoload' => false, // autoloading a module will remove the ability to enable or disable it
306 281 );
307 - if ( isset( $args['messages'] ) ) {
308 - $args['messages'] = array_merge( (array) $args['messages'], $defaults['messages'] );
309 - }
310 - $args = array_merge( $defaults, $args );
311 - $args['name'] = $name;
282 + if ( isset( $args['messages'] ) )
283 + $args['messages'] = array_merge( (array)$args['messages'], $defaults['messages'] );
284 + $args = array_merge( $defaults, $args );
285 + $args['name'] = $name;
312 286 $args['options_group_name'] = $this->options_group . $name . '_options';
313 - if ( ! isset( $args['settings_slug'] ) ) {
287 + if ( !isset( $args['settings_slug'] ) )
314 288 $args['settings_slug'] = 'ef-' . $args['slug'] . '-settings';
315 - }
316 - if ( empty( $args['post_type_support'] ) ) {
289 + if ( empty( $args['post_type_support'] ) )
317 290 $args['post_type_support'] = 'ef_' . $name;
318 - }
319 - // If there's a Help Screen registered for the module, make sure we auto-load it.
320 - if ( ! empty( $args['settings_help_tab'] ) ) {
291 + // If there's a Help Screen registered for the module, make sure we
292 + // auto-load it
293 + if ( !empty( $args['settings_help_tab'] ) )
321 294 add_action( 'load-edit-flow_page_' . $args['settings_slug'], array( &$this->$name, 'action_settings_help_menu' ) );
322 - }
323 295
324 296 $this->modules->$name = (object) $args;
325 297
326 - ++$this->modules_count;
298 + $this->modules_count++;
327 299
328 300 /**
329 301 * Fires after edit_flow has registered a module.
330 302 *
@@ -336,20 +308,19 @@
336 308 return $this->modules->$name;
337 309 }
338 310
339 311 /**
340 - * Load all of the module options from the database.
341 - *
342 - * If a given option isn't yet set, then set it to the module's default (upgrades, etc.).
312 + * Load all of the module options from the database
313 + * If a given option isn't yet set, then set it to the module's default (upgrades, etc.)
343 314 */
344 - public function load_module_options() {
315 + function load_module_options() {
345 316
346 317 foreach ( $this->modules as $mod_name => $mod_data ) {
347 - $this->modules->$mod_name->options = get_option( $this->options_group . $mod_name . '_options', new stdClass() );
318 +
319 + $this->modules->$mod_name->options = get_option( $this->options_group . $mod_name . '_options', new stdClass );
348 320 foreach ( $mod_data->default_options as $default_key => $default_value ) {
349 - if ( ! isset( $this->modules->$mod_name->options->$default_key ) ) {
321 + if ( !isset( $this->modules->$mod_name->options->$default_key ) )
350 322 $this->modules->$mod_name->options->$default_key = $default_value;
351 - }
352 323 }
353 324
354 325 $this->$mod_name->module = $this->modules->$mod_name;
355 326 }
@@ -357,22 +328,23 @@
357 328 /**
358 329 * Fires after edit_flow has loaded all of the module options from the database.
359 330 *
360 331 * Plugin authors can hook into this action to read and manipulate module settings.
332 + *
361 333 */
362 334 do_action( 'ef_module_options_loaded' );
363 335 }
364 336
365 337 /**
366 - * Load the post type options again so we give add_post_type_support() a chance to work.
338 + * Load the post type options again so we give add_post_type_support() a chance to work
367 339 *
368 340 * @see http://dev.editflow.org/2011/11/17/edit-flow-v0-7-alpha2-notes/#comment-232
369 341 */
370 - public function action_init_after() {
342 + function action_init_after() {
371 343 foreach ( $this->modules as $mod_name => $mod_data ) {
372 - if ( isset( $this->modules->$mod_name->options->post_types ) ) {
344 +
345 + if ( isset( $this->modules->$mod_name->options->post_types ) )
373 346 $this->modules->$mod_name->options->post_types = $this->helpers->clean_post_type_options( $this->modules->$mod_name->options->post_types, $mod_data->post_type_support );
374 - }
375 347
376 348 $this->$mod_name->module = $this->modules->$mod_name;
377 349 }
378 350 }
@@ -377,24 +349,23 @@
377 349 }
378 350 }
379 351
380 352 /**
381 - * Get a module by one of its descriptive values.
353 + * Get a module by one of its descriptive values
382 354 *
383 - * @param string $key The property to use for searching a module (ex: 'name').
384 - * @param string|int|array $value The value to compare (using ==).
385 - * @return object|false Module object on success, false on failure.
355 + * @param string $key The property to use for searching a module (ex: 'name')
356 + * @param string|int|array $value The value to compare (using ==)
386 357 */
387 - public function get_module_by( $key, $value ) {
358 + function get_module_by( $key, $value ) {
388 359 $module = false;
389 360 foreach ( $this->modules as $mod_name => $mod_data ) {
390 - if ( 'name' === $key && $value === $mod_name ) {
391 - $module = $this->modules->$mod_name;
361 +
362 + if ( $key == 'name' && $value == $mod_name ) {
363 + $module = $this->modules->$mod_name;
392 364 } else {
393 - foreach ( $mod_data as $mod_data_key => $mod_data_value ) {
394 - if ( $mod_data_key === $key && $mod_data_value === $value ) {
365 + foreach( $mod_data as $mod_data_key => $mod_data_value ) {
366 + if ( $mod_data_key == $key && $mod_data_value == $value )
395 367 $module = $this->modules->$mod_name;
396 - }
397 368 }
398 369 }
399 370 }
400 371 return $module;
@@ -400,41 +371,28 @@
400 371 return $module;
401 372 }
402 373
403 374 /**
404 - * Update the $edit_flow object with new value and save to the database.
405 - *
406 - * @param string $mod_name Module name.
407 - * @param string $key Option key.
408 - * @param mixed $value Option value.
409 - * @return bool True on success, false on failure.
375 + * Update the $edit_flow object with new value and save to the database
410 376 */
411 - public function update_module_option( $mod_name, $key, $value ) {
377 + function update_module_option( $mod_name, $key, $value ) {
412 378 $this->modules->$mod_name->options->$key = $value;
413 - $this->$mod_name->module = $this->modules->$mod_name;
379 + $this->$mod_name->module = $this->modules->$mod_name;
414 380 return update_option( $this->options_group . $mod_name . '_options', $this->modules->$mod_name->options );
415 381 }
416 382
417 - /**
418 - * Update all module options at once.
419 - *
420 - * @param string $mod_name Module name.
421 - * @param array|object $new_options New options.
422 - * @return bool True on success, false on failure.
423 - */
424 - public function update_all_module_options( $mod_name, $new_options ) {
425 - if ( is_array( $new_options ) ) {
426 - $new_options = (object) $new_options;
427 - }
383 + function update_all_module_options( $mod_name, $new_options ) {
384 + if ( is_array( $new_options ) )
385 + $new_options = (object)$new_options;
428 386 $this->modules->$mod_name->options = $new_options;
429 - $this->$mod_name->module = $this->modules->$mod_name;
387 + $this->$mod_name->module = $this->modules->$mod_name;
430 388 return update_option( $this->options_group . $mod_name . '_options', $this->modules->$mod_name->options );
431 389 }
432 390
433 391 /**
434 - * Registers commonly used scripts + styles for easy enqueueing.
392 + * Registers commonly used scripts + styles for easy enqueueing
435 393 */
436 - public function register_scripts_and_styles() {
394 + function register_scripts_and_styles() {
437 395 wp_enqueue_style( 'ef-admin-css', EDIT_FLOW_URL . 'common/css/edit-flow-admin.css', false, EDIT_FLOW_VERSION, 'all' );
438 396
439 397 wp_register_script( 'jquery-listfilterizer', EDIT_FLOW_URL . 'common/js/jquery.listfilterizer.js', array( 'jquery' ), EDIT_FLOW_VERSION, true );
440 398 wp_register_style( 'jquery-listfilterizer', EDIT_FLOW_URL . 'common/css/jquery.listfilterizer.css', false, EDIT_FLOW_VERSION, 'all' );
@@ -439,24 +397,21 @@
439 397 wp_register_script( 'jquery-listfilterizer', EDIT_FLOW_URL . 'common/js/jquery.listfilterizer.js', array( 'jquery' ), EDIT_FLOW_VERSION, true );
440 398 wp_register_style( 'jquery-listfilterizer', EDIT_FLOW_URL . 'common/css/jquery.listfilterizer.css', false, EDIT_FLOW_VERSION, 'all' );
441 399
442 400
443 - wp_localize_script(
444 - 'jquery-listfilterizer',
445 - '__i18n_jquery_filterizer',
446 - array(
447 - 'all' => esc_html__( 'All', 'edit-flow' ),
448 - 'selected' => esc_html__( 'Selected', 'edit-flow' ),
449 - )
450 - );
401 + wp_localize_script( 'jquery-listfilterizer',
402 + '__i18n_jquery_filterizer',
403 + array(
404 + 'all' => esc_html__( 'All', 'edit-flow' ),
405 + 'selected' => esc_html__( 'Selected', 'edit-flow' ),
406 + ) );
407 +
408 + wp_register_script( 'jquery-quicksearch', EDIT_FLOW_URL . 'common/js/jquery.quicksearch.js', array( 'jquery' ), EDIT_FLOW_VERSION, true );
409 +
451 410 }
411 +
452 412 }
453 413
454 -/**
455 - * Get the Edit Flow instance.
456 - *
457 - * @return edit_flow The Edit Flow instance.
458 - */
459 -function EditFlow() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- Legacy function name.
414 +function EditFlow() {
460 415 return edit_flow::instance();
461 416 }
462 417 add_action( 'plugins_loaded', 'EditFlow' );