/** * Adds options to print at the frontend. * * @since 1.0.0 */ function opanda_social_locker_options($options, $id) { global $post; $options['groups'] = array('social-buttons'); $options['socialButtons'] = array(); $buttonOrder = 'twitter-tweet,facebook-like,google-plus'; $actualUrls = opanda_get_option('actual_urls', false); $postUrl = !empty($post) ? get_permalink($post->ID) : null; $postUrl = $actualUrls ? null : $postUrl; $fbLikeUrl = opanda_get_dynamic_url($id, 'facebook_like_url', $postUrl); $fbShareUrl = opanda_get_dynamic_url($id, 'facebook_share_url', $postUrl); $twTweetUrl = opanda_get_dynamic_url($id, 'twitter_tweet_url', $postUrl); $twFollowUrl = opanda_get_dynamic_url($id, 'twitter_follow_url', $postUrl); $glPlusUrl = opanda_get_dynamic_url($id, 'google_plus_url', $postUrl); $glShareUrl = opanda_get_dynamic_url($id, 'google_share_url', $postUrl); $lnShareUrl = opanda_get_dynamic_url($id, 'linkedin_share_url', $postUrl); $options['socialButtons']['counters'] = opanda_get_item_option($id, 'show_counters', false, 1); $options['socialButtons']['order'] = opanda_get_item_option($id, 'buttons_order', false, $buttonOrder); $options['socialButtons']['facebook'] = array('appId' => opanda_get_option('facebook_appid', '117100935120196'), 'lang' => opanda_get_option('lang', 'en_GB'), 'version' => opanda_get_option('facebook_version', 'v1.0'), 'like' => array('url' => $fbLikeUrl, 'title' => opanda_get_item_option($id, 'facebook_like_title'), 'theConfirmIssue' => opanda_get_item_option($id, 'facebook_like_confirm_issue'))); $options['socialButtons']['twitter'] = array('lang' => opanda_get_option('short_lang', 'en'), 'tweet' => array('url' => $twTweetUrl, 'text' => opanda_get_item_option($id, 'twitter_tweet_text'), 'counturl' => opanda_get_item_option($id, 'twitter_tweet_counturl'), 'title' => opanda_get_item_option($id, 'twitter_tweet_title'), 'via' => opanda_get_item_option($id, 'twitter_tweet_via'))); $options['socialButtons']['google'] = array('lang' => opanda_get_option('google_lang', opanda_get_option('short_lang', 'en')), 'plus' => array('url' => $glPlusUrl, 'title' => opanda_get_item_option($id, 'google_plus_title'))); if ('blurring' === $options['overlap']['mode']) { $options['overlap']['mode'] = 'transparence'; } if (!in_array($options['theme'], array('starter', 'secrets'))) { $options['theme'] = 'secrets'; } $allowedButtons = array('facebook-like', 'facebook-share', 'twitter-tweet', 'twitter-follow', 'google-plus', 'google-share', 'youtube-subscribe', 'linkedin-share'); $allowedButtons = apply_filters('opanda_social-locker_allowed_buttons', $allowedButtons); if ($options['socialButtons']['order']) { $options['socialButtons']['order'] = explode(',', $options['socialButtons']['order']); } if (empty($options['socialButtons']['order'])) { unset($options['socialButtons']['order']); } else { $filteredButtons = array(); foreach ($options['socialButtons']['order'] as $buttonName) { if (!in_array($buttonName, $allowedButtons)) { continue; } $filteredButtons[] = $buttonName; } $options['socialButtons']['order'] = $filteredButtons; } // - Replaces shortcodes in the locker message and twitter text $postTitle = $post != null ? $post->post_title : ''; $postUrl = $post != null ? get_permalink($post->ID) : ''; if (!empty($options['socialButtons']['twitter']['tweet']['text'])) { $options['socialButtons']['twitter']['tweet']['text'] = str_replace('[post_title]', $postTitle, $options['socialButtons']['twitter']['tweet']['text']); } return $options; }
/** * Replaces the variables in URLs {var} and return the result URL. * * @since 1.1.3 */ function opanda_get_dynamic_url($id, $name, $default = null) { $url = opanda_get_item_option($id, $name, false); if (empty($url)) { return $default; } return preg_replace_callback("/\\{([^}]+)\\}/", 'opanda_get_dunamic_url_callback', $url); }
/** * Adds the action 'lead' action of the user selected * the action 'save email' but 'subscribe' and 'create account' are not selected. */ function opanda_signin_locker_get_actions($id, $optionName) { $actions = explode(',', opanda_get_item_option($id, $optionName)); if (empty($actions) || empty($actions[0])) { $actions = array(); } if (!BizPanda::hasPlugin('optinpanda')) { $temp = $actions; $actions = array(); foreach ($temp as $actionName) { if ('subscribe' === $actionName) { continue; } $actions[] = $actionName; } } $catchLeads = opanda_get_item_option($id, 'catch_leads', false); if (!$catchLeads) { return $actions; } if (in_array('signup', $actions)) { return $actions; } if (in_array('subscribe', $actions)) { return $actions; } $actions[] = 'lead'; return $actions; }