| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Disqus Conditional Load |
| 4 |
* Plugin URI: https://dclwp.com |
| 5 |
* Description: Disqus commenting system for WordPress with advanced features like like <strong>lazy load, shortcode</strong> etc. |
| 6 |
* Version: 11.1.2 |
| 7 |
* Author: Joel James |
| 8 |
* Author URI: https://duckdev.com/ |
| 9 |
* Donate link: https://paypal.me/JoelCJ |
| 10 |
* License: GPL-2.0+ |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt |
| 12 |
* Text Domain: disqus-conditional-load |
| 13 |
* Domain Path: /languages |
| 14 |
* |
| 15 |
* Disqus Conditional Load is free software: you can redistribute it and/or modify |
| 16 |
* it under the terms of the GNU General Public License as published by |
| 17 |
* the Free Software Foundation, either version 2 of the License, or |
| 18 |
* any later version. |
| 19 |
* |
| 20 |
* Disqus Conditional Load is distributed in the hope that it will be useful, |
| 21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
* GNU General Public License for more details. |
| 24 |
* |
| 25 |
* You should have received a copy of the GNU General Public License |
| 26 |
* along with Disqus Conditional Load. If not, see <http://www.gnu.org/licenses/>. |
| 27 |
* |
| 28 |
* @category Core |
| 29 |
* @package DCL |
| 30 |
* @author Joel James <mail@cjoel.com> |
| 31 |
* @license http://www.gnu.org/licenses/ GNU General Public License |
| 32 |
* @link https://dclwp.com |
| 33 |
*/ |
| 34 |
|
| 35 |
// If this file is called directly, abort. |
| 36 |
defined( 'ABSPATH' ) || die( 'K. Bye.' ); |
| 37 |
|
| 38 |
// Stay lazy if our class is already there. |
| 39 |
if ( ! class_exists( 'Disqus_Conditional_Load' ) ) : |
| 40 |
|
| 41 |
// These are constants. Seriously! |
| 42 |
$constants = array( |
| 43 |
// Oh yeah, we decide these constants. |
| 44 |
// These constants can not be overwritten. |
| 45 |
'fixed' => array( |
| 46 |
'DCL_NAME' => 'disqus-conditional-load', |
| 47 |
'DCL_DOMAIN' => 'disqus-conditional-load', |
| 48 |
'DCL_DIR' => plugin_dir_path( __FILE__ ), |
| 49 |
'DCL_PATH' => plugin_dir_url( __FILE__ ), |
| 50 |
'DCL_BASE_FILE' => __FILE__, |
| 51 |
'DCL_VERSION' => '11.1.2', |
| 52 |
'DCL_DISQUS_VERSION' => '3.0.23', |
| 53 |
), |
| 54 |
|
| 55 |
// Aaaand, here is something for your choice. |
| 56 |
// These constants can be overwritten. |
| 57 |
'open' => array( |
| 58 |
// Set who all can access plugin settings. |
| 59 |
// You can change this if you want to give others access. |
| 60 |
'DCL_ACCESS' => 'manage_options', |
| 61 |
), |
| 62 |
); |
| 63 |
|
| 64 |
// Now, let the constants born. |
| 65 |
foreach ( $constants['fixed'] as $constant => $value ) { |
| 66 |
define( $constant, $value ); |
| 67 |
} |
| 68 |
|
| 69 |
// Let open constants born too. |
| 70 |
foreach ( $constants['open'] as $constant => $value ) { |
| 71 |
// Check if it is defined already. |
| 72 |
if ( ! defined( $constant ) ) { |
| 73 |
define( $constant, $value ); |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
// Activation, deactivation and un-installation. |
| 78 |
require_once DCL_DIR . 'includes/class-dcl-activator-deactivator.php'; |
| 79 |
|
| 80 |
/** |
| 81 |
* Plugin activation actions. We are starting fellas! |
| 82 |
* |
| 83 |
* Actions to perform during plugin activation. |
| 84 |
* We will be registering default options in this function. |
| 85 |
* |
| 86 |
* @uses register_activation_hook() To register activation hook. |
| 87 |
* @since 10.0.0 |
| 88 |
* @access private |
| 89 |
* |
| 90 |
* @return void |
| 91 |
*/ |
| 92 |
function dcl_activate() { |
| 93 |
|
| 94 |
// If incase Pro version is already active, do not activate. |
| 95 |
if ( is_plugin_active( 'disqus-conditional-load-pro/disqus-conditional-load-pro.php' ) ) { |
| 96 |
// Hmmm, sacrifice. |
| 97 |
deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 98 |
// Suicide with a suicide note. |
| 99 |
wp_die( esc_html__( 'More powerful Pro version of this plugin is already active. Just relax.', 'disqus-conditional-load' ) ); |
| 100 |
} |
| 101 |
|
| 102 |
// The very beginning! |
| 103 |
DCL_Activator_Deactivator::activate(); |
| 104 |
} |
| 105 |
|
| 106 |
// Make use of activation hook. |
| 107 |
register_activation_hook( __FILE__, 'dcl_activate' ); |
| 108 |
|
| 109 |
// Our helper functions. Thanks for the help, helper. |
| 110 |
include_once DCL_DIR . 'includes/class-dcl-helper.php'; |
| 111 |
|
| 112 |
// Load all required files for the plugin to work. |
| 113 |
require_once DCL_DIR . 'includes/class-disqus-conditional-load.php'; |
| 114 |
|
| 115 |
/** |
| 116 |
* Begins execution of the plugin. |
| 117 |
* |
| 118 |
* Since everything within the plugin is registered via hooks, |
| 119 |
* then kicking off the plugin from this point in the file does |
| 120 |
* not affect the page life cycle. |
| 121 |
* |
| 122 |
* @since 10.0.0 |
| 123 |
* @access public |
| 124 |
* |
| 125 |
* @return Disqus_Conditional_Load |
| 126 |
*/ |
| 127 |
function dcl_instance() { |
| 128 |
|
| 129 |
return Disqus_Conditional_Load::instance(); |
| 130 |
} |
| 131 |
|
| 132 |
// Initialize DCL. |
| 133 |
dcl_instance(); |
| 134 |
|
| 135 |
endif; // End if class_exists check. |
| 136 |
|
| 137 |
// I will find you, and I will thank you! - Joel James. |
| 138 |
|