Browse code

アイキャッチ画像サポート一旦削除

nita authored on 2015/04/05 16:59:20
Showing 3 changed files
... ...
@@ -18,14 +18,4 @@
18 18
 }
19 19
 .rc-datetime{
20 20
     display: inline-block;
21
-}
22
-
23
-.rc_feature_image {
24
-    max-width: 100%;
25
-    max-height: 80%;
26
-    width: 50%;
27
-    height: 50%;
28
-}
29
-.rc_remove_feature_image {
30
-    display: none;
31 21
 }
32 22
\ No newline at end of file
... ...
@@ -55,30 +55,5 @@ jQuery(document).ready(function(){
55 55
         jQuery('.rc-datetime-edit').show();
56 56
         return false;
57 57
     });
58
-    // reservation feature image uploader
59
-    window.original_send_to_editor = window.send_to_editor;
60
-    window.send_to_editor = function(html){
61
-        fileurl = jQuery('img', html).attr('src');
62
-        jQuery('#rc_feature_image').val(fileurl);
63
-        tb_remove();
64
-        if(jQuery('#rc_feature_image_upload').hasClass('has_image')){
65
-            jQuery('.rc_feature_image').attr('src', fileurl);
66
-            jQuery('.rc_remove_feature_image').show();
67
-        } else {
68
-            var img = jQuery('<img>').attr('src',fileurl).addClass('rc_feature_image size-thumbnail');
69
-            jQuery('#rc_feature_image_upload').addClass('has_image').html(img);
70
-            jQuery('.rc_remove_feature_image').show();
71
-        }
72
-    };
73
-    if(jQuery('#rc_feature_image_upload').hasClass('has_image')){
74
-        jQuery('.rc_remove_feature_image').show();
75
-    }
76
-    jQuery('.rc_remove_feature_image').on('click', function(){
77
-        jQuery('#rc_feature_image').val('');
78
-        var replace_text = jQuery('#rc_feature_image_upload').attr('title');
79
-        jQuery('#rc_feature_image_upload').html(replace_text);
80
-        jQuery(this).hide();
81
-        return false;
82
-    });
83 58
 });
84 59
 
... ...
@@ -40,9 +40,7 @@ function get_rc_metas($post_id = "")
40 40
         'accept' => 'rc_reserv_accept',
41 41
         'content' => 'rc_reserv_content',
42 42
         'date' => 'rc_reserv_date',
43
-        'feature_img' => 'rc_reserv_feature_image',
44
-        'accept_feature_img' => 'rc_reserv_accept_feature_image',
45
-            );
43
+    );
46 44
     if($post_id > 0)
47 45
     {
48 46
         foreach ($base as $key => $value)
... ...
@@ -74,19 +72,6 @@ function add_rucy_metabox_inside()
74 74
     $rc_metas = get_rc_metas($post->ID);
75 75
     $reserv_accept = $rc_metas['accept'];
76 76
     $reserv_date = $rc_metas['date'];
77
-    $reserv_feature_name = $rc_keys['feature_img'];
78
-    $reserv_feature = $rc_metas['feature_img'];
79
-    $reserv_accept_feature_name = $rc_keys['accept_feature_img'];
80
-    $reserv_accept_feature = $rc_metas['accept_feature_img'];
81
-    $thumb_id = get_post_thumbnail_id($post->ID);
82
-    $reserv_feature_width = "255";
83
-    $reserv_feature_height = "255";
84
-    if($thumb_id){
85
-        $image = wp_get_attachment_image_src($thumb_id, 'thumbnail');
86
-        $reserv_feature_width = $image[1];
87
-        $reserv_feature_height = $image[2];
88
-    }
89
-    $reserv_feature_image = ($reserv_feature != '') ? '<img width="'.$reserv_feature_width.'" height="'.$reserv_feature_height.'" class="rc_feature_image" src="'.$reserv_feature.'" />' : '';
90 77
     if("" == $reserv_date)
91 78
     {
92 79
         $reserv_date = date_i18n('Y-m-d H:i:s');
... ...
@@ -176,22 +161,6 @@ function add_rucy_metabox_inside()
176 176
 </div>
177 177
 <?php 
178 178
     wp_editor($reserv_content, $rc_content_name);
179
-/*
180
- * support feature image reservation.
181
- */
182
-    if( current_theme_supports('post-thumbnails') ) {
183
-?>
184
-<fieldset>
185
-<h3><?php echo __('Featured Image for Reservation Update', RC_TXT_DOMAIN); ?></h3>
186
-<label class="rc_feature_accept">
187
-    <input type="checkbox" name="<?php echo $reserv_accept_feature_name; ?>" value="1" <?php echo ($reserv_accept_feature == "1") ? "checked" : ""; ?>> <?php _e('Accept reserve update feature image.', RC_TXT_DOMAIN); ?>
188
-</label>
189
-<p><a href="media-upload.php?type=image&TB_iframe=1&width=753&height=522&post_id=<?php echo $post->ID ?>" class="thickbox<?php echo ($reserv_feature_image != '') ? ' has_image' : ''; ?>" id="rc_feature_image_upload" title="<?php _e('Set featured image Reservation', RC_TXT_DOMAIN) ?>"><?php echo ($reserv_feature_image != '') ? $reserv_feature_image : __('Set featured image for Reservation', RC_TXT_DOMAIN); ?></a></p>
190
-<p><a href="#" class="rc_remove_feature_image"><?php _e('Remove Featured image for Reservation', RC_TXT_DOMAIN) ?></a></p>
191
-<input type="hidden" id="rc_feature_image" name="<?php echo $reserv_feature_name ?>" value="<?php echo $reserv_feature ?>" />
192
-</fieldset>
193
-<?php 
194
-    }
195 179
 }
196 180
 
197 181
 // save post meta
... ...
@@ -272,13 +241,8 @@ function update_rc_reserved_content($post_id)
272 272
     {
273 273
         $updates = array(
274 274
             'ID' => (int)$post_id,
275
-            'post_content' => $rc_metas['content'],
275
+            'post_content' => apply_filters('the_content', $rc_metas['content']),
276 276
         );
277
-        // feature_image
278
-        if(isset($rc_metas['accept_feature_img']) && "1" == $rc_metas['accept_feature_img'] &&
279
-           isset($rc_metas['feature_img']) && $rc_metas['feature_img'] != '') {
280
-            update_rc_post_thumbnail($post_id, $rc_metas['feature_img']);
281
-        }
282 277
        $upp = wp_update_post($updates,true);
283 278
     }
284 279
     $dels = get_rc_metas();
... ...
@@ -289,36 +253,6 @@ function update_rc_reserved_content($post_id)
289 289
     wp_clear_scheduled_hook(RC_CRON_HOOK, array($post_id));
290 290
 }
291 291
 
292
-function update_rc_post_thumbnail($post_id, $reserved_post_thumb_path)
293
-{
294
-    include_once(ABSPATH . 'wp-admin/includes/image.php');
295
-    $upload_dir = wp_upload_dir();
296
-    $image_data = file_get_contents($reserved_post_thumb_path);
297
-    $file_name = basename($reserved_post_thumb_path);
298
-    if(wp_mkdir_p($upload_dir['path'])) {
299
-        $file = $upload_dir['path'] . '/' . $file_name;
300
-    } else {
301
-        $file = $upload_dir['basedir'] . '/' . $file_name;
302
-    }
303
-    file_put_contents($file, $image_data);
304
-    $wp_file_type = wp_check_filetype($file_name, null);
305
-    $attachment = array(
306
-        'post_mime_type' => $wp_file_type['type'],
307
-        'post_title' => sanitize_file_name($file_name),
308
-        'post_content' => '',
309
-        'post_status' => 'inherit',
310
-    );
311
-    delete_post_thumbnail($post_id);
312
-    $attachment_id = wp_insert_attachment($attachment, $file, $post_id);
313
-    $attach_data = wp_generate_attachment_metadata($attachment_id, $file);
314
-    if(!empty($attach_data) && !is_wp_error($attach_data)){
315
-        $res = wp_update_attachment_metadata($attachment_id, $attach_data);
316
-        set_post_thumbnail($post_id, $attachment_id);
317
-        
318
-        return $res;
319
-    }
320
-}
321
-
322 292
 // add update message
323 293
 add_filter('post_updated_messages','add_rc_message');
324 294
 function add_rc_message($messages)