本文整理汇总了PHP中MAB函数的典型用法代码示例。如果您正苦于以下问题:PHP MAB函数的具体用法?PHP MAB怎么用?PHP MAB使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mab_get_fresh_design_option
/**
* This function pulls the design settings from the DB
* for use/return. Does not cache, so always up to date.
*
* @author Gary Jones
* @param string $opt array index name of option
* @param string $key actually the postID since style settings are stored as postmeta
* @return mixed
* @since 0.9.5
* @version 0.9.8
*/
function mab_get_fresh_design_option($opt, $key = null)
{
$MabDesign = MAB('design');
$setting = $MabDesign->getConfiguredStyle($key);
if (isset($setting[$opt])) {
return $setting[$opt];
}
return false;
}
示例2: mab_constantcontact_form_html
function mab_constantcontact_form_html($html, $actionBoxObj)
{
$settings = MAB('settings')->getAll();
if ($settings['optin']['allowed']['constantcontact'] == 0) {
return '';
}
$actionBoxObj->addClass('mab-ajax');
$meta = $actionBoxObj->getMeta();
$meta['ID'] = $actionBoxObj->getId();
$filename = 'optinforms/constant-contact.php';
$form = MAB_Utils::getView($filename, $meta);
return $form;
}
示例3: mab_gforms_meta_box
/**
* Outputs the GFORMS options metabox in action box edit screen
* @param object $post the current post
* @return html
*/
function mab_gforms_meta_box($post)
{
$MabBase = MAB();
$data['meta'] = $MabBase->get_mab_meta($post->ID);
$type = $MabBase->get_action_box_type($post->ID);
//Get gravity forms stuff
$forms = RGFormsModel::get_forms(null, 'title');
$data['forms'] = is_array($forms) ? $forms : array();
//error_log();
$filename = 'metabox/metabox.php';
$box = mab_gforms_get_view($filename, $data);
echo $box;
}
示例4: getStyleSettings
/**
* Gets style settings data from OPTIONS table
* @return array saved style settings or a default setting
*/
function getStyleSettings()
{
$MabBase = MAB();
//TODO: get from cache?
$settings = get_option($this->_option_StyleSettings);
if (!is_array($settings)) {
//create default style settings array
$settings = $this->getDefaultSettings();
$settings['timesaved'] = current_time('timestamp');
$settings['title'] = __('Default', 'mab');
$settings = array(0 => $settings);
update_option($this->_option_StyleSettings, $settings);
}
return $settings;
}
示例5: mab_cf7_meta_box
/**
* Outputs the CF7 options metabox in action box edit screen
* @param object $post the current post
* @return html
*/
function mab_cf7_meta_box($post)
{
$MabBase = MAB();
$MabButton = MAB('button');
$data['meta'] = $MabBase->get_mab_meta($post->ID);
$type = $MabBase->get_action_box_type($post->ID);
//Get contact form 7 stuff
$args = array('orderby' => 'title', 'order' => 'ASC');
$cf7_list = WPCF7_ContactForm::find($args);
$data['cf7-list'] = is_array($cf7_list) ? $cf7_list : array();
$data['buttons'] = $MabButton->getConfiguredButtons();
$filename = 'metabox/cf7-settings.php';
$box = mab_cf7_get_view($filename, $data);
echo $box;
}
示例6: activate
public static function activate()
{
$MabBase = MAB();
if (!is_object($MabBase)) {
$MabBase = new MAB();
}
//check for post type
if (!post_type_exists(self::POST_TYPE)) {
$MabBase->register_post_type();
}
//setup initial settings?
$settingsApi = MAB('settings');
$settingsApi->defaultSettingsIfNew();
flush_rewrite_rules();
}
示例7: getAllAllowed
/**
* Returns list of allowed optin providers in an array
* @return array
*/
public static function getAllAllowed()
{
/** TODO: add a registerOptinProviders() function **/
$settings = MAB('settings')->getAll();
$allowed = array();
foreach (self::getAll() as $k => $provider) {
if ($provider['auto_allow']) {
$allowed[$k] = array('id' => $provider['id'], 'name' => $provider['name']);
} else {
//add optin providers where value is not 0 or empty or null
if (!empty($settings['optin']['allowed'][$provider['id']])) {
$allowed[$k] = array('id' => $provider['id'], 'name' => $provider['name']);
}
}
}
return $allowed;
}
示例8: getActionBoxTypes
/**
* Get Action Box Types
* @param string $type - unique name/type of action box
* @return array|bool - return array of data for action box depending specified through $type or all action boxes if no parameter is passed. Will return FALSE if specified $type is not found
*/
public static function getActionBoxTypes($type = null)
{
$MabBase = MAB();
$boxTypes = $MabBase->get_registered_action_box_types();
if (!is_null($type)) {
if (isset($boxTypes[$type])) {
//return specified action box
return $boxTypes[$type];
} else {
//specified action box type does not exist
return false;
}
} else {
//return all action boxes
return $boxTypes;
}
}
示例9: getIdOfActionBoxUsed
/**
* @param int $postId ID of post where Action Box is enabled
* @return int|string ID of action box used OR "default" OR "none" OR empty string if not yet set
*/
function getIdOfActionBoxUsed($postId = '')
{
global $post;
$MabBase = MAB();
if ($postId == '') {
$postId = $post->ID;
}
$postmeta = $MabBase->get_mab_meta($postId, 'post');
return isset($postmeta['post-action-box']) ? $postmeta['post-action-box'] : '';
}
示例10: convertOptinKeys
/**
* to be deprecated @2.8.7
*/
public static function convertOptinKeys($settings)
{
$MabBase = MAB();
$settingsChanged = false;
$new = array();
$meta = $settings;
if (!empty($meta['optin-image-url']) && empty($meta['aside-image-url'])) {
$settingsChanged = true;
$meta['aside-image-url'] = $meta['optin-image-url'];
}
if (!empty($meta['optin-image-width']) && empty($meta['aside-image-width'])) {
$settingsChanged = true;
$meta['aside-image-width'] = $meta['optin-image-width'];
}
if (!empty($meta['optin-image-height']) && empty($meta['aside-image-height'])) {
$settingsChanged = true;
$meta['aside-image-height'] = $meta['optin-image-height'];
}
if (!empty($meta['optin-image-placement']) && empty($meta['aside-image-placement'])) {
$settingsChanged = true;
$meta['aside-image-placement'] = $meta['optin-image-placement'];
}
if (!empty($meta['optin-heading']) && empty($meta['main-heading'])) {
$settingsChanged = true;
$meta['main-heading'] = $meta['optin-heading'];
}
if (!empty($meta['optin-subheading']) && empty($meta['subheading'])) {
$settingsChanged = true;
$meta['subheading'] = $meta['optin-subheading'];
}
if (!empty($meta['optin-main-copy']) && empty($meta['main-copy'])) {
$settingsChanged = true;
$meta['main-copy'] = $meta['optin-main-copy'];
}
if ($settingsChanged) {
//save the new settings and return new settings
$new = $meta;
unset($new['ID']);
$MabBase->update_mab_meta($meta['ID'], $new);
$new['ID'] = $meta['ID'];
return $new;
}
return $meta;
}
示例11: _e
_e('Button Saved.', 'mab');
?>
</strong></p></div>
<?php
} elseif (isset($_GET['reset']) && $_GET['reset'] == 'true') {
?>
<div id="mab-design-settings-reset" class="updated fade"><p><strong><?php
_e('Button Reset.', 'mab');
?>
</strong></p></div>
<?php
}
?>
<?php
$MabButton = MAB('button');
$button = $data['button'];
$key = $data['key'];
$action = $data['action'];
$button_code = $data['button-code'];
?>
<?php
//TODO: put button id/key here if editing a button
if ($action == 'edit' && isset($key)) {
?>
<input type="hidden" name="mab-button-key" value="<?php
echo esc_attr($key);
?>
" />
<?php
示例12: init
/**
* @return TRUE if the action box was configured, FALSE otherwise
*/
function init($id = null)
{
$MabBase = MAB();
//stop early if $id is empty
if ($id === '' || is_null($id)) {
return false;
}
//make sure action box exists
$actionbox = get_post($id);
if (empty($actionbox)) {
return false;
}
// make sure the $actionbox post object is not trashed
if ($actionbox->post_status == 'trash') {
return false;
}
//make sure action box type is registered
$type = $MabBase->get_mab_meta($id, 'type');
if (!$MabBase->get_registered_action_box_type($type)) {
//error_log($type . ' not registered');
return false;
}
$this->_type = $type;
$this->_id = $id;
$this->_meta = $MabBase->get_mab_meta($id);
//set $_is_configured to TRUE indicating that this action box
//is configured correctly
$this->_is_configured = true;
$this->_template_obj = new MAB_Template($this);
// set html data
$this->setHtmlData('mabid', $id);
$this->setHtmlData('trackid', $id);
$this->setHtmlData('type', $this->getActionBoxType());
// set tracking/analytics
$this->track(true);
return true;
}
示例13: get_mailchimp_account_details
function get_mailchimp_account_details($apikey = '')
{
require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';
if (empty($apikey)) {
$settings = MAB('settings')->getAll();
$apikey = $settings['optin']['mailchimp-api'];
}
$mailchimp = new Mailchimp($apikey);
$details = $mailchimp->helper->accountDetails();
return $details;
}
示例14: print_r
<?php
if (is_dir($css_dir)) {
?>
<tr>
<th><strong>CSS directory contents</strong></th>
<td><pre><textarea class="large-text" rows="20" readonly style="background: #fff;"><?php
print_r(@scandir($css_dir));
?>
</textarea></pre></td>
</tr>
<?php
}
?>
<tr>
<th><strong>_mab_settings</strong></th>
<td><pre><textarea class="large-text" rows="30" readonly style="background: #fff;"><?php
print_r(MAB('settings')->getAll(false));
?>
</textarea></pre></td>
</tr>
</tbody>
</table>
<?php
}
?>
</div>
</div>
</div><!-- #mab-dashboard -->
</div><!-- .wrap -->
示例15: setup
/**
* Setup ajax
*/
public static function setup()
{
$ajax = MAB('ajax');
// note: wp ajax is always run in admin context
add_action('wp_ajax_nopriv_mab-process-optin', array($ajax, 'processOptin'));
add_action('wp_ajax_mab-process-optin', array($ajax, 'processOptin'));
}