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


PHP assets_server_path函数代码示例

本文整理汇总了PHP中assets_server_path函数的典型用法代码示例。如果您正苦于以下问题:PHP assets_server_path函数的具体用法?PHP assets_server_path怎么用?PHP assets_server_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: index

 function index()
 {
     $max_size = 10240 * 20000;
     $extensions = array('jpeg', 'jpg', 'png');
     $dir = ltrim(assets_server_path('property_listing/', 'images'), '/');
     $count = 0;
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['files'])) {
         // loop all files
         foreach ($_FILES['files']['name'] as $i => $name) {
             // if file not uploaded then skip it
             if (!is_uploaded_file($_FILES['files']['tmp_name'][$i])) {
                 die("file is not uploaded");
             }
             // skip large files
             if ($_FILES['files']['size'][$i] >= $max_size) {
                 die("file size is too big");
             }
             // skip unprotected files
             if (!in_array(pathinfo($name, PATHINFO_EXTENSION), $extensions)) {
                 die("invalid image file type");
             }
             // now we can move uploaded files
             if (move_uploaded_file($_FILES["files"]["tmp_name"][$i], $dir . $name)) {
                 $count++;
             }
         }
         echo json_encode(array('count' => $count));
     } else {
         echo "missing files!!!";
     }
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:31,代码来源:file_uploader.php

示例2: form_fields

 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $upload_path = assets_server_path('authors/', 'images');
     $fields['avatar_upload'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE);
     $fields['published']['order'] = 1000;
     return $fields;
 }
开发者ID:rudyondolan,项目名称:FUEL-CMS-User-Guide-Module,代码行数:8,代码来源:authors_model.php

示例3: form_fields

 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     //$fields['published']['order'] = 1000;
     $upload_path = ltrim(assets_server_path('i_property/', 'images'), "/");
     $fields['Property_info_image'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE, 'xss_clean' => TRUE, 'allowed_types' => 'jpg|jpeg|bmp|png|gif');
     return $fields;
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:8,代码来源:property_info_model.php

示例4: form_fields

 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $upload_path = assets_server_path('i_property/', 'images');
     $fields['category']['required'] = TRUE;
     $fields['category_path']['required'] = TRUE;
     $fields['category_icon'] = array('required' => TRUE, 'type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE, 'xss_clean' => TRUE, 'is_image' => TRUE, 'allowed_types' => 'jpg|jpeg|bmp|png|gif');
     $fields['category_mo_icon'] = array('required' => TRUE, 'type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE, 'xss_clean' => TRUE, 'is_image' => TRUE, 'allowed_types' => 'jpg|jpeg|bmp|png|gif');
     return $fields;
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:10,代码来源:home_category_model.php

示例5: get_create_captcha

 /**
  * Create CAPTCHA image to verify user as a human
  *
  * @return	string
  */
 public function get_create_captcha()
 {
     $this->CI->load->helper('captcha');
     $cap = create_captcha(array('img_path' => assets_server_path('captcha/', 'images'), 'img_url' => base_url() . "assets/images/captcha/", 'font_path' => './' . $this->CI->config->item('captcha_fonts_path', 'tank_auth'), 'font_size' => $this->CI->config->item('captcha_font_size', 'tank_auth'), 'img_width' => $this->CI->config->item('captcha_width', 'tank_auth'), 'img_height' => $this->CI->config->item('captcha_height', 'tank_auth'), 'show_grid' => $this->CI->config->item('captcha_grid', 'tank_auth'), 'expiration' => $this->CI->config->item('captcha_expire', 'tank_auth')));
     // Save captcha params in session
     /*$this->CI->session->set_userdata(array(
     				'captcha_word' => $cap['word'],
     				'captcha_time' => $cap['time'],
     		));*/
     $img_path = str_replace("\"", "'", $cap['image']);
     return array($img_path, $cap['word'], $cap['time']);
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:17,代码来源:CBWS_Member.php

示例6: index

 function index()
 {
     $this->_validate_user('tools/backup');
     $backup_config = $this->config->item('backup');
     $download_path = $backup_config['db_backup_path'];
     $is_writable = is_writable($download_path);
     if ($post = $this->input->post('action')) {
         // Load the DB utility class
         $this->load->dbutil();
         // Backup your entire database and assign it to a variable
         //$config = array('newline' => "\r", 'format' => 'zip');
         // need to do text here to make some fixes
         $db_back_prefs = $backup_config['db_backup_prefs'];
         $db_back_prefs['format'] = 'txt';
         $backup =& $this->dbutil->backup($db_back_prefs);
         //fixes to work with PHPMYAdmin
         $backup = str_replace('\\\\t', "\t", $backup);
         $backup = str_replace('\\\\n', '\\n', $backup);
         $backup = str_replace("\\'", "''", $backup);
         $backup = str_replace('\\\\', '', $backup);
         // load the file helper and write the file to your server
         $this->load->helper('file');
         $this->load->library('zip');
         if ($backup_config['backup_file_prefix'] == 'AUTO') {
             $this->load->helper('url');
             $backup_config['backup_file_prefix'] = url_title($this->config->item('site_name', FUEL_FOLDER), '_', TRUE);
         }
         $filename = $backup_config['backup_file_prefix'] . '_' . date('Y-m-d');
         $this->zip->add_data($filename . '.sql', $backup);
         // include assets folder
         if (!empty($_POST['include_assets'])) {
             $this->zip->read_dir(assets_server_path());
         }
         // write the zip file to a folder on your server.
         $this->zip->archive($download_path . $filename . '.zip');
         // download the file to your desktop.
         $this->zip->download($filename . '.zip');
         $msg = lang('data_backup');
         $this->logs_model->logit($msg);
     } else {
         $vars['download_path'] = $download_path;
         $vars['is_writable'] = $is_writable;
         $vars['backup_assets'] = $backup_config['backup_assets'];
         $this->_render('backup', $vars);
     }
 }
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:46,代码来源:backup.php

示例7: form_fields

 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $CI =& get_instance();
     $CI->load->module_model(FUEL_FOLDER, 'users_model');
     $CI->load->module_library(BLOG_FOLDER, 'fuel_blog');
     $options = $CI->users_model->options_list();
     $upload_image_path = assets_server_path($CI->fuel_blog->settings('asset_upload_path'));
     $fields['fuel_user_id'] = array('label' => 'User', 'type' => 'select', 'options' => $options);
     // put all project images into a projects suboflder.
     $fields['avatar_image_upload']['upload_path'] = assets_server_path($CI->fuel_blog->settings('asset_upload_path'));
     // fix the preview by adding projects in front of the image path since we are saving it in a subfolder
     if (!empty($values['avatar_image'])) {
         $fields['avatar_image_upload']['before_html'] = '<img src="' . assets_path($CI->fuel_blog->settings('asset_upload_path') . $values['avatar_image']) . '" style="float: right;"/>';
     }
     return $fields;
 }
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:17,代码来源:blog_users_model.php

示例8: form_fields

 function form_fields($values = array(), $related_fields = array())
 {
     $fields = parent::form_fields($values, $related_fields);
     $CI =& get_instance();
     $CI->load->module_model(FUEL_FOLDER, 'fuel_users_model');
     $CI->load->module_library(BLOG_FOLDER, 'fuel_blog');
     //use only fuel users not already chosen
     $where = !empty($values['fuel_user_id']) ? array('fuel_user_id !=' => $values['fuel_user_id']) : array();
     $already_used = array_keys($this->options_list('fuel_user_id', 'display_name', $where));
     if (!empty($already_used)) {
         $CI->fuel_users_model->db()->where_not_in('id', $already_used);
     }
     $options = $CI->fuel_users_model->options_list();
     $upload_image_path = assets_server_path($CI->fuel->blog->settings('asset_upload_path'));
     $fields['fuel_user_id'] = array('label' => 'User', 'type' => 'select', 'options' => $options, 'module' => 'users');
     return $fields;
 }
开发者ID:pwhsueh,项目名称:voting,代码行数:17,代码来源:blog_users_model.php

示例9: form_fields

 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $CI =& get_instance();
     $CI->load->module_library(BLOG_FOLDER, 'fuel_blog');
     $CI->load->module_model(BLOG_FOLDER, 'blog_users_model');
     $CI->load->module_model(BLOG_FOLDER, 'blog_categories_model');
     $CI->load->module_model(BLOG_FOLDER, 'blog_posts_to_categories_model');
     $blog_config = $CI->config->item('blog');
     $category_options = $CI->blog_categories_model->options_list('id', 'name', array('published' => 'yes'), 'name');
     $category_values = !empty($values['id']) ? array_keys($CI->blog_posts_to_categories_model->find_all_array_assoc('category_id', array('post_id' => $values['id'], $this->_tables['blog_categories'] . '.published' => 'yes'))) : array();
     $fields['categories'] = array('label' => 'Categories', 'type' => 'array', 'options' => $category_options, 'class' => 'add_edit blog/categories combo', 'value' => $category_values, 'mode' => 'multi');
     $user_options = $CI->blog_users_model->options_list();
     $user = $this->fuel_auth->user_data();
     $user_value = !empty($values['author_id']) ? $values['author_id'] : $user['id'];
     $author_comment = $fields['author_id']['comment'];
     $fields['author_id'] = array('label' => 'Author', 'type' => 'select', 'options' => $user_options, 'first_option' => 'Select an author...', 'value' => $user_value, 'comment' => $author_comment);
     if (!isset($values['allow_comments'])) {
         $fields['allow_comments']['value'] = $CI->fuel_blog->settings('allow_comments') ? 'yes' : 'no';
     }
     if (!empty($blog_config['formatting'])) {
         $blog_config['formatting'] = (array) $blog_config['formatting'];
         if (count($blog_config['formatting']) == 1) {
             $fields['formatting'] = array('type' => 'hidden', 'options' => current($blog_config['formatting']), 'default' => $fields['formatting']['default']);
         } else {
             $fields['formatting'] = array('type' => 'select', 'options' => $blog_config['formatting'], 'default' => $fields['formatting']['default']);
         }
     }
     $fields['published']['order'] = 10000;
     if (!is_true_val($CI->fuel_blog->settings('allow_comments'))) {
         unset($fields['allow_comments']);
     }
     $fields['upload_images'] = array('type' => 'file', 'class' => 'multifile', 'order' => 6, 'upload_path' => assets_server_path($CI->fuel_blog->settings('asset_upload_path')), 'comment' => 'Upload images to be used with your blog posts');
     unset($fields['content_filtered']);
     //$fields['date_added']['type'] = 'hidden'; // so it will auto add
     $fields['date_added']['type'] = 'datetime';
     // so it will auto add
     $fields['last_modified']['type'] = 'hidden';
     // so it will auto add
     return $fields;
 }
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:41,代码来源:blog_posts_model.php

示例10: cache

 function cache()
 {
     $this->_validate_user('manage/cache');
     $this->nav_selected = 'manage/cache';
     if ($post = $this->input->post('action')) {
         $this->load->library('cache');
         $cache_group = $this->config->item('page_cache_group', 'fuel');
         $this->cache->remove_group($cache_group);
         // also delete DWOO compiled files
         $this->load->helper('file');
         $dwoo_path = APPPATH . 'cache/dwoo/compiled/';
         if (is_dir($dwoo_path) and is_writable($dwoo_path)) {
             @delete_files($dwoo_path);
         }
         // remove asset cache files if exist
         $modules = $this->config->item('modules_allowed', 'fuel');
         $modules[] = FUEL_FOLDER;
         // fuel
         $modules[] = '';
         // main application assets
         foreach ($modules as $module) {
             // check if there is a css module assets file and load it so it will be ready when the page is ajaxed in
             $cache_folder = assets_server_path($this->asset->assets_cache_folder, 'cache', $module);
             if (is_dir($cache_folder) and is_writable($cache_folder)) {
                 @delete_files($cache_folder);
             }
         }
         $msg = lang('cache_cleared');
         $this->logs_model->logit($msg);
         $this->session->set_flashdata('success', 'The cache has been cleared.');
         redirect('fuel/manage/cache');
     } else {
         $vars['notifications'] = $this->load->view('_blocks/notifications', array(), TRUE);
         $this->_render('manage/cache', $vars);
     }
 }
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:36,代码来源:manage.php

示例11: _get_excluded_asset_server_folders

 private function _get_excluded_asset_server_folders()
 {
     $CI =& get_instance();
     $excluded = $CI->config->item('assets_excluded_dirs', 'fuel');
     $return = array();
     foreach ($excluded as $folder) {
         $return[] = assets_server_path($folder) . '/';
     }
     return $return;
 }
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:10,代码来源:assets_model.php

示例12: form_fields

 /**
  * Add FUEL specific changes to the form_fields method
  *
  * @access	public
  * @param	string
  * @param	int
  * @return	boolean
  */
 function form_fields($values = array(), $related = array())
 {
     $fields = parent::form_fields($values, $related);
     $order = 1;
     // create default images
     $upload_path = assets_server_path('', 'images');
     $order = 1;
     foreach ($fields as $key => $field) {
         $fields[$key]['order'] = $order;
         // get field names that end with _image
         if ($fields[$key]['type'] == 'string' and substr($key, -5) == 'image' or substr($key, -3) == 'img') {
             $img = '';
             if (!empty($values['id'])) {
                 if (!empty($values[$key])) {
                     $img = '<div class="img_display"><img src="' . img_path($values[$key]) . '" style="float: right;"/></div>';
                 }
             }
             $fields[$key]['class'] = 'asset_select';
             $order++;
             $fields[$key . '_upload'] = array('order' => $order, 'before_html' => $img, 'label' => '... OR upload an image', 'upload_path' => $upload_path, 'type' => 'file', 'overwrite' => TRUE);
         }
         $order++;
     }
     $yes = lang('form_enum_option_yes');
     $no = lang('form_enum_option_no');
     if (isset($fields['published'])) {
         $fields['published']['order'] = 9999;
         $fields['published']['options'] = array('yes' => $yes, 'no' => $no);
     }
     if (isset($fields['active'])) {
         $fields['active']['order'] = 9999;
         $fields['active']['options'] = array('yes' => $yes, 'no' => $no);
     }
     return $fields;
 }
开发者ID:rwestergren,项目名称:FUEL-CMS,代码行数:43,代码来源:base_module_model.php

示例13: do_code_edit

 function do_code_edit($code_id)
 {
     $module_uri = base_url() . $this->module_uri;
     if (!empty($code_id)) {
         $post_arr = $this->input->post();
         $post_arr['lang_code'] = 'zh-TW';
         $root_path = assets_server_path('code_img/' . $post_arr['code_key'] . "/" . $post_arr['lang_code'] . "/");
         if (!file_exists($root_path)) {
             mkdir($root_path, 0777, true);
         }
         $config['upload_path'] = $root_path;
         $config['allowed_types'] = 'png';
         $config['max_size'] = '9999';
         $config['max_width'] = '1024';
         $config['max_height'] = '768';
         $this->load->library('upload', $config);
         // $name = 'news_img/'.$post_arr['type']."/".$post_arr['title'].".png";
         $redirect_uri = base_url() . "fuel/code/lists?codekind_key=" . $post_arr['codekind_key'] . "&code_id=" . $post_arr['parent_id'];
         if ($this->upload->do_upload('img')) {
             $data = array('upload_data' => $this->upload->data());
             $post_arr["img"] = 'code_img/' . $post_arr['code_key'] . '/' . $post_arr['lang_code'] . '/' . $data["upload_data"]["file_name"];
         } else {
             $post_arr["img"] = $post_arr["exist_img"];
         }
         // $update_data = array();
         // $update_data['code_name'] 		= $this->input->get_post("code_name");
         // $update_data['code_key'] 		= $this->input->get_post("code_key");
         // $update_data['code_value1'] 	= $this->input->get_post("code_value1");
         // $update_data['code_value2'] 	= $this->input->get_post("code_value2");
         // $update_data['code_value3'] 	= $this->input->get_post("code_value3");
         // $update_data['lang_code'] 		= $this->input->get_post("lang_code");
         // $update_data['codekind_key'] 	= $this->input->get_post("codekind_key");
         // $update_data['parent_id'] 		= $this->input->get_post("parent_id");
         $success = $this->codekind_manage_model->code_update($code_id, $post_arr);
         if ($success) {
             $this->comm->plu_redirect($redirect_uri, 0, "更新成功");
             die;
         } else {
             $this->comm->plu_redirect($redirect_uri, 0, "更新失敗");
             die;
         }
     } else {
         $this->comm->plu_redirect($module_uri, 0, "更新失敗");
         die;
     }
     return;
 }
开发者ID:pwhsueh,项目名称:voting,代码行数:47,代码来源:codekind_manage.php

示例14: image_path

 /**
  * Returns an image based on the assets upload path
  *
  * @access	public
  * @param	string
  * @param	string
  * @param	boolean
  * @return	string
  */
 function image_path($image, $variable = NULL, $is_server = FALSE)
 {
     $base_path = $this->fuel->blog->config('asset_upload_path');
     $base_path = preg_replace('#(\\{.+\\})#U', $variable, $base_path);
     if ($is_server) {
         $folder = assets_server_path($base_path);
     } else {
         $folder = assets_path($base_path);
     }
     return $folder . $image;
 }
开发者ID:pwhsueh,项目名称:voting,代码行数:20,代码来源:Fuel_blog.php

示例15: asset_filesize

 /**
 * Returns the file size of an asset
 *
 	<code>
 	echo $this->asset->asset_filesize('banner.jpg');
 	// 20500
 
 	echo $this->asset->assets_path('banner.jpg', 'images', '', TRUE);
 	// 20.5 KB 
 	</code>
 
 * @access	public
 * @param	string	asset file name including extension
  	 * @param	string	subfolder to asset file (e.g. images, js, css... etc)
  	 * @param	string	module folder if any
  	 * @param	boolean	format
 * @return	string
 */
 public function asset_filesize($file = NULL, $path = NULL, $module = NULL, $format = TRUE)
 {
     $asset_file = assets_server_path($file, $path, $module);
     $filesize = 0;
     if (file_exists($asset_file)) {
         $filesize = filesize($asset_file);
     }
     if ($format) {
         if (!function_exists('byte_format')) {
             $CI = $this->_get_assets_config();
             $CI->load->helper('number');
         }
         $filesize = byte_format($filesize);
     }
     return $filesize;
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:34,代码来源:Asset.php


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