/** * Prints locker options. * * @since 1.0.0 * @global type $post */ public static function printLockerOptions() { $data = array(); foreach (self::$_lockerOptionsToPrint as $name => $id) { if (self::autoUnlock($id)) { continue; } $lockData = self::getLockerDataToPrint($id); $data[$id] = array('name' => $name, 'options' => $lockData); } ?> <!-- Lockers: options of bulk lockers OnePress, bizpanda.com --> <script> if ( !window.bizpanda ) window.bizpanda = {}; if ( !window.bizpanda.lockerOptions ) window.bizpanda.lockerOptions = {}; <?php foreach ($data as $item) { ?> window.bizpanda.lockerOptions['<?php echo $item['name']; ?> '] = <?php echo json_encode($item['options']); ?> ; <?php } ?> </script> <?php foreach ($data as $id => $item) { ?> <?php do_action('opanda_print_batch_locker_assets', $id, $item['options'], $item['name']); ?> <?php } ?> <!-- / --> <?php self::$_lockerOptionsToPrint = array(); }
/** * Requests assets for email locker. */ function opanda_social_locker_assets($lockerId, $options, $fromBody, $fromHeader) { OPanda_AssetsManager::requestLockerAssets(); // Miscellaneous OPanda_AssetsManager::requestTextRes(array('misc_close', 'misc_or_wait')); if (isset($options['opanda_buttons_order']) && strpos($options['opanda_buttons_order'], 'facebook') !== false) { OPanda_AssetsManager::requestFacebookSDK(); } }
public function html($attr, $content) { global $post; global $wp_embed; $id = isset($attr['id']) ? (int) $attr['id'] : $this->getDefaultId(); if (!empty($id)) { $lockerMeta = get_post_meta($id, ''); } if (empty($id) || empty($lockerMeta) || empty($lockerMeta['opanda_item'])) { printf(__('<div><strong>[Locker] The locker [id=%d] doesn\'t exist or the default lockers were deleted.</strong></div>', 'bizpanda'), $id); return; } // runs nested shortcodes $content = $wp_embed->autoembed($content); $content = do_shortcode($content); // passcode if (OPanda_AssetsManager::autoUnlock($id)) { echo $content; return; } // if returns: // 'content' - shows the locker content // 'nothing' - shows nothing (cut content) // 'locker' or other values - shows the locker $whatToShow = apply_filters('onp_sl_what_to_show', 'locker', $id); if ('content' === $whatToShow) { echo $content; return; } if ('nothing' === $whatToShow) { return; } $content = preg_replace('/^<br \\/>/', '', $content); $content = preg_replace('/<br \\/>$/', '', $content); $lockData = OPanda_AssetsManager::getLockerDataToPrint($id); // - // use the shortcode attrs if specified instead of configured option if (isset($attr['url'])) { $lockData['options']['facebook']['like']['url'] = $attr['url']; $lockData['options']['facebook']['share']['url'] = $attr['url']; $lockData['options']['twitter']['tweet']['url'] = $attr['url']; $lockData['options']['google']['plus']['url'] = $attr['url']; $lockData['options']['google']['share']['url'] = $attr['url']; $lockData['options']['linkedin']['share']['url'] = $attr['url']; } if (isset($attr['title'])) { $lockData['options']['text']['title'] = $attr['title']; } if (isset($attr['message'])) { $lockData['options']['text']['message'] = $attr['message']; } if (isset($attr['theme'])) { $lockData['options']['theme'] = $attr['theme']; } $isAjax = false; $lockData['ajax'] = false; $dynamicTheme = get_option('opanda_dynamic_theme', 0); $this->lockId = "onpLock" . rand(100000, 999999); $this->lockData = $lockData; $overlap = $lockData['options']['overlap']['mode']; $hideContent = $overlap === 'full'; if ($isAjax) { ?> <div class="onp-locker-call" style="display: none;" data-lock-id="<?php echo $this->lockId; ?> "></div> <?php } else { ?> <div class="onp-locker-call" <?php if ($hideContent) { ?> style="display: none;"<?php } ?> data-lock-id="<?php echo $this->lockId; ?> "> <p><?php echo $content; ?> </p> </div> <?php } ?> <?php if ($dynamicTheme) { ?> <div class="onp-optinpanda-params" style="display: none;"> <?php echo json_encode($lockData); ?> </div> <?php } else { add_action('wp_footer', array($this, 'wp_footer'), 1); } }
public function html($attr, $content) { global $post; global $wp_embed; global $sociallocker; if (in_array($sociallocker->license->type, array('free'))) { echo $content; return; } $id = isset($attr['id']) ? (int) $attr['id'] : $this->getDefaultId(); if (!empty($id)) { $lockerMeta = get_post_meta($id, ''); } if (empty($id) || empty($lockerMeta)) { printf(__('<div><strong>[Opt-In Panda] The locker [id=%d] doesn\'t exist or the default lockers were deleted.</strong></div>', 'bizpanda'), $id); return; } // passcode if (OPanda_AssetsManager::autoUnlock($id)) { echo $content; return; } // runs nested shortcodes $content = $wp_embed->autoembed($content); $content = do_shortcode($content); // - RSS and Members // if it's a premium build, check premium features such // as RSS feeds and logged in users. if (is_feed()) { if (get_option('opanda_rss', false)) { echo $content; return; } else { return; } } if (is_user_logged_in() && OPanda_AssetsManager::getLockerOption($id, 'hide_for_member', false)) { echo '<p>' . $content . '</p>'; return; } if (!empty($post) && OPanda_AssetsManager::getLockerOption($id, 'lock_delay', false)) { $lockDelayInterval = OPanda_AssetsManager::getLockerOption($id, 'lock_delay_interval_in_seconds'); $createdTime = get_post_time('U', true, $post); $currentTime = time(); if ($currentTime - $createdTime <= $lockDelayInterval) { echo '<p>' . $content . '</p>'; return; } } // if returns: // 'content' - shows the locker content // 'nothing' - shows nothing (cut content) // 'locker' or other values - shows the locker $whatToShow = apply_filters('onp_sl_what_to_show', 'locker', $id); if ('content' === $whatToShow) { echo $content; return; } if ('nothing' === $whatToShow) { return; } $content = preg_replace('/^<br \\/>/', '', $content); $content = preg_replace('/<br \\/>$/', '', $content); $lockData = OPanda_AssetsManager::getLockerDataToPrint($id); // - // use the shortcode attrs if specified instead of configured option if (isset($attr['url'])) { $lockData['options']['facebook']['like']['url'] = $attr['url']; $lockData['options']['facebook']['share']['url'] = $attr['url']; $lockData['options']['twitter']['tweet']['url'] = $attr['url']; $lockData['options']['google']['plus']['url'] = $attr['url']; $lockData['options']['google']['share']['url'] = $attr['url']; $lockData['options']['linkedin']['share']['url'] = $attr['url']; } if (isset($attr['title'])) { $lockData['options']['text']['title'] = $attr['title']; } if (isset($attr['message'])) { $lockData['options']['text']['message'] = $attr['message']; } if (isset($attr['theme'])) { $lockData['options']['theme'] = $attr['theme']; } $isAjax = false; $lockData['ajax'] = false; // - AJAX // if it's a premium build, check is ajax required? $contentHash = null; if (isset($lockerMeta['opanda_ajax']) && $lockerMeta['opanda_ajax'][0]) { if ('full' == OPanda_AssetsManager::getLockerOption($id, 'overlap', false, 'full')) { $isAjax = true; $ajaxContent = '<p>' . $content . '</p>'; $lockData['contentHash'] = $contentHash = md5($ajaxContent); $lockData['ajax'] = true; $metaKey = 'opanda_locker_content_hash_' . $contentHash; if (!isset($lockerMeta[$metaKey])) { add_post_meta($id, $metaKey, $ajaxContent, true); } } } $dynamicTheme = get_option('opanda_dynamic_theme', 0); $this->lockId = "onpLock" . rand(100000, 999999); $this->lockData = $lockData; $overlap = $lockData['options']['overlap']['mode']; $hideContent = $overlap === 'full'; if ($isAjax) { ?> <div class="onp-locker-call" style="display: none;" data-lock-id="<?php echo $this->lockId; ?> "></div> <?php } else { ?> <div class="onp-locker-call" <?php if ($hideContent) { ?> style="display: none;"<?php } ?> data-lock-id="<?php echo $this->lockId; ?> "> <p><?php echo $content; ?> </p> </div> <?php } ?> <?php if ($dynamicTheme) { ?> <div class="onp-optinpanda-params" style="display: none;"> <?php echo json_encode($lockData); ?> </div> <?php } else { add_action('wp_footer', array($this, 'wp_footer'), 1); } }
/** * Requests assets for email locker. */ function opanda_signin_locker_assets($lockerId, $options, $fromBody, $fromHeader) { OPanda_AssetsManager::requestLockerAssets(); // The screen "Please Confirm Your Email" OPanda_AssetsManager::requestTextRes(array('confirm_screen_title', 'confirm_screen_instructiont', 'confirm_screen_note1', 'confirm_screen_note2', 'confirm_screen_cancel', 'confirm_screen_open')); // Miscellaneous OPanda_AssetsManager::requestTextRes(array('misc_data_processing', 'misc_or_enter_email', 'misc_enter_your_email', 'misc_enter_your_name', 'misc_your_agree_with', 'misc_terms_of_use', 'misc_privacy_policy', 'misc_or_wait', 'misc_close', 'misc_or')); // Errors & Notices OPanda_AssetsManager::requestTextRes(array('errors_empty_email', 'errors_inorrect_email', 'errors_empty_name', 'errors_subscription_canceled', 'misc_close', 'misc_or')); // The screen "One Step To Complete" | Errors & Notices OPanda_AssetsManager::requestTextRes(array('onestep_screen_title', 'onestep_screen_instructiont', 'onestep_screen_button', 'errors_not_signed_in', 'errors_not_granted')); // Sign-In Buttons OPanda_AssetsManager::requestTextRes(array('signin_long', 'signin_short', 'signin_facebook_name', 'signin_twitter_name', 'signin_google_name', 'signin_linkedin_name')); if (isset($options['opanda_connect_buttons']) && strpos($options['opanda_connect_buttons'], 'facebook') !== false) { OPanda_AssetsManager::requestFacebookSDK(); } }