PluginProbe
Cooked – Recipe Management / 1.9.1
Cooked – Recipe Management v1.9.1
1.16.1 1.16.0 1.15.0 trunk 1.10.0 1.11.0 1.11.1 1.11.2 1.11.3 1.11.4 1.12.0 1.13.0 1.14.0 1.7.10 1.7.11 1.7.12 1.7.13 1.7.15.1 1.7.15.3 1.7.15.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 All 37 releases
← All changes | cooked.php +41 -118 trunk1.9.1 View file →
@@ -1,47 +1,38 @@
1 1 <?php
2 -/**
3 - * Plugin Name: Cooked - Recipe Management
4 - * Plugin URI: https://wordpress.org/plugins/cooked
5 - * Description: A recipe plugin for WordPress.
6 - * Author: Gora Tech
7 - * Author URI: https://goratech.dev
8 - * Version: 1.16.1
9 - * Text Domain: cooked
10 - * Domain Path: /languages
11 - * License: GPLv2 or later
12 - * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 - * Requires at least: 6.8
14 - * Tested up to: 7.1
15 - * Requires PHP: 7.4
16 - * Contributors: xjsv, boxystudio
17 - * Tags: recipe, recipes, food, cooking, nutrition
18 - *
19 - * Cooked is free software: you can redistribute it and/or modify
20 - * it under the terms of the GNU General Public License as published by
21 - * the Free Software Foundation, either version 2 of the License, or
22 - * any later version.
23 - *
24 - * Cooked is distributed in the hope that it will be useful,
25 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 - * GNU General Public License for more details.
28 - *
29 - * You should have received a copy of the GNU General Public License
30 - * along with Cooked. If not, see http://www.gnu.org/licenses/.
31 - *
32 - * @package Cooked
2 +
3 +/*
4 +Plugin Name: Cooked - Recipe Management
5 +Plugin URI: https://wordpress.org/plugins/cooked/
6 +Description: A recipe plugin for WordPress.
7 +Author: Gora Tech
8 +Author URI: https://goratech.dev
9 +Version: 1.9.1
10 +Text Domain: cooked
11 +Domain Path: languages
12 +License: GPL2
13 +
14 +Cooked 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 +any later version.
18 +
19 +Cooked 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 Cooked. If not, see http://www.gnu.org/licenses/.
33 26 */
34 27
35 28 // Exit if accessed directly.
36 -if ( ! defined( 'ABSPATH' ) ) {
37 - exit;
38 -}
29 +if ( ! defined( 'ABSPATH' ) ) exit;
39 30
40 31 require_once __DIR__ . '/vendor/autoload.php';
41 32
33 +define( 'COOKED_VERSION', '1.9.1' );
42 34 define( 'COOKED_DEV', false );
43 -define( 'COOKED_VERSION', '1.16.1' );
44 35
45 36 if ( ! class_exists( 'Cooked_Plugin' ) ) :
46 37
47 38 /**
@@ -105,16 +96,8 @@
105 96 */
106 97 public $migration;
107 98
108 99 /**
109 - * Cooked Updates Object.
110 - *
111 - * @var object|Cooked_Updates
112 - * @since 1.0.0
113 - */
114 - public $updates;
115 -
116 - /**
117 100 * Cooked Post Types Object.
118 101 *
119 102 * @var object|Cooked_Post_Types
120 103 * @since 1.0.0
@@ -217,40 +200,16 @@
217 200 */
218 201 public $yoastseo;
219 202
220 203 /**
221 - * Cooked Multilingual Object.
222 - *
223 - * @var object|Cooked_Multilingual
224 - * @since 1.12.0
225 - */
226 - public $multilingual;
227 -
228 - /**
229 - * Cooked Related Recipes Object.
230 - *
231 - * @var object|Cooked_Related_Recipes
232 - * @since 1.12.0
233 - */
234 - public $related_recipes;
235 -
236 - /**
237 204 * Cooked Extra Object.
238 205 *
239 - * @var object|Cooked_Plugin_Extra
206 + * @var object|Cooked_Extra
240 207 * @since 1.8.7
241 208 */
242 209 public $extra;
243 210
244 211 /**
245 - * Cooked Pixwell Theme Support Object.
246 - *
247 - * @var object|Cooked_Pixwell
248 - * @since 1.16.0
249 - */
250 - public $pixwell;
251 -
252 - /**
253 212 * Main Cooked_Plugin Instance.
254 213 *
255 214 * Insures that only one instance of Cooked_Plugin exists in memory at any one
256 215 * time. Also prevents needing to define globals everywhere.
@@ -269,9 +228,8 @@
269 228 self::$instance = new Cooked_Plugin;
270 229 self::$instance->setup_constants();
271 230
272 231 add_action( 'init', [self::$instance, 'load_textdomain'] );
273 - add_action( 'plugins_loaded', [self::$instance, 'check_plugin_update'] );
274 232
275 233 self::$instance->includes();
276 234 self::$instance->roles = new Cooked_Roles();
277 235 self::$instance->admin_menus = new Cooked_Admin_Menus();
@@ -283,13 +241,11 @@
283 241 }
284 242
285 243 self::$instance->admin_settings = new Cooked_Settings();
286 244 self::$instance->migration = new Cooked_Migration();
287 - self::$instance->related_recipes = new Cooked_Related_Recipes();
288 - self::$instance->updates = new Cooked_Updates();
289 245 self::$instance->post_types = new Cooked_Post_Types();
290 246 self::$instance->recipe_meta = new Cooked_Recipe_Meta();
291 - self::$instance->measurements = new Cooked_Measurements();
247 + self::$instance->recipe_meta = new Cooked_Measurements();
292 248 self::$instance->users = new Cooked_Users();
293 249 self::$instance->recipes = new Cooked_Recipes();
294 250 self::$instance->shortcodes = new Cooked_Shortcodes();
295 251 self::$instance->ajax = new Cooked_Ajax();
@@ -297,16 +253,12 @@
297 253 self::$instance->widget = new Cooked_Widgets();
298 254 self::$instance->gutenberg = new Cooked_Gutenberg();
299 255 self::$instance->elementor = new Cooked_Elementor();
300 256 self::$instance->extra = new Cooked_Plugin_Extra();
301 - self::$instance->multilingual = new Cooked_Multilingual();
302 - self::$instance->pixwell = new Cooked_Pixwell();
303 257
304 258 self::$instance->module_setup();
305 259
306 260 add_action( 'init', [self::$instance, 'initialize_plugin_support'], 10 );
307 -
308 - do_action('cooked_loaded');
309 261 }
310 262
311 263 return self::$instance;
312 264 }
@@ -377,25 +329,8 @@
377 329 }
378 330 }
379 331
380 332 /**
381 - * Check for plugin updates and run migrations if needed
382 - *
383 - * @since 1.10.0
384 - */
385 - public function check_plugin_update() {
386 - $current_version = get_option('cooked_version', '0');
387 -
388 - if (version_compare($current_version, COOKED_VERSION, '<')) {
389 - // Run migrations
390 - $this->migration->init();
391 -
392 - // Update version in database
393 - update_option('cooked_version', COOKED_VERSION);
394 - }
395 - }
396 -
397 - /**
398 333 * Throw error on object clone.
399 334 *
400 335 * The whole idea of the singleton design pattern is that there is a single
401 336 * object therefore, we don't want the object to be cloned.
@@ -484,19 +419,16 @@
484 419 require_once COOKED_DIR . 'includes/class.cooked-taxonomies.php';
485 420 require_once COOKED_DIR . 'includes/class.cooked-post-types.php';
486 421 require_once COOKED_DIR . 'includes/class.cooked-seo.php';
487 422 require_once COOKED_DIR . 'includes/class.cooked-recipes.php';
488 - require_once COOKED_DIR . 'includes/class.cooked-related-recipes.php';
489 423 require_once COOKED_DIR . 'includes/class.cooked-recipe-meta.php';
490 424 require_once COOKED_DIR . 'includes/class.cooked-shortcodes.php';
491 425 require_once COOKED_DIR . 'includes/class.cooked-measurements.php';
492 - require_once COOKED_DIR . 'includes/class.cooked-unit-converter.php';
493 426 require_once COOKED_DIR . 'includes/class.cooked-admin-enqueues.php';
494 427 require_once COOKED_DIR . 'includes/class.cooked-enqueues.php';
495 428 require_once COOKED_DIR . 'includes/class.cooked-admin-menus.php';
496 429 require_once COOKED_DIR . 'includes/class.cooked-settings.php';
497 430 require_once COOKED_DIR . 'includes/class.cooked-migration.php';
498 - require_once COOKED_DIR . 'includes/class.cooked-updates.php';
499 431 require_once COOKED_DIR . 'includes/class.cooked-ajax.php';
500 432 require_once COOKED_DIR . 'includes/class.cooked-functions.php';
501 433 require_once COOKED_DIR . 'includes/class.cooked-widgets.php';
502 434 require_once COOKED_DIR . 'includes/class.cooked-gutenberg.php';
@@ -501,15 +433,8 @@
501 433 require_once COOKED_DIR . 'includes/class.cooked-widgets.php';
502 434 require_once COOKED_DIR . 'includes/class.cooked-gutenberg.php';
503 435 require_once COOKED_DIR . 'includes/class.cooked-elementor.php';
504 436 require_once COOKED_DIR . 'includes/class.cooked-plugin-extra.php';
505 - require_once COOKED_DIR . 'includes/class.cooked-multilingual.php';
506 - require_once COOKED_DIR . 'includes/class.cooked-allergens.php';
507 - require_once COOKED_DIR . 'includes/class.cooked-pixwell.php';
508 -
509 - if ( defined( 'WP_CLI' ) && WP_CLI ) {
510 - require_once COOKED_DIR . 'includes/class.cooked-cli.php';
511 - }
512 437 }
513 438
514 439 /**
515 440 * Loads the plugin language files.
@@ -530,27 +455,25 @@
530 455
531 456 // Set filter for plugin's languages directory.
532 457 $cooked_lang_dir = apply_filters( 'cooked_languages_directory', COOKED_DIR . 'languages/' );
533 458
534 - // Traditional WordPress plugin locale filter.
535 - $locale = apply_filters( 'plugin_locale', get_locale(), 'cooked' );
536 - $mofile = sprintf( '%1$s-%2$s.mo', 'cooked', $locale );
537 -
538 - // Look in wp-content/languages/plugins/cooked
539 - $lang_file_ext = WP_LANG_DIR . '/plugins/cooked/' . $mofile;
540 -
541 - if ( file_exists( $lang_file_ext ) ) {
542 - // Load the externally located language files.
543 - load_textdomain( 'cooked', $lang_file_ext );
544 - } else {
545 - // Load the default language files.
546 - // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Bundled /languages .mo files.
547 - load_plugin_textdomain( 'cooked', false, COOKED_FOLDER . '/languages' );
548 - }
459 + load_plugin_textdomain(
460 + 'cooked',
461 + false,
462 + $cooked_lang_dir
463 + );
549 464 }
550 465 }
551 466
552 467 endif; // End if class_exists check.
468 +
469 +// Uninstall Hook.
470 +register_uninstall_hook( __FILE__, 'cooked_uninstall' );
471 +function cooked_uninstall() {
472 + Cooked_Roles::remove_caps();
473 + Cooked_Roles::remove_roles();
474 + flush_rewrite_rules();
475 +}
553 476
554 477 /**
555 478 * The main function for that returns Cooked_Plugin.
556 479 *