public function oxd_get_output($atts)
 {
     if (is_oxd_registered()) {
         $gluu_widget = new oxd_openid_login_wid();
         $html = $gluu_widget->openidloginFormShortCode($atts);
         return $html;
     }
 }
function oxd_openid_troubleshoot_info()
{
    ?>
    <div class="oxd_openid_table_layout">
        <?php 
    if (!is_oxd_registered()) {
        ?>
            <div class="mess_red">
                Please enter OXD configuration to continue.
            </div>
        <?php 
    }
    ?>

        <table width="100%">
            <tbody>
            <tr>
                <td>
                    <h1><a id="Wordpress_GLUU_SSO_plugin_0"></a>Wordpress GLUU SSO plugin</h1>
                    <p><img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/plugin.jpg" alt="image"></p>
                    <p>Wordpress-GLUU-SSO plugin gives access for login to your Wordpress site, with the help of GLUU server.</p>
                    <p>There are already 2 versions of Wordpress-GLUU-SSO (2.4.2 and 2.4.3) plugins, each in its turn is working with oxD and GLUU servers.
                        For example if you are using Wordpress-gluu-sso-2.4.3 plugin, you need to connect with oxD-server-2.4.3.</p>
                    <p>Now I want to explain in details how to use plugin step by step.</p>
                    <p>Plugin will not be working if your host does not have https://.</p>
                    <h2><a id="Step_1_Install_Gluuserver_13"></a>Step 1. Install Gluu-server</h2>
                    <p>(version 2.4.2 or 2.4.3)</p>
                    <p>If you want to use external gluu server, You can not do this step.</p>
                    <p><a target="_blank" href="https://www.gluu.org/docs/deployment/">Gluu-server installation gide</a>.</p>
                    <h2><a id="Step_2_Download_oxDserver_21"></a>Step 2. Download oxD-server</h2>
                    <p><a target="_blank" href="https://ox.gluu.org/maven/org/xdi/oxd-server/2.4.3.Final/oxd-server-2.4.3.Final-distribution.zip">Download oxD-server-2.4.3.Final</a>.</p>
                    <h2><a id="Step_3_Unzip_and_run_oXDserver_31"></a>Step 3. Unzip and run oXD-server</h2>
                    <ol>
                        <li>Unzip your oxD-server.</li>
                        <li>Open the command line and navigate to the extracted folder in the conf directory.</li>
                        <li>Open oxd-conf.json file.</li>
                        <li>If your server is using 8099 port, please change “port” number to free port, which is not used.</li>
                        <li>Set parameter “op_host”:“Your gluu-server-url (internal or external)”</li>
                        <li>Open the command line and navigate to the extracted folder in the bin directory.</li>
                        <li>For Linux environment, run sh <a href="http://oxd-start.sh">oxd-start.sh</a>&amp;.</li>
                        <li>For Windows environment, run oxd-start.bat.</li>
                        <li>After the server starts, go to Step 4.</li>
                    </ol>
                    <h2><a id="Step_6_General_73"></a>Step 4. General</h2>
                    <p><img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/wp-sso-2.4.2/docu/1.png" alt="General"></p>
                    <ol>
                        <li>Admin Email: please add your or admin email address for registrating site in Gluu server.</li>
                        <li>Port number: choose that port which is using oxd-server (see in oxd-server/conf/oxd-conf.json file).</li>
                        <li>Click <code>Next</code> to continue.</li>
                    </ol>
                    <p>If You are successfully registered in gluu server, you will see bottom page.</p>
                    <p><img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/wp-sso-2.4.2/docu/2.png" alt="oxD_id"></p>
                    <p>For making sure go to your gluu server / OpenID Connect / Clients and search for your oxD ID</p>
                    <p>If you want to reset configurations click on Reset configurations button.</p>
                    <h2><a id="Step_8_OpenID_Connect_Configuration_89"></a>Step 5. OpenID Connect Configuration</h2>
                    <p>OpenID Connect Configuration page for Wordpress-gluu-sso 2.4.3.</p>
                    <h3><a id="Scopes_93"></a>Scopes.</h3>
                    <p>You can look all scopes in your gluu server / OpenID Connect / Scopes and understand the meaning of  every scope.
                        Scopes are need for getting loged in users information from gluu server.
                        Pay attention to that, which scopes you are using that are switched on in your gluu server.</p>
                    <p>In Wordpress-gluu-sso 2.4.3  you can add, enable, disable and delete scope.
                        <img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/wp-sso-2.4.2/docu/4.png" alt="Scopes1"></p>
                    <h3><a id="Custom_scripts_104"></a>Custom scripts.</h3>
                    <p><img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/wp-sso-2.4.2/docu/5.png" alt="Customscripts"></p>
                    <p>You can look all custom scripts in your gluu server / Configuration / Manage Custom Scripts / and enable login type, which type you want.
                        Custom Script represent itself the type of login, at this moment gluu server supports (U2F, Duo, Google +, Basic) types.</p>
                    <h3><a id="Pay_attention_to_that_111"></a>Pay attention to that.</h3>
                    <ol>
                        <li>Which custom script you enable in your Wordpress site in order it must be switched on in gluu server too.</li>
                        <li>Which custom script you will be enable in OpenID Connect Configuration page, after saving that will be showed in Wordpress Configuration page too.</li>
                        <li>When you create new custom script, both fields are required.</li>
                    </ol>
                    <h2><a id="Step_9_Wordpress_Configuration_117"></a>Step 6. Wordpress Configuration</h2>
                    <h3><a id="Customize_Login_Icons_1194"></a>Customize Login Icons</h3>
                    <p>Pay attention to that, if custom scripts are not enabled, nothing will be showed.
                        Customize shape, space between icons and size of the login icons.</p>
                    <h3><a id="Customize_Login_Icons_119"></a>Display Options</h3>
                    <ul>
                        <ol> If you enable Default Login Form,than login icons will be showed in wordpress Default Login page .</ol>
                        <ol> If you enable Default Registration Form,than login icons will be showed in wordpress Default Registration page .</ol>
                        <ol> If you enable Comment Form,than login icons will be showed near wordpress Comment Form.</ol>
                        <ol> If you enable WooCommerce Login Form,than login icons will be showed in wordpress WooCommerce Login page.</ol>
                    </ul>
                    <p><img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/wp-sso-2.4.2/docu/6.png" alt="WordpressConfiguration"></p>
                    <h2><a id="Step_10_Show_icons_in_frontend_1288"></a>Step 7. Gluu SSO Widget</h2>
                    <p>
                        You can use plugin also as widget.
                        In your widget page find Gluu SSO Widget and use.
                    </p>
                    <h2><a id="Step_10_Show_icons_in_frontend_126"></a>Step 8. Show icons in frontend</h2>
                    <p><img src="https://raw.githubusercontent.com/GluuFederation/gluu-wordpress-oxd-login-plugin/master/wp-sso-2.4.2/docu/7.png" alt="frontend"></p>
                </td>
            </tr>
            <tr>
                <td>
                    <h3><a  id="openid_question_login" class="oxd_openid_title_panel" >Gluu SSO</a></h3>
                    <div class="oxd_openid_help_desc" hidden="" id="openid_question_login_desc">
                        <h4><a  id="openid_question2"  >How to add login icons to frontend login page?</a></h4>
                        <div id="openid_question2_desc">
                            You can add social and gluu login icons to frontend login page using our shortcode [gluu_login].
                            Refer to 'Shortcode' tab to add customizations to Shortcode.
                        </div>
                        <hr>
                        <h4><a  id="openid_question4"  >How can I put gluu sso icons on a page without using widgets?</a></h4>
                        <div  id="openid_question4_desc">
                            You can add social and gluu login icons to any page or custom login page using 'gluu sso shortcode' [gluu_login].
                            Refer to 'Shortcode' tab to add customizations to Shortcode.
                        </div>

                        <h4 style="display: none"><a  id="openid_question12" >Gluu SSO icons are not added to login/registration form.</a></h4>
                        <div  id="openid_question12_desc" style="display: none">
                            Your login/registration form may not be wordpress's default login/registration form.
                            In this case you can add social and gluu login icons to custom login/registration form using 'gluu sso shortcode' [gluu_login].
                            Refer to 'Shortcode' tab to add customizations to Shortcode.
                        </div>
                        <h4 style="display: none"><a  id="openid_question3"  >How can I redirect to my blog page after login?</a></h4>
                        <div style="display: none" id="openid_question3_desc">
                            You can select one of the options from <b>Redirect URL after login</b> of <b>Display Option</b> section under <b>Wordpress Config</b> tab. <br>
                            1. Same page where user logged in <br>
                            2. Homepage <br>
                            3. Account Dsahboard <br>
                            4. Custom URL - Example: https://www.example.com <br>
                        </div>
                    </div>
                    <hr>
                </td>
            </tr>
            <tr>
                <td>
                    <h3><a id="openid_login_shortcode_title"  aria-expanded="false" >Gluu SSO Shortcode</a></h3>
                    <div class="oxd_openid_help_desc" hidden="" id="openid_login_shortcode" style="font-size:13px !important">
                        Use the shortcode in the content of the required page/post where you want to display login icons.<br>
                        <b>Example:</b> <code>[gluu_login]</code>
                        <h4 style="margin-bottom:0 !important">For Icons</h4>
                        You can use request attributes to customize the icons. All attributes are optional.<br>
                        <b>Example:</b> <code>[gluu_login  shape="<?php 
    echo get_option('oxd_openid_login_theme');
    ?>
" theme="<?php 
    echo get_option('oxd_openid_login_custom_theme');
    ?>
" space="<?php 
    echo get_option('oxd_login_icon_space');
    ?>
" size="<?php 
    echo get_option('oxd_login_icon_custom_size');
    ?>
"]</code><br>

                        <br/>
                        You can use a shortcode in a PHP file like this: &nbsp;&nbsp;
                        &nbsp;
                        <code>&lt;&#63;php echo do_shortcode(‘SHORTCODE’) /&#63;&gt;</code>
                        <br>
                        Replace SHORTCODE in the above code with the required shortcode like [gluu_login theme="default"], so the final code looks like following :
                        <br>
                        <code>&lt;&#63;php echo do_shortcode('[gluu_login theme="default"]') &#63;&gt;</code>
                    </div>
                    <hr>
                </td>
            </tr>
            <tr style="display: none">
                <td>
                    <h3>
                        <a  id="openid_question_logout" class="oxd_openid_title_panel" >Logout Redirection</a>
                    </h3>
                    <div class="oxd_openid_help_desc" hidden="" id="openid_question_logout_desc">
                        <h4><a  id="openid_question11"  >After logout I am redirected to blank page</a></h4>
                        <div  id="openid_question11_desc">
                            Your theme and Gluu SSO plugin may conflict during logout. To resolve it you need to uncheck <b>Enable Logout Redirection</b> checkbox under <b>Display Option</b> of <b>Social Login</b> tab.
                        </div>
                    </div>
                    <hr>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <?php 
}
<?php

include_once dirname(__FILE__) . '/oxd-rp/Get_authorization_url.php';
include_once dirname(__FILE__) . '/oxd-rp/Get_tokens_by_code.php';
include_once dirname(__FILE__) . '/oxd-rp/Get_user_info.php';
include_once dirname(__FILE__) . '/oxd-rp/Logout.php';
if (is_oxd_registered()) {
    /*
     * Login Widget
     */
    class oxd_openid_login_wid extends WP_Widget
    {
        public function __construct()
        {
            parent::__construct('oxd_openid_login_wid', 'Gluu SSO 2.4.3 Widget', array('description' => __('Login using Social Apps and Gluu Apps .', 'flw')));
        }
        public function widget($args, $instance)
        {
            extract($args);
            echo $args['before_widget'];
            $this->openidloginForm();
            echo $args['after_widget'];
        }
        public function update($new_instance, $old_instance)
        {
            $instance = array();
            $instance['wid_title'] = strip_tags($new_instance['wid_title']);
            return $instance;
        }
        public function openidloginForm()
        {