/** * Configures a form that will be inside the metabox. * * @see FactoryMetaboxes321_FormMetabox * @since 1.0.0 * * @param FactoryForms328_Form $form A form object to configure. * @return void */ public function form($form) { $itemType = OPanda_Items::getCurrentItem(); $form->add(array('type' => 'hidden', 'name' => 'item', 'default' => isset($_GET['opanda_item']) ? $_GET['opanda_item'] : null)); $defaultHeader = __('This content is locked!', 'bizpanda'); $defaultMessage = __('Please support us, use one of the buttons below to unlock the content.', 'bizpanda'); switch ($itemType['name']) { case 'email-locker': $defaultHeader = __('This Content Is Only For Subscribers', 'bizpanda'); $defaultMessage = __('Please subscribe to unlock this content. Just enter your email below.', 'bizpanda'); break; case 'connect-locker': $defaultHeader = __('Sing In To Unlock This Content', 'bizpanda'); $defaultMessage = __('Please sign in. It\'s free. Just click one of the buttons below to get instant access.', 'bizpanda'); break; } $form->add(array(array('type' => 'textbox', 'name' => 'header', 'title' => __('Locker header', 'bizpanda'), 'hint' => __('Type a header which attracts attention or calls to action. You can leave this field empty.', 'bizpanda'), 'default' => $defaultHeader), array('type' => 'wp-editor', 'name' => 'message', 'title' => __('Locker message', 'bizpanda'), 'hint' => __('Type a message which will appear under the header.', 'bizpanda') . '<br /><br />' . __('Shortcodes: [post_title], [post_url].', 'bizpanda'), 'default' => $defaultMessage, 'tinymce' => array('setup' => 'function(ed){ window.bizpanda.lockerEditor.bindWpEditorChange( ed ); }', 'height' => 100), 'layout' => array('hint-position' => 'left')))); if ('email-locker' === $itemType['name']) { $form->add(array('type' => 'columns', 'items' => array(array('type' => 'textbox', 'name' => 'button_text', 'title' => __('Buttton Text', 'bizpanda'), 'hint' => __('The text on the button. Call to action!'), 'default' => __('subscribe to unlock', 'bizpanda'), 'column' => 1), array('type' => 'textbox', 'name' => 'after_button', 'title' => __('After Buttton', 'bizpanda'), 'hint' => __('The text below the button. Guarantee something.'), 'default' => __('Your email address is 100% safe from spam!', 'bizpanda'), 'column' => 2)))); } if (in_array($itemType['name'], array('email-locker', 'signin-locker'))) { $form->add(array('type' => 'html', 'html' => array($this, 'showOtherFrontendTextNote'))); $form->add(array('type' => 'separator')); } require_once OPANDA_BIZPANDA_DIR . '/includes/themes.php'; $form->add(array(array('type' => 'dropdown', 'hasHints' => true, 'name' => 'style', 'data' => OPanda_ThemeManager::getThemes(OPanda_Items::getCurrentItemName(), 'dropdown'), 'title' => __('Theme', 'bizpanda'), 'hint' => __('Select the most suitable theme.', 'bizpanda'), 'default' => 'secrets'))); if (OPanda_Items::isCurrentPremium()) { $form->add(array(array('type' => 'dropdown', 'way' => 'buttons', 'name' => 'overlap', 'data' => array(array('full', '<i class="fa fa-lock"></i>' . __('Full (classic)', 'bizpanda')), array('transparence', '<i class="fa fa-adjust"></i>' . __('Transparency', 'bizpanda')), array('blurring', '<i class="fa fa-bullseye"></i>' . __('Blurring', 'bizpanda'), __('Works in all browsers except IE 10-11 (In IE 10-10, the transparency mode will be applied)', 'bizpanda'))), 'title' => __('Overlap Mode', 'bizpanda'), 'hint' => __('Choose the way how your locker should lock the content.', 'bizpanda'), 'default' => 'full'))); } else { $form->add(array(array('type' => 'dropdown', 'way' => 'buttons', 'name' => 'overlap', 'data' => array(array('full', '<i class="fa fa-lock"></i>Full (classic)'), array('transparence', '<i class="fa fa-adjust"></i>Transparency'), array('blurring', '<i class="fa fa-bullseye"></i>Blurring', sprintf(__('This option is available only in the <a href="%s" target="_blank">premium version</a> of the plugin (the transparency mode will be used in the free version)', 'bizpanda'), opanda_get_premium_url(null, 'blurring')))), 'title' => __('Overlap Mode', 'bizpanda'), 'hint' => __('Choose the way how your locker should lock the content.', 'bizpanda'), 'default' => 'full'))); } $form->add(array(array('type' => 'dropdown', 'name' => 'overlap_position', 'data' => array(array('top', __('Top Position', 'bizpanda')), array('middle', __('Middle Position', 'bizpanda')), array('scroll', __('Scrolling (N/A in Preview)', 'bizpanda'))), 'title' => '', 'hint' => '', 'default' => 'middle'))); }
/** * Renders content of the metabox. * * @see FactoryMetaboxes321_Metabox * @since 1.0.0 * * @return void */ public function html() { global $post; $isSystem = get_post_meta($post->ID, 'opanda_is_system', true); $item = OPanda_Items::getCurrentItem(); $shortcodeName = $item['shortcode']; $shortcode = '[' . $shortcodeName . '] [/' . $shortcodeName . ']'; if (!$isSystem) { $shortcode = '[' . $shortcodeName . ' id="' . $post->ID . '"] [/' . $shortcodeName . ']'; } ?> <div class="factory-bootstrap-329 factory-fontawesome-320"> <p class="onp-sl-description-section"> <?php _e('Wrap content you want to lock via the following shortcode in your post editor:', 'bizpanda'); ?> <input class="onp-sl-shortcode" type="text" value='<?php echo $shortcode; ?> ' /> </p> </div> <?php }
/** * Registers default options (lockers, popups, forms). * * @since 1.0.0 */ function opanda_add_meta_boxes() { global $bizpanda; $type = OPanda_Items::getCurrentItem(); if (empty($type)) { return; } $typeName = $type['name']; $data = array(); if (OPanda_Items::isCurrentPremium()) { $data[] = array('class' => 'OPanda_BasicOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/basic-options.php'); $data[] = array('class' => 'OPanda_PreviewMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/preview.php'); $data[] = array('class' => 'OPanda_ManualLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/manual-locking.php'); $data[] = array('class' => 'OPanda_BulkLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/bulk-locking.php'); $data[] = array('class' => 'OPanda_VisabilityOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/visability-options.php'); $data[] = array('class' => 'OPanda_AdvancedOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/advanced-options.php'); } else { $data[] = array('class' => 'OPanda_BasicOptionsMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/basic-options.php'); $data[] = array('class' => 'OPanda_PreviewMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/preview.php'); $data[] = array('class' => 'OPanda_ManualLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/manual-locking.php'); $data[] = array('class' => 'OPanda_BulkLockingMetaBox', 'path' => OPANDA_BIZPANDA_DIR . '/includes/metaboxes/bulk-locking.php'); } $data = apply_filters("opanda_item_type_metaboxes", $data, $typeName); $data = apply_filters("opanda_{$typeName}_type_metaboxes", $data); foreach ($data as $metabox) { require_once $metabox['path']; FactoryMetaboxes321::registerFor(new $metabox['class']($bizpanda), OPANDA_POST_TYPE, $bizpanda); } }