modula-best-grid-gallery
Last commit date
assets
4 months ago
includes
4 months ago
languages
1 year ago
.prettierrc.js
4 months ago
Modula.php
4 months ago
changelog.txt
4 months ago
license.txt
1 year ago
readme.md
1 year ago
readme.txt
4 months ago
Modula.php
122 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Modula |
| 4 | * Plugin URI: https://wp-modula.com/ |
| 5 | * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks. |
| 6 | * Author: WPChill |
| 7 | * Version: 2.14.13 |
| 8 | * Author URI: https://www.wpchill.com/ |
| 9 | * License: GPLv3 or later |
| 10 | * License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 11 | * Requires PHP: 5.6 |
| 12 | * Text Domain: modula-best-grid-gallery |
| 13 | * Domain Path: /languages |
| 14 | * |
| 15 | * Copyright 2015-2017 GreenTreeLabs diego@greentreelabs.net |
| 16 | * Copyright 2017-2020 MachoThemes hello@wp-modula.com |
| 17 | * Copyright 2020 WPchill hello@wp-modula.com |
| 18 | * |
| 19 | * Original Plugin URI: https://modula.greentreelabs.net/ |
| 20 | * Original Author URI: https://greentreelabs.net |
| 21 | * Original Author: https://profiles.wordpress.org/greentreelabs/ |
| 22 | * |
| 23 | * NOTE: |
| 24 | * GreenTreeLabs transferred ownership rights on: 03/29/2017 06:34:07 PM when ownership was handed over to MachoThemes |
| 25 | * The MachoThemes ownership period started on: 03/29/2017 06:34:08 PM |
| 26 | * SVN commit proof of ownership transferral: https://plugins.trac.wordpress.org/changeset/1607943/modula-best-grid-gallery |
| 27 | * |
| 28 | * MachoThemes has transferred ownership to WPChill on: 5th of November, 2020. WPChill is a rebrand & restructure of MachoThemes. |
| 29 | * |
| 30 | * This program is free software; you can redistribute it and/or modify |
| 31 | * it under the terms of the GNU General Public License, version 3, as |
| 32 | * published by the Free Software Foundation. |
| 33 | * |
| 34 | * This program is distributed in the hope that it will be useful, |
| 35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 37 | * GNU General Public License for more details. |
| 38 | * |
| 39 | * You should have received a copy of the GNU General Public License |
| 40 | * along with this program; if not, write to the Free software |
| 41 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 42 | */ |
| 43 | |
| 44 | /** |
| 45 | * Define Constants |
| 46 | * |
| 47 | * @since 2.0.2 |
| 48 | */ |
| 49 | |
| 50 | define( 'MODULA_LITE_VERSION', '2.14.13' ); |
| 51 | define( 'MODULA_PATH', plugin_dir_path( __FILE__ ) ); |
| 52 | define( 'MODULA_URL', plugin_dir_url( __FILE__ ) ); |
| 53 | defined( 'MODULA_PRO_STORE_URL' ) || define( 'MODULA_PRO_STORE_URL', 'https://wp-modula.com' ); |
| 54 | defined( 'MODULA_PRO_STORE_UPGRADE_URL' ) || define( 'MODULA_PRO_STORE_UPGRADE_URL', 'https://wp-modula.com/pricing' ); |
| 55 | define( 'MODULA_FILE', plugin_basename( __FILE__ ) ); |
| 56 | |
| 57 | define( 'MODULA_LITE_TRANSLATE', dirname( plugin_basename( __FILE__ ) ) . '/languages' ); |
| 58 | |
| 59 | define( 'MODULA_CPT_NAME', 'modula-gallery' ); |
| 60 | define( 'MODULA_AI_ENDPOINT', 'https://api.imageseo.com' ); |
| 61 | |
| 62 | /** |
| 63 | * The code that runs during plugin activation. |
| 64 | * This action is documented in includes/class-modula-activator.php |
| 65 | */ |
| 66 | function modula_activate() {} |
| 67 | |
| 68 | register_activation_hook( __FILE__, 'modula_activate' ); |
| 69 | |
| 70 | /** |
| 71 | * The core plugin class that is used to define internationalization, |
| 72 | * admin-specific hooks, and public-facing site hooks. |
| 73 | */ |
| 74 | require plugin_dir_path( __FILE__ ) . 'includes/class-modula.php'; |
| 75 | |
| 76 | // Action Scheduler |
| 77 | require_once plugin_dir_path( __FILE__ ) . 'includes/libraries/action-scheduler/action-scheduler.php'; |
| 78 | /** |
| 79 | * Ensures Modula Pro (modula/Modula.php) loads right after Lite so extensions |
| 80 | * that depend on Modula_Pro do not run before the class exists. |
| 81 | * Runs on every request when Lite loads first; updates DB for the next request. |
| 82 | * |
| 83 | * @since 2.14.0 |
| 84 | */ |
| 85 | function modula_ensure_pro_loads_after_lite() { |
| 86 | $lite = 'modula-best-grid-gallery/Modula.php'; |
| 87 | $pro = 'modula/Modula.php'; |
| 88 | $list = (array) get_option( 'active_plugins', array() ); |
| 89 | |
| 90 | $key_lite = array_search( $lite, $list, true ); |
| 91 | $key_pro = array_search( $pro, $list, true ); |
| 92 | |
| 93 | if ( false === $key_pro ) { |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | $want_pro_index = ( false !== $key_lite ) ? 1 : 0; |
| 98 | if ( $key_pro === $want_pro_index ) { |
| 99 | return; |
| 100 | } |
| 101 | unset( $list[ $key_pro ] ); |
| 102 | $list = array_values( $list ); |
| 103 | array_splice( $list, $want_pro_index, 0, array( $pro ) ); |
| 104 | |
| 105 | update_option( 'active_plugins', $list ); |
| 106 | } |
| 107 | /** |
| 108 | * Begins execution of the plugin. |
| 109 | * |
| 110 | * Since everything within the plugin is registered via hooks, |
| 111 | * then kicking off the plugin from this point in the file does |
| 112 | * not affect the page life cycle. |
| 113 | * |
| 114 | * @since 2.0.0 |
| 115 | */ |
| 116 | function modula_run() { |
| 117 | modula_ensure_pro_loads_after_lite(); |
| 118 | new Modula(); |
| 119 | } |
| 120 | |
| 121 | modula_run(); |
| 122 |