init_hooks(); } } /** * Initiate hooks. */ private function init_hooks() { add_action( 'admin_init', [ $this, 'init_settings' ] ); } /** * {@inheritdoc} */ public function init_settings() { /** * VK */ add_settings_section( 'section_vkontakte', __( 'VK', "anycomment" ), function () { ?>

page_slug ); $this->render_fields( $this->page_slug, 'section_vkontakte', [ [ 'id' => self::OPTION_VK_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => esc_html( __( 'Allow VK authorization', "anycomment" ) ), ], [ 'id' => self::OPTION_VK_APP_ID, 'title' => __( 'Application ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter app id. Can be found in apps page', "anycomment" ), 'https://vk.com/apps?act=manage' ) ], [ 'id' => self::OPTION_VK_SECRET, 'title' => __( 'Secure key', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter secure key. Can be found in apps page', "anycomment" ), 'https://vk.com/apps?act=manage' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_twitter', [ [ 'id' => self::OPTION_TWITTER_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Twitter authorization', "anycomment" ) ], [ 'id' => self::OPTION_TWITTER_CONSUMER_KEY, 'title' => __( 'Consumer Key', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter consumer key. Can be found in the list of apps', "anycomment" ), 'https://apps.twitter.com/' ) ], [ 'id' => self::OPTION_TWITTER_CONSUMER_SECRET, 'title' => __( 'Consumer Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter consumer secret. Can be found in the list of apps', "anycomment" ), 'https://apps.twitter.com/' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_facebook', [ [ 'id' => self::OPTION_FACEBOOK_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Facebook authorization', "anycomment" ) ], [ 'id' => self::OPTION_FACEBOOK_APP_ID, 'title' => __( 'App ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter app id. Can be found in the list of apps', "anycomment" ), 'https://developers.facebook.com/apps/' ) ], [ 'id' => self::OPTION_FACEBOOK_APP_SECRET, 'title' => __( 'App Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter app secret. Can be found in the list of apps', "anycomment" ), 'https://developers.facebook.com/apps/' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_google', [ [ 'id' => self::OPTION_GOOGLE_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Google authorization', "anycomment" ) ], [ 'id' => self::OPTION_GOOGLE_CLIENT_ID, 'title' => __( 'Client ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client id. Can be found in the list of apps', "anycomment" ), 'https://console.developers.google.com/apis/credentials' ) ], [ 'id' => self::OPTION_GOOGLE_SECRET, 'title' => __( 'Client Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client secret. Can be found in the list of apps', "anycomment" ), 'https://console.developers.google.com/apis/credentials' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_github', [ [ 'id' => self::OPTION_GITHUB_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow GitHub authorization', "anycomment" ) ], [ 'id' => self::OPTION_GITHUB_CLIENT_ID, 'title' => __( 'Client ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client id. Can be found in the list of apps', "anycomment" ), 'https://github.com/settings/developers' ) ], [ 'id' => self::OPTION_GITHUB_SECRET, 'title' => __( 'Client Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client secret. Can be found in the list of apps', "anycomment" ), 'https://github.com/settings/developers' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_odnoklassniki', [ [ 'id' => self::OPTION_OK_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Odnoklassniki authorization', "anycomment" ) ], [ 'id' => self::OPTION_OK_APP_ID, 'title' => __( 'App ID', "anycomment" ), 'type' => 'text', 'description' => __( 'Enter app id. Can be found in the email sent to you by Odnoklassniki', "anycomment" ), ], [ 'id' => self::OPTION_OK_APP_KEY, 'title' => __( 'App Key', "anycomment" ), 'type' => 'text', 'description' => __( 'Enter app key. Can be found in the email sent to you by Odnoklassniki', "anycomment" ), ], [ 'id' => self::OPTION_OK_APP_SECRET, 'title' => __( 'App Secret', "anycomment" ), 'type' => 'text', 'description' => __( 'Enter client secret. Can be found in the email sent to you by Odnoklassniki', "anycomment" ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_instagram', [ [ 'id' => self::OPTION_INSTAGRAM_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Instagram authorization', "anycomment" ) ], [ 'id' => self::OPTION_INSTAGRAM_CLIENT_ID, 'title' => __( 'Client ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client id. Can be found in Manage Clients', "anycomment" ), 'https://www.instagram.com/developer/clients/manage/' ) ], [ 'id' => self::OPTION_INSTAGRAM_CLIENT_SECRET, 'title' => __( 'Client Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client secret. Can be found in Manage Clients', "anycomment" ), 'https://www.instagram.com/developer/clients/manage/' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_twitch', [ [ 'id' => self::OPTION_TWITCH_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Twitch authorization', "anycomment" ) ], [ 'id' => self::OPTION_TWITCH_CLIENT_ID, 'title' => __( 'Client ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client id. It can be found in the apps', "anycomment" ), 'https://glass.twitch.tv/console/apps' ) ], [ 'id' => self::OPTION_TWITCH_CLIENT_SECRET, 'title' => __( 'Client Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client secret. It can be found in the apps', "anycomment" ), 'https://glass.twitch.tv/console/apps' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_dribbble', [ [ 'id' => self::OPTION_DRIBBBLE_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Dribbble authorization', "anycomment" ) ], [ 'id' => self::OPTION_DRIBBBLE_CLIENT_ID, 'title' => __( 'Client ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client id. It can be found in the your applications', "anycomment" ), 'https://dribbble.com/account/applications' ) ], [ 'id' => self::OPTION_DRIBBBLE_CLIENT_SECRET, 'title' => __( 'Client Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client secret. It can be found in the your applications', "anycomment" ), 'https://dribbble.com/account/applications' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug . time(), 'section_yahoo', [ [ 'id' => self::OPTION_YAHOO_TOGGLE, 'title' => __( 'Enable', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow Yahoo authorization', "anycomment" ) ], [ 'id' => self::OPTION_YAHOO_APP_ID, 'title' => __( 'App ID', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter app id. It can be found in the my apps', "anycomment" ), 'https://developer.yahoo.com/apps/' ) ], [ 'id' => self::OPTION_YAHOO_CLIENT_SECRET, 'title' => __( 'Client Secret', "anycomment" ), 'type' => 'text', 'description' => sprintf( __( 'Enter client secret. It can be found in the my apps', "anycomment" ), 'https://developer.yahoo.com/apps/' ), 'after' => function () { ?>
page_slug ); $this->render_fields( $this->page_slug, 'section_wordpress', [ [ 'id' => self::OPTION_WORDPRESS_NATIVE_TOGGLE, 'title' => __( 'Enable Native', "anycomment" ), 'type' => 'checkbox', 'description' => __( 'Allow WordPress native authorization', "anycomment" ) ], ] ); } /** * top level menu: * callback functions * * @param bool $wrapper Whether to wrap for with header or not. */ public function page_html( $wrapper = true ) { if ( ! current_user_can( 'manage_options' ) ) { return; } if ( isset( $_GET['settings-updated'] ) ) { add_settings_error( $this->alert_key, 'anycomment_message', __( 'Settings Saved', 'anycomment' ), 'updated' ); } settings_errors( $this->alert_key ); ?>

option_group ) ?>
do_tab_sections( $this->page_slug, false ); submit_button( __( 'Save', 'anycomment' ) ); ?>
'; $i = 0; foreach ( (array) $wp_settings_sections[ $page ] as $section ) { $liClasses = ( $i == 0 ? 'current' : '' ); $liClasses .= ' ' . ( static::isEnabled( str_replace( 'section_', '', $section['id'] ) ) ? 'toggled' : '' ); $path = sprintf( AnyComment()->plugin_url() . '/assets/img/icons/auth/%s.svg', str_replace( 'section_', 'social-', $section['id'] ) ); echo '
  • ' . $section['title'] . '
  • '; $i ++; } echo ''; ?> {$section['title']}\n"; } if ( $includeHeader && $section['callback'] ) { call_user_func( $section['callback'], $section ); } if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { continue; } $social = str_replace( 'section_', '', $section['id'] ); $guide_link = static::getGuide( [ 'social' => $social ] ); echo '
    '; echo '