Esempio n. 1
0
<?php

/**
 * List of plugin optins, contains only default values, actual values are stored in database
 * and can be changed by corresponding wordpress function calls
 */
$config = array("info_api_url" => "http://www.wpallimport.com", "history_file_count" => 10000, "history_file_age" => 365, "highlight_limit" => 10000, "upload_max_filesize" => 2048, "post_max_size" => 2048, "max_input_time" => -1, "max_execution_time" => -1, "dismiss" => 0, "html_entities" => 0, "utf8_decode" => 0, "cron_job_key" => wp_all_import_url_title(wp_all_import_rand_char(12)), "chunk_size" => 32, "pingbacks" => 1, "legacy_special_character_handling" => 1, "case_sensitive" => 1, "session_mode" => 'default', "enable_ftp_import" => 0, "large_feed_limit" => 1000, "cron_processing_time_limit" => 120, "secure" => 1, "log_storage" => 5, "cron_sleep" => "", "port" => "", "google_client_id" => "", "google_signature" => "", "licenses" => array(), "statuses" => array());
if (!defined('WPALLIMPORT_SIGNATURE')) {
    define('WPALLIMPORT_SIGNATURE', '');
}
Esempio n. 2
0
 /**
  * Class constructor containing dispatching logic
  * @param string $rootDir Plugin root dir
  * @param string $pluginFilePath Plugin main file
  */
 protected function __construct()
 {
     $this->load_plugin_textdomain();
     // regirster autoloading method
     if (function_exists('__autoload') and !in_array('__autoload', spl_autoload_functions())) {
         // make sure old way of autoloading classes is not broken
         spl_autoload_register('__autoload');
     }
     spl_autoload_register(array($this, '__autoload'));
     // register helpers
     if (is_dir(self::ROOT_DIR . '/helpers')) {
         foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
             require_once $filePath;
         }
     }
     // init plugin options
     $option_name = get_class($this) . '_Options';
     $options_default = PMXI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray();
     $this->options = array_intersect_key(get_option($option_name, array()), $options_default) + $options_default;
     $this->options = array_intersect_key($options_default, array_flip(array('info_api_url'))) + $this->options;
     // make sure hidden options apply upon plugin reactivation
     if ('' == $this->options['cron_job_key']) {
         $this->options['cron_job_key'] = wp_all_import_url_title(wp_all_import_rand_char(12));
     }
     update_option($option_name, $this->options);
     $this->options = get_option(get_class($this) . '_Options');
     register_activation_hook(self::FILE, array($this, '__activation'));
     // register action handlers
     if (is_dir(self::ROOT_DIR . '/actions')) {
         if (is_dir(self::ROOT_DIR . '/actions')) {
             foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/actions/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
                 require_once $filePath;
                 $function = $actionName = basename($filePath, '.php');
                 if (preg_match('%^(.+?)[_-](\\d+)$%', $actionName, $m)) {
                     $actionName = $m[1];
                     $priority = intval($m[2]);
                 } else {
                     $priority = 10;
                 }
                 add_action($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99);
                 // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
             }
         }
     }
     // register filter handlers
     if (is_dir(self::ROOT_DIR . '/filters')) {
         foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/filters/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
             require_once $filePath;
             $function = $actionName = basename($filePath, '.php');
             if (preg_match('%^(.+?)[_-](\\d+)$%', $actionName, $m)) {
                 $actionName = $m[1];
                 $priority = intval($m[2]);
             } else {
                 $priority = 10;
             }
             add_filter($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99);
             // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
         }
     }
     // register shortcodes handlers
     if (is_dir(self::ROOT_DIR . '/shortcodes')) {
         foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/shortcodes/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
             $tag = strtolower(str_replace('/', '_', preg_replace('%^' . preg_quote(self::ROOT_DIR . '/shortcodes/', '%') . '|\\.php$%', '', $filePath)));
             add_shortcode($tag, array($this, 'shortcodeDispatcher'));
         }
     }
     // register admin page pre-dispatcher
     add_action('admin_init', array($this, '__adminInit'));
     add_action('admin_init', array($this, '_fix_options'));
 }
Esempio n. 3
0
<?php

/**
 * List of plugin optins, contains only default values, actual values are stored in database
 * and can be changed by corresponding wordpress function calls
 */
$config = array("history_file_count" => 10000, "history_file_age" => 365, "highlight_limit" => 10000, "upload_max_filesize" => 2048, "post_max_size" => 2048, "max_input_time" => -1, "max_execution_time" => -1, "dismiss" => 0, "dismiss_speed_up" => 0, "dismiss_manage_top" => 0, "dismiss_manage_bottom" => 0, "html_entities" => 0, "utf8_decode" => 0, "cron_job_key" => wp_all_import_url_title(wp_all_import_rand_char(12)), "chunk_size" => 32, "pingbacks" => 1, "legacy_special_character_handling" => 1, "case_sensitive" => 1, "session_mode" => 'default', "enable_ftp_import" => 0, "large_feed_limit" => 1000, "cron_processing_time_limit" => 120, "secure" => 1, "log_storage" => 5, "cron_sleep" => "", "port" => "");