| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WPeMatico |
| 4 |
* Plugin URI: https://www.wpematico.com |
| 5 |
* Description: Create posts automatically from RSS/Atom feeds organized into campaigns with multiples filters. If you like it, please rate it 5 stars. |
| 6 |
* Version: 2.8.25 |
| 7 |
* Author: Etruel Developments LLC |
| 8 |
* Author URI: https://etruel.com/wpematico/ |
| 9 |
* Text Domain: wpematico |
| 10 |
* Domain Path: /lang/ |
| 11 |
* |
| 12 |
* @package WPeMatico |
| 13 |
* @category Core |
| 14 |
* @author etruel <etruel@etruel.com> |
| 15 |
*/ |
| 16 |
# @charset utf-8 |
| 17 |
if (!function_exists('add_filter')) |
| 18 |
exit; |
| 19 |
if (!class_exists('Main_WPeMatico')) { |
| 20 |
|
| 21 |
/** |
| 22 |
* Main_WPeMatico Class. |
| 23 |
*/ |
| 24 |
class Main_WPeMatico { |
| 25 |
|
| 26 |
private static $instance; |
| 27 |
|
| 28 |
private function setup_constants() { |
| 29 |
if (!defined('WPEMATICO_VERSION')) |
| 30 |
define('WPEMATICO_VERSION', '2.8.25'); |
| 31 |
|
| 32 |
if (!defined('WPEMATICO_BASENAME')) |
| 33 |
define('WPEMATICO_BASENAME', plugin_basename(__FILE__)); |
| 34 |
if (!defined('WPEMATICO_ROOTFILE')) |
| 35 |
define('WPEMATICO_ROOTFILE', __FILE__); |
| 36 |
if (!defined('WPEMATICO_PLUGIN_URL')) |
| 37 |
define('WPEMATICO_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 38 |
if (!defined('WPEMATICO_PLUGIN_DIR')) |
| 39 |
define('WPEMATICO_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 40 |
} |
| 41 |
|
| 42 |
public static function required_php_notice() { |
| 43 |
?> |
| 44 |
<div class="error"> <p> |
| 45 |
<b>WPeMatico:</b> <?php esc_html_e('PHP 7.0 or higher needed!', 'wpematico'); ?><br /> |
| 46 |
</p></div> |
| 47 |
<?php |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
public static function instance() { |
| 52 |
|
| 53 |
if (version_compare(phpversion(), '7.0', '<')) { // check PHP Version |
| 54 |
add_action('admin_notices', array(__CLASS__, 'required_php_notice')); |
| 55 |
return false; |
| 56 |
} |
| 57 |
|
| 58 |
if (!self::$instance) { |
| 59 |
self::$instance = new Main_WPeMatico(); |
| 60 |
self::$instance->setup_constants(); |
| 61 |
self::$instance->includes(); |
| 62 |
self::$instance->hooks(); |
| 63 |
self::$instance->setup_cron(); |
| 64 |
} |
| 65 |
return self::$instance; |
| 66 |
} |
| 67 |
|
| 68 |
private function includes() { |
| 69 |
global $cfg; |
| 70 |
if (is_admin()) { |
| 71 |
if (file_exists('app/nonstatic.php')) |
| 72 |
require_once('app/nonstatic.php'); |
| 73 |
require_once('app/plugin_functions.php'); |
| 74 |
require_once('app/campaigns_list.php'); |
| 75 |
require_once("app/campaign_edit_functions.php"); |
| 76 |
require_once('app/campaign_edit.php'); |
| 77 |
require_once("app/settings_help.php"); |
| 78 |
require_once("app/tools_help.php"); |
| 79 |
require_once("app/settings_page.php"); |
| 80 |
require_once("app/tools_page.php"); |
| 81 |
require_once("app/debug_page.php"); |
| 82 |
require_once("app/settings_tabs.php"); |
| 83 |
require_once("app/tools_tabs.php"); |
| 84 |
require_once("app/addons_page.php"); |
| 85 |
require_once("app/notification_traslate.php"); |
| 86 |
require_once("app/smart_notifications.php"); |
| 87 |
require_once("app/wp-backend-helpers.php"); |
| 88 |
require_once('app/lib/licenses_handlers.php'); |
| 89 |
require_once('app/lib/update_class.php'); |
| 90 |
require_once("app/lib/welcome.php"); |
| 91 |
require_once('app/campaign_log.php'); |
| 92 |
require_once('app/campaign_preview.php'); |
| 93 |
require_once('app/campaign_preview_item.php'); |
| 94 |
} |
| 95 |
require_once('app/cron_functions.php'); |
| 96 |
require_once('app/compatibilities.php'); |
| 97 |
require_once('app/wpematico_functions.php'); |
| 98 |
require_once('wpematico_class.php'); |
| 99 |
require_once('app/xml-importer.php'); |
| 100 |
require_once('app/cron.php'); |
| 101 |
} |
| 102 |
|
| 103 |
private function hooks() { |
| 104 |
add_action('init', array('WPeMatico', 'init')); |
| 105 |
add_action('init', array(self::$instance, 'load_textdomain')); |
| 106 |
add_action('the_permalink', array('WPeMatico', 'wpematico_permalink')); |
| 107 |
add_filter('post_link', array('WPeMatico', 'wpematico_permalink')); |
| 108 |
add_filter('get_canonical_url', array('WPeMatico_functions', 'wpematico_set_canonical'), 999999, 2); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* setup_cron |
| 113 |
* |
| 114 |
* @access public |
| 115 |
* @since 1.0.0 |
| 116 |
* @return void |
| 117 |
*/ |
| 118 |
public function setup_cron() { |
| 119 |
$options = get_option( WPeMatico::OPTION_KEY, array() ); |
| 120 |
|
| 121 |
if ( !empty( $options['disablewpcron'] ) && !defined( 'DISABLE_WP_CRON' ) ) { |
| 122 |
define( 'DISABLE_WP_CRON', true ); |
| 123 |
} |
| 124 |
if ( !empty( $options['enable_alternate_wp_cron'] ) && !defined( 'ALTERNATE_WP_CRON' ) ) { |
| 125 |
define( 'ALTERNATE_WP_CRON', true ); |
| 126 |
} |
| 127 |
if ( !empty( $options['dontruncron'] ) ) { |
| 128 |
wp_clear_scheduled_hook( 'wpematico_cron' ); |
| 129 |
return; |
| 130 |
} |
| 131 |
|
| 132 |
add_filter( 'cron_schedules', 'wpematico_intervals' ); |
| 133 |
add_action( 'wpematico_cron', 'wpem_cron_callback' ); |
| 134 |
|
| 135 |
if ( ! wp_next_scheduled( 'wpematico_cron' ) ) { |
| 136 |
wp_schedule_event( time(), 'wpematico_int', 'wpematico_cron' ); |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
/** |
| 141 |
* Internationalization |
| 142 |
* |
| 143 |
* @access public |
| 144 |
* @since 1.0.0 |
| 145 |
* @simplify to standard WP 2.6.3 |
| 146 |
* @return void |
| 147 |
*/ |
| 148 |
public function load_textdomain() { |
| 149 |
load_plugin_textdomain('wpematico', false, 'wpematico/lang'); |
| 150 |
} |
| 151 |
|
| 152 |
} |
| 153 |
|
| 154 |
//class WPeMatico |
| 155 |
} |
| 156 |
$WPeMatico = Main_WPeMatico::instance(); |
| 157 |
|