public function gigyaRaas($attrs, $content, $tag) { require_once GIGYA__PLUGIN_DIR . 'features/raas/GigyaRaasSet.php'; $login = new GigyaRaasSet(); $login->init(); $output = ""; if ($tag == "gigya-raas-login" && !is_user_logged_in()) { $output .= '<div class="gigya-raas-widget">'; $output .= '<a href="wp-login.php">' . __('Login') . '</a> | '; $output .= '<a href="wp-login.php?action=register">' . __('Register') . '</a>'; $output .= '</div>'; } elseif ($tag == "gigya-raas-profile" && is_user_logged_in()) { $current_user = wp_get_current_user(); $output .= '<div class="gigya-wp-account-widget">'; $output .= '<a class="gigya-wp-avatar" href="' . user_admin_url('profile.php') . '">' . get_avatar($current_user->ID) . '</a>'; $output .= '<div class="gigya-wp-info">'; $output .= '<a class="gigya-wp-name" href="' . user_admin_url('profile.php') . '">' . $current_user->display_name . '</a>'; $output .= '<a class="gigya-wp-logout" href="' . wp_logout_url() . '">' . __('Log Out') . '</a>'; $output .= '</div></div>'; } return $output; }
/** * 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(); } }