Пример #1
0
function content_excerpt($count = 400, $string = '')
{
    global $post;
    $content = apply_filters('the_content', $post->post_content);
    $content_text = delete_html($content);
    return wp_trim_words($content_text, $count, $string);
}
Пример #2
0
/**
 * 生成详细页静态
 * @param string $mod
 * @param unknown $id
 * @param unknown $newhtml
 * @param string $old_html
 * @return boolean
 */
function _html_view($mod = 'scenic/view', $id, $newhtml, $old_html = '')
{
    if (!empty($old_html) && $newhtml != $old_html) {
        delete_html($old_html);
    }
    $config = get_config();
    $content = curl("{$config['base_url']}index.php/{$mod}/{$id}");
    if (empty($content)) {
        return false;
    }
    return create_html($newhtml, $content);
}
Пример #3
0
 private function save_share_upload()
 {
     $cover_url = $this->spArgs('cover_filename');
     $all_files = $this->spArgs('all_files');
     //$all_files_arr = explode('|', $all_files);
     $all_files_arr = unserialize(stripslashes($all_files));
     $length = array_length($all_files_arr);
     if ($this->permission['other_permission']['upload_maxnum'] && $length > $this->permission['other_permission']['upload_maxnum']) {
         $this->ajax_failed_response(T('reach_upload_maxnum') . $this->permission['other_permission']['upload_maxnum']);
     }
     $file_name = $this->current_user['user_id'] . '_' . time() . '';
     $date_dir = '/data/attachments/' . date("Y/m/d/");
     !is_dir(APP_PATH . $date_dir) && @mkdir(APP_PATH . $date_dir, 0777, true);
     $this->save_upload_file($cover_url, $date_dir, $file_name, true);
     $img_array = array();
     foreach ($all_files_arr as $key => $up_image) {
         if ($up_image && trim($up_image['url']) != '') {
             if ($up_image['cover']) {
                 $img_array[] = array('id' => $key, 'url' => $date_dir . $file_name, 'desc' => delete_html($up_image['desc']), 'cover' => $up_image['cover']);
                 continue;
             }
             $this->save_upload_file($up_image['url'], $date_dir, $file_name . '_' . $key, false);
             $img_array[] = array('id' => $key, 'url' => $date_dir . $file_name . '_' . $key, 'desc' => delete_html($up_image['desc']), 'cover' => $up_image['cover']);
         }
     }
     $this->create_share_item($date_dir . $file_name, array_length($img_array), $img_array);
     return true;
 }