function __construct() { parent::__construct(); //check that the application has been installed properly $config = WYSIJA::get('config', 'model'); define('WYSIJA_DBG', (int) $config->getValue('debug_new')); //by default do not show the errors until we get into the debug file if (!defined('WP_DEBUG') || !WP_DEBUG) { error_reporting(0); ini_set('display_errors', '0'); } add_filter('admin_footer_text', array(&$this, 'admin_footer_text')); add_filter('update_footer', array(&$this, 'update_footer'), 15); //the controller is backend is it from our pages or from wordpress? //are we pluging-in to wordpress interfaces or doing entirely our own page? if (isset($_GET['page']) && substr($_GET['page'], 0, 7) == 'wysija_') { define('WYSIJA_ITF', TRUE); $this->controller = WYSIJA::get(str_replace('wysija_', '', $_GET['page']), 'controller'); } else { //check if we are pluging in wordpress interface define('WYSIJA_ITF', FALSE); } if (WYSIJA_DBG > 0) { include_once WYSIJA_INC . 'debug.php'; } if (!function_exists('dbg')) { function dbg($mixed, $exit = true) { } } //we set up the important hooks for backend: menus js css etc if (defined('DOING_AJAX')) { //difference between frontend and backend add_action('after_setup_theme', array($this, 'ajax_setup')); } else { if (WYSIJA_ITF) { add_action('admin_init', array($this, 'verify_capability'), 1); add_action('admin_init', array($this->controller, 'main')); add_action('after_setup_theme', array($this, 'resolveConflicts')); } //this is a fix for qtranslate as we were loading translatable string quite early //somehow if we add caps to one role the user with that role doesnt get its caps updated ... add_action('after_setup_theme', array('WYSIJA', 'update_user_caps'), 11); add_action('admin_menu', array($this, 'define_translated_strings'), 98); add_action('admin_menu', array($this, 'add_menus'), 99); add_action('admin_enqueue_scripts', array($this, 'add_js'), 10, 1); //add specific page script add_action('admin_head-post-new.php', array($this, 'addCodeToPagePost')); add_action('admin_head-post.php', array($this, 'addCodeToPagePost')); //make sure that admin and super admin always have the highest access $wptools = WYSIJA::get('wp_tools', 'helper'); $wptools->set_default_rolecaps(); // Hook the warning function for premium. add_action('admin_init', array(&$this, 'warn_action_on_premium')); } //if the comment form option is activated then we add an approval action if ($config->getValue('commentform')) { add_action('wp_set_comment_status', array($this, 'comment_approved'), 60, 2); } }
function __construct() { parent::__construct(); // wysija form shortcode add_shortcode('wysija_form', array($this, 'scan_form_shortcode')); // wysija total of subscribers shortcode add_shortcode('wysija_subscribers_count', array($this, 'scan_subscribers_count_shortcode')); // init shortcode [wysija_archive] require_once WYSIJA_CORE . 'controller.php'; require_once WYSIJA_CORE . 'module' . DS . 'module.php'; // @todo: move to autoloader $archive_std = WYSIJA_module::get_instance_by_name('archive_std'); // implement hook "wysija_front_init() if (!empty($archive_std) && is_a($archive_std, 'WYSIJA_module')) { $archive_std->front_init(); } /* We try to process the least possible code */ if (isset($_REQUEST['wysija-page']) || isset($_REQUEST['wysija-launch'])) { if (defined('DOING_AJAX')) { add_action('wp_ajax_nopriv_wysija_ajax', array($this, 'ajax')); } else { $paramscontroller = $_REQUEST['controller']; //this is an exception on one server this params stats was not accepted if ($paramscontroller == 'stat') { $paramscontroller = 'stats'; } $this->controller = WYSIJA::get($paramscontroller, 'controller'); if (isset($_REQUEST['action']) && method_exists($this->controller, $_REQUEST['action'])) { add_action('init', array($this->controller, $_REQUEST['action'])); //$this->controller->$_REQUEST['action'](); } else { $this->error('Action does not exist.'); } if (isset($_REQUEST['wysija-page'])) { /* set the content filter to replace the shortcode */ add_filter('wp_title', array($this, 'meta_page_title')); add_filter('the_title', array($this, 'scan_title')); add_filter('the_content', array($this, 'scan_content'), 98); if (isset($_REQUEST['message_success'])) { add_filter('the_content', array($this, 'scan_content_NLform'), 99); } } } } else { add_filter('the_content', array($this, 'scan_content_NLform'), 99); //if the comment form checkbox option is activated we add some hooks to process it $model_config = WYSIJA::get('config', 'model'); if ($model_config->getValue('commentform')) { add_action('comment_form', array($this, 'comment_form_extend')); add_action('comment_post', array($this, 'comment_posted'), 60, 2); } // if the register form checkbox option is activated we add some hooks to process it if ($model_config->getValue('registerform')) { if (is_multisite()) { add_action('signup_extra_fields', array($this, 'register_form_extend')); // we need this condition otherwise we will send two confirmation emails when on ms with buddypress if (!WYSIJA::is_plugin_active('buddypress/bp-loader.php')) { add_filter('wpmu_validate_user_signup', array($this, 'registerms_posted'), 60, 3); } } else { add_action('register_form', array($this, 'register_form_extend')); add_action('register_post', array($this, 'register_posted'), 60, 3); } // special case when buddypress is activated if (WYSIJA::is_plugin_active('buddypress/bp-loader.php')) { add_action('bp_after_signup_profile_fields', array($this, 'register_form_bp_extend')); add_action('bp_signup_validate', array($this, 'register_bp'), 60, 3); // we can have just one confirmation email for the wp user and the wysija confirmation when bp and multisite are activated if (is_multisite()) { add_action('wpmu_activate_user', array($this, 'wpmu_activate_user')); } } } } }
function __construct() { parent::__construct(); }