pull/132/head
spirit 2019-11-15 09:23:07 +08:00
parent 3ac9b3a8f5
commit 07f32152d5
4 changed files with 9 additions and 7 deletions

View File

@ -203,7 +203,9 @@ function sakura_scripts() {
'ajaxurl' => admin_url('admin-ajax.php'),
'order' => get_option('comment_order'), // ajax comments
'formpostion' => 'bottom', // ajax comments 默认为bottom如果你的表单在顶部则设置为top。
'reply_link_version' => $reply_link_version
'reply_link_version' => $reply_link_version,
'api' => esc_url_raw( rest_url() ),
'nonce' => wp_create_nonce( 'wp_rest' )
));
}
add_action( 'wp_enqueue_scripts', 'sakura_scripts' );
@ -1640,4 +1642,4 @@ function sakura_comment_notify($comment_id){
}
add_action('comment_post', 'sakura_comment_notify');
//code end
//code end

View File

@ -77,7 +77,7 @@ window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}
</script>
<?php endif; ?>
</head>
<body nonce-data="<?php echo wp_create_nonce( 'wp_rest' ); ?>" <?php body_class(); ?>>
<body <?php body_class(); ?>>
<?php if(get_template_directory_uri() != get_site_url().'/wp-content/themes/Sakura') echo '<div style="position:fixed;height:100%;width:100%;top:0;left:0;font-size:20px;z-index:999999;background-color: #fff;">Plz rename the theme folder name as <span style="color:red">Sakura</span>!<br>请将主题文件夹名改为 <span style="color:red">Sakura</span></div>'; ?>
<?php if(!function_exists('curl_exec')) echo '<div style="position:fixed;height:100%;width:100%;top:0;left:0;font-size:20px;z-index:999999;background-color: #fff;">主题需要 PHP 的 curl 支持!请在 `php.ini` 里开启或者联系你的主机商。<br>The theme requires PHP\'s curl support! Please turn on in `php.ini` or contact your hosting provider.</div>'; ?>
<div class="scrollbar" id="bar"></div>

View File

@ -215,7 +215,7 @@ function SMMS_API($image)
/*
* 定制实时搜索 rest api
* @rest api接口路径https://sakura.2heng.xin/wp-json/cache_search/v1/json/
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/cache_search/json
* @可在cache_search_json()函数末尾通过设置 HTTP header 控制 json 缓存时间
*/
function cache_search_json()

View File

@ -182,7 +182,7 @@ function attach_image() {
var formData = new FormData();
formData.append('cmt_img_file', f);
$.ajax({
url: '/wp-json/sakura/v1/image/upload/?_wpnonce='+$('body').attr('nonce-data'),
url: Poi.api + 'sakura/v1/image/upload?_wpnonce=' + Poi.nonce,
type: 'POST',
processData: false,
contentType: false,
@ -1376,7 +1376,7 @@ var home = location.href,
$('html').css('overflow-y', 'hidden');
if (mashiro_option.live_search) {
var QueryStorage = [];
search_a("https://" + document.domain + "/wp-json/sakura/v1/cache_search/json");
search_a(Poi.api + "sakura/v1/cache_search/json");
var otxt = addComment.I("search-input"),
list = addComment.I("PostlistBox"),
@ -1871,4 +1871,4 @@ if ((isWebkit || isOpera || isIe) && document.getElementById && window.addEventL
element.focus();
}
}, false);
}
}