/** * Wrapper for MAB_MetaBoxes::optionBox() */ function mab_option_box($name = '', $data = array()) { return MAB_MetaBoxes::optionBox($name, $data); }
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; }
/** * 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; }
function register_meta_box_cb($post) { $MabMetaBoxes = new MAB_MetaBoxes($post); $MabMetaBoxes->initMetaboxes(); }