jetpack_comments = $jetpack_comments; // Setup settings add_action( 'admin_init', array( $this, 'add_settings' ) ); $this->setup_globals(); } /** Private Methods *******************************************************/ /** * Set any global variables or class variables * @since JetpackComments (1.4) */ protected function setup_globals() { // Default option values $this->default_greeting = __( 'Leave a Reply', 'jetpack' ); // Possible color schemes $this->color_schemes = array( 'light' => __( 'Light', 'jetpack' ), 'dark' => __( 'Dark', 'jetpack' ), 'transparent' => __( 'Transparent', 'jetpack' ), ); } /** Settings **************************************************************/ /** * Add the Jetpack settings to WordPress's discussions page * * @since JetpackComments (1.4) */ public function add_settings() { // Create the section add_settings_section( 'jetpack_comment_form', __( 'Comments', 'jetpack' ), array( $this, 'comment_form_settings_section' ), 'discussion' ); /** Clever Greeting ***************************************************/ add_settings_field( 'highlander_comment_form_prompt', __( 'Greeting Text', 'jetpack' ), array( $this, 'comment_form_greeting_setting' ), 'discussion', 'jetpack_comment_form' ); register_setting( 'discussion', 'highlander_comment_form_prompt', array( $this, 'comment_form_greeting_sanitize' ) ); /** Color Scheme ******************************************************/ add_settings_field( 'jetpack_comment_form_color_scheme', __( 'Color Scheme', 'jetpack' ), array( $this, 'comment_form_color_scheme_setting' ), 'discussion', 'jetpack_comment_form' ); register_setting( 'discussion', 'jetpack_comment_form_color_scheme', array( $this, 'comment_form_color_scheme_sanitize' ) ); } /** * Discussions setting section blurb * * @since JetpackComments (1.4) */ public function comment_form_settings_section() { ?>
default_greeting ); ?> default_greeting == $val ) ) { delete_option( 'highlander_comment_form_prompt' ); return false; } return wp_kses( $val, array() ); } /** * Color Scheme Setting * * @since JetpackComments (1.4) */ public function comment_form_color_scheme_setting() { // The color scheme $scheme = get_option( 'jetpack_comment_form_color_scheme', $this->jetpack_comments->default_color_scheme ); ?> color_schemes ) ) // ... unknown || $val == $this->jetpack_comments->default_color_scheme // ... or the default ) { delete_option( 'jetpack_comment_form_color_scheme' ); return false; } return $val; } } Jetpack_Comments_Settings::init();