/**
  * Generate the parameters for the reactions-bar plugin.
  * @return array
  */
 public function getParams()
 {
     // The current post.
     global $post;
     // Set image path.
     $image_by = _gigParam($this->reactions_options, 'image', '0');
     if (!empty($image_by)) {
         $img = _gigParam($this->reactions_options, 'imageURL', get_bloginfo('wpurl') . '/' . WPINC . '/images/blank.gif');
     } else {
         $img = $this->getImage($post);
     }
     // Unique bar ID.
     $bar_id = 'bar-' . get_the_ID();
     // The parameters array.
     $params = array('barID' => $bar_id, 'layout' => _gigParam($this->reactions_options, 'layout', 'horizontal'), 'showCounts' => _gigParam($this->reactions_options, 'showCounts', 'right'), 'countType' => _gigParam($this->reactions_options, 'countType', 'right'), 'enabledProviders' => _gigParam($this->reactions_options, 'enabledProviders', 'reactions,facebook-like,google-plusone,twitter,email'), 'multipleReactions' => _gigParam($this->reactions_options, 'multipleReactions', 0), 'scope' => _gigParam($this->feed_options, 'scope', 'external'), 'privacy' => _gigParam($this->feed_options, 'privacy', 'private'), 'ua' => array('linkBack' => esc_url(apply_filters('the_permalink', get_permalink())), 'postTitle' => get_the_title(), 'postDesc' => _gigParam($post, 'post_excerpt', ''), 'imageURL' => $img));
     // Add reactions buttons parameters if exist.
     if (!empty($this->reactions_options['buttons'])) {
         $buttons = gigyaCMS::parseJSON(_gigParam($this->reactions_options, 'buttons', _gigya_get_json('admin/forms/json/default_reaction')));
         $params['reactions'] = $buttons;
     }
     // Add advanced parameters if exist.
     if (!empty($this->reactions_options['advanced'])) {
         $advanced = gigyaCMS::parseJSON(_gigParam($this->reactions_options, 'advanced', ''));
         $params = array_merge($params, $advanced);
     }
     // Let others plugins to modify the reactions parameters.
     $params = apply_filters('gigya_reactions_params', $params);
     return $params;
 }
 /**
  * Back-end widget form.
  *
  * @see WP_Widget::form()
  *
  * @param array $instance Previously saved values from database.
  *
  * @return string|void
  */
 public function form($instance)
 {
     $form = array();
     $form[$this->get_field_id('title')] = array('type' => 'text', 'value' => esc_attr(_gigParam($instance, 'title', '')), 'label' => __('Title'), 'class' => 'size', 'name' => $this->get_field_name('title'));
     $form[$this->get_field_id('override')] = array('type' => 'checkbox', 'value' => esc_attr(_gigParam($instance, 'override', '')), 'label' => __('Override'), 'class' => 'gigya-widget-override', 'name' => $this->get_field_name('override'));
     $form[$this->get_field_id('iconSize')] = array('type' => 'text', 'value' => esc_attr(_gigParam($instance, 'iconSize', 32)), 'label' => __('Icon size'), 'class' => 'size', 'name' => $this->get_field_name('iconSize'));
     $form[$this->get_field_id('layout')] = array('type' => 'select', 'options' => array('horizontal' => __('Horizontal'), 'vertical' => __('Vertical')), 'value' => esc_attr(_gigParam($instance, 'layout', 'horizontal')), 'label' => __('Layout'), 'class' => 'size', 'name' => $this->get_field_name('layout'));
     $form[$this->get_field_id('followButtons')] = array('type' => 'textarea', 'value' => _gigParam($instance, 'buttons', _gigya_get_json('admin/forms/json/default_follow')), 'label' => __('Follow Bar buttons'), 'desc' => __('Please fill valid JSON for follow-bar button as describe') . ' ' . '<a href="http://developers.gigya.com/010_Developer_Guide/18_Plugins/050_Follow_Bar#Quick_Start_Implementation">' . __('here') . '</a>', 'name' => $this->get_field_name('buttons'), 'class' => 'json');
     echo _gigya_form_render($form);
 }
 /**
  * Generate the parameters for the feed plugin.
  * @return array
  */
 public function getParams()
 {
     // The parameters array.
     $params = array('on' => _gigParam($this->follow_options, 'on', true), 'layout' => _gigParam($this->follow_options, 'layout', 'horizontal'), 'iconSize' => _gigParam($this->follow_options, 'iconSize', '32'), 'buttons' => _gigParam($this->follow_options, 'followButtons', _gigya_get_json('admin/forms/json/default_follow')));
     if (!empty($this->follow_options['advanced'])) {
         $params = array_merge($params, json_decode($this->follow_options['advanced'], true));
     }
     // Let others plugins to modify the comments parameters.
     $params = apply_filters('gigya_follow_params', $params);
     return $params;
 }
/**
 * Form builder for 'Share Settings' configuration page.
 */
function followSettingsForm()
{
    $values = get_option(GIGYA__SETTINGS_FOLLOW);
    $form = array();
    $form['on'] = array('type' => 'checkbox', 'label' => __('Enable Follow Bar Plugin'), 'value' => _gigParamDefaultOn($values, 'on'));
    $form['followButtons'] = array('type' => 'textarea', 'label' => __('Follow Buttons'), 'value' => _gigParam($values, 'followButtons', _gigya_get_json('admin/forms/json/default_follow')), 'desc' => __('Please fill valid JSON for follow-bar button as describe') . ' ' . '<a href="http://developers.gigya.com/010_Developer_Guide/18_Plugins/050_Follow_Bar#Quick_Start_Implementation">' . __('here') . '</a>');
    $form['layout'] = array('type' => 'select', 'options' => array("horizontal" => __("Horizontal"), "vertical" => __("Vertical")), 'value' => _gigParam($values, 'layout', 'horizontal'), 'label' => __('Layout'));
    $form['iconSize'] = array('type' => 'text', 'value' => esc_attr(_gigParam($values, 'iconSize', 32)), 'label' => __('Icon size'), 'desc' => __('The size of the follow icons'));
    $form['advanced'] = array('type' => 'textarea', 'label' => __("Additional Parameters (advanced)"), 'value' => _gigParam($values, 'advanced', ''), 'desc' => sprintf(__('Enter valid %s. See list of available:'), '<a class="gigya-json-example" href="javascript:void(0)">' . __('JSON format') . '</a>') . ' <a href="http://developers.gigya.com/020_Client_API/010_Socialize/socialize.showFollowBarUI" target="_blank">' . __('parameters') . '</a>');
    // use this field in multisite to flag when sub site settings are saved locally for site
    if (is_multisite() && !$values['sub_site_settings_saved']) {
        $form['sub_site_settings_saved'] = array('type' => 'hidden', 'id' => 'sub_site_settings_saved', 'value' => 1, 'msg' => 1, 'msg_txt' => 'Settings are set to match the main site. once saved they will become independent', 'class' => 'gigya-raas-warn');
    }
    echo _gigya_form_render($form, GIGYA__SETTINGS_FOLLOW);
}
/**
 * Form builder for 'Reaction Settings' configuration page.
 */
function reactionsSettingsForm()
{
    $values = get_option(GIGYA__SETTINGS_REACTIONS);
    $form = array();
    $form['on'] = array('type' => 'checkbox', 'label' => __('Enable Reactions Plugin'), 'default' => 0, 'value' => _gigParamDefaultOn($values, 'on'));
    $form['position'] = array('type' => 'select', 'label' => __('Set the position of the Reactions in a post page'), 'options' => array("none" => __("None"), "bottom" => __("Bottom"), "top" => __("Top"), "both" => __("Both")), 'value' => _gigParam($values, 'position', 'none'), 'desc' => sprintf(__('You can also add and position Gigya Reactions using the %s settings page.'), '<a href="' . admin_url('widgets.php') . '">' . __('Widgets') . '</a>'));
    $form['enabledProviders'] = array('type' => 'text', 'label' => __('Providers'), 'value' => _gigParam($values, 'enabledProviders', '*'), 'desc' => __('Comma separated list of share providers to include. For example: facebook,twitter,linkedin. Leave empty or type * for all providers. See the entire list of available') . ' <a href="http://developers.gigya.com/020_Client_API/010_Socialize/socialize.showReactionsBarUI">Providers</a>');
    $form['showCounts'] = array('type' => 'select', 'label' => __('Show Counts'), 'options' => array("right" => __("Right"), "top" => __("Top"), "none" => __("None")), 'value' => _gigParam($values, 'showCounts', 'right'));
    $form['countType'] = array('type' => 'select', 'options' => array("number" => __("Number"), "percentage" => __("Percentage")), 'value' => _gigParam($values, 'countType', 'number'), 'label' => __('Count Type'));
    $form['layout'] = array('type' => 'select', 'label' => __('Layout'), 'options' => array("horizontal" => __("Horizontal"), "vertical" => __("Vertical")), 'value' => _gigParam($values, 'layout', 'horizontal'));
    $form['image'] = array('type' => 'checkbox', 'value' => _gigParam($values, 'image', 0), 'label' => __('Set image URL'), 'class' => 'conditional');
    $form['imageURL'] = array('type' => 'text', 'label' => __("Default URL of the image to share"), 'value' => _gigParam($values, 'imageURL', ''));
    $form['multipleReactions'] = array('type' => 'checkbox', 'label' => __('Allow multiple reactions'), 'value' => _gigParam($values, 'multipleReactions', 0));
    $form['buttons'] = array('type' => 'textarea', 'label' => __('Reaction Buttons'), 'value' => _gigParam($values, 'buttons', _gigya_get_json('admin/forms/json/default_reaction')), 'desc' => sprintf(__('Please enter an array of %s, representing the buttons to display in the Reactions bar.'), '<a href="http://developers.gigya.com/020_Client_API/010_Socialize/socialize.showReactionsBarUI#Reaction_Object">' . _('Reaction objects') . '</a>'));
    $form['advanced'] = array('type' => 'textarea', 'label' => __("Additional Parameters (advanced)"), 'value' => _gigParam($values, 'advanced', ''), 'desc' => sprintf(__('Enter valid %s. See list of available:'), '<a class="gigya-json-example" href="javascript:void(0)">' . __('JSON format') . '</a>') . ' <a href="http://developers.gigya.com/020_Client_API/010_Socialize/socialize.showReactionsBarUI" target="_blank">' . __('parameters') . '</a>');
    // use this field in multisite to flag when sub site settings are saved locally for site
    if (is_multisite() && !$values['sub_site_settings_saved']) {
        $form['sub_site_settings_saved'] = array('type' => 'hidden', 'id' => 'sub_site_settings_saved', 'value' => 1, 'msg' => 1, 'msg_txt' => 'Settings are set to match the main site. once saved they will become independent', 'class' => 'gigya-raas-warn');
    }
    echo _gigya_form_render($form, GIGYA__SETTINGS_REACTIONS);
}