/**
  * 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;
 }
Example #5
0
 /**
  * Initialize hook.
  */
 public function init()
 {
     require_once GIGYA__PLUGIN_DIR . 'sdk/GSSDK.php';
     require_once GIGYA__PLUGIN_DIR . 'sdk/gigyaCMS.php';
     // Load jQuery and jQueryUI from WP.
     wp_enqueue_script('jquery');
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('jquery-ui-dialog');
     wp_enqueue_script('gigya_js', GIGYA__PLUGIN_URL . 'gigya.js');
     wp_enqueue_style('gigya_css', GIGYA__PLUGIN_URL . 'gigya.css');
     // Parameters to be sent to the DOM.
     $params = array('ajaxurl' => admin_url('admin-ajax.php'), 'logoutUrl' => wp_logout_url(), 'connectWithoutLoginBehavior' => _gigParam($this->login_options, 'connectWithoutLoginBehavior', 'loginExistingUser'), 'jsonExampleURL' => GIGYA__PLUGIN_URL . 'admin/forms/json/advance_example.json', 'enabledProviders' => _gigParam($this->global_options, 'enabledProviders', '*'), 'lang' => _gigParam($this->global_options, 'lang', 'en'), 'sessionExpiration' => gigyaSyncLoginSession());
     // Add advanced parameters if exist.
     if (!empty($this->global_options['advanced'])) {
         $advanced = gigyaCMS::parseJSON(_gigParam($this->global_options, 'advanced', ''));
         $params = array_merge($params, $advanced);
     }
     // Let others plugins to modify the global parameters.
     $params = apply_filters('gigya_global_params', $params);
     // Load params to be available to client-side script.
     wp_localize_script('gigya_js', 'gigyaParams', $params);
     // Checking that we have an API key and Gigya's plugin is turn on.
     $api_key = GIGYA__API_KEY;
     if (!empty($api_key)) {
         // Loads requirements for any Gigya's login.
         // Load Gigya's socialize.js from CDN.
         wp_enqueue_script('gigya_cdn', GIGYA__JS_CDN . GIGYA__API_KEY . '&lang=' . $params['lang']);
         // Loads requirements for any Gigya's social login.
         if ($this->login_options['mode'] == 'wp_sl') {
             require_once GIGYA__PLUGIN_DIR . 'features/login/GigyaLoginSet.php';
             $gigyaLoginSet = new GigyaLoginSet();
             $gigyaLoginSet->init();
         }
         // Loads requirements for any Gigya's RaaS login.
         if ($this->login_options['mode'] == 'raas') {
             // Loads RaaS links class.
             require_once GIGYA__PLUGIN_DIR . 'features/raas/GigyaRaasSet.php';
             $gigyaRaasSet = new GigyaRaasSet();
             $gigyaRaasSet->init();
         }
         // Loads requirements for any Gigya's Google-Analytics integration.
         if (!empty($this->global_options['google_analytics'])) {
             wp_enqueue_script('gigya_ga', GIGYA__CDN_PROTOCOL . '.gigya.com/js/gigyaGAIntegration.js');
         }
     }
     if (is_admin()) {
         // Loads requirements for the admin settings section.
         require_once GIGYA__PLUGIN_DIR . 'admin/admin.GigyaSettings.php';
         new GigyaSettings();
     }
 }