/**
  * 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;
 }
 /**
  * Generate the parameters for the Comments plugin.
  * @return array
  */
 public function getParams()
 {
     $params = array('categoryID' => _gigParam($this->comments_options, 'categoryID', ''), 'rating' => _gigParam($this->comments_options, 'rating', 0), 'enabledShareProviders' => _gigParam($this->comments_options, 'enabledShareProviders', '*'), 'streamID' => get_the_ID(), 'scope' => _gigParam($this->feed_options, 'scope', 'external'), 'privacy' => _gigParam($this->feed_options, 'privacy', 'private'), 'version' => 2);
     if (!empty($this->comments_options['advanced'])) {
         $advanced = gigyaCMS::parseJSON(_gigParam($this->comments_options, 'advanced', ''));
         $params = array_merge($params, $advanced);
     }
     // Let other plugins modify the comments parameters.
     // For example:
     // $params['useSiteLogin'] = true;
     // $params['onSiteLoginClicked'] = 'onSiteLoginHandler';
     // To registering to the onSiteLoginClicked event.
     $params = apply_filters('gigya_comments_params', $params);
     return $params;
 }
Example #3
0
 /**
  * Generate the parameters for the login plugin.
  * @return array
  */
 public function getParams()
 {
     // Parameters to be sent to the DOM.
     $params = array('actionLogin' => 'gigya_login', 'actionCustomLogin' => 'custom_login', 'redirect' => _gigParam($this->login_options, 'redirect', user_admin_url()));
     $params['ui'] = array();
     $params['ui']['showTermsLink'] = false;
     $params['ui']['version'] = 2;
     if (!empty($this->login_options['width'])) {
         $params['ui']['width'] = $this->login_options['width'];
     }
     if (!empty($this->login_options['height'])) {
         $params['ui']['height'] = $this->login_options['height'];
     }
     if (!empty($this->login_options['showTermsLink'])) {
         $params['ui']['showTermsLink'] = $this->login_options['showTermsLink'];
     }
     if (!empty($this->login_options['enabledProviders'])) {
         $params['ui']['enabledProviders'] = $this->login_options['enabledProviders'];
     }
     if (!empty($this->login_options['buttonsStyle'])) {
         $params['ui']['buttonsStyle'] = $this->login_options['buttonsStyle'];
     }
     if (!empty($this->login_options['advancedLoginUI'])) {
         $arr = gigyaCMS::parseJSON($this->login_options['advancedLoginUI']);
         if (!empty($arr)) {
             foreach ($arr as $key => $val) {
                 $params['ui'][$key] = $val;
             }
         }
     }
     if (!empty($this->login_options['advancedAddConnectionsUI'])) {
         $arr = gigyaCMS::parseJSON($this->login_options['advancedAddConnectionsUI']);
         if (!empty($arr)) {
             foreach ($arr as $key => $val) {
                 $params['addConnection'][$key] = $val;
             }
         }
     }
     // Let others plugins to modify the login parameters.
     $params = apply_filters('gigya_login_params', $params);
     return $params;
 }
Example #4
0
 /**
  * Generate the parameters for the share-bar plugin.
  * @return array
  */
 public function getParams()
 {
     // The current post.
     global $post;
     // Set image path.
     $image_by = _gigParam($this->share_options, 'image', '0');
     if (!empty($image_by)) {
         $img = _gigParam($this->share_options, 'imageURL', get_bloginfo('wpurl') . '/' . WPINC . '/images/blank.gif');
     } else {
         $img = $this->getImage($post);
     }
     // The parameters array.
     $params = array('layout' => _gigParam($this->share_options, 'layout', 'horizontal'), 'showCounts' => _gigParam($this->share_options, 'showCounts', 'right'), 'shareButtons' => _gigParam($this->share_options, 'shareButtons', 'share,facebook-like,google-plusone,twitter,email'), 'shortURLs' => !empty($this->share_options['shortURLs']) ? 'always' : 'never', 'ua' => array('linkBack' => esc_url(apply_filters('the_permalink', get_permalink())), 'postTitle' => get_the_title(), 'postDesc' => _gigParam($post, 'post_excerpt', ''), 'imageURL' => $img));
     // Add advanced parameters if exist.
     if (!empty($this->share_options['advanced'])) {
         $advanced = gigyaCMS::parseJSON(_gigParam($this->share_options, 'advanced', ''));
         $params = array_merge($params, $advanced);
     }
     // Let others plugins to modify the share parameters.
     $params = apply_filters('gigya_share_params', $params);
     return $params;
 }
 /**
  * On Setting page save event.
  */
 public static function onSave()
 {
     // When a Gigya's setting page is submitted.
     if (isset($_POST['gigya_login_settings'])) {
         // When we turn on the Gigya's social login plugin,
         // We also turn on the WP 'Membership: Anyone can register' option.
         if ($_POST['gigya_login_settings']['mode'] == 'wp_sl') {
             update_option('users_can_register', 1);
         } elseif ($_POST['gigya_login_settings']['mode'] == 'raas') {
             update_option('users_can_register', 0);
         }
     } elseif (isset($_POST['gigya_global_settings'])) {
         $cms = new gigyaCMS();
         STATIC::_setSecret();
         $res = $cms->apiValidate($_POST['gigya_global_settings']['api_key'], $_POST['gigya_global_settings']['api_secret'], $_POST['gigya_global_settings']['data_center']);
         if (!empty($res)) {
             $gigyaErrCode = $res->getErrorCode();
             if ($gigyaErrCode > 0) {
                 $gigyaErrMsg = $res->getErrorMessage();
                 $errorsLink = "<a href='http://developers.gigya.com/037_API_reference/zz_Response_Codes_and_Errors' target='_blank'>Response_Codes_and_Errors</a>";
                 $message = "Gigya API error: {$gigyaErrCode} - {$gigyaErrMsg}. For more information please refer to {$errorsLink}";
                 add_settings_error('gigya_global_settings', 'api_validate', $message, 'error');
                 // prevent updating values
                 STATIC::_keepOldApiValues();
             }
         } else {
             add_settings_error('gigya_global_settings', 'api_validate', 'Error sending request to gigya', 'error');
         }
     }
 }
Example #6
0
 /**
  * Hook comments_template.
  *
  * @param $comment_template
  * @return string
  */
 public function commentsTemplate($comment_template)
 {
     // Spider trap.
     // When a spider detect we render the comment in the HTML for SEO
     $is_spider = gigyaCMS::isSpider();
     if (!empty($is_spider)) {
         // Override default WP comments template with comment spider.
         return GIGYA__PLUGIN_DIR . 'admin/tpl/comments-spider.tpl.php';
     }
     // Override default WP comments template.
     return GIGYA__PLUGIN_DIR . 'admin/tpl/comments.tpl.php';
 }