diff --git a/inc/options-framework/includes/class-options-framework-admin.php b/inc/options-framework/includes/class-options-framework-admin.php index 731e356..afd40e1 100755 --- a/inc/options-framework/includes/class-options-framework-admin.php +++ b/inc/options-framework/includes/class-options-framework-admin.php @@ -62,6 +62,7 @@ class Options_Framework_Admin { // Displays notice after options save add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) ); + add_action( 'optionsframework_after_sendmail', array( $this, 'send_mail_notice' ) ); } public function add_top_options_page() @@ -252,20 +253,27 @@ class Options_Framework_Admin { } } - // Hook to run after validation - do_action( 'optionsframework_after_validate', $clean ); - - return $clean; + if ( isset( $_POST['sendmail'] ) ) { + wp_mail( get_bloginfo( 'admin_email' ) ,__('[测试]邮件服务配置成功', 'kratos'),__('恭喜您 SMTP 邮件服务配置成功!', 'kratos')); + do_action( 'optionsframework_after_sendmail', $clean ); + return $clean; + } else { + do_action( 'optionsframework_after_validate', $clean ); + return $clean; + } } /** * Display message when options have been saved */ - function save_options_notice() { add_settings_error( 'options-framework', 'save_options', __( '保存成功', 'kratos' ), 'updated fade' ); } + function send_mail_notice() { + add_settings_error( 'options-framework', 'send_mail', __( '发送完成,请留意邮箱:' . get_bloginfo( 'admin_email' ), 'kratos' ), 'updated fade' ); + } + /** * Get the default values for all the theme options * diff --git a/inc/options-framework/includes/class-options-interface.php b/inc/options-framework/includes/class-options-interface.php index 58abe5d..d9fd1af 100755 --- a/inc/options-framework/includes/class-options-interface.php +++ b/inc/options-framework/includes/class-options-interface.php @@ -7,281 +7,284 @@ * @copyright 2010-2014 WP Theming */ -class Options_Framework_Interface { +class Options_Framework_Interface +{ - /** - * Generates the tabs that are used in the options menu - */ - static function optionsframework_tabs() { - $counter = 0; - $options = & Options_Framework::_optionsframework_options(); - $menu = ''; + /** + * Generates the tabs that are used in the options menu + */ + public static function optionsframework_tabs() + { + $counter = 0; + $options = &Options_Framework::_optionsframework_options(); + $menu = ''; - foreach ( $options as $value ) { - // Heading for Navigation - if ( $value['type'] == "heading" ) { - $counter++; - $class = ''; - $class = ! empty( $value['id'] ) ? $value['id'] : $value['name']; - $class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab'; - $menu .= '' . esc_html( $value['name'] ) . ''; - } - } + foreach ($options as $value) { + // Heading for Navigation + if ($value['type'] == "heading") { + $counter++; + $class = ''; + $class = !empty($value['id']) ? $value['id'] : $value['name']; + $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class)) . '-tab'; + $menu .= '' . esc_html($value['name']) . ''; + } + } - return $menu; - } + return $menu; + } - /** - * Generates the options fields that are used in the form. - */ - static function optionsframework_fields() { + /** + * Generates the options fields that are used in the form. + */ + public static function optionsframework_fields() + { - global $allowedtags; + global $allowedtags; - $options_framework = new Options_Framework; - $option_name = $options_framework->get_option_name(); - $settings = get_option( $option_name ); - $options = & Options_Framework::_optionsframework_options(); + $options_framework = new Options_Framework; + $option_name = $options_framework->get_option_name(); + $settings = get_option($option_name); + $options = &Options_Framework::_optionsframework_options(); - $counter = 0; - $menu = ''; + $counter = 0; + $menu = ''; - foreach ( $options as $value ) { + foreach ($options as $value) { - $val = ''; - $select_value = ''; - $output = ''; + $val = ''; + $select_value = ''; + $output = ''; - // Wrap all options - if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) && ( $value['type'] != "about" ) ) { + // Wrap all options + if (($value['type'] != "heading") && ($value['type'] != "info") && ($value['type'] != "about")) { - // Keep all ids lowercase with no spaces - $value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id']) ); + // Keep all ids lowercase with no spaces + $value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id'])); - $id = 'section-' . $value['id']; + $id = 'section-' . $value['id']; - $class = 'section'; - if ( isset( $value['type'] ) ) { - $class .= ' section-' . $value['type']; - } - if ( isset( $value['class'] ) ) { - $class .= ' ' . $value['class']; - } + $class = 'section'; + if (isset($value['type'])) { + $class .= ' section-' . $value['type']; + } + if (isset($value['class'])) { + $class .= ' ' . $value['class']; + } - $output .= '
'. __('提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息中。','kratos') .'
-' . __('提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息中。', 'kratos') . '
+'. __('欢迎使用 Kratos 主题开始文章创作,诚邀您加入主题交流 QQ 群:734508','kratos') .'
-'. __('主题源码使用 MIT 协议 进行许可,说明文档使用 CC BY-NC-ND 4.0 进行许可。','kratos') .'
-'. __('项目的发展需要您的支持和鼓励,打赏时请确认作者姓名为姜学栋','kratos') .'
-' . __('欢迎使用 Kratos 主题开始文章创作,诚邀您加入主题交流 QQ 群:734508', 'kratos') . '
+' . __('主题源码使用 MIT 协议 进行许可,说明文档使用 CC BY-NC-ND 4.0 进行许可。', 'kratos') . '
+' . __('项目的发展需要您的支持和鼓励,打赏时请确认作者姓名为姜学栋', 'kratos') . '
+