Exemplo n.º 1
0
 function init()
 {
     $this->_initialize_action_box_types();
     //$this->loadAddOns();
     global $Mab;
     $Mab = new ProsulumMab();
     MAB_OptinProviders::init();
     do_action('mab_init');
     if (is_admin()) {
         //global $MabAdmin;
         //$MabAdmin = new ProsulumMabAdmin();
         $this->MAB('admin', new ProsulumMabAdmin());
     }
     do_action('mab_post_init');
 }
Exemplo n.º 2
0
 */
add_action('init', array('MAB_Assets', 'register'), 1);
add_action('wp_enqueue_scripts', array('MAB_Assets', 'enqueue'));
/**
 * AJAX
 */
if (defined('DOING_AJAX')) {
    MAB_Ajax::setup();
}
/**
 * Process ajax submission to optin forms
 */
add_filter('mab_process_postmatic_optin_submit', 'mab_process_postmatic_optin_submit', 10, 2);
add_filter('mab_process_constantcontact_optin_submit', 'mab_process_constantcontact_optin_submit', 10, 2);
add_filter('mab_process_wysija_optin_submit', 'mab_process_wysija_optin_submit', 10, 2);
/**
 * Setup Widgets
 */
add_action('widgets_init', array('ProsulumMabBase', 'register_widgets'));
/**
 * Default optin settings html
 */
foreach (MAB_OptinProviders::getDefault() as $k => $v) {
    add_filter("mab_get_{$k}_settings_html", array('MAB_MetaBoxes', 'getDefaultOptinSettingsHtml'), 10, 3);
    // @see MAB_Template::getOptinForm() for reference
    add_filter("mab_{$k}_optin_form_output", "mab_{$k}_form_html", 10, 2);
}
/**
 * Version to Footer
 */
add_action('wp_footer', array('ProsulumMabBase', 'version_to_footer'), 100);
Exemplo n.º 3
0
 /**
  * FUNCTIONAL CALLBACKS
  * ================================ */
 public static function ajaxGetOptinProviderSettings()
 {
     $data = stripslashes_deep($_REQUEST);
     $provider = sanitize_text_field($data['provider']);
     if (empty($provider)) {
         echo "No settings found for selected opt-in provider [{$provider}].";
         exit;
     }
     $optinProviders = MAB_OptinProviders::getAllAllowed();
     if (empty($optinProviders[$provider])) {
         echo "No settings found for selected opt-in provider [{$provider}].";
         exit;
     }
     $postId = intval($data['postid']);
     echo MAB_MetaBoxes::getOptinSettingsHtml($provider, $postId);
     exit;
 }
Exemplo n.º 4
0
 function optInSettings($post)
 {
     $MabAdmin = MAB('admin');
     $MabBase = MAB();
     $MabButton = MAB('button');
     $data['meta'] = $MabBase->get_mab_meta($post->ID);
     $data['assets-url'] = MAB_ASSETS_URL;
     //get allowed optin providers
     $data['optin-providers'] = MAB_OptinProviders::getAllAllowed();
     if (!empty($data['meta']['optin-provider'])) {
         $data['optin-provider-html'] = MAB_MetaBoxes::getOptinSettingsHtml($data['meta']['optin-provider'], $post->ID);
     } else {
         $data['optin-provider-html'] = MAB_MetaBoxes::getOptinSettingsHtml('manual', $post->ID);
     }
     //get available action box styles
     $data['styles'] = MAB_Utils::getStyles();
     //get buttons
     $data['buttons'] = $MabButton->getConfiguredButtons();
     $filename = 'metaboxes/type/optin-settings.php';
     $box = MAB_Utils::getView($filename, $data);
     echo $box;
 }