feat: add smtp test function (#141)

pull/155/head
Seaton Jiang 2020-02-23 15:03:21 +08:00
parent ad7cd532e8
commit c26ab00926
6 changed files with 352 additions and 317 deletions

View File

@ -62,6 +62,7 @@ class Options_Framework_Admin {
// Displays notice after options save // Displays notice after options save
add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) ); 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() public function add_top_options_page()
@ -252,20 +253,27 @@ class Options_Framework_Admin {
} }
} }
// Hook to run after validation if ( isset( $_POST['sendmail'] ) ) {
do_action( 'optionsframework_after_validate', $clean ); wp_mail( get_bloginfo( 'admin_email' ) ,__('[测试]邮件服务配置成功', 'kratos'),__('恭喜您 SMTP 邮件服务配置成功!', 'kratos'));
do_action( 'optionsframework_after_sendmail', $clean );
return $clean; return $clean;
} else {
do_action( 'optionsframework_after_validate', $clean );
return $clean;
}
} }
/** /**
* Display message when options have been saved * Display message when options have been saved
*/ */
function save_options_notice() { function save_options_notice() {
add_settings_error( 'options-framework', 'save_options', __( '保存成功', 'kratos' ), 'updated fade' ); 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 * Get the default values for all the theme options
* *

View File

@ -7,281 +7,284 @@
* @copyright 2010-2014 WP Theming * @copyright 2010-2014 WP Theming
*/ */
class Options_Framework_Interface { class Options_Framework_Interface
{
/** /**
* Generates the tabs that are used in the options menu * Generates the tabs that are used in the options menu
*/ */
static function optionsframework_tabs() { public static function optionsframework_tabs()
$counter = 0; {
$options = & Options_Framework::_optionsframework_options(); $counter = 0;
$menu = ''; $options = &Options_Framework::_optionsframework_options();
$menu = '';
foreach ( $options as $value ) { foreach ($options as $value) {
// Heading for Navigation // Heading for Navigation
if ( $value['type'] == "heading" ) { if ($value['type'] == "heading") {
$counter++; $counter++;
$class = ''; $class = '';
$class = ! empty( $value['id'] ) ? $value['id'] : $value['name']; $class = !empty($value['id']) ? $value['id'] : $value['name'];
$class = preg_replace( '/[^a-zA-Z0-9._\-]/', '', strtolower($class) ) . '-tab'; $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class)) . '-tab';
$menu .= '<a id="options-group-'. $counter . '-tab" class="nav-tab ' . $class .'" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#options-group-'. $counter ) . '">' . esc_html( $value['name'] ) . '</a>'; $menu .= '<a id="options-group-' . $counter . '-tab" class="nav-tab ' . $class . '" title="' . esc_attr($value['name']) . '" href="' . esc_attr('#options-group-' . $counter) . '">' . esc_html($value['name']) . '</a>';
} }
} }
return $menu; return $menu;
} }
/** /**
* Generates the options fields that are used in the form. * Generates the options fields that are used in the form.
*/ */
static function optionsframework_fields() { public static function optionsframework_fields()
{
global $allowedtags; global $allowedtags;
$options_framework = new Options_Framework; $options_framework = new Options_Framework;
$option_name = $options_framework->get_option_name(); $option_name = $options_framework->get_option_name();
$settings = get_option( $option_name ); $settings = get_option($option_name);
$options = & Options_Framework::_optionsframework_options(); $options = &Options_Framework::_optionsframework_options();
$counter = 0; $counter = 0;
$menu = ''; $menu = '';
foreach ( $options as $value ) { foreach ($options as $value) {
$val = ''; $val = '';
$select_value = ''; $select_value = '';
$output = ''; $output = '';
// Wrap all options // Wrap all options
if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) && ( $value['type'] != "about" ) ) { if (($value['type'] != "heading") && ($value['type'] != "info") && ($value['type'] != "about")) {
// Keep all ids lowercase with no spaces // Keep all ids lowercase with no spaces
$value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id']) ); $value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['id']));
$id = 'section-' . $value['id']; $id = 'section-' . $value['id'];
$class = 'section'; $class = 'section';
if ( isset( $value['type'] ) ) { if (isset($value['type'])) {
$class .= ' section-' . $value['type']; $class .= ' section-' . $value['type'];
} }
if ( isset( $value['class'] ) ) { if (isset($value['class'])) {
$class .= ' ' . $value['class']; $class .= ' ' . $value['class'];
} }
$output .= '<div id="' . esc_attr( $id ) .'" class="' . esc_attr( $class ) . '">'."\n"; $output .= '<div id="' . esc_attr($id) . '" class="' . esc_attr($class) . '">' . "\n";
if ( isset( $value['name'] ) ) { if (isset($value['name'])) {
$output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n"; $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
} }
if ( $value['type'] != 'editor' ) { if ($value['type'] != 'editor') {
$output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n"; $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
} } else {
else { $output .= '<div class="option">' . "\n" . '<div>' . "\n";
$output .= '<div class="option">' . "\n" . '<div>' . "\n"; }
} }
}
// Set default value to $val // Set default value to $val
if ( isset( $value['std'] ) ) { if (isset($value['std'])) {
$val = $value['std']; $val = $value['std'];
} }
// If the option is already saved, override $val // If the option is already saved, override $val
if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') && ( $value['type'] != "about" ) ) { if (($value['type'] != 'heading') && ($value['type'] != 'info') && ($value['type'] != "about")) {
if ( isset( $settings[($value['id'])]) ) { if (isset($settings[($value['id'])])) {
$val = $settings[($value['id'])]; $val = $settings[($value['id'])];
// Striping slashes of non-array options // Striping slashes of non-array options
if ( !is_array($val) ) { if (!is_array($val)) {
$val = stripslashes( $val ); $val = stripslashes($val);
} }
} }
} }
// If there is a description save it for labels // If there is a description save it for labels
$explain_value = ''; $explain_value = '';
if ( isset( $value['desc'] ) ) { if (isset($value['desc'])) {
$explain_value = $value['desc']; $explain_value = $value['desc'];
} }
// Set the placeholder if one exists // Set the placeholder if one exists
$placeholder = ''; $placeholder = '';
if ( isset( $value['placeholder'] ) ) { if (isset($value['placeholder'])) {
$placeholder = ' placeholder="' . esc_attr( $value['placeholder'] ) . '"'; $placeholder = ' placeholder="' . esc_attr($value['placeholder']) . '"';
} }
if ( has_filter( 'optionsframework_' . $value['type'] ) ) { if (has_filter('optionsframework_' . $value['type'])) {
$output .= apply_filters( 'optionsframework_' . $value['type'], $option_name, $value, $val ); $output .= apply_filters('optionsframework_' . $value['type'], $option_name, $value, $val);
} }
switch ($value['type']) {
switch ( $value['type'] ) { // Basic text input
case 'text':
$output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="text" value="' . esc_attr($val) . '"' . $placeholder . ' />';
break;
// Basic text input // Password input
case 'text': case 'password':
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '"' . $placeholder . ' />'; $output .= '<input id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" type="password" value="' . esc_attr($val) . '" />';
break; break;
// Password input // Textarea
case 'password': case 'textarea':
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="password" value="' . esc_attr( $val ) . '" />'; $rows = '8';
break;
// Textarea if (isset($value['settings']['rows'])) {
case 'textarea': $custom_rows = $value['settings']['rows'];
$rows = '8'; if (is_numeric($custom_rows)) {
$rows = $custom_rows;
}
}
if ( isset( $value['settings']['rows'] ) ) { $val = stripslashes($val);
$custom_rows = $value['settings']['rows']; $output .= '<textarea id="' . esc_attr($value['id']) . '" class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea($val) . '</textarea>';
if ( is_numeric( $custom_rows ) ) { break;
$rows = $custom_rows;
}
}
$val = stripslashes( $val ); // Select Box
$output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea( $val ) . '</textarea>'; case 'select':
break; $output .= '<select class="of-input" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '">';
// Select Box foreach ($value['options'] as $key => $option) {
case 'select': $output .= '<option' . selected($val, $key, false) . ' value="' . esc_attr($key) . '">' . esc_html($option) . '</option>';
$output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '">'; }
$output .= '</select>';
break;
foreach ($value['options'] as $key => $option ) { // Radio Box
$output .= '<option'. selected( $val, $key, false ) .' value="' . esc_attr( $key ) . '">' . esc_html( $option ) . '</option>'; case "radio":
} $name = $option_name . '[' . $value['id'] . ']';
$output .= '</select>'; foreach ($value['options'] as $key => $option) {
break; $id = $option_name . '-' . $value['id'] . '-' . $key;
$output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr($name) . '" id="' . esc_attr($id) . '" value="' . esc_attr($key) . '" ' . checked($val, $key, false) . ' /><label for="' . esc_attr($id) . '">' . esc_html($option) . '</label>';
}
break;
// Image Selectors
case "images":
$name = $option_name . '[' . $value['id'] . ']';
foreach ($value['options'] as $key => $option) {
$selected = '';
if ($val != '' && ($val == $key)) {
$selected = ' of-radio-img-selected';
}
$output .= '<input type="radio" id="' . esc_attr($value['id'] . '_' . $key) . '" class="of-radio-img-radio" value="' . esc_attr($key) . '" name="' . esc_attr($name) . '" ' . checked($val, $key, false) . ' />';
$output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
$output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
}
break;
// Radio Box // Checkbox
case "radio": case "checkbox":
$name = $option_name .'['. $value['id'] .']'; $output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
foreach ($value['options'] as $key => $option) { $output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
$id = $option_name . '-' . $value['id'] .'-'. $key; break;
$output .= '<input class="of-input of-radio" type="radio" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" value="'. esc_attr( $key ) . '" '. checked( $val, $key, false) .' /><label for="' . esc_attr( $id ) . '">' . esc_html( $option ) . '</label>';
}
break;
// Image Selectors // Color picker
case "images": case "color":
$name = $option_name .'['. $value['id'] .']'; $default_color = '';
foreach ( $value['options'] as $key => $option ) { if (isset($value['std'])) {
$selected = ''; if ($val != $value['std']) {
if ( $val != '' && ($val == $key) ) { $default_color = ' data-default-color="' . $value['std'] . '" ';
$selected = ' of-radio-img-selected'; }
}
$output .= '<input type="radio" id="' . esc_attr( $value['id'] .'_'. $key) . '" class="of-radio-img-radio" value="' . esc_attr( $key ) . '" name="' . esc_attr( $name ) . '" '. checked( $val, $key, false ) .' />';
$output .= '<div class="of-radio-img-label">' . esc_html( $key ) . '</div>';
$output .= '<img src="' . esc_url( $option ) . '" alt="' . $option .'" class="of-radio-img-img' . $selected .'" onclick="document.getElementById(\''. esc_attr($value['id'] .'_'. $key) .'\').checked=true;" />';
}
break;
// Checkbox }
case "checkbox": $output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color" type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" '. checked( $val, 1, false) .' />';
$output .= '<label class="explain" for="' . esc_attr( $value['id'] ) . '">' . wp_kses( $explain_value, $allowedtags) . '</label>';
break;
// Color picker
case "color":
$default_color = '';
if ( isset($value['std']) ) {
if ( $val != $value['std'] )
$default_color = ' data-default-color="' .$value['std'] . '" ';
}
$output .= '<input name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" id="' . esc_attr( $value['id'] ) . '" class="of-color" type="text" value="' . esc_attr( $val ) . '"' . $default_color .' />';
break; break;
// Uploader // Uploader
case "upload": case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader( $value['id'], $val, null ); $output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break; break;
case "info": case "info":
$id = ''; $id = '';
$class = 'section'; $class = 'section';
if ( isset( $value['id'] ) ) { if (isset($value['id'])) {
$id = 'id="' . esc_attr( $value['id'] ) . '" '; $id = 'id="' . esc_attr($value['id']) . '" ';
} }
if ( isset( $value['type'] ) ) { if (isset($value['type'])) {
$class .= ' section-' . $value['type']; $class .= ' section-' . $value['type'];
} }
if ( isset( $value['class'] ) ) { if (isset($value['class'])) {
$class .= ' ' . $value['class']; $class .= ' ' . $value['class'];
} }
$output .= '<div ' . $id . 'class="' . esc_attr( $class ) . '">' . "\n"; $output .= '<div ' . $id . 'class="' . esc_attr($class) . '">' . "\n";
if ( isset($value['name']) ) { if (isset($value['name'])) {
$output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n"; $output .= '<h4 class="heading">' . esc_html($value['name']) . '</h4>' . "\n";
} }
if ( isset( $value['desc'] ) ) { if (isset($value['desc'])) {
$output .= $value['desc'] . "\n"; $output .= $value['desc'] . "\n";
} }
$output .= '</div>' . "\n"; $output .= '</div>' . "\n";
break; break;
case "about": case "about":
global $wp_version; global $wp_version;
$version = $wp_version; $version = $wp_version;
$output .= '<div class="section section-info"> $output .= '<div class="about-content">
<div class="about-content"> <img src="' . get_template_directory_uri() . '/inc/options-framework/images/about.png">
<img src="'. get_template_directory_uri() .'/inc/options-framework/images/about.png"> <h4>' . __('基础信息', 'kratos') . '</h3>
<h4>'. __('基础信息','kratos') .'</h3>
<ul> <ul>
<li>'. __('PHP 版本:','kratos') . PHP_VERSION .'</li> <li>' . __('PHP 版本:', 'kratos') . PHP_VERSION . '</li>
<li>'. __('Kratos 版本:','kratos') . THEME_VERSION .'</li> <li>' . __('Kratos 版本:', 'kratos') . THEME_VERSION . '</li>
<li>'. __('WordPress 版本:','kratos') . $version .'</li> <li>' . __('WordPress 版本:', 'kratos') . $version . '</li>
<li>'. __('User Agent 信息:','kratos') . $_SERVER['HTTP_USER_AGENT'] .'</li> <li>' . __('User Agent 信息:', 'kratos') . $_SERVER['HTTP_USER_AGENT'] . '</li>
</ul> </ul>
<p class="notices">'. __('提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息中。','kratos') .'</p> <p class="notices">' . __('提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息中。', 'kratos') . '</p>
<h4>'. __('资料文档','kratos') .'</h3> <h4>' . __('资料文档', 'kratos') . '</h3>
<ul> <ul>
<li>'. __('说明文档:','kratos') .'<a href="https://www.vtrois.com/" target="_blank">https://www.vtrois.com/</a></li> <li>' . __('说明文档:', 'kratos') . '<a href="https://www.vtrois.com/" target="_blank">https://www.vtrois.com/</a></li>
<li>'. __('代码托管:','kratos') .'<a href="https://github.com/vtrois/kratos" target="_blank">https://github.com/vtrois/kratos</a></li> <li>' . __('代码托管:', 'kratos') . '<a href="https://github.com/vtrois/kratos" target="_blank">https://github.com/vtrois/kratos</a></li>
<li>'. __('问题反馈:','kratos') .'<a href="https://github.com/vtrois/kratos/issues" target="_blank">https://github.com/vtrois/kratos/issues</a></li> <li>' . __('问题反馈:', 'kratos') . '<a href="https://github.com/vtrois/kratos/issues" target="_blank">https://github.com/vtrois/kratos/issues</a></li>
<li>'. __('更新日志:','kratos') .'<a href="https://github.com/vtrois/kratos/releases" target="_blank">https://github.com/vtrois/kratos/releases</a></li> <li>' . __('更新日志:', 'kratos') . '<a href="https://github.com/vtrois/kratos/releases" target="_blank">https://github.com/vtrois/kratos/releases</a></li>
</ul> </ul>
<h4>'. __('讨论交流','kratos') .'</h3> <h4>' . __('讨论交流', 'kratos') . '</h3>
<p>'. __('欢迎使用 Kratos 主题开始文章创作,诚邀您加入主题交流 QQ 群:<a href="https://shang.qq.com/wpa/qunwpa?idkey=18a1de727037e3e8b9b49bfc7a410139e5db736106ef07292f07a62ff5eef9a2" target="_blank">734508</a>','kratos') .'</p> <p>' . __('欢迎使用 Kratos 主题开始文章创作,诚邀您加入主题交流 QQ 群:<a href="https://shang.qq.com/wpa/qunwpa?idkey=18a1de727037e3e8b9b49bfc7a410139e5db736106ef07292f07a62ff5eef9a2" target="_blank">734508</a>', 'kratos') . '</p>
<h4>'. __('版权声明','kratos') .'</h3> <h4>' . __('版权声明', 'kratos') . '</h3>
<p>'. __('主题源码使用 <a href="https://github.com/Vtrois/Kratos/blob/master/LICENSE" target="_blank">MIT 协议</a> 进行许可,说明文档使用 <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a> 进行许可。','kratos') .'</p> <p>' . __('主题源码使用 <a href="https://github.com/Vtrois/Kratos/blob/master/LICENSE" target="_blank">MIT 协议</a> 进行许可,说明文档使用 <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a> 进行许可。', 'kratos') . '</p>
<h4>'. __('打赏支持','kratos') .'</h3> <h4>' . __('打赏支持', 'kratos') . '</h3>
<img src="'. get_template_directory_uri() .'/inc/options-framework/images/donate.png"> <img src="' . get_template_directory_uri() . '/inc/options-framework/images/donate.png">
<p class="tips">'. __('项目的发展需要您的支持和鼓励,打赏时请确认作者姓名为<b>姜学栋</b>','kratos') .'</p> <p class="tips">' . __('项目的发展需要您的支持和鼓励,打赏时请确认作者姓名为<b>姜学栋</b>', 'kratos') . '</p>
</div> </div>';
</div>'; break;
break;
// Heading for Navigation case "sendmail":
case "heading": $output .= '<input type="submit" name="sendmail" class="button-secondary" value="' . __('测试邮件', 'kratos') . '">';
$counter++; break;
if ( $counter >= 2 ) {
$output .= '</div>'."\n";
}
$class = '';
$class = ! empty( $value['id'] ) ? $value['id'] : $value['name'];
$class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) );
$output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
$output .= '<h3>' . esc_html( $value['name'] ) . '</h3>' . "\n";
break;
}
if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) && ( $value['type'] != "about" ) ) { // Heading for Navigation
$output .= '</div>'; case "heading":
if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) { $counter++;
$output .= '<div class="explain">' . wp_kses( $explain_value, $allowedtags) . '</div>'."\n"; if ($counter >= 2) {
} $output .= '</div>' . "\n";
$output .= '</div></div>'."\n"; }
} $class = '';
$class = !empty($value['id']) ? $value['id'] : $value['name'];
$class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class));
$output .= '<div id="options-group-' . $counter . '" class="group ' . $class . '">';
$output .= '<h3>' . esc_html($value['name']) . '</h3>' . "\n";
break;
}
echo $output; if (($value['type'] != "heading") && ($value['type'] != "info") && ($value['type'] != "about")) {
} $output .= '</div>';
if (($value['type'] != "checkbox") && ($value['type'] != "editor")) {
$output .= '<div class="explain">' . wp_kses($explain_value, $allowedtags) . '</div>' . "\n";
}
$output .= '</div></div>' . "\n";
}
// Outputs closing div if there tabs echo $output;
if ( Options_Framework_Interface::optionsframework_tabs() != '' ) { }
echo '</div>';
}
}
} // Outputs closing div if there tabs
if (Options_Framework_Interface::optionsframework_tabs() != '') {
echo '</div>';
}
}
}

View File

@ -32,6 +32,7 @@ jQuery(document).ready(function($) {
jQuery('#section-m_port').fadeToggle(400); jQuery('#section-m_port').fadeToggle(400);
jQuery('#section-m_username').fadeToggle(400); jQuery('#section-m_username').fadeToggle(400);
jQuery('#section-m_passwd').fadeToggle(400); jQuery('#section-m_passwd').fadeToggle(400);
jQuery('#section-m_sendmail').fadeToggle(400);
}); });
if (jQuery('#m_smtp:checked').val() !== undefined) { if (jQuery('#m_smtp:checked').val() !== undefined) {
@ -40,6 +41,7 @@ jQuery(document).ready(function($) {
jQuery('#section-m_port').show(); jQuery('#section-m_port').show();
jQuery('#section-m_username').show(); jQuery('#section-m_username').show();
jQuery('#section-m_passwd').show(); jQuery('#section-m_passwd').show();
jQuery('#section-m_sendmail').show();
} }
// Loads the color pickers // Loads the color pickers

View File

@ -3,7 +3,7 @@
* 主题选项 * 主题选项
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.02.15 * @version 2020.02.23
*/ */
function getrobots() function getrobots()
@ -326,6 +326,12 @@ function kratos_options()
'type' => 'password', 'type' => 'password',
); );
$options[] = array(
'id' => 'm_sendmail',
'class' => 'hidden',
'type' => 'sendmail',
);
$options[] = array( $options[] = array(
'name' => __('顶部配置', 'kratos'), 'name' => __('顶部配置', 'kratos'),
'type' => 'heading', 'type' => 'heading',

View File

@ -3,7 +3,7 @@
* 侧栏小工具 * 侧栏小工具
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.02.22 * @version 2020.02.23
*/ */
// 添加小工具 // 添加小工具

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Kratos\n" "Project-Id-Version: Kratos\n"
"POT-Creation-Date: 2020-02-22 15:03+0800\n" "POT-Creation-Date: 2020-02-23 15:01+0800\n"
"PO-Revision-Date: 2020-02-14 23:32+0800\n" "PO-Revision-Date: 2020-02-14 23:32+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -66,84 +66,96 @@ msgstr ""
msgid "搜点什么呢?" msgid "搜点什么呢?"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:70
#: inc/options-framework/includes/class-options-framework-admin.php:71 #: inc/options-framework/includes/class-options-framework-admin.php:71
#: inc/options-framework/includes/class-options-framework-admin.php:84 #: inc/options-framework/includes/class-options-framework-admin.php:72
#: inc/options-framework/includes/class-options-framework-admin.php:85 #: inc/options-framework/includes/class-options-framework-admin.php:85
#: inc/options-framework/includes/class-options-framework-admin.php:86
msgid "主题设置" msgid "主题设置"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:180 #: inc/options-framework/includes/class-options-framework-admin.php:181
msgid "保存配置" msgid "保存配置"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:181 #: inc/options-framework/includes/class-options-framework-admin.php:182
msgid "恢复默认" msgid "恢复默认"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:181 #: inc/options-framework/includes/class-options-framework-admin.php:182
msgid "单击「确定」进行恢复,但所有的配置都将丢失!" msgid "单击「确定」进行恢复,但所有的配置都将丢失!"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:212 #: inc/options-framework/includes/class-options-framework-admin.php:213
msgid "恢复完成" msgid "恢复完成"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:266 #: inc/options-framework/includes/class-options-framework-admin.php:257
msgid "[测试]邮件服务配置成功"
msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:257
msgid "恭喜您 SMTP 邮件服务配置成功!"
msgstr ""
#: inc/options-framework/includes/class-options-framework-admin.php:270
msgid "保存成功" msgid "保存成功"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:229 #: inc/options-framework/includes/class-options-framework-admin.php:274
msgid "发送完成,请留意邮箱:"
msgstr ""
#: inc/options-framework/includes/class-options-interface.php:230
msgid "基础信息" msgid "基础信息"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:231 #: inc/options-framework/includes/class-options-interface.php:232
msgid "PHP 版本:" msgid "PHP 版本:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:232 #: inc/options-framework/includes/class-options-interface.php:233
msgid "Kratos 版本:" msgid "Kratos 版本:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:233 #: inc/options-framework/includes/class-options-interface.php:234
msgid "WordPress 版本:" msgid "WordPress 版本:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:234 #: inc/options-framework/includes/class-options-interface.php:235
msgid "User Agent 信息:" msgid "User Agent 信息:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:236 #: inc/options-framework/includes/class-options-interface.php:237
msgid "" msgid ""
"提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息" "提示:在提交主题相关问题反馈时,请将上面「基础信息」中的内容复制到环境信息"
"中。" "中。"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:237 #: inc/options-framework/includes/class-options-interface.php:238
msgid "资料文档" msgid "资料文档"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:239 #: inc/options-framework/includes/class-options-interface.php:240
msgid "说明文档:" msgid "说明文档:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:240 #: inc/options-framework/includes/class-options-interface.php:241
msgid "代码托管:" msgid "代码托管:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:241 #: inc/options-framework/includes/class-options-interface.php:242
msgid "问题反馈:" msgid "问题反馈:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:242 #: inc/options-framework/includes/class-options-interface.php:243
msgid "更新日志:" msgid "更新日志:"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:244 #: inc/options-framework/includes/class-options-interface.php:245
msgid "讨论交流" msgid "讨论交流"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:245 #: inc/options-framework/includes/class-options-interface.php:246
msgid "" msgid ""
"欢迎使用 Kratos 主题开始文章创作,诚邀您加入主题交流 QQ 群:<a href=" "欢迎使用 Kratos 主题开始文章创作,诚邀您加入主题交流 QQ 群:<a href="
"\"https://shang.qq.com/wpa/qunwpa?" "\"https://shang.qq.com/wpa/qunwpa?"
@ -151,11 +163,11 @@ msgid ""
"target=\"_blank\">734508</a>" "target=\"_blank\">734508</a>"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:246 #: inc/options-framework/includes/class-options-interface.php:247
msgid "版权声明" msgid "版权声明"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:247 #: inc/options-framework/includes/class-options-interface.php:248
msgid "" msgid ""
"主题源码使用 <a href=\"https://github.com/Vtrois/Kratos/blob/master/LICENSE" "主题源码使用 <a href=\"https://github.com/Vtrois/Kratos/blob/master/LICENSE"
"\" target=\"_blank\">MIT 协议</a> 进行许可,说明文档使用 <a href=\"https://" "\" target=\"_blank\">MIT 协议</a> 进行许可,说明文档使用 <a href=\"https://"
@ -163,14 +175,18 @@ msgid ""
"4.0</a> 进行许可。" "4.0</a> 进行许可。"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:248 #: inc/options-framework/includes/class-options-interface.php:249
msgid "打赏支持" msgid "打赏支持"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:250 #: inc/options-framework/includes/class-options-interface.php:251
msgid "项目的发展需要您的支持和鼓励,打赏时请确认作者姓名为<b>姜学栋</b>" msgid "项目的发展需要您的支持和鼓励,打赏时请确认作者姓名为<b>姜学栋</b>"
msgstr "" msgstr ""
#: inc/options-framework/includes/class-options-interface.php:256
msgid "测试邮件"
msgstr ""
#: inc/options-framework/includes/class-options-media-uploader.php:62 #: inc/options-framework/includes/class-options-media-uploader.php:62
msgid "没有选择任何文件" msgid "没有选择任何文件"
msgstr "" msgstr ""
@ -457,7 +473,7 @@ msgstr ""
msgid "个人昵称" msgid "个人昵称"
msgstr "" msgstr ""
#: inc/theme-options.php:271 inc/theme-widgets.php:146 #: inc/theme-options.php:271 inc/theme-widgets.php:140
msgid "个人简介" msgid "个人简介"
msgstr "" msgstr ""
@ -513,123 +529,123 @@ msgstr ""
msgid "填写邮箱密码" msgid "填写邮箱密码"
msgstr "" msgstr ""
#: inc/theme-options.php:330 #: inc/theme-options.php:336
msgid "顶部配置" msgid "顶部配置"
msgstr "" msgstr ""
#: inc/theme-options.php:335 #: inc/theme-options.php:341
msgid "顶部图片" msgid "顶部图片"
msgstr "" msgstr ""
#: inc/theme-options.php:342 #: inc/theme-options.php:348
msgid "副标题" msgid "副标题"
msgstr "" msgstr ""
#: inc/theme-options.php:349 #: inc/theme-options.php:355
msgid "标题描述" msgid "标题描述"
msgstr "" msgstr ""
#: inc/theme-options.php:356 #: inc/theme-options.php:362
msgid "页脚配置" msgid "页脚配置"
msgstr "" msgstr ""
#: inc/theme-options.php:361 #: inc/theme-options.php:367
msgid "选择需要开启的社交图标" msgid "选择需要开启的社交图标"
msgstr "" msgstr ""
#: inc/theme-options.php:362 #: inc/theme-options.php:368
msgid "国内平台" msgid "国内平台"
msgstr "" msgstr ""
#: inc/theme-options.php:367 #: inc/theme-options.php:373
msgid "新浪微博" msgid "新浪微博"
msgstr "" msgstr ""
#: inc/theme-options.php:380 #: inc/theme-options.php:386
msgid "哔哩哔哩" msgid "哔哩哔哩"
msgstr "" msgstr ""
#: inc/theme-options.php:393 #: inc/theme-options.php:399
msgid "CODING" msgid "CODING"
msgstr "" msgstr ""
#: inc/theme-options.php:406 #: inc/theme-options.php:412
msgid "码云 Gitee" msgid "码云 Gitee"
msgstr "" msgstr ""
#: inc/theme-options.php:419 #: inc/theme-options.php:425
msgid "海外平台" msgid "海外平台"
msgstr "" msgstr ""
#: inc/theme-options.php:424 #: inc/theme-options.php:430
msgid "Twitter" msgid "Twitter"
msgstr "" msgstr ""
#: inc/theme-options.php:437 #: inc/theme-options.php:443
msgid "Telegram" msgid "Telegram"
msgstr "" msgstr ""
#: inc/theme-options.php:450 #: inc/theme-options.php:456
msgid "LinkedIn" msgid "LinkedIn"
msgstr "" msgstr ""
#: inc/theme-options.php:463 #: inc/theme-options.php:469
msgid "YouTube" msgid "YouTube"
msgstr "" msgstr ""
#: inc/theme-options.php:476 #: inc/theme-options.php:482
msgid "Github" msgid "Github"
msgstr "" msgstr ""
#: inc/theme-options.php:489 #: inc/theme-options.php:495
msgid "Stack Overflow" msgid "Stack Overflow"
msgstr "" msgstr ""
#: inc/theme-options.php:502 #: inc/theme-options.php:508
msgid "其他" msgid "其他"
msgstr "" msgstr ""
#: inc/theme-options.php:507 #: inc/theme-options.php:513
msgid "电子邮箱" msgid "电子邮箱"
msgstr "" msgstr ""
#: inc/theme-options.php:520 #: inc/theme-options.php:526
msgid "工信部备案信息" msgid "工信部备案信息"
msgstr "" msgstr ""
#: inc/theme-options.php:527 #: inc/theme-options.php:533
msgid "公安网备案信息" msgid "公安网备案信息"
msgstr "" msgstr ""
#: inc/theme-options.php:534 #: inc/theme-options.php:540
msgid "公安网备案连接" msgid "公安网备案连接"
msgstr "" msgstr ""
#: inc/theme-options.php:541 #: inc/theme-options.php:547
msgid "版权信息" msgid "版权信息"
msgstr "" msgstr ""
#: inc/theme-options.php:548 #: inc/theme-options.php:554
msgid "广告配置" msgid "广告配置"
msgstr "" msgstr ""
#: inc/theme-options.php:553 #: inc/theme-options.php:559
msgid "文章页面广告" msgid "文章页面广告"
msgstr "" msgstr ""
#: inc/theme-options.php:554 #: inc/theme-options.php:560
msgid "开启顶部广告" msgid "开启顶部广告"
msgstr "" msgstr ""
#: inc/theme-options.php:567 inc/theme-options.php:587 #: inc/theme-options.php:573 inc/theme-options.php:593
msgid "选填广告连接,如果不填则只显示图片" msgid "选填广告连接,如果不填则只显示图片"
msgstr "" msgstr ""
#: inc/theme-options.php:574 #: inc/theme-options.php:580
msgid "开启底部广告" msgid "开启底部广告"
msgstr "" msgstr ""
#: inc/theme-options.php:594 #: inc/theme-options.php:600
msgid "关于主题" msgid "关于主题"
msgstr "" msgstr ""
@ -695,92 +711,92 @@ msgstr ""
msgid "侧边栏工具" msgid "侧边栏工具"
msgstr "" msgstr ""
#: inc/theme-widgets.php:77 #: inc/theme-widgets.php:71
msgid "图片广告" msgid "图片广告"
msgstr "" msgstr ""
#: inc/theme-widgets.php:78 #: inc/theme-widgets.php:72
msgid "显示自定义图片广告的工具" msgid "显示自定义图片广告的工具"
msgstr "" msgstr ""
#: inc/theme-widgets.php:94 inc/theme-widgets.php:116 #: inc/theme-widgets.php:88 inc/theme-widgets.php:110
msgid "广告" msgid "广告"
msgstr "" msgstr ""
#: inc/theme-widgets.php:122 #: inc/theme-widgets.php:116
msgid "副标题:" msgid "副标题:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:126 #: inc/theme-widgets.php:120
msgid "链接地址:" msgid "链接地址:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:130 #: inc/theme-widgets.php:124
msgid "广告图片:" msgid "广告图片:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:132 inc/theme-widgets.php:196 #: inc/theme-widgets.php:126 inc/theme-widgets.php:190
msgid "选择图片" msgid "选择图片"
msgstr "" msgstr ""
#: inc/theme-widgets.php:147 #: inc/theme-widgets.php:141
msgid "可跳转后台的个人简介展示工具" msgid "可跳转后台的个人简介展示工具"
msgstr "" msgstr ""
#: inc/theme-widgets.php:194 #: inc/theme-widgets.php:188
msgid "背景图片:" msgid "背景图片:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:208 inc/theme-widgets.php:231 #: inc/theme-widgets.php:202 inc/theme-widgets.php:225
msgid "标签聚合" msgid "标签聚合"
msgstr "" msgstr ""
#: inc/theme-widgets.php:209 #: inc/theme-widgets.php:203
msgid "文章标签的展示工具" msgid "文章标签的展示工具"
msgstr "" msgstr ""
#: inc/theme-widgets.php:254 #: inc/theme-widgets.php:248
msgid "显示数量:" msgid "显示数量:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:258 #: inc/theme-widgets.php:252
msgid "显示排序:" msgid "显示排序:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:260 #: inc/theme-widgets.php:254
msgid "降序" msgid "降序"
msgstr "" msgstr ""
#: inc/theme-widgets.php:261 #: inc/theme-widgets.php:255
msgid "升序" msgid "升序"
msgstr "" msgstr ""
#: inc/theme-widgets.php:262 inc/theme-widgets.php:292 #: inc/theme-widgets.php:256 inc/theme-widgets.php:286
#: inc/theme-widgets.php:297 #: inc/theme-widgets.php:291
msgid "随机" msgid "随机"
msgstr "" msgstr ""
#: inc/theme-widgets.php:275 #: inc/theme-widgets.php:269
msgid "文章聚合" msgid "文章聚合"
msgstr "" msgstr ""
#: inc/theme-widgets.php:276 #: inc/theme-widgets.php:270
msgid "展示最热、随机、最新文章的工具" msgid "展示最热、随机、最新文章的工具"
msgstr "" msgstr ""
#: inc/theme-widgets.php:290 inc/theme-widgets.php:295 #: inc/theme-widgets.php:284 inc/theme-widgets.php:289
msgid "最新" msgid "最新"
msgstr "" msgstr ""
#: inc/theme-widgets.php:291 inc/theme-widgets.php:296 #: inc/theme-widgets.php:285 inc/theme-widgets.php:290
msgid "热点" msgid "热点"
msgstr "" msgstr ""
#: inc/theme-widgets.php:334 #: inc/theme-widgets.php:328
msgid "展示数量:" msgid "展示数量:"
msgstr "" msgstr ""
#: inc/theme-widgets.php:338 #: inc/theme-widgets.php:332
msgid "统计天数:" msgid "统计天数:"
msgstr "" msgstr ""