| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: CubeWP Framework |
| 4 |
* Plugin URI: https://cubewp.com/ |
| 5 |
* Description: CubeWP is an end-to-end dynamic content framework for WordPress to help you save up to 90% of your coding time. |
| 6 |
* Version: 1.1.31 |
| 7 |
* Author: CubeWP |
| 8 |
* Author URI: https://cubewp.com |
| 9 |
* Text Domain: cubewp-framework |
| 10 |
* Domain Path: /languages/ |
| 11 |
* License: GPLv2 or later |
| 12 |
* @package Cubewp |
| 13 |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 14 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals |
| 15 |
// Exit if accessed directly. |
| 16 |
if ( !defined( 'ABSPATH' ) ) |
| 17 |
exit; |
| 18 |
|
| 19 |
if ( !defined( 'CUBEWP' ) ) { |
| 20 |
define( 'CUBEWP', 'CubeWp' ); |
| 21 |
} |
| 22 |
|
| 23 |
/* CWP_PLUGIN_PATH Defines for load Php files */ |
| 24 |
if ( !defined( 'CWP_PLUGIN_PATH' ) ) { |
| 25 |
define( 'CWP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 26 |
define( 'CUBEWP_FILES', plugin_dir_path( __FILE__ ).'/cube/' ); |
| 27 |
define( 'CUBEWP_CLASSES', plugin_dir_path( __FILE__ ).'/cube/classes/' ); |
| 28 |
} |
| 29 |
|
| 30 |
/* CWP_PLUGIN_URI Defines for load JS and CSS files */ |
| 31 |
if ( !defined( 'CWP_PLUGIN_URI' ) ) { |
| 32 |
define( 'CWP_PLUGIN_URI', plugin_dir_url( __FILE__ ) ); |
| 33 |
} |
| 34 |
|
| 35 |
/* CUBEWP_POST_CARD_PATH Defines Cubewp Post cards path */ |
| 36 |
/* CUBEWP_POST_CARDS_URL Defines Cubewp Post cards URL */ |
| 37 |
if (! defined('CUBEWP_POST_CARDS_DIR')) { |
| 38 |
$upload_dir = wp_upload_dir(); |
| 39 |
define('CUBEWP_POST_CARDS_DIR', $upload_dir['basedir'] . '/cubewp-post-cards'); |
| 40 |
// Ensure correct protocol based on current request |
| 41 |
$current_scheme = is_ssl() ? 'https' : 'http'; |
| 42 |
$baseurl = preg_replace('/^https?:/', $current_scheme . ':', $upload_dir['baseurl']); |
| 43 |
define('CUBEWP_POST_CARDS_URL', $baseurl . '/cubewp-post-cards'); |
| 44 |
} |
| 45 |
|
| 46 |
/* CWP_PLUGIN_FILE Defines for file access */ |
| 47 |
if ( !defined( 'CWP_PLUGIN_FILE' ) ) { |
| 48 |
define( 'CWP_PLUGIN_FILE', __FILE__ ); |
| 49 |
} |
| 50 |
|
| 51 |
spl_autoload_register( 'CWP_autoload_classes' ); |
| 52 |
|
| 53 |
|
| 54 |
/** |
| 55 |
* All CubeWP classes files to be loaded automatically. |
| 56 |
* @param string $className a class name |
| 57 |
* @since 1.0.0 |
| 58 |
*/ |
| 59 |
function CWP_autoload_classes( $className ) { |
| 60 |
|
| 61 |
// If class does not start with our prefix ( CubeWp ), nothing will return. |
| 62 |
if ( false === strpos( $className, 'CubeWp' ) ) { |
| 63 |
return null; |
| 64 |
} |
| 65 |
$file_name = 'class-' .str_replace( '_', '-', strtolower( $className ) ).'.php'; |
| 66 |
$file = CUBEWP_CLASSES.$file_name; |
| 67 |
|
| 68 |
// Checking if exists then include. |
| 69 |
if ( file_exists( $file ) ) { |
| 70 |
require $file; |
| 71 |
} |
| 72 |
return; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Class CubeWp_Load: Loads CubeWP plugin configurations. |
| 77 |
* |
| 78 |
* @since 1.0 |
| 79 |
*/ |
| 80 |
|
| 81 |
function CWP() { |
| 82 |
return CubeWp_Load::instance(); |
| 83 |
} |
| 84 |
CWP(); |
| 85 |
|