当前位置: 首页>>代码示例>>PHP>>正文


PHP WDWLibrary::spider_replace4byte方法代码示例

本文整理汇总了PHP中WDWLibrary::spider_replace4byte方法的典型用法代码示例。如果您正苦于以下问题:PHP WDWLibrary::spider_replace4byte方法的具体用法?PHP WDWLibrary::spider_replace4byte怎么用?PHP WDWLibrary::spider_replace4byte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WDWLibrary的用法示例。


在下文中一共展示了WDWLibrary::spider_replace4byte方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_image_db

 public function save_image_db()
 {
     global $wpdb;
     $gal_id = isset($_POST['current_id']) ? (int) $_POST['current_id'] : 0;
     $image_ids = isset($_POST['ids_string']) ? esc_html(stripslashes($_POST['ids_string'])) : '';
     $image_id_array = explode(',', $image_ids);
     foreach ($image_id_array as $image_id) {
         if ($image_id) {
             $filename = isset($_POST['input_filename_' . $image_id]) ? esc_html(stripslashes($_POST['input_filename_' . $image_id])) : '';
             $image_url = isset($_POST['image_url_' . $image_id]) ? esc_html(stripslashes($_POST['image_url_' . $image_id])) : '';
             $thumb_url = isset($_POST['thumb_url_' . $image_id]) ? esc_html(stripslashes($_POST['thumb_url_' . $image_id])) : '';
             $description = isset($_POST['image_description_' . $image_id]) ? esc_html(stripslashes($_POST['image_description_' . $image_id])) : '';
             $alt = isset($_POST['image_alt_text_' . $image_id]) ? esc_html(stripslashes($_POST['image_alt_text_' . $image_id])) : '';
             $date = isset($_POST['input_date_modified_' . $image_id]) ? esc_html(stripslashes($_POST['input_date_modified_' . $image_id])) : '';
             $size = isset($_POST['input_size_' . $image_id]) ? esc_html(stripslashes($_POST['input_size_' . $image_id])) : '';
             $filetype = isset($_POST['input_filetype_' . $image_id]) ? esc_html(stripslashes($_POST['input_filetype_' . $image_id])) : '';
             $resolution = isset($_POST['input_resolution_' . $image_id]) ? esc_html(stripslashes($_POST['input_resolution_' . $image_id])) : '';
             $order = isset($_POST['order_input_' . $image_id]) ? esc_html(stripslashes($_POST['order_input_' . $image_id])) : '';
             $redirect_url = isset($_POST['redirect_url_' . $image_id]) ? esc_html(stripslashes($_POST['redirect_url_' . $image_id])) : '';
             $author = get_current_user_id();
             $tags_ids = isset($_POST['tags_' . $image_id]) ? esc_html(stripslashes($_POST['tags_' . $image_id])) : '';
             if (strpos($image_id, 'pr_') !== FALSE) {
                 $save = $wpdb->insert($wpdb->prefix . 'bwg_image', array('gallery_id' => $gal_id, 'slug' => WDWLibrary::spider_replace4byte($alt), 'filename' => $filename, 'image_url' => $image_url, 'thumb_url' => $thumb_url, 'description' => WDWLibrary::spider_replace4byte($description), 'alt' => WDWLibrary::spider_replace4byte($alt), 'date' => $date, 'size' => $size, 'filetype' => $filetype, 'resolution' => $resolution, 'author' => $author, 'order' => $order, 'published' => 1, 'comment_count' => 0, 'avg_rating' => 0, 'rate_count' => 0, 'hit_count' => 0, 'redirect_url' => $redirect_url), array('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s'));
                 $new_image_id = (int) $wpdb->get_var('SELECT MAX(`id`) FROM ' . $wpdb->prefix . 'bwg_image');
                 if (isset($_POST['check_' . $image_id])) {
                     $_POST['check_' . $new_image_id] = 'on';
                 }
                 if (isset($_POST['image_current_id']) && esc_html($_POST['image_current_id']) == $image_id) {
                     $_POST['image_current_id'] = $new_image_id;
                 }
                 $image_id = $new_image_id;
             } else {
                 $save = $wpdb->update($wpdb->prefix . 'bwg_image', array('gallery_id' => $gal_id, 'slug' => WDWLibrary::spider_replace4byte($alt), 'filename' => $filename, 'image_url' => $image_url, 'thumb_url' => $thumb_url, 'description' => WDWLibrary::spider_replace4byte($description), 'alt' => WDWLibrary::spider_replace4byte($alt), 'date' => $date, 'size' => $size, 'filetype' => $filetype, 'resolution' => $resolution, 'author' => $author, 'order' => $order, 'redirect_url' => $redirect_url), array('id' => $image_id));
             }
             $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE image_id="%d" AND gallery_id="%d"', $image_id, $gal_id));
             if ($save !== FALSE) {
                 $tag_id_array = explode(',', $tags_ids);
                 foreach ($tag_id_array as $tag_id) {
                     if ($tag_id) {
                         if (strpos($tag_id, 'pr_') !== FALSE) {
                             $tag_id = substr($tag_id, 3);
                         }
                         $save = $wpdb->insert($wpdb->prefix . 'bwg_image_tag', array('tag_id' => $tag_id, 'image_id' => $image_id, 'gallery_id' => $gal_id), array('%d', '%d', '%d'));
                         // Increase tag count in term_taxonomy table.
                         $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'term_taxonomy SET count="%d" WHERE term_id="%d"', $wpdb->get_var($wpdb->prepare('SELECT COUNT(image_id) FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $tag_id)), $tag_id));
                     }
                 }
             }
         }
     }
 }
开发者ID:pbhanu1994,项目名称:bhanuprakash,代码行数:51,代码来源:BWGControllerGalleries_bwg.php


注:本文中的WDWLibrary::spider_replace4byte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。