provider = $provider; $this->path = $this->provider->getPath() . '/admin'; add_filter('nsl_update_settings_validate_' . $this->provider->getOptionKey(), array( $this, 'validateSettings' ), 10, 2); } /** * @return NextendSocialProvider */ public function getProvider() { return $this->provider; } /** * @param string $subview * Returns the admin URL for a subview. * * @return string */ public function getUrl($subview = '') { return add_query_arg(array( 'subview' => $subview ), NextendSocialLoginAdmin::getAdminUrl('provider-' . $this->provider->getId())); } /** * @param $newData * @param $postedData * Returns the validated settings for the buttons. * * @return mixed */ public function validateSettings($newData, $postedData) { $newData = $this->provider->validateSettings($newData, $postedData); if (isset($postedData['custom_default_button'])) { if (isset($postedData['custom_default_button_enabled']) && $postedData['custom_default_button_enabled'] == '1') { $newData['custom_default_button'] = $postedData['custom_default_button']; } else { if ($postedData['custom_default_button'] != '') { $newData['custom_default_button'] = ''; } } } if (isset($postedData['custom_icon_button'])) { if (isset($postedData['custom_icon_button_enabled']) && $postedData['custom_icon_button_enabled'] == '1') { $newData['custom_icon_button'] = $postedData['custom_icon_button']; } else { if ($postedData['custom_icon_button'] != '') { $newData['custom_icon_button'] = ''; } } } if (isset($postedData['terms'])) { if (isset($postedData['terms_override']) && $postedData['terms_override'] == '1') { $newData['terms'] = $postedData['terms']; } else { $newData['terms'] = ''; } } foreach ($postedData AS $key => $value) { switch ($key) { case 'login_label': case 'register_label': case 'link_label': case 'unlink_label': $newData[$key] = wp_kses_post($value); break; case 'user_prefix': case 'user_fallback': $newData[$key] = preg_replace("/[^A-Za-z0-9\-_ ]/", '', $value); break; case 'settings_saved': $newData[$key] = intval($value) ? 1 : 0; break; case 'oauth_redirect_url': $newData[$key] = $value; break; } } return $newData; } /** * Displays a subview if it is set in the URL. */ public function settingsForm() { $subview = !empty($_REQUEST['subview']) ? $_REQUEST['subview'] : ''; $this->displaySubView($subview); } /** * @param $subview * Display the requested subview */ protected function displaySubView($subview) { if (!$this->provider->adminDisplaySubView($subview)) { switch ($subview) { case 'settings': $this->render('settings'); break; case 'buttons': $this->render('buttons'); break; case 'sync-data': if ($this->provider->hasSyncFields()) { $this->render('sync-data'); } else { wp_redirect($this->provider->getAdmin() ->getUrl()); exit; } break; case 'usage': $this->render('usage'); break; default: $this->render('getting-started'); break; } } } /** * @param $view * @param bool $showMenu * Enframe the specified part-view with the complete view(header, menu, footer). */ public function render($view, $showMenu = true) { include(self::$globalPath . '/templates/header.php'); $_view = $view; $view = 'providers'; include(self::$globalPath . '/templates/menu.php'); $view = $_view; echo '
'; echo '

' . $this->provider->getLabel() . '

'; if ($showMenu) { include(self::$globalPath . '/templates-provider/menu.php'); } Notices::displayNotices(); if ($view == 'buttons') { include(self::$globalPath . '/templates-provider/buttons.php'); } else if ($view == 'usage') { include(self::$globalPath . '/templates-provider/usage.php'); } else if ($view == 'sync-data') { include(self::$globalPath . '/templates-provider/sync-data.php'); } else { include($this->path . '/' . $view . '.php'); } echo '
'; include(self::$globalPath . '/templates/footer.php'); } /** * Display the Verify part of the settings subview. */ public function renderSettingsHeader() { $provider = $this->provider; $state = $provider->getState(); ?>

If you see error message in the popup check the copied ID and secret or the app itself. Otherwise your settings are fine.', 'nextend-facebook-connect'); ?>

settings->get('tested') == '1') : ?>

-

getLabel()); break; case 'enabled': printf(__('This provider works fine, but you can test it again. If you don’t want to let users register or login with %s anymore you can disable it.', 'nextend-facebook-connect'), $provider->getLabel()); echo '

'; echo '

'; printf(__('This provider is currently enabled, which means that users can register or login via their %s account.', 'nextend-facebook-connect'), $provider->getLabel()); break; } ?>

' . $this->provider->getLabel() . ''; include($this->path . '/fix-redirect-uri.php'); } } NextendSocialProviderAdmin::$globalPath = NSL_PATH . '/admin';