/**
  * 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)
 {
     require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
     $sociallockerUrl = OPanda_Plugins::getPremiumUrl('sociallocker');
     $tabs = array('type' => 'tab', 'align' => 'vertical', 'class' => 'social-settings-tab', 'items' => array());
     $facebookIsActiveByDefault = true;
     $twitterActiveByDefault = true;
     $googleIsActiveByDefault = true;
     $vkIsActiveByDefault = false;
     // - Facebook Like Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'facebook-like', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'facebook-like_available', 'default' => $facebookIsActiveByDefault), array('type' => 'url', 'title' => __('URL to like', 'sociallocker'), 'hint' => __('Set an URL (a facebook page or website page) which the user has to like in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'facebook_like_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'facebook_like_title', 'default' => __('like', 'sociallocker')), array('type' => 'more-link', 'name' => 'like-button-options', 'title' => __('Show more options', 'sociallocker'), 'count' => 1, 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('I see the "confirm" link after a like', 'sociallocker'), 'hint' => __('<p style="margin-top: 8px;">Optional. Facebook has an automatic Like-spam protection that happens if the Like button gets clicked a lot (for example, while testing the plugin). Don\'t worry, it will go away automatically within some hours/days.</p><p>Just during the time, when Facebook asks to confirm likes on your website, turn on this option and the locker will wait the confirmation to unlock the content.</p>', 'sociallocker'), 'name' => 'facebook_like_confirm_issue', 'default' => false)))));
     // - Twitter Tweet Tab
     $tabs['items'][] = array('type' => 'tab-item', 'title' => '', 'name' => 'twitter-tweet', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'twitter-tweet_available', 'default' => $twitterActiveByDefault), array('type' => 'url', 'title' => __('URL to tweet', 'sociallocker'), 'hint' => __('Set an URL which the user has to tweet in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'twitter_tweet_url'), array('type' => 'textarea', 'title' => __('Tweet', 'sociallocker'), 'hint' => __('Type a message to tweet. Leave this field empty to use default tweet (page title + URL). Also you can use the shortcode [post_title] in order to insert automatically a post title into the tweet.', 'sociallocker'), 'name' => 'twitter_tweet_text'), array('type' => 'url', 'title' => __('Counter URL', 'sociallocker'), 'hint' => __('Optional. If you use a shorter tweet URL, paste here a full URL for the counter.', 'sociallocker'), 'name' => 'twitter_tweet_counturl'), array('type' => 'textbox', 'title' => __('Via', 'sociallocker'), 'hint' => __('Optional. Screen name of the user to attribute the Tweet to (without @).', 'sociallocker'), 'name' => 'twitter_tweet_via'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'twitter_tweet_title', 'default' => __('tweet', 'sociallocker'))));
     // - Google Plus Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'google-plus', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'google-plus_available', 'default' => $googleIsActiveByDefault), array('type' => 'url', 'title' => __('URL to +1', 'sociallocker'), 'hint' => __('Set an URL which the user has to +1 in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'google_plus_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'google_plus_title', 'default' => __('+1 us', 'sociallocker'))));
     // - Facebook Share Tab
     // if the user has not updated the facebook app id, show a notice
     $facebookAppId = get_option('opanda_facebook_appid', '117100935120196');
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'facebook-share', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'facebook-share_available', 'default' => false), array('type' => 'url', 'title' => __('URL to share', 'sociallocker'), 'hint' => __('Set an URL which the user has to share in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'facebook_fake_field_1'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'facebook_fake_field_2', 'default' => __('share', 'sociallocker'))));
     // - Twitter Follow Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'twitter-follow', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'twitter-follow_available', 'default' => false), array('type' => 'url', 'title' => __('User to follow', 'sociallocker'), 'hint' => __('Set an URL of your Twitter profile (for example, <a href="https://twitter.com/byonepress" target="_blank">https://twitter.com/byonepress</a>).', 'sociallocker'), 'name' => 'twiiter_fake_field_1'), array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Hide Username', 'sociallocker'), 'hint' => __('Set On to hide your username on the button (makes the button shorter).', 'sociallocker'), 'name' => 'twiiter_fake_field_2'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'twiiter_fake_field_3', 'default' => __('follow us', 'sociallocker'))));
     // - Google Share Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'google-share', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'google-share_available'), array('type' => 'url', 'title' => __('URL to share', 'sociallocker'), 'hint' => __('Set an URL which the user has to share in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'google_fake_field_1'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'google_fake_field_2', 'default' => __('share', 'sociallocker'))));
     // - Youtube Subscribe
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'youtube-subscribe', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'youtube-subscribe_available', 'default' => false), array('type' => 'textbox', 'title' => __('Channel ID', 'sociallocker'), 'hint' => __('Set a channel ID to subscribe (for example, <a href="http://www.youtube.com/channel/UCANLZYMidaCbLQFWXBC95Jg" target="_blank">UCANLZYMidaCbLQFWXBC95Jg</a>).', 'sociallocker'), 'name' => 'youtube_fake_field_2'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A visible title of the buttons that is used in some themes (by default only in the Secrets theme).', 'sociallocker'), 'name' => 'youtube_fake_field_3', 'default' => __('Youtube', 'sociallocker'))));
     // - LinkedIn Share Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'linkedin-share', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'linkedin-share_available', 'default' => false), array('type' => 'url', 'title' => __('URL to share', 'sociallocker'), 'hint' => __('Set an URL which the user has to share in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'linkedin_fake_field_1'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'linkedin_fake_field_2', 'default' => __('share', 'sociallocker'))));
     $allowed = array('facebook-like', 'twitter-tweet', 'google-plus');
     foreach ($tabs['items'] as $index => $tabItem) {
         if (in_array($tabItem['name'], $allowed)) {
             continue;
         }
         $tabs['items'][$index]['items'][0]['value'] = false;
         $tabs['items'][$index]['items'][1]['value'] = false;
         $tabs['items'][$index]['cssClass'] = 'opanda-not-available';
         $tabs['items'][$index]['items'][] = array('type' => 'html', 'html' => opanda_get_premium_note(true, 'social-buttons'));
     }
     $tabs = apply_filters('onp_sl_social_options', $tabs);
     $defaultOrder = array();
     if ($vkIsActiveByDefault) {
         $defaultOrder[] = 'vk-like';
     }
     if ($facebookIsActiveByDefault) {
         $defaultOrder[] = 'facebook-like';
     }
     if ($twitterActiveByDefault) {
         $defaultOrder[] = 'twitter-tweet';
     }
     if ($googleIsActiveByDefault) {
         $defaultOrder[] = 'google-plus';
     }
     $form->add(array(array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'show_counters', 'title' => __('Show counters', 'sociallocker'), 'default' => true), array('type' => 'html', 'html' => '<div class="onp-sl-metabox-hint">
                             <strong>' . __('Hint', 'sociallocker') . '</strong>: ' . __('Drag and drop the tabs to change the order of the buttons.', 'sociallocker') . '</div>'), array('type' => 'hidden', 'name' => 'buttons_order', 'default' => implode(',', $defaultOrder)), $tabs));
 }
 /**
  * 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)
 {
     require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
     $sociallockerUrl = OPanda_Plugins::getPremiumUrl('sociallocker');
     $tabs = array('type' => 'tab', 'align' => 'vertical', 'class' => 'social-settings-tab', 'items' => array());
     $facebookIsActiveByDefault = true;
     $twitterActiveByDefault = true;
     $googleIsActiveByDefault = true;
     $vkIsActiveByDefault = false;
     // - Facebook Like Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'facebook-like', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'facebook-like_available', 'default' => $facebookIsActiveByDefault), array('type' => 'url', 'title' => __('URL to like', 'sociallocker'), 'hint' => __('Set an URL (a facebook page or website page) which the user has to like in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'facebook_like_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'facebook_like_title', 'default' => __('like', 'sociallocker')), array('type' => 'more-link', 'name' => 'like-button-options', 'title' => __('Show more options', 'sociallocker'), 'count' => 1, 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('I see the "confirm" link after a like', 'sociallocker'), 'hint' => __('<p style="margin-top: 8px;">Optional. Facebook has an automatic Like-spam protection that happens if the Like button gets clicked a lot (for example, while testing the plugin). Don\'t worry, it will go away automatically within some hours/days.</p><p>Just during the time, when Facebook asks to confirm likes on your website, turn on this option and the locker will wait the confirmation to unlock the content.</p>', 'sociallocker'), 'name' => 'facebook_like_confirm_issue', 'default' => false)))));
     // - Twitter Tweet Tab
     $tabs['items'][] = array('type' => 'tab-item', 'title' => '', 'name' => 'twitter-tweet', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'twitter-tweet_available', 'default' => $twitterActiveByDefault), array('type' => 'url', 'title' => __('URL to tweet', 'sociallocker'), 'hint' => __('Set an URL which the user has to tweet in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'twitter_tweet_url'), array('type' => 'textarea', 'title' => __('Tweet', 'sociallocker'), 'hint' => __('Type a message to tweet. Leave this field empty to use default tweet (page title + URL). Also you can use the shortcode [post_title] in order to insert automatically a post title into the tweet.', 'sociallocker'), 'name' => 'twitter_tweet_text'), array('type' => 'url', 'title' => __('Counter URL', 'sociallocker'), 'hint' => __('Optional. If you use a shorter tweet URL, paste here a full URL for the counter.', 'sociallocker'), 'name' => 'twitter_tweet_counturl'), array('type' => 'textbox', 'title' => __('Via', 'sociallocker'), 'hint' => __('Optional. Screen name of the user to attribute the Tweet to (without @).', 'sociallocker'), 'name' => 'twitter_tweet_via'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'twitter_tweet_title', 'default' => __('tweet', 'sociallocker'))));
     // - Google Plus Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'google-plus', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'google-plus_available', 'default' => $googleIsActiveByDefault), array('type' => 'url', 'title' => __('URL to +1', 'sociallocker'), 'hint' => __('Set an URL which the user has to +1 in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'google_plus_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'google_plus_title', 'default' => __('+1 us', 'sociallocker'))));
     // - Facebook Share Tab
     // if the user has not updated the facebook app id, show a notice
     $facebookAppId = get_option('opanda_facebook_appid', '117100935120196');
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'facebook-share', 'items' => array(array('off' => !(empty($facebookAppId) || $facebookAppId == '117100935120196'), 'type' => 'html', 'html' => '<div class="alert alert-warning">' . sprintf(__('Please make sure that you <a href="%s">set a facebook app id</a> for your domain, otherwise the button will not work. The Facebook Share button requires an app id registered for a domain where it\'s used.', 'sociallocker'), opanda_get_settings_url('social')) . '</div>'), array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'facebook-share_available', 'default' => false), array('type' => 'url', 'title' => __('URL to share', 'sociallocker'), 'hint' => __('Set an URL which the user has to share in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'facebook_share_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'facebook_share_title', 'default' => __('share', 'sociallocker')), array('type' => 'more-link', 'name' => 'share-button-options', 'title' => __('Show more options', 'sociallocker'), 'count' => 5, 'items' => array(array('type' => 'form-group', 'id' => 'opanda-facebook-share-vs-feed', 'title' => __('Feed Dialog Or Share Dialog', 'sociallocker'), 'hint' => __('By default the plugin uses the Facebook <a href="https://developers.facebook.com/docs/sharing/reference/feed-dialog/" target="_blank">Feed Dialog</a>. But some users believe that posts published via the Facebook <a href="https://developers.facebook.com/docs/sharing/reference/share-dialog" target="_blank">Share Dialog</a> appear more often on the top of the news feeds and this way bring more traffic.  Both the dialogue perform the same action (sharing) and look approximately equally.', 'sociallocker'), 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Use Facebook Share Dialog', 'sociallocker'), 'hint' => __('Optional. Set On to use the Facebook Share Dialog instead of the Facebook Feed Dialog. Use the <A href="http://davidwalsh.name/facebook-meta-tags" target="_blank">Open Graph Meta Tags</a> to specify the message to share for the Share Dialog.', 'sociallocker'), 'name' => 'facebook_share_dialog', 'default' => false))), array('type' => 'form-group', 'id' => 'opanda-facebook-message-to-share', 'title' => __('Message To Share', 'sociallocker'), 'hint' => __('By default the message is extracted from the page content (from the <A href="http://davidwalsh.name/facebook-meta-tags" target="_blank">Open Graph Meta Tags</a>). But for the Feed Dialog you can set an own message.', 'sociallocker'), 'items' => array(array('type' => 'textbox', 'title' => __('Name', 'sociallocker'), 'hint' => __('Optional. The name of the link attachment.', 'sociallocker'), 'name' => 'facebook_share_message_name'), array('type' => 'textbox', 'title' => __('Caption', 'sociallocker'), 'hint' => __('Optional. The caption of the link (appears beneath the link name). If not specified, this field is automatically populated with the URL of the link.', 'sociallocker'), 'name' => 'facebook_share_message_caption'), array('type' => 'textbox', 'title' => __('Description', 'sociallocker'), 'hint' => __('Optional. The description of the link (appears beneath the link caption). If not specified, this field is automatically populated by information scraped from the link, typically the title of the page.', 'sociallocker'), 'name' => 'facebook_share_message_description'), array('type' => 'textbox', 'title' => __('Image', 'sociallocker'), 'hint' => __('Optional. The URL of a picture attached to this post. The picture must be at least 50px by 50px (though minimum 200px by 200px is preferred) and have a maximum aspect ratio of 3:1.', 'sociallocker'), 'name' => 'facebook_share_message_image')))))));
     // - Twitter Follow Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'twitter-follow', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'twitter-follow_available', 'default' => false), array('type' => 'url', 'title' => __('User to Follow', 'sociallocker'), 'hint' => __('Set an URL of your Twitter profile (for example, <a href="https://twitter.com/byonepress" target="_blank">https://twitter.com/byonepress</a>).', 'sociallocker'), 'name' => 'twitter_follow_url'), array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Hide Username', 'sociallocker'), 'hint' => __('Set On to hide your username on the button (makes the button shorter).', 'sociallocker'), 'name' => 'twitter_follow_hide_name'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'twitter_follow_title', 'default' => __('follow us', 'sociallocker'))));
     // - Google Share Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'google-share', 'items' => array(array('type' => 'html', 'html' => '<div class="alert alert-warning">' . __('<strong>Warning!</strong> The Google Share button will not appear on mobile devices because it\'s not possible to catch the moment when the mobile user clicks on the button. Also please pay attention the plugin cannot track whether the user shared actually or not. If the user closes the Share Dialog without sharing, the content will be unlocked.', 'sociallocker') . '</div>'), array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'google-share_available'), array('type' => 'url', 'title' => __('URL to share', 'sociallocker'), 'hint' => __('Set an URL which the user has to share in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'google_share_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'google_share_title', 'default' => __('share', 'sociallocker'))));
     // - YouTube Subscribe
     // if the user has not set the cliend id, show a notice
     $googleClientId = get_option('opanda_google_client_id', false);
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'youtube-subscribe', 'items' => array(array('off' => !empty($googleClientId), 'type' => 'html', 'html' => '<div class="alert alert-warning">' . sprintf(__(' The YouTube Button requires the Google Client ID linked to your domain. Before using the button, please <a href="%s" target="_blank">set the Client ID</a>.', 'sociallocker'), opanda_get_settings_url('social')) . '</div>'), array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'youtube-subscribe_available', 'default' => false), array('type' => 'textbox', 'title' => __('Channel ID', 'sociallocker'), 'hint' => __('Set a channel ID to subscribe (for example, <a href="http://www.youtube.com/channel/UCANLZYMidaCbLQFWXBC95Jg" target="_blank">UCANLZYMidaCbLQFWXBC95Jg</a>).', 'sociallocker'), 'name' => 'google_youtube_channel_id'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A visible title of the buttons that is used in some themes (by default only in the Secrets theme).', 'sociallocker'), 'name' => 'google_youtube_title', 'default' => __('Youtube', 'sociallocker'))));
     // - LinkedIn Share Tab
     $tabs['items'][] = array('type' => 'tab-item', 'name' => 'linkedin-share', 'items' => array(array('type' => 'checkbox', 'way' => 'buttons', 'title' => __('Available', 'sociallocker'), 'hint' => __('Set On, to activate the button.', 'sociallocker'), 'name' => 'linkedin-share_available', 'default' => false), array('type' => 'url', 'title' => __('URL to share', 'sociallocker'), 'hint' => __('Set an URL which the user has to share in order to unlock your content. Leave this field empty to use an URL of the page where the locker will be located.', 'sociallocker'), 'name' => 'linkedin_share_url'), array('type' => 'textbox', 'title' => __('Button Title', 'sociallocker'), 'hint' => __('Optional. A title of the button that is situated on the covers in the themes "Secrets" and "Flat".', 'sociallocker'), 'name' => 'linkedin_share_title', 'default' => __('share', 'sociallocker'))));
     $tabs = apply_filters('onp_sl_social_options', $tabs);
     $defaultOrder = array();
     if ($vkIsActiveByDefault) {
         $defaultOrder[] = 'vk-like';
     }
     if ($facebookIsActiveByDefault) {
         $defaultOrder[] = 'facebook-like';
     }
     if ($twitterActiveByDefault) {
         $defaultOrder[] = 'twitter-tweet';
     }
     if ($googleIsActiveByDefault) {
         $defaultOrder[] = 'google-plus';
     }
     $form->add(array(array('type' => 'checkbox', 'way' => 'buttons', 'name' => 'show_counters', 'title' => __('Show counters', 'sociallocker'), 'default' => true), array('type' => 'html', 'html' => '<div class="onp-sl-metabox-hint">
                             <strong>' . __('Hint', 'sociallocker') . '</strong>: ' . __('Drag and drop the tabs to change the order of the buttons.', 'sociallocker') . '</div>'), array('type' => 'hidden', 'name' => 'buttons_order', 'default' => implode(',', $defaultOrder)), $tabs));
 }
예제 #3
0
/**
 * Returns an URL for purchasing a premium version of the plugin.
 * 
 * @since 1.1.4
 * 
 * @param string $name plugin or item name.
 * @return string|false the URL to purchase
 */
function opanda_get_premium_url($name = null, $campaign = 'na')
{
    if (empty($name)) {
        $name = OPanda_Items::getCurrentItemName();
    }
    $url = null;
    $url = apply_filters('opanda_premium_url', $url, $name, $campaign);
    if (!empty($url)) {
        return $url;
    }
    $url = OPanda_Items::getPremiumUrl($name);
    if (!empty($url)) {
        return $url;
    }
    require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
    $url = OPanda_Plugins::getPremiumUrl($name);
    if (!empty($url)) {
        return $url;
    }
    return OPanda_Items::getPremiumUrl($name);
}
예제 #4
0
<?php

global $bizpanda;
$lang = $bizpanda->options['lang'];
require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
$optinpandaUrl = OPanda_Plugins::getPremiumUrl('optinpanda');
$sociallockerUrl = OPanda_Plugins::getPremiumUrl('sociallocker');
?>

<div class="onp-help-section">
    <h1><?php 
_e('Sign-In Locker', 'signinlocker');
?>
</h1>
    
    <?php 
if (BizPanda::hasPlugin('sociallocker')) {
    ?>
    
        <p>
            <?php 
    printf(__('Sign-In Locker works the same way as the <a href="%s">Social Locker</a> but instead of liking/sharing it asks the user to sign in through social networks. Concurrently it can perform some social actions.', 'signinlocker'), opanda_get_help_url('what-is-social-locker'));
    ?>
        </p>
    
    <?php 
} elseif (BizPanda::hasPlugin('optinpanda')) {
    ?>
    
        <p>
            <?php 
    /**
     * Shows the control to manage the connect buttons.
     * 
     * @since 1.0.0
     * @return string
     */
    public function showConnectButtonsControl()
    {
        $buttons = array('facebook' => array('title' => __('Facebook', 'signinlocker'), 'errors' => array($this, 'getFacebookErrors'), 'actions' => array('lead' => array('on' => true, 'title' => __('Save Email', 'signinlocker'), 'always' => true), 'subscribe' => array('title' => __('Subscribe', 'signinlocker')), 'signup' => array('on' => true, 'title' => __('Create Account', 'signinlocker')))), 'twitter' => array('title' => __('Twitter', 'signinlocker'), 'errors' => array($this, 'getTwitterErrors'), 'actions' => array('lead' => array('on' => true, 'title' => __('Save Email', 'signinlocker'), 'always' => true), 'subscribe' => array('title' => __('Subscribe', 'signinlocker')), 'signup' => array('on' => true, 'title' => __('Create Account', 'signinlocker')), 'follow' => array('title' => __('Follow', 'signinlocker'), 'type' => 'social'), 'tweet' => array('title' => __('Tweet', 'signinlocker'), 'type' => 'social'))), 'google' => array('title' => __('Google', 'signinlocker'), 'errors' => array($this, 'getGoogleErrors'), 'actions' => array('lead' => array('on' => true, 'title' => __('Save Email', 'signinlocker'), 'always' => true), 'subscribe' => array('title' => __('Subscribe', 'signinlocker')), 'signup' => array('on' => true, 'title' => __('Create Account', 'signinlocker')), 'youtube-subscribe' => array('title' => __('Subscribe (YT)', 'signinlocker'), 'type' => 'social'))), 'linkedin' => array('title' => __('LinkedIn', 'signinlocker'), 'errors' => array($this, 'getLinkedInErrors'), 'actions' => array('lead' => array('on' => true, 'title' => __('Save Email', 'signinlocker'), 'always' => true), 'subscribe' => array('title' => __('Subscribe', 'signinlocker')), 'signup' => array('on' => true, 'title' => __('Create Account', 'signinlocker')))), 'email' => array('title' => __('Email Form', 'signinlocker'), 'errors' => array($this, 'getEmailFormErrors'), 'actions' => array('lead' => array('on' => true, 'title' => __('Save Email', 'signinlocker'), 'always' => true), 'subscribe' => array('title' => __('Subscribe', 'signinlocker')), 'signup' => array('on' => true, 'title' => __('Create Account', 'signinlocker')))));
        if (BizPanda::hasPlugin('optinpanda')) {
            foreach ($buttons as $buttonName => $buttonData) {
                $buttons[$buttonName]['actions']['subscribe']['on'] = true;
            }
        } else {
            $url = OPanda_Plugins::getPremiumUrl('optinpanda', 'co-subscribe-action');
            foreach ($buttons as $buttonName => $buttonData) {
                $buttons[$buttonName]['actions']['subscribe']['error'] = sprintf(__('To enable this action, please install the plugin Opt-In Panda which provides subscription features. <a href="%s" target="_blank">Click here to learn more</a>.', 'signinlocker'), $url);
            }
        }
        if (BizPanda::hasPlugin('sociallocker')) {
            foreach ($buttons as $buttonName => $buttonData) {
                foreach ($buttons[$buttonName]['actions'] as $actionName => $actionData) {
                    if (isset($actionData['type']) && 'social' === $actionData['type']) {
                        $buttons[$buttonName]['actions'][$actionName]['on'] = true;
                    }
                }
            }
        } else {
            $url = OPanda_Plugins::getPremiumUrl('sociallocker', 'co-social-actions');
            foreach ($buttons as $buttonName => $buttonData) {
                foreach ($buttons[$buttonName]['actions'] as $actionName => $actionData) {
                    if (isset($actionData['type']) && 'social' === $actionData['type']) {
                        $buttons[$buttonName]['actions'][$actionName]['error'] = sprintf(__('To enable this action, please install the Social Locker plugin which provides social features. <a href="%s" target="_blank">Click here to learn more</a>.', 'signinlocker'), $url);
                    }
                }
            }
        }
        if (BizPanda::isSinglePlugin() && BizPanda::hasPlugin('optinpanda')) {
        } else {
            if (!BizPanda::hasFeature('sociallocker-premium')) {
                unset($buttons['twitter']['actions']['follow']['on']);
                $buttons['twitter']['actions']['follow']['error'] = opanda_get_premium_note(false, 'co-follow-action');
                unset($buttons['twitter']['actions']['tweet']['on']);
                $buttons['twitter']['actions']['tweet']['error'] = opanda_get_premium_note(false, 'co-follow-action');
                unset($buttons['google']['actions']['youtube-subscribe']['on']);
                $buttons['google']['actions']['youtube-subscribe']['error'] = opanda_get_premium_note(false, 'co-youtube-action');
            }
        }
        $buttons = apply_filters('opanda_connect_buttons_options', $buttons);
        $commonActions = array('subscribe', 'signup', 'lead');
        ?>
        <div class="opanda-connect-buttons factory-fontawesome-320">

            <?php 
        foreach ($buttons as $name => $button) {
            ?>
                <?php 
            $errors = isset($button['errors']) ? call_user_func($button['errors']) : null;
            $errorName = isset($errors['name']) ? $errors['name'] : 'noname';
            $errorIcon = isset($errors['icon']) ? $errors['icon'] : 'fa-exclamation-triangle';
            $errorText = isset($errors['text']) ? $errors['text'] : $errors;
            ?>
            
                <div class="opanda-button opanda-button-<?php 
            echo $name;
            ?>
 opanda-off <?php 
            if ($errors) {
                echo 'opanda-has-error';
            }
            ?>
" data-name="<?php 
            echo $name;
            ?>
">
                    <div class="opanda-inner-wrap">
                        <label class="opanda-button-title" for="opanda-button-<?php 
            echo $name;
            ?>
-activated">
                            
                            <?php 
            if ($errors) {
                ?>
                            <span class="opanda-error opanda-error-<?php 
                echo $errorName;
                ?>
">
                                <i class="fa <?php 
                echo $errorIcon;
                ?>
"></i>
                                <div class='opanda-error-text'><?php 
                echo $errorText;
                ?>
</div>
                            </span>
                            <?php 
            } else {
                ?>
                            <span class='opanda-checkbox'>
                                <input type="checkbox" value="<?php 
                echo $name;
                ?>
" id="opanda-button-<?php 
                echo $name;
                ?>
-activated" />
                            </span>
                            <?php 
            }
            ?>
  
                            <span><?php 
            echo $button['title'];
            ?>
</span>

                        </label>
                        <ul class='opanda-actions'>
                            <?php 
            foreach ($button['actions'] as $actionName => $actionData) {
                ?>
                            <?php 
                if (isset($button['actions'][$actionName]['on'])) {
                    ?>
                                <?php 
                    $actionTitle = $actionData['title'];
                    ?>
                                <?php 
                    $isCommon = in_array($actionName, $commonActions);
                    ?>
                            
                                <li class='opanda-action opanda-action-<?php 
                    echo $actionName;
                    ?>
'>
                                    <span>
                                        <input 
                                            type="checkbox" 
                                            value="1" 
                                            data-common="<?php 
                    echo $isCommon ? '1' : '0';
                    ?>
" 
                                            data-button="<?php 
                    echo $name;
                    ?>
" 
                                            data-action="<?php 
                    echo $actionName;
                    ?>
" 
                                            disabled="disabled" />
                                    </span>
                                    
                                    <a href="#" class="opanda-action-link" data-common="<?php 
                    echo $isCommon ? '1' : '0';
                    ?>
" data-button="<?php 
                    echo $name;
                    ?>
" data-action="<?php 
                    echo $actionName;
                    ?>
"><?php 
                    echo $actionTitle;
                    ?>
</a>
                                </li>
                            <?php 
                }
                ?>
                            <?php 
            }
            ?>
                        </ul>
                        <ul class='opanda-actions opanda-actions-disabled'>
                            <?php 
            foreach ($button['actions'] as $actionName => $actionData) {
                ?>
                            <?php 
                if (!isset($button['actions'][$actionName]['on'])) {
                    ?>
                            <?php 
                    $actionTitle = $actionData['title'];
                    ?>
                            <?php 
                    $isCommon = in_array($actionName, $commonActions);
                    ?>
                            <li class='opanda-action opanda-action-disabled opanda-action-<?php 
                    echo $actionName;
                    ?>
'>
                                <span class="opanda-error-wrap">
                                    <input type="checkbox" disabled="disabled" value="1" />
                                    <span class='opanda-error-text'><?php 
                    echo $actionData['error'];
                    ?>
</span>
                                    <a href="#" class="opanda-action-link" data-common="<?php 
                    echo $isCommon ? '1' : '0';
                    ?>
" data-button="<?php 
                    echo $name;
                    ?>
" data-action="<?php 
                    echo $actionName;
                    ?>
"><?php 
                    echo $actionTitle;
                    ?>
</a>  
                                </span>
                            </li>
                            <?php 
                }
                ?>
                            <?php 
            }
            ?>
                        </ul>
                    </div>
                </div>
            <?php 
        }
        ?>
        </div>  
        <?php 
    }
예제 #6
0
    /**
     * Shows the screen.
     * 
     * @sinve 1.0.0
     * @return void
     */
    public function indexAction()
    {
        $types = OPanda_Items::getAvailable();
        // checkes extra items which are not installed yet
        require_once OPANDA_BIZPANDA_DIR . '/admin/includes/plugins.php';
        $suggestions = OPanda_Plugins::getSuggestions();
        ?>

        <div class="wrap factory-fontawesome-320">

            <div class="opanda-items ">
                
                <h2><?php 
        _e('Creating New Item', 'bizpanda');
        ?>
</h2>
                <p style="margin-top: 0px;"><?php 
        _e('Choose which items you would like to create.', 'bizpanda');
        ?>
</p>

                <?php 
        foreach ($types as $name => $type) {
            ?>
                <div class="postbox opanda-item opanda-item-<?php 
            echo $type['type'];
            ?>
">

                    <h4 class="opanda-title">
                        <?php 
            echo $type['title'];
            ?>
                    </h4>
                    <div class="opanda-description">
                        <?php 
            echo $type['description'];
            ?>
                    </div>
                    <div class="opanda-buttons">

                        <a href="<?php 
            echo admin_url('post-new.php?post_type=opanda-item&opanda_item=' . $name);
            ?>
" class="button button-large opanda-create">
                            <i class="fa fa-plus"></i><span><?php 
            _e('Create Item', 'bizpanda');
            ?>
</span>
                        </a>

                        <?php 
            if (isset($type['help'])) {
                ?>
                        <a href="<?php 
                echo $type['help'];
                ?>
" class="button button-large opanda-help opanda-right" title="<?php 
                _e('Click here to learn more', 'bizpanda');
                ?>
">
                            <i class="fa fa-question-circle"></i>
                        </a>
                        <?php 
            }
            ?>
                    </div>
                </div>

                <?php 
        }
        ?>
            </div>
            
            <?php 
        if (!empty($suggestions)) {
            ?>
            
            <div class="opanda-separator"></div>
            
            <div class="opanda-extra-items">
                <div class="opanda-inner-wrap">
                    
                    <h2>
                        <?php 
            _e('More Marketing Tools To Grow Your Business', 'bizpanda');
            ?>
                    </h2>
                    <p style="margin-top: 0px;">
                        <?php 
            _e('Check out other plugins which add more features to your lockers.', 'bizpanda');
            ?>
                    </p>
                    
                    <?php 
            foreach ($suggestions as $suggestion) {
                $url = $suggestion['url'];
                if (false === strpos($url, 'utm_source')) {
                    if (BizPanda::isSinglePlugin()) {
                        $plugin = BizPanda::getPlugin();
                        $args = array('utm_source' => 'plugin-' . $plugin->options['name'], 'utm_medium' => $plugin->license && isset($plugin->license->data['Category']) ? $plugin->license->data['Category'] . '-version' : 'unknown-version', 'utm_campaign' => 'suggestions', 'tracker' => isset($plugin->options['tracker']) ? $plugin->options['tracker'] : null);
                        $url = add_query_arg($args, $url);
                    } else {
                        $url = add_query_arg(array('utm_source' => 'plugin-bizpanda', 'utm_medium' => 'mixed-versions', 'utm_campaign' => 'suggestions', 'utm_term' => implode(',', BizPanda::getPluginNames(true))), $url);
                    }
                }
                ?>
                    
                        <div class="postbox opanda-item opanda-item-<?php 
                echo $suggestion['type'];
                ?>
">
                            <div class="opanda-item-cover"></div>
                            
                            <i class="fa fa-plus-circle opanda-plus-background"></i>
                            
                            <h4 class="opanda-title">
                                <?php 
                echo $suggestion['title'];
                ?>
                            </h4>
                            <div class="opanda-description">
                                <?php 
                echo $suggestion['description'];
                ?>
                            </div>
                            <div class="opanda-buttons">
                                <a href='<?php 
                echo $url;
                ?>
' class="button button-large" title="<?php 
                _e('Click here to learn more', 'bizpanda');
                ?>
">
                                    <i class="fa fa-external-link"></i><span>Learn More</span>
                                </a>
                            </div>
                        </div>
                    
                    <?php 
            }
            ?>

                    <img class="opanda-arrow" src='<?php 
            echo OPANDA_BIZPANDA_URL . '/assets/admin/img/new-item-arrow.png';
            ?>
' />
                    
                </div>
            </div>
            
            <?php 
        }
        ?>
        </div>
        <?php 
    }