/** * 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; }
/** * Adds options to print at the frontend. * * @since 1.0.0 */ function opanda_signin_locker_options($options, $id) { $options['terms'] = opanda_terms_url(); $options['privacyPolicy'] = opanda_privacy_policy_url(); if (!get_option('opanda_terms_use_pages', false)) { $options['termsPopup'] = array('width' => 570, 'height' => 400); } $options['theme'] = 'great-attractor'; $actions = explode(',', opanda_get_item_option($id, 'connect_buttons')); $hasEmailForm = in_array('email', $actions); if ($hasEmailForm) { $emailFormIndex = array_search('email', $actions); unset($actions[$emailFormIndex]); } $options['groups'] = $hasEmailForm ? array('connect-buttons', 'subscription') : array('connect-buttons'); // connect buttons $options['connectButtons'] = array(); $options['connectButtons']['order'] = $actions; if (in_array('facebook', $actions)) { $options['connectButtons']['facebook'] = array('actions' => opanda_signin_locker_get_actions($id, 'facebook_actions'), 'appId' => opanda_get_option('facebook_appid')); } if (in_array('twitter', $actions)) { $options['connectButtons']['twitter'] = array('actions' => opanda_signin_locker_get_actions($id, 'twitter_actions'), 'follow' => array('user' => opanda_get_item_option($id, 'twitter_follow_user'), 'notifications' => opanda_get_item_option($id, 'twitter_follow_notifications')), 'tweet' => array('message' => opanda_get_item_option($id, 'twitter_tweet_message'))); } if (in_array('google', $actions)) { $options['connectButtons']['google'] = array('actions' => opanda_signin_locker_get_actions($id, 'google_actions'), 'clientId' => opanda_get_option('google_client_id'), 'youtubeSubscribe' => array('channelId' => opanda_get_item_option($id, 'google_youtube_channel_id'))); } if (in_array('linkedin', $actions)) { $linkedInActions = opanda_signin_locker_get_actions($id, 'linkedin_actions'); if (($key = array_search('follow', $linkedInActions)) !== false) { unset($linkedInActions[$key]); } $options['connectButtons']['linkedin'] = array('actions' => $linkedInActions, 'apiKey' => opanda_get_option('linkedin_api_key')); } // subscription options if ($hasEmailForm) { $options['subscription'] = array(); $options['subscription']['text'] = opanda_get_item_option($id, 'subscribe_before_form', false); $options['subscription']['form'] = array('actions' => opanda_signin_locker_get_actions($id, 'email_actions'), 'buttonText' => opanda_get_item_option($id, 'subscribe_button_text', false), 'noSpamText' => opanda_get_item_option($id, 'subscribe_after_button', false), 'type' => opanda_get_item_option($id, 'subscribe_name') ? 'name-email-form' : 'email-form'); } $optinMode = opanda_get_item_option($id, 'subscribe_mode'); $service = opanda_get_option('subscription_service', 'database'); $listId = 'database' === $service ? 'default' : opanda_get_item_option($id, 'subscribe_list', false); $options['subscribeActionOptions'] = array('listId' => $listId, 'service' => $service, 'doubleOptin' => in_array($optinMode, array('quick-double-optin', 'double-optin')), 'confirm' => in_array($optinMode, array('double-optin'))); return $options; }