| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Blog Designer Pack |
| 4 |
* Plugin URI: https://infornweb.com/news-blog-designer-pack-pro/ |
| 5 |
* Description: Display blog posts on your website with 6 blog layouts (2 designs for each blog layout) plus 1 Ticker and 2 Widgets |
| 6 |
* Text Domain: blog-designer-pack |
| 7 |
* Domain Path: /languages/ |
| 8 |
* Author: InfornWeb |
| 9 |
* Author URI: https://infornweb.com |
| 10 |
* Version: 4.0.12 |
| 11 |
* Requires at least: 5.8 |
| 12 |
* Requires PHP: 5.4 |
| 13 |
* |
| 14 |
* @package Blog Designer Pack |
| 15 |
*/ |
| 16 |
|
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; // Exit if accessed directly |
| 19 |
} |
| 20 |
|
| 21 |
if ( function_exists( 'bdp_fs' ) ) { |
| 22 |
bdp_fs()->set_basename( true, __FILE__ ); |
| 23 |
} |
| 24 |
|
| 25 |
if ( ! class_exists( 'Blog_Designer_Pack_Lite' ) ) : |
| 26 |
|
| 27 |
/** |
| 28 |
* Main Class |
| 29 |
* @package Blog Designer Pack |
| 30 |
* @version 1.0 |
| 31 |
*/ |
| 32 |
final class Blog_Designer_Pack_Lite { |
| 33 |
|
| 34 |
// Instance |
| 35 |
private static $instance; |
| 36 |
|
| 37 |
/** |
| 38 |
* Script Object. |
| 39 |
* |
| 40 |
* @version 1.0 |
| 41 |
*/ |
| 42 |
public $scripts; |
| 43 |
|
| 44 |
/** |
| 45 |
* Main Blog Designer Pack Lite Instance. |
| 46 |
* Ensures only one instance of Blog_Designer_Pack_Lite is loaded or can be loaded. |
| 47 |
* |
| 48 |
* @version 1.0 |
| 49 |
*/ |
| 50 |
public static function instance() { |
| 51 |
|
| 52 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Blog_Designer_Pack_Lite ) ) { |
| 53 |
self::$instance = new Blog_Designer_Pack_Lite(); |
| 54 |
self::$instance->setup_constants(); |
| 55 |
|
| 56 |
self::$instance->includes(); // Including required files |
| 57 |
self::$instance->init_hooks(); |
| 58 |
|
| 59 |
self::$instance->scripts = new BDP_Scripts(); // Script Class |
| 60 |
} |
| 61 |
return self::$instance; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Define constant if not already set. |
| 66 |
* |
| 67 |
* @param string $name Constant name. |
| 68 |
* @param string|bool $value Constant value. |
| 69 |
*/ |
| 70 |
private function define( $name, $value ) { |
| 71 |
if ( ! defined( $name ) ) { |
| 72 |
define( $name, $value ); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* Setup plugin constants |
| 78 |
* Basic plugin definitions |
| 79 |
* |
| 80 |
* @since 1.0 |
| 81 |
*/ |
| 82 |
private function setup_constants() { |
| 83 |
|
| 84 |
$this->define( 'BDP_VERSION', '4.0.12' ); // Version of plugin |
| 85 |
$this->define( 'BDP_FILE', __FILE__ ); |
| 86 |
$this->define( 'BDP_DIR', dirname( __FILE__ ) ); |
| 87 |
$this->define( 'BDP_URL', plugin_dir_url( __FILE__ ) ); |
| 88 |
$this->define( 'BDP_BASENAME', basename( BDP_DIR ) ); |
| 89 |
$this->define( 'BDP_META_PREFIX', '_bdp_' ); |
| 90 |
$this->define( 'BDP_POST_TYPE', 'post' ); |
| 91 |
$this->define( 'BDP_CAT', 'category' ); |
| 92 |
$this->define( 'BDP_LAYOUT_POST_TYPE', 'bdpp_layout' ); |
| 93 |
$this->define( 'BDP_SETTING_PAGE_URL', add_query_arg( array('page' => 'bdpp-settings', 'tab' => 'general'), 'admin.php' ) ); |
| 94 |
$this->define( 'BDP_PRO_TAB_URL', add_query_arg( array('page' => 'bdpp-settings', 'tab' => 'pro'), 'admin.php' ) ); |
| 95 |
$this->define( 'BDP_UPGRADE_URL', add_query_arg( array('page' => 'bdpp-layouts-pricing'), 'admin.php' ) ); |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Load Localisation files |
| 100 |
* |
| 101 |
* @since 1.0 |
| 102 |
*/ |
| 103 |
public function bdp_load_textdomain() { |
| 104 |
|
| 105 |
// Set filter for plugin's languages directory. |
| 106 |
$bdp_lang_dir = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; |
| 107 |
$bdp_lang_dir = apply_filters( 'bdpp_languages_directory', $bdp_lang_dir ); |
| 108 |
|
| 109 |
// Traditional WordPress plugin locale filter. |
| 110 |
$locale = apply_filters( 'plugin_locale', get_user_locale(), 'blog-designer-pack' ); |
| 111 |
$mofile = sprintf( '%1$s-%2$s.mo', 'blog-designer-pack', $locale ); |
| 112 |
|
| 113 |
// Setup paths to current locale file |
| 114 |
$mofile_global = WP_LANG_DIR . '/plugins/' . BDP_BASENAME . '/' . $mofile; |
| 115 |
|
| 116 |
if ( file_exists( $mofile_global ) ) { // Look in global /wp-content/languages/blog-designer-pack-pro folder |
| 117 |
|
| 118 |
load_textdomain( 'blog-designer-pack', $mofile_global ); |
| 119 |
|
| 120 |
} else { // Load the default language files |
| 121 |
load_plugin_textdomain( 'blog-designer-pack', false, $bdp_lang_dir ); |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* Include required files |
| 127 |
* |
| 128 |
* @since 1.0 |
| 129 |
*/ |
| 130 |
private function includes() { |
| 131 |
|
| 132 |
global $bdpp_options; |
| 133 |
|
| 134 |
// Including freemius file |
| 135 |
include_once( BDP_DIR . '/freemius.php' ); |
| 136 |
|
| 137 |
// Register Post Type |
| 138 |
require_once( BDP_DIR . '/includes/bdpp-post-types.php' ); |
| 139 |
|
| 140 |
// Including common functions file |
| 141 |
include_once( BDP_DIR . '/includes/bdpp-functions.php' ); |
| 142 |
|
| 143 |
// Plugin Settings |
| 144 |
require_once( BDP_DIR . '/includes/admin/settings/bdpp-register-settings.php' ); |
| 145 |
$bdpp_options = bdp_get_settings(); // Gettings plugin settings |
| 146 |
|
| 147 |
// Class Script |
| 148 |
require_once( BDP_DIR . '/includes/class-bdpp-scripts.php' ); |
| 149 |
|
| 150 |
// Class Public |
| 151 |
require_once( BDP_DIR . '/includes/class-bdpp-public.php' ); |
| 152 |
|
| 153 |
// Class Admin |
| 154 |
require_once( BDP_DIR . '/includes/admin/class-bdpp-admin.php' ); |
| 155 |
|
| 156 |
// Class Metabox |
| 157 |
require_once( BDP_DIR . '/includes/admin/class-bdpp-metabox.php' ); |
| 158 |
|
| 159 |
// Plugin shortcodes |
| 160 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-grid.php' ); |
| 161 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-list.php' ); |
| 162 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-gridbox.php' ); |
| 163 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-slider.php' ); |
| 164 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-carousel.php' ); |
| 165 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-masonry.php' ); |
| 166 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-post-ticker.php' ); |
| 167 |
require_once( BDP_DIR . '/includes/shortcodes/bdpp-shrt-tmpl.php' ); |
| 168 |
|
| 169 |
// Shortcode Supports |
| 170 |
include_once( BDP_DIR . '/includes/admin/shortcode-support/shortcode-fields.php' ); |
| 171 |
|
| 172 |
// Widget Class |
| 173 |
require_once( BDP_DIR . '/includes/widgets/class-bdpp-widgets.php' ); |
| 174 |
|
| 175 |
// Blocks |
| 176 |
require_once( BDP_DIR . '/includes/integrations/blocks/bdpp-blocks.php' ); |
| 177 |
|
| 178 |
// For Admin Side Only |
| 179 |
if ( is_admin() ) { |
| 180 |
|
| 181 |
// Class Shortcode Builder |
| 182 |
require_once( BDP_DIR . '/includes/admin/shortcode-builder/class-bdpp-shortcode-generator.php' ); |
| 183 |
|
| 184 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-welcome-settings.php' ); |
| 185 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-general-settings.php' ); |
| 186 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-trending-settings.php' ); |
| 187 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-taxonomy-settings.php' ); |
| 188 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-sharing-settings.php' ); |
| 189 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-css-settings.php' ); |
| 190 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-misc-settings.php' ); |
| 191 |
include_once( BDP_DIR . '/includes/admin/settings/bdpp-pro-settings.php' ); |
| 192 |
} |
| 193 |
|
| 194 |
// Plugin installation file |
| 195 |
require_once BDP_DIR . '/includes/class-bdpp-install.php'; |
| 196 |
} |
| 197 |
|
| 198 |
/** |
| 199 |
* Hook into actions and filters. |
| 200 |
* |
| 201 |
* @since 1.0 |
| 202 |
*/ |
| 203 |
private function init_hooks() { |
| 204 |
|
| 205 |
register_activation_hook( BDP_FILE, array( 'BDP_Install', 'install' ) ); |
| 206 |
|
| 207 |
add_action( 'after_setup_theme', array( $this, 'bdp_setup_environment' ) ); |
| 208 |
add_action( 'plugins_loaded', array( $this, 'bdp_plugins_loaded' ) ); |
| 209 |
add_action( 'init', array( $this, 'bdp_init_processes' ) ); |
| 210 |
} |
| 211 |
|
| 212 |
/** |
| 213 |
* Ensure theme and server variable compatibility and setup image sizes. |
| 214 |
* |
| 215 |
* @since 1.0 |
| 216 |
*/ |
| 217 |
public function bdp_setup_environment() { |
| 218 |
|
| 219 |
// Support Post Thumbnails |
| 220 |
if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
| 221 |
add_theme_support( 'post-thumbnails' ); |
| 222 |
} |
| 223 |
add_post_type_support( 'post', array( 'thumbnail', 'page-attributes' ) ); |
| 224 |
} |
| 225 |
|
| 226 |
/** |
| 227 |
* Do stuff once all the plugin has been loaded |
| 228 |
* |
| 229 |
* @since 1.0 |
| 230 |
*/ |
| 231 |
public function bdp_plugins_loaded() { |
| 232 |
|
| 233 |
// Visual Composer Page Builder Support |
| 234 |
if( class_exists('Vc_Manager') ) { |
| 235 |
include_once( BDP_DIR . '/includes/integrations/wpbakery/wpbakery.php' ); |
| 236 |
} |
| 237 |
|
| 238 |
// If Elementor Page Builder is Installed |
| 239 |
if( defined('ELEMENTOR_PLUGIN_BASE') ) { |
| 240 |
require_once( BDP_DIR . '/includes/integrations/elementor/select2-ajax-control.php' ); |
| 241 |
require_once( BDP_DIR . '/includes/integrations/elementor/elementor.php' ); |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
/** |
| 246 |
* Prior Init Processes |
| 247 |
* |
| 248 |
* @since 1.0 |
| 249 |
*/ |
| 250 |
public function bdp_init_processes() { |
| 251 |
|
| 252 |
// Set up localisation. |
| 253 |
$this->bdp_load_textdomain(); |
| 254 |
|
| 255 |
/* |
| 256 |
* Plugin Menu Name just to check the screen ID to load condition based assets |
| 257 |
* This var is not going to be echo anywhere. `sanitize_title` will take care of string. |
| 258 |
*/ |
| 259 |
$this->define( 'BDPP_SCREEN_ID', sanitize_title(__('Blog Designer Pack', 'blog-designer-pack')) ); |
| 260 |
|
| 261 |
// Add BDP Image sizes to WP. |
| 262 |
add_image_size( 'bdpp-medium', 640, 480, true ); |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
endif; // End if class_exists check. |
| 267 |
|
| 268 |
/** |
| 269 |
* The main function for that returns Blog_Designer_Pack_Lite |
| 270 |
* |
| 271 |
* Example: $bdp = BDP_Lite(); |
| 272 |
* |
| 273 |
* @since 1.0 |
| 274 |
* @return object|Blog_Designer_Pack_Lite The one true Blog_Designer_Pack_Lite Instance. |
| 275 |
*/ |
| 276 |
function BDP_Lite() { |
| 277 |
return Blog_Designer_Pack_Lite::instance(); |
| 278 |
} |
| 279 |
|
| 280 |
// Get Plugin Running |
| 281 |
BDP_Lite(); |