예제 #1
0
/**
 * 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
0
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
0
/**
 * 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
0
 /**
  * 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
0
/**
 * 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
0
파일: MAB.php 프로젝트: phupx/phamlook
 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * @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
0
 /**
  * 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
0
    _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
0
 /**
  * @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
0
 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
0
					<?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
0
파일: MAB_Ajax.php 프로젝트: aki08/akil
 /**
  * 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'));
 }
예제 #16
0
/**
 * Used to create the actual markup of options.
 *
 * @author Gary Jones
 * @param string Used as comparison to see which option should be selected.
 * @param string $type One of 'border', 'family', 'style', 'variant', 'weight', 'align', 'decoration', 'transform'.
 * @since 0.9.5
 * @return string HTML markup of dropdown <option>s
 * @version 0.9.8
 */
function mab_create_options($compare, $type)
{
    switch ($type) {
        case "border":
            // border styles
            $options = array(array('None', 'none'), array('Solid', 'solid'), array('Dashed', 'dashed'), array('Dotted', 'dotted'), array('Double', 'double'), array('Groove', 'groove'), array('Ridge', 'ridge'), array('Inset', 'inset'), array('Outset', 'outset'));
            break;
        case "family":
            //font-family sets
            static $fonts = array();
            if (empty($fonts)) {
                $fonts = array(array('Arial', 'Arial, Helvetica, sans-serif'), array('Arial Black', "'Arial Black', Gadget, sans-serif"), array('Century Gothic', "'Century Gothic', sans-serif"), array('Courier New', "'Courier New', Courier, monospace"), array('Georgia', 'Georgia, serif'), array('Lucida Console', "'Lucida Console', Monaco, monospace"), array('Lucida Sans Unicode', "'Lucida Sans Unicode', 'Lucida Grande', sans-serif"), array('Palatino Linotype', "'Palatino Linotype', 'Book Antiqua', Palatino, serif"), array('Tahoma', 'Tahoma, Geneva, sans-serif'), array('Times New Roman', "'Times New Roman', serif"), array('Trebuchet MS', "'Trebuchet MS', Helvetica, sans-serif"), array('Verdana', 'Verdana, Geneva, sans-serif'));
                $MabBase = MAB();
                $settingsApi = MAB('settings');
                $settings = $settingsApi->getAll();
                if (!empty($settings['fonts'])) {
                    $t_fonts = explode("\n", str_replace("\r", "", $settings['fonts']));
                    foreach ($t_fonts as $f) {
                        $line = explode(':', $f);
                        if (count($line) > 1) {
                            // used delimiter. first element is the font
                            // name. second is the actual font family
                            // value
                            $fonts[] = array($line[0], $line[1]);
                        } else {
                            $fonts[] = array($line[0], $line[0]);
                        }
                    }
                }
            }
            $options = apply_filters('mab_font_family_options', $fonts);
            sort($options);
            array_unshift($options, array('Inherit', 'inherit'));
            // Adds Inherit option as first option.
            break;
        case "style":
            // font-style options
            $options = array(array('Normal', 'normal'), array('Italic', 'italic'));
            break;
        case "variant":
            // font-variant options
            $options = array(array('Normal', 'normal'), array('Small-Caps', 'small-caps'));
            break;
        case "weight":
            // font-weight options
            $options = array(array('Normal', 'normal'), array('Bold', 'bold'));
            break;
        case "align":
            // text-align options
            $options = array(array('Left', 'left'), array('Center', 'center'), array('Right', 'right'), array('Justify', 'justify'));
            break;
        case "decoration":
            // text-decoration options
            $options = array(array('None', 'none'), array('Underline', 'underline'), array('Overline', 'overline'));
            break;
        case "transform":
            // text-transform options
            $options = array(array('None', 'none'), array('Capitalize', 'capitalize'), array('Lowercase', 'lowercase'), array('Uppercase', 'uppercase'));
            break;
        case "background":
            // background color options
            $options = array(array('Color (Hex)', 'hex'), array('Inherit', 'inherit'), array('Transparent', 'transparent'));
            break;
        case "color":
            // font color options
            $options = array(array('Color (Hex)', 'hex'), array('Inherit', 'inherit'));
            break;
        case 'repeat':
            $options = array(array('None', 'no-repeat'), array('Horizontal', 'repeat-x'), array('Vertical', 'repeat-y'), array('All', 'repeat'));
            break;
        case 'image_align':
            $options = array(array('Left', 'left'), array('Center', 'center'), array('Right', 'right'));
            break;
        default:
            $options = '';
    }
    if (is_array($options)) {
        $output = '';
        foreach ($options as $option) {
            $output .= '<option value="' . esc_attr($option[1]) . '" title="' . esc_attr($option[1]) . '" ' . selected(esc_attr($option[1]), esc_attr($compare), false) . '>' . __($option[0], 'mab') . '</option>';
        }
    } else {
        $output = '<option>Select type was not valid.</option>';
    }
    return $output;
}
예제 #17
0
/**
 * Process Constant Contact form submit
 * @param $result
 * @param $data - form post data
 */
function mab_process_constantcontact_optin_submit($result, $data)
{
    if (empty($data['email']) || !is_email($data['email'])) {
        MAB_Ajax::addMessage(__('Invalid email address.', 'mab'));
        return false;
    }
    if (empty($data['list'])) {
        MAB_Ajax::addMessage(__('Email list is not set.', 'mab'));
        return false;
    }
    $email = $data['email'];
    $list = $data['list'];
    $vars = array();
    if (!empty($data['fname'])) {
        $vars['firstname'] = $data['fname'];
    }
    if (!empty($data['lname'])) {
        $vars['lastname'] = $data['lname'];
    }
    $result = MAB('admin')->signupConstantContact($list, $email, $vars);
    if (is_array($result)) {
        foreach ($result as $error) {
            MAB_Ajax::addMessage(print_r($error, true));
        }
        return false;
    }
    $actionBox = MAB_ActionBox::get($data['mabid']);
    if (!$actionBox) {
        MAB_Ajax::addMessage(__('Action box does not exist.', 'mab'));
        return false;
    }
    $meta = $actionBox->getMeta();
    if (!empty($meta['optin']['success-message'])) {
        MAB_Ajax::addMessage(wp_kses_post($meta['optin']['success-message']));
    }
    if (!empty($meta['optin']['redirect'])) {
        return array('redirect' => esc_url($meta['optin']['redirect']));
    }
    return true;
}
예제 #18
0
<?php

$MabBase = MAB();
$meta = $data['meta'];
$assets_url = $data['assets-url'];
?>
<div class="mab-option-box">
	<h4><label for="mab-post-action-box"><?php 
_e('Select Action Box', 'mab');
?>
</label></h4>
	<p><?php 
_e(sprintf('Select an Action Box to display. <a href="http://www.magicactionbox.com/features/?pk_campaign=LITE&pk_kwd=selectDefaultBox" target="_blank">With Pro version</a>, you can also specify the default Action Box to use in the <a href="%1s">Main Settings page</a>.', admin_url('admin.php?page=mab-main')), 'mab');
?>
</p>
	<select id="mab-post-action-box" class="large-text" name="mabpostmeta[post-action-box]" >
		<?php 
$selected_action_box = isset($meta['post-action-box']) ? $meta['post-action-box'] : 'default';
?>
		<option value="none" <?php 
selected($selected_action_box, 'none');
?>
 >Disable</option>
		<option value="default" <?php 
selected($selected_action_box, 'default');
?>
 >Use Default</option>
		<?php 
//Get action boxes available
$action_boxes_obj = get_posts(array('numberposts' => -1, 'orderby' => 'title date', 'post_type' => $MabBase->get_post_type()));
foreach (MAB_ActionBox::getAll() as $action_box) {
예제 #19
0
/**
 * Creates CSS for actionboxes
 */
function mab_prepare_actionbox_stylesheet($postId, $section = 'all')
{
    $MabBase = MAB();
    $output = array();
    $styleSettings = $MabBase->get_mab_meta($postId, 'design');
    switch ($section) {
        case 'all':
        case 'custom':
        default:
            $output[] = '/* Custom CSS */';
            $output[] = isset($styleSettings['mab_custom_css']) ? $styleSettings['mab_custom_css'] : '';
            break;
    }
    //switch
    return apply_filters('mab_prepare_actionbox_stylesheet', implode("\n", $output), $postId, $output);
}
예제 #20
0
 static function postActionBox($post)
 {
     $MabBase = MAB();
     $data['meta'] = $MabBase->get_mab_meta($post->ID, 'post');
     $data['assets-url'] = MAB_ASSETS_URL;
     $filename = 'metaboxes/post-select-actionbox.php';
     $box = MAB_Utils::getView($filename, $data);
     echo $box;
 }
예제 #21
0
파일: post-new.php 프로젝트: aki08/akil
<?php

$MabAdmin = MAB('admin');
$MabBase = MAB('MAB');
?>
<div class="wrap">
	<?php 
screen_icon();
?>
	<h2><?php 
_e('Add New Action Box', 'mab');
?>
</h2>

	<h3>Select Action Box Type</h3>

	<p>
		<?php 
_e('Choose the type of Magic Action Box you wish to create. You cannot change the type of an Action Box after creating it, so choose wisely.', 'mab');
?>
	</p>
	<ul class="mab-type-choice">
		<?php 
global $post;
$types = $MabBase->get_registered_action_box_types('all');
$disabledTypes = array();
foreach ($types as $type => $info) {
    $enabled = !empty($info['status']) && $info['status'] == 'enabled' ? true : false;
    /* List all enabled types first */
    if ($enabled) {
        ?>
예제 #22
0
 function possiblyEndOutputBuffering()
 {
     global $pagenow;
     $MabBase = MAB();
     if ($pagenow == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == $MabBase->get_post_type()) {
         $result = ob_get_clean();
         $filename = 'interceptions/post-new.php';
         //$data = $result;
         $view = ProsulumMabCommon::getView($filename);
         echo $view;
     }
 }
예제 #23
0
/**
 * @param string $context - single | page | default
 * @return int|bool Post ID of Action Box or FALSE if actionbox is not specified for a context
 */
function mab_get_action_box_id_from_context($context = 'default')
{
    $MabBase = MAB();
    $settings = MAB_Utils::getSettings();
    $globalMab = $settings['global-mab'];
    $actionBoxId = '';
    $default = isset($globalMab['default']['actionbox']) && $globalMab['default']['actionbox'] != 'none' ? $globalMab['default']['actionbox'] : '';
    $defaultPlacement = $placement = isset($globalMab['default']['placement']) ? $globalMab['default']['placement'] : 'bottom';
    switch ($context) {
        case 'single':
            global $post;
            if (!is_object($post)) {
                //something's wrong
                $actionBoxId = '';
                break;
            }
            /** Single Post Setting **/
            $postmeta = $MabBase->get_mab_meta($post->ID, 'post');
            $singleActionBoxId = isset($postmeta['post-action-box']) ? $postmeta['post-action-box'] : '';
            //if $pageActionBoxId is empty string, then action box is not yet set
            if ('' !== $singleActionBoxId && 'default' != $singleActionBoxId) {
                //specific action box set for Post
                $actionBoxId = $singleActionBoxId;
                $placement = isset($postmeta['post-action-box-placement']) ? $postmeta['post-action-box-placement'] : $defaultPlacement;
            } else {
                //use global settings
                /** Global Single Post Setting **/
                $actionBoxId = isset($globalMab['post']['actionbox']) ? $globalMab['post']['actionbox'] : 'default';
                $placement = isset($globalMab['post']['placement']) ? $globalMab['post']['placement'] : $defaultPlacement;
                /** Global Category Setting - will override Global Single Post Setting **/
                $terms = get_the_terms($post->ID, 'category');
                if ($terms && !is_wp_error($terms)) {
                    foreach ($terms as $term) {
                        //catch the first category set
                        if (isset($globalMab['category'][$term->term_id]['actionbox']) and $globalMab['category'][$term->term_id]['actionbox'] != 'default') {
                            $actionBoxId = $globalMab['category'][$term->term_id]['actionbox'];
                            $placement = $globalMab['category'][$term->term_id]['placement'];
                            break;
                            //break out of foreach loop
                        }
                        //endif
                    }
                    //endforeach
                }
                //endif
            }
            //endif
            break;
        case 'page':
            global $post;
            if (!is_object($post)) {
                //something's wrong
                $actionBoxId = '';
            }
            $postmeta = $MabBase->get_mab_meta($post->ID, 'post');
            $pageActionBoxId = isset($postmeta['post-action-box']) ? $postmeta['post-action-box'] : '';
            //if $pageActionBoxId is empty string, then action box is not yet set
            if ('' !== $pageActionBoxId && 'default' != $pageActionBoxId) {
                //specific action box set for Page
                $actionBoxId = $pageActionBoxId;
                $placement = isset($postmeta['post-action-box-placement']) ? $postmeta['post-action-box-placement'] : $defaultPlacement;
            } else {
                //use global setting
                $actionBoxId = isset($globalMab['page']['actionbox']) ? $globalMab['page']['actionbox'] : 'default';
                $placement = isset($globalMab['page']['placement']) ? $globalMab['page']['placement'] : $defaultPlacement;
            }
            break;
        case 'front_page':
            global $wp_query;
            //make sure that the front page is set to display a static page
            if (!is_page()) {
                break;
            }
            $post = $wp_query->get_queried_object();
            if (!is_object($post)) {
                //something's wrong
                $actionBoxId = '';
            }
            $postmeta = $MabBase->get_mab_meta($post->ID, 'post');
            $pageActionBoxId = isset($postmeta['post-action-box']) ? $postmeta['post-action-box'] : '';
            //if $pageActionBoxId is empty string, then action box is not yet set
            if ('' !== $pageActionBoxId && 'default' != $pageActionBoxId) {
                //specific action box set for Page
                $actionBoxId = $pageActionBoxId;
                $placement = isset($postmeta['post-action-box-placement']) ? $postmeta['post-action-box-placement'] : $defaultPlacement;
            } else {
                //use global setting
                $actionBoxId = isset($globalMab['page']['actionbox']) ? $globalMab['page']['actionbox'] : 'default';
                $placement = isset($globalMab['page']['placement']) ? $globalMab['page']['placement'] : $defaultPlacement;
            }
            break;
        case 'tag':
        case 'archive':
        case 'blog':
        case 'category':
        default:
            $actionBoxId = '';
            break;
    }
    //endswitch
    if ($actionBoxId == 'default') {
        $actionBoxId = $default;
    } elseif ($actionBoxId == 'none') {
        $actionBoxId = '';
    }
    //return array( 'id' => $actionBoxId, 'placement' => $placement );
    return $actionBoxId;
}
예제 #24
0
파일: MAB_Widget.php 프로젝트: aki08/akil
    function form($instance)
    {
        //setup default values
        $defaults = array();
        $instance = wp_parse_args((array) $instance, $defaults);
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $selected_action_box = isset($instance['actionbox-id']) ? $instance['actionbox-id'] : '';
        $force_stacked = !empty($instance['force-stacked']) ? 1 : 0;
        $textdomain = $this->textdomain;
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', $textdomain);
        ?>
</label>
			<input type="text" name="<?php 
        echo $this->get_field_name('title');
        ?>
"  value="<?php 
        echo $title;
        ?>
" class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('actionbox-id');
        ?>
"><?php 
        _e('Action box to display:', MAB_DOMAIN);
        ?>
</label>
			<select name="<?php 
        echo $this->get_field_name('actionbox-id');
        ?>
" class="widefat">
				<?php 
        $MabBase = MAB();
        /** Get available actionboxes **/
        $mab = get_posts(array('numberposts' => -1, 'orderby' => 'title date', 'post_type' => $MabBase->get_post_type()));
        foreach ($mab as $box) {
            ?>
					<option value="<?php 
            echo $box->ID;
            ?>
" <?php 
            selected($selected_action_box, $box->ID);
            ?>
><?php 
            echo $box->post_title;
            ?>
</option>
				<?php 
        }
        ?>
			</select>
			<br/>
			<small><?php 
        _e('Select an action box to display on your widget area.', MAB_DOMAIN);
        ?>
</small>
		</p>
		<p>
			<label><input type="checkbox" name="<?php 
        echo $this->get_field_name('force-stacked');
        ?>
" value="1" <?php 
        checked($force_stacked, 1);
        ?>
> <?php 
        _e('Force stacked layout', 'mab');
        ?>
</label>
			<br>
			<small><?php 
        _e('Check this box to force the action box to display fields vertically. If unchecked, the fields layout will be determined by the <strong>Form Fields Layout</strong> setting in the action box.', 'mab');
        ?>
</small>
		</p>

		<?php 
    }
예제 #25
0
<?php

$MabAdmin = MAB('admin');
$meta = !empty($data['meta']) ? $data['meta'] : array();
$assets_url = $data['assets-url'];
?>


<?php 
/* Load Style Select Box */
include_once 'template-style-settings.php';
?>

<?php 
$width = !empty($meta['width']) ? esc_attr($meta['width']) : '';
?>
<div class="mab-option-box">
	<h4><label for="mab-width"><?php 
_e('Action Box Width', 'mab');
?>
</label></h4>
	<input type="text" class="code" value="<?php 
echo $width;
?>
" name="mab[width]" placeholder="Ex. 400px or 100%">
	<p><?php 
_e('Specify the width of the action box with the unit i.e. px, em, %. This will be added as inline style to the <code>.magic-action-box</code> div.', 'mab');
?>
</p>
</div>
예제 #26
0
<?php

/**
 * Style Settings Template
 * this template is loaded using php include
 */
$MabDesign = MAB('design');
$preconfiguredStyles = $data['styles'];
$userStyles = $MabDesign->getStyleSettings();
$selected_style = isset($meta['style']) ? $meta['style'] : null;
?>
<div class="mab-option-box">
	<h4><label for="mab-style"><?php 
_e('Action Box Style', 'mab');
?>
</label></h4>
	<p>Choose a style for this Action Box. Select <strong>User Settings</strong> to use the design settings specified below.</p>
	<select id="mab-style" class="large-text" name="mab[style]">
		<?php 
$selected_style = isset($meta['style']) ? $meta['style'] : null;
?>
		<option value="user" <?php 
selected($selected_style, 'user');
?>
>User Styles</option>
		<option value="none" <?php 
selected($selected_style, 'none');
?>
>None</option>
		<?php 
//PRECONFIGURED STYLES