function wsl_render_settings()
{
    if (!wsl_check_requirements()) {
        include "plugin.fail.php";
        exit;
    }
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    $wslp = @(int) $_REQUEST["wslp"];
    if ($wslp < 1 || $wslp > 7) {
        $wslp = 1;
    }
    include "plugin.settings/plugin.settings.0.php";
    include "plugin.settings/plugin.settings.{$wslp}.php";
}
示例#2
0
/**
* Generate wsl admin pages 
*
* wp-admin/options-general.php?page=wordpress-social-login&.. 
*/
function wsl_admin_init()
{
    // HOOKABLE:
    do_action("wsl_admin_init_start");
    if (!wsl_check_requirements()) {
        wsl_admin_ui_fail();
        exit;
    }
    global $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS;
    global $WORDPRESS_SOCIAL_LOGIN_COMPONENTS;
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    global $WORDPRESS_SOCIAL_LOGIN_VERSION;
    global $wpdb;
    if (isset($_REQUEST["enable"]) && isset($WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$_REQUEST["enable"]])) {
        $component = $_REQUEST["enable"];
        $WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$component]["enabled"] = true;
        update_option("wsl_components_" . $component . "_enabled", 1);
        wsl_register_components();
    }
    if (isset($_REQUEST["disable"]) && isset($WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$_REQUEST["disable"]])) {
        $component = $_REQUEST["disable"];
        $WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$component]["enabled"] = false;
        update_option("wsl_components_" . $component . "_enabled", 2);
        wsl_register_components();
    }
    $wslp = "networks";
    $wsldwp = 0;
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/16x16/';
    if (isset($_REQUEST["wslp"])) {
        $wslp = trim(strtolower(strip_tags($_REQUEST["wslp"])));
    }
    if (isset($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["enabled"]) {
        if (isset($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["header_action"]) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["header_action"]) {
            do_action($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["header_action"]);
        }
        wsl_admin_ui_header($wslp);
        if (isset($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["body_action"]) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["body_action"]) {
            do_action($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["body_action"]);
        } elseif (!(isset($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["admin-url"]) && !$WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["admin-url"])) {
            include "components/{$wslp}/index.php";
            wsl_admin_ui_footer();
        }
    } else {
        wsl_admin_ui_header();
        wsl_admin_ui_error();
    }
    // HOOKABLE:
    do_action("wsl_admin_init_end");
}
/**
* Generate wsl admin pages
*
* wp-admin/options-general.php?page=wordpress-social-login&..
*/
function wsl_admin_main()
{
    // HOOKABLE:
    do_action("wsl_admin_main_start");
    if (!current_user_can('manage_options')) {
        wp_die('You do not have sufficient permissions to access this page.');
    }
    if (!wsl_check_requirements()) {
        wsl_admin_ui_fail();
        exit;
    }
    global $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS;
    global $WORDPRESS_SOCIAL_LOGIN_COMPONENTS;
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    global $WORDPRESS_SOCIAL_LOGIN_VERSION;
    if (isset($_REQUEST["enable"]) && isset($WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$_REQUEST["enable"]])) {
        $component = $_REQUEST["enable"];
        $WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$component]["enabled"] = true;
        update_option("wsl_components_" . $component . "_enabled", 1);
        wsl_register_components();
    }
    if (isset($_REQUEST["disable"]) && isset($WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$_REQUEST["disable"]])) {
        $component = $_REQUEST["disable"];
        $WORDPRESS_SOCIAL_LOGIN_COMPONENTS[$component]["enabled"] = false;
        update_option("wsl_components_" . $component . "_enabled", 2);
        wsl_register_components();
    }
    $wslp = "networks";
    $wsldwp = 0;
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/16x16/';
    if (isset($_REQUEST["wslp"])) {
        $wslp = trim(strtolower(strip_tags($_REQUEST["wslp"])));
    }
    wsl_admin_ui_header($wslp);
    if (isset($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["enabled"]) {
        if (isset($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["action"]) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["action"]) {
            do_action($WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["action"]);
        } else {
            include "components/{$wslp}/index.php";
        }
    } else {
        wsl_admin_ui_error();
    }
    wsl_admin_ui_footer();
    // HOOKABLE:
    do_action("wsl_admin_main_end");
}
 function test_requirements()
 {
     $this->assertTrue(wsl_check_requirements());
 }