assets
5 years ago
bin
5 years ago
languages
5 years ago
lib
5 years ago
templates
5 years ago
.jshintrc
6 years ago
Gruntfile.js
5 years ago
init.php
5 years ago
package.json
5 years ago
yit-deactive-plugin.php
9 years ago
yit-functions.php
5 years ago
yit-plugin-registration-hook.php
8 years ago
yit-plugin.php
5 years ago
yit-woocommerce-compatibility.php
8 years ago
init.php
121 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Framework Name: YIT Plugin Framework |
| 4 | * Version: 3.4.37 |
| 5 | * Author: YITH |
| 6 | * Text Domain: yith-plugin-fw |
| 7 | * Domain Path: /languages/ |
| 8 | * |
| 9 | * @author Your Inspiration Themes |
| 10 | * @version 3.4.37 |
| 11 | */ |
| 12 | /** |
| 13 | * This file belongs to the YIT Plugin Framework. |
| 14 | * |
| 15 | * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) |
| 16 | * that is bundled with this package in the file LICENSE.txt. |
| 17 | * It is also available through the world-wide-web at this URL: |
| 18 | * http://www.gnu.org/licenses/gpl-3.0.txt |
| 19 | */ |
| 20 | |
| 21 | if ( ! defined ( 'ABSPATH' ) ) { |
| 22 | exit; |
| 23 | } // Exit if accessed directly |
| 24 | |
| 25 | |
| 26 | |
| 27 | if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) { |
| 28 | /** |
| 29 | * yit_maybe_plugin_fw_loader |
| 30 | * |
| 31 | * @since 1.0.0 |
| 32 | */ |
| 33 | function yit_maybe_plugin_fw_loader ( $plugin_path ) { |
| 34 | global $plugin_fw_data, $plugin_upgrade_fw_data; |
| 35 | |
| 36 | $default_headers = array ( |
| 37 | 'Name' => 'Framework Name', |
| 38 | 'Version' => 'Version', |
| 39 | 'Author' => 'Author', |
| 40 | 'TextDomain' => 'Text Domain', |
| 41 | 'DomainPath' => 'Domain Path', |
| 42 | ); |
| 43 | |
| 44 | $plugin_path = trailingslashit( $plugin_path ); |
| 45 | $framework_data = get_file_data( $plugin_path . 'plugin-fw/init.php', $default_headers ); |
| 46 | $plugin_fw_main_file = $plugin_path . 'plugin-fw/yit-plugin.php'; |
| 47 | |
| 48 | if ( ! empty( $plugin_fw_data ) ) { |
| 49 | foreach ( $plugin_fw_data as $version => $path ) { |
| 50 | if ( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ) { |
| 51 | $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file ); |
| 52 | } |
| 53 | } |
| 54 | } else { |
| 55 | $plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file ); |
| 56 | } |
| 57 | |
| 58 | //Check for license & upgrade classes |
| 59 | $upgrade_fw_init_file = $plugin_path . 'plugin-upgrade/init.php'; |
| 60 | $framework_data = file_exists( $upgrade_fw_init_file ) ? get_file_data( $upgrade_fw_init_file, $default_headers ) : $framework_data; |
| 61 | $plugin_license_path = $plugin_upgrade_path = $plugin_path . 'plugin-upgrade'; |
| 62 | |
| 63 | if( ! file_exists( $plugin_upgrade_path ) ){ |
| 64 | //Check the path for OLD plugin FW |
| 65 | if( file_exists( $plugin_path . 'plugin-fw/licence' ) ){ |
| 66 | $plugin_license_path = $plugin_path . 'plugin-fw/licence'; |
| 67 | $plugin_upgrade_path = $plugin_path . 'plugin-fw/'; |
| 68 | } |
| 69 | |
| 70 | else { |
| 71 | $plugin_upgrade_path = $plugin_license_path = false; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | if( file_exists( $plugin_upgrade_path ) ){ |
| 76 | if( ! empty( $plugin_upgrade_fw_data ) ){ |
| 77 | foreach( $plugin_upgrade_fw_data as $version => $files ){ |
| 78 | if( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ){ |
| 79 | $plugin_upgrade_fw_data = array ( $framework_data[ 'Version' ] => yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path ) ); |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | else { |
| 85 | $plugin_upgrade_fw_data = array ( $framework_data[ 'Version' ] => yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path ) ); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if( ! function_exists( 'yit_get_upgrade_files' ) ){ |
| 92 | /** |
| 93 | * Retreive the core files to include to manage license and upgrade if exists |
| 94 | * |
| 95 | * @param $plugin_update_path file path |
| 96 | * |
| 97 | * @return array to files to include |
| 98 | */ |
| 99 | function yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path = '' ){ |
| 100 | $to_include = array(); |
| 101 | |
| 102 | if( false ==! $plugin_license_path ){ |
| 103 | $plugin_upgrade_path = empty( $plugin_upgrade_path ) ? $plugin_license_path : $plugin_upgrade_path; |
| 104 | $license_files = array( |
| 105 | '%yith-license-path%/lib/yit-licence.php', |
| 106 | '%yith-license-path%/lib/yit-plugin-licence.php', |
| 107 | '%yith-license-path%/lib/yit-theme-licence.php', |
| 108 | ); |
| 109 | |
| 110 | $upgrade_files = array( '%yith-upgrade-path%/lib/yit-plugin-upgrade.php' ); |
| 111 | |
| 112 | $to_include_license = str_replace( '%yith-license-path%', $plugin_license_path, $license_files ); |
| 113 | $to_include_upgrade = str_replace( '%yith-upgrade-path%', $plugin_upgrade_path, $upgrade_files ); |
| 114 | |
| 115 | $to_include = array_merge( $to_include_license, $to_include_upgrade ); |
| 116 | } |
| 117 | |
| 118 | return $to_include; |
| 119 | } |
| 120 | } |
| 121 |