Skip to content

Commit

Permalink
1217
Browse files Browse the repository at this point in the history
  • Loading branch information
owen0o0 committed Dec 17, 2019
1 parent 0b52122 commit 3d381e7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
4 changes: 1 addition & 3 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@
<?php endif; ?>
<?php wp_footer(); ?>
<!-- 自定义代码 -->
<script>
<?php echo io_get_option('foot_code');?>
</script>
<?php echo io_get_option('code_2_footer');?>
<!-- end 自定义代码 -->
</body>
</html>
Binary file removed inc/frame/._.DS_Store
Binary file not shown.
Binary file removed inc/frame/assets/._.DS_Store
Binary file not shown.
23 changes: 11 additions & 12 deletions inc/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"sites_link" => array(
"name" => "_sites_link",
"std" => "",
"title" => "输入网址链接,需包含 http(s)://",
"title" => "输入网址链接,需包含 http(s)://<br><span style='font-weight: normal;color: crimson;margin-top: 10px;display: block;'>注意:“网址”和“公众号二维码”两者可同时填写,但是至少填一项。</span>",
"type"=>"text"),

"sites_sescribe" => array(
Expand Down Expand Up @@ -48,7 +48,7 @@ function new_meta_sites_boxes() {
global $post, $new_meta_sites_boxes;
//获取保存
foreach ($new_meta_sites_boxes as $meta_box) {
$meta_box_value = get_post_meta($post->ID, $meta_box['name'] . '', true);
$meta_box_value = get_post_meta($post->ID, $meta_box['name'] , true);
if ($meta_box_value != "")
//将默认值替换为已保存的值
$meta_box['std'] = $meta_box_value;
Expand All @@ -59,15 +59,15 @@ function new_meta_sites_boxes() {
echo '<h4>' . $meta_box['title'] . '</h4>';
break;
case 'text':
echo '<h4>' . $meta_box['title'] . '</h4>';
echo '<h4 style="margin-bottom: 0;">' . $meta_box['title'] . '</h4>';
echo '<span class="form-field"><input type="text" size="40" name="' . $meta_box['name'] . '" value="' . $meta_box['std'] . '" /></span><br />';
break;
case 'textarea':
echo '<h4>' . $meta_box['title'] . '</h4>';
echo '<h4 style="margin-bottom: 0;">' . $meta_box['title'] . '</h4>';
echo '<textarea id="seo-excerpt" cols="40" rows="2" name="' . $meta_box['name'] . '">' . $meta_box['std'] . '</textarea><br />';
break;
case 'radio':
echo '<h4>' . $meta_box['title'] . '</h4>';
echo '<h4 style="margin-bottom: 0;">' . $meta_box['title'] . '</h4>';
$counter = 1;
foreach ($meta_box['buttons'] as $radiobutton) {
$checked = "";
Expand All @@ -86,9 +86,8 @@ function new_meta_sites_boxes() {
break;
case 'upload':
$button_text = (isset($meta_box['button_text'])) ? $meta_box['button_text'] : 'Upload';
echo '<h4>' . $meta_box['title'] . '</h4>';
echo '<h4 style="margin-bottom: 0;">' . $meta_box['title'] . '</h4>';
echo '<input class="damiwp_url_input" style="width: 95%;margin-bottom: 10px;" type="text" id="'.$meta_box['name'].'_input" size="'.$meta_box['size'].'" value="'.$meta_box['std'].'" name="'.$meta_box['name'].'"/><br><a href="#" id="'.$meta_box['name'].'" class="dami_upload_button button">'.$button_text.'</a>';
//add_script_and_styles();
break;
}
}
Expand All @@ -102,18 +101,18 @@ function create_meta_sites_box() {
function save_sites_postdata($post_id) {
global $post, $new_meta_sites_boxes;
foreach ($new_meta_sites_boxes as $meta_box) {
if (!wp_verify_nonce($_POST[$meta_box['name'] . '_noncename'], plugin_basename(__FILE__))) {
if (!wp_verify_nonce((@$_POST[$meta_box['name'] . '_noncename']), plugin_basename(__FILE__))) {
return $post_id;
}
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) return $post_id;
} else {
if (!current_user_can('edit_post', $post_id)) return $post_id;
}
$data = $_POST[$meta_box['name'] . ''];
if (get_post_meta($post_id, $meta_box['name'] . '') == "") add_post_meta($post_id, $meta_box['name'] . '', $data, true);
elseif ($data != get_post_meta($post_id, $meta_box['name'] . '', true)) update_post_meta($post_id, $meta_box['name'] . '', $data);
elseif ($data == "") delete_post_meta($post_id, $meta_box['name'] . '', get_post_meta($post_id, $meta_box['name'] . '', true));
$data = $_POST[$meta_box['name'] ];
if (get_post_meta($post_id, $meta_box['name'] ) == "") add_post_meta($post_id, $meta_box['name'] , $data, true);
elseif ($data != get_post_meta($post_id, $meta_box['name'] , true)) update_post_meta($post_id, $meta_box['name'] , $data);
elseif ($data == "") delete_post_meta($post_id, $meta_box['name'] , get_post_meta($post_id, $meta_box['name'] , true));
}
}
add_action('admin_menu', 'create_meta_sites_box');
Expand Down
2 changes: 1 addition & 1 deletion inc/post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function io_save_quick_edit_data($post_id) {
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id;
// 验证权限,'sites' 为文章类型,默认为 'post' ,这里为我自定义的文章类型'sites'
if ( 'sites' == $_POST['post_type'] ) {
if ( 'sites' == @$_POST['post_type'] ) {
if ( !current_user_can( 'edit_page', $post_id ) )
return $post_id;
} else {
Expand Down
3 changes: 2 additions & 1 deletion single-sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@

<p><?php echo get_post_meta(get_the_ID(), '_sites_sescribe', true) ?></p>
<?php
$qrurl="https://my.tv.sohu.com/user/a/wvideo/getQRCode.do?width=150&height=150&text=". $m_link_url;
$m_post_link_url = $m_link_url ?: get_permalink($post->ID);
$qrurl="https://my.tv.sohu.com/user/a/wvideo/getQRCode.do?width=150&height=150&text=". $m_post_link_url;
$qrname = "手机查看";
if(get_post_meta(get_the_ID(), '_wechat_qr', true)){
$qrurl=get_post_meta(get_the_ID(), '_wechat_qr', true);
Expand Down

0 comments on commit 3d381e7

Please sign in to comment.