Exemplo n.º 1
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     $this->db = IncPopupDatabase::instance();
     // Prepare the URL
     if (!empty($_REQUEST['orig_request_uri'])) {
         $this->prepare_url();
         add_action('init', array($this, 'revert_url'), 999);
         // prevent 404.
         add_action('parse_query', array($this, 'prepare_url'));
     }
     /*
      * URLs for the "from" and "referer" fields are transmitted in reversed
      * format (moc.elpmaxe//:ptth)
      * Reason for this is that plugins like iThemes security might block
      * incoming requests that contain the value "http://". This is how
      * we bypass that security check.
      */
     if (!empty($_REQUEST['thefrom'])) {
         $_REQUEST['thefrom'] = strrev($_REQUEST['thefrom']);
     }
     if (!empty($_REQUEST['thereferrer'])) {
         $_REQUEST['thereferrer'] = strrev($_REQUEST['thereferrer']);
     }
     // http://premium.wpmudev.org/forums/topic/ive-debugged-a-problem-in-the-latest-version-of-the-popup-pro-plugin
     if (!empty($_GET['thefrom'])) {
         $_GET['thefrom'] = strrev($_GET['thefrom']);
     }
     if (!empty($_GET['thereferrer'])) {
         $_GET['thereferrer'] = strrev($_GET['thereferrer']);
     }
     if (!empty($_POST['thefrom'])) {
         $_POST['thefrom'] = strrev($_POST['thefrom']);
     }
     if (!empty($_POST['thereferrer'])) {
         $_POST['thereferrer'] = strrev($_POST['thereferrer']);
     }
     lib2()->translate_plugin(PO_LANG, PO_LANG_DIR);
     // Register the popup post type.
     add_action('init', array('IncPopupPosttype', 'instance'), 99);
     // Register the popup post type.
     add_action('wp_loaded', array('IncPopupDatabase', 'check_db'));
     // Load active add-ons.
     add_action('init', array('IncPopup', 'load_optional_files'));
     // Returns a list of all style infos (id, url, path, deprecated)
     add_filter('popup-styles', array('IncPopupBase', 'style_infos'));
     // Ajax handlers to load PopUp data (for logged in users).
     add_action('wp_ajax_inc_popup', array($this, 'ajax_load_popup'));
     // Ajax handlers to load PopUp data (for guests).
     add_action('wp_ajax_nopriv_inc_popup', array($this, 'ajax_load_popup'));
     // Compatibility with plugins
     add_filter('popup-output-data', array($this, 'compat_init'), 999, 2);
     if (function_exists('get_rocket_option') && get_rocket_option('minify_js')) {
         foreach (array('edit-inc_popup', 'inc_popup', 'inc_popup_page_settings') as $screen) {
             lib2()->ui->admin_message(__('You are using WP Rocket with JS Minification, which has ' . 'caused some issues in the past. We recommend to disable ' . 'the JS Minification setting in WP Rocket to avoid problems.', PO_LANG), 'err', $screen);
         }
     }
     // Tell Add-ons and extensions that we are set up.
     do_action('popup-init');
 }