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


PHP userfiles_path函数代码示例

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


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

示例1: templates_path

function templates_path()
{
    static $folder;
    if (!$folder) {
        $folder = userfiles_path() . MW_TEMPLATES_FOLDER_NAME . DIRECTORY_SEPARATOR;
    }
    return $folder;
}
开发者ID:microweber,项目名称:microweber,代码行数:8,代码来源:paths.php

示例2: run

 public function run()
 {
     $removed = 0;
     $value = mw()->cache_manager->get('create_batch', $this->cache_group);
     if (isset($value['total']) and $value['total'] > 0) {
         if (isset($value['remaining']) and $value['remaining'] > 0) {
             $batch = mw()->media_manager->get_all('limit=30000');
             if ($batch) {
                 foreach ($batch as $k => $v) {
                     if (isset($v['id']) and isset($v['filename']) and $v['filename'] != false) {
                         $process = false;
                         if (stristr($v['filename'], '{SITE_URL}')) {
                             $process = true;
                         } else {
                             if (stristr($v['filename'], site_url())) {
                                 $process = true;
                             }
                         }
                         if ($process) {
                             $v['filename'] = str_ireplace('{SITE_URL}', '', $v['filename']);
                             $v['filename'] = str_ireplace(site_url(), '', $v['filename']);
                             $is_file = false;
                             $file1 = normalize_path(public_path() . DS . $v['filename'], false);
                             $file2 = normalize_path(base_path() . DS . $v['filename'], false);
                             $file3 = normalize_path(media_base_path() . DS . $v['filename'], false);
                             $file4 = normalize_path(userfiles_path() . DS . $v['filename'], false);
                             if (is_file($file1)) {
                                 $is_file = true;
                             } elseif (is_file($file2)) {
                                 $is_file = true;
                             } elseif (is_file($file3)) {
                                 $is_file = true;
                             } elseif (is_file($file4)) {
                                 $is_file = true;
                             }
                             if ($is_file == false) {
                                 mw()->media_manager->delete($v['id']);
                                 $removed++;
                             }
                         }
                     }
                 }
             }
         }
     }
     mw()->cache_manager->delete($this->cache_group);
     $resp = array('success' => "Removed " . $removed . ' items');
     return $resp;
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:49,代码来源:Worker.php

示例3: export_to_excel

 public function export_to_excel($params)
 {
     //this function is experimental
     set_time_limit(0);
     $adm = $this->app->user_manager->is_admin();
     if ($adm == false) {
         return array('error' => 'Error: not logged in as admin.' . __FILE__ . __LINE__);
     }
     if (!isset($params['id'])) {
         return array('error' => 'Please specify list id! By posting field id=the list id ');
     } else {
         $lid = intval($params['id']);
         $data = get_form_entires('limit=100000&list_id=' . $lid);
         $surl = $this->app->url_manager->site();
         $csv_output = '';
         if (is_array($data)) {
             $csv_output = 'id,';
             $csv_output .= 'created_at,';
             $csv_output .= 'user_ip,';
             foreach ($data as $item) {
                 if (isset($item['custom_fields'])) {
                     foreach ($item['custom_fields'] as $k => $v) {
                         $csv_output .= $this->app->format->no_dashes($k) . ",";
                         $csv_output .= "\t";
                     }
                 }
             }
             $csv_output .= "\n";
             foreach ($data as $item) {
                 if (isset($item['custom_fields'])) {
                     $csv_output .= $item['id'] . ",";
                     $csv_output .= "\t";
                     $csv_output .= $item['created_at'] . ",";
                     $csv_output .= "\t";
                     $csv_output .= $item['user_ip'] . ",";
                     $csv_output .= "\t";
                     foreach ($item['custom_fields'] as $item1 => $val) {
                         $output_val = $val;
                         $output_val = str_replace('{SITE_URL}', $surl, $output_val);
                         $csv_output .= $output_val . ",";
                         $csv_output .= "\t";
                     }
                     $csv_output .= "\n";
                 }
             }
         }
         $filename = 'export' . "_" . date("Y-m-d_H-i", time()) . uniqid() . '.csv';
         $filename_path = userfiles_path() . 'export' . DS . 'forms' . DS;
         $filename_path_index = userfiles_path() . 'export' . DS . 'forms' . DS . 'index.php';
         if (!is_dir($filename_path)) {
             mkdir_recursive($filename_path);
             if (!is_file($filename_path_index)) {
                 @touch($filename_path_index);
             }
         }
         $filename_path_full = $filename_path . $filename;
         file_put_contents($filename_path_full, $csv_output);
         $download = $this->app->url_manager->link_to_file($filename_path_full);
         return array('success' => 'Your file has been exported!', 'download' => $download);
     }
 }
开发者ID:biggtfish,项目名称:microweber,代码行数:61,代码来源:FormsManager.php

示例4: only_admin_access

only_admin_access();
/**
 * Simple file browser
 *
 * Gets all files from dir and output them in a template
 *
 * @package		modules
 * @subpackage	files
 * @category	modules
 */
// Explore the files via a web interface.
$script = $config['url'];
// the name of this script
$path = media_base_path();
// the path the script should access
$path_restirct = userfiles_path();
// the path the script should access
if (isset($params['path']) and trim($params['path']) != '' and trim($params['path']) != 'false') {
    $path = $params['path'];
    // the path the script should access
}
$path = str_replace('./', '', $path);
$path = str_replace('..', '', $path);
$path = urldecode($path);
$path = str_replace($path_restirct, '', $path);
//$data = rglob($path);
$params_get_files = array();
$params_get_files['directory'] = $path_restirct . $path;
if (isset($params['search'])) {
    $params_get_files['search'] = $params['search'];
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:browser.php

示例5: media_base_path

$target_path = media_base_path() . DS;
$target_path = media_base_path() . DS . $host_dir . DS . 'uploaded' . DS;
$target_path = normalize_path($target_path, 0);
$path_restirct = userfiles_path();
// the path the script should access
if (isset($_REQUEST['path']) and trim($_REQUEST['path']) != '' and trim($_REQUEST['path']) != 'false') {
    $path = urldecode($_REQUEST['path']);
    $path = html_entity_decode($path);
    $path = htmlspecialchars_decode($path, ENT_NOQUOTES);
    //$path = urldecode($path);
    $path = str_replace('%2F', '/', $path);
    //$path = str_replace('%25252F','/',$path);
    $path = normalize_path($path, 0);
    $path = str_replace('..', '', $path);
    $path = str_replace($path_restirct, '', $path);
    $target_path = userfiles_path() . DS . $path;
    $target_path = normalize_path($target_path, 1);
}
$targetDir = $target_path;
if (!is_dir($targetDir)) {
    mkdir_recursive($targetDir);
}
//$targetDir = 'uploads';
$cleanupTargetDir = true;
// Remove old files
$maxFileAge = 5 * 3600;
// Temp file age in seconds
// 5 minutes execution time
@set_time_limit(5 * 60);
// Uncomment this one to fake upload time
// usleep(5000);
开发者ID:microweber,项目名称:microweber,代码行数:31,代码来源:plupload.php

示例6: delete_media_file

 public function delete_media_file($params)
 {
     only_admin_access();
     $target_path = media_base_path() . 'uploaded' . DS;
     $target_path = normalize_path($target_path, 0);
     $path_restirct = userfiles_path();
     $fn_remove_path = $_REQUEST["path"];
     $resp = array();
     if ($fn_remove_path != false and is_array($fn_remove_path)) {
         foreach ($fn_remove_path as $key => $value) {
             $fn_remove = $this->app->url_manager->to_path($value);
             if (isset($fn_remove) and trim($fn_remove) != '' and trim($fn_remove) != 'false') {
                 $path = urldecode($fn_remove);
                 $path = normalize_path($path, 0);
                 $path = str_replace('..', '', $path);
                 $path = str_replace($path_restirct, '', $path);
                 $target_path = userfiles_path() . DS . $path;
                 $target_path = normalize_path($target_path, false);
                 if (stristr($target_path, media_base_path())) {
                     if (is_dir($target_path)) {
                         mw('Microweber\\Utils\\Files')->rmdir($target_path, false);
                         $resp = array('success' => 'Directory ' . $target_path . ' is deleted');
                     } else {
                         if (is_file($target_path)) {
                             unlink($target_path);
                             $resp = array('success' => 'File ' . basename($target_path) . ' is deleted');
                         } else {
                             $resp = array('error' => 'Not valid file or folder ' . $target_path . ' ');
                         }
                     }
                 } else {
                     $resp = array('error' => 'Not allowed to delete on ' . $target_path . ' ');
                 }
             }
         }
     }
     return $resp;
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:38,代码来源:MediaManager.php

示例7: _e

         $is_pdo_loaded = false;
     }
 }
 if ($is_pdo_loaded == false) {
     $check_pass = false;
     $server_check_errors['pdo'] = "The PDO MYSQL PHP extension must be loaded";
 }
 if (extension_loaded('gd') && function_exists('gd_info')) {
 } else {
     $check_pass = false;
     $server_check_errors['gd'] = _e("The GD extension must be loaded in PHP", true);
 }
 if (defined('userfiles_path()') and is_dir(userfiles_path()) and !is_writable(userfiles_path())) {
     $check_pass = false;
     $must_be = userfiles_path();
     $server_check_errors['userfiles_path()'] = _e("The directory " . userfiles_path() . " must be writable", true);
 }
 if (defined('MW_CACHE_ROOT_DIR') and is_dir(MW_CACHE_ROOT_DIR) and !is_writable(MW_CACHE_ROOT_DIR)) {
     $check_pass = false;
     $must_be = MW_CACHE_ROOT_DIR;
     $server_check_errors['MW_CACHE_ROOT_DIR'] = _e("The directory " . MW_CACHE_ROOT_DIR . " must be writable", true);
 }
 if (defined('MW_CACHE_ROOT_DIR') and is_dir(MW_CACHE_ROOT_DIR) and !is_writable(MW_CACHE_ROOT_DIR)) {
     $check_pass = false;
     $must_be = MW_CACHE_ROOT_DIR;
     $server_check_errors['MW_CACHE_ROOT_DIR'] = _e("The directory " . MW_CACHE_ROOT_DIR . " must be writable", true);
 }
 if (defined('media_base_path()') and is_dir(media_base_path()) and !is_writable(media_base_path())) {
     $check_pass = false;
     $must_be = media_base_path();
     $server_check_errors['media_base_path()'] = _e("The directory " . media_base_path() . " must be writable", true);
开发者ID:newaltcoin,项目名称:microweber,代码行数:31,代码来源:index.php

示例8: modules_url

    <td><?php 
print modules_url();
?>
</td>
  </tr>
  <tr>
    <td>modules_path</td>
    <td><?php 
print modules_path();
?>
</td>
  </tr>
  <tr>
    <td>userfiles_path</td>
    <td><?php 
print userfiles_path();
?>
</td>
  </tr>
  <tr>
    <td>userfiles_folder</td>
    <td><?php 
print modules_url();
?>
</td>
  </tr>
  <tr>
    <td>site_url</td>
    <td><?php 
print site_url();
?>
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:variables.php

示例9: modules_url

    <td><?php 
echo modules_url();
?>
</td>
  </tr>
  <tr>
    <td>modules_path</td>
    <td><?php 
echo modules_path();
?>
</td>
  </tr>
  <tr>
    <td>userfiles_path</td>
    <td><?php 
echo userfiles_path();
?>
</td>
  </tr>
  <tr>
    <td>userfiles_folder</td>
    <td><?php 
echo modules_url();
?>
</td>
  </tr>
  <tr>
    <td>site_url</td>
    <td><?php 
echo site_url();
?>
开发者ID:microweber,项目名称:microweber,代码行数:31,代码来源:variables.php

示例10: clear_cache

 public function clear_cache()
 {
     $userfiles_dir = userfiles_path();
     $userfiles_cache_dir = normalize_path($userfiles_dir . 'cache' . DS);
     if (is_dir($userfiles_cache_dir)) {
         if (function_exists('rmdir_recursive')) {
             rmdir_recursive($userfiles_cache_dir);
         }
     }
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:10,代码来源:Template.php

示例11: template_save_css

 function template_save_css($params)
 {
     $is_admin = $this->app->user_manager->is_admin();
     if ($is_admin == false) {
         return false;
     }
     if (is_string($params)) {
         $params = parse_params($params);
     }
     $ref_page = false;
     if (!isset($params['active_site_template'])) {
         if (!isset($params['content_id'])) {
             if (isset($_SERVER['HTTP_REFERER'])) {
                 $ref_page_url = $_SERVER['HTTP_REFERER'];
                 if ($ref_page_url != '') {
                     $ref_page_url_rel = str_ireplace(site_url(), '', $ref_page_url);
                     if ($ref_page_url_rel == '') {
                         $ref_page1 = $this->app->content_manager->homepage();
                     } else {
                         $ref_page1 = $this->app->content_manager->get_by_url($ref_page_url, true);
                     }
                     if (isset($ref_page1['id'])) {
                         $ref_page = $this->app->content_manager->get_by_id(intval($ref_page1['id']));
                     }
                 }
             }
         } else {
             $ref_page = $this->app->content_manager->get_by_id(intval($params['content_id']));
         }
         if (isset($ref_page['id']) and isset($ref_page['content_type']) and $ref_page['content_type'] != 'page') {
             $ref_page_parent = $this->app->content_manager->get_by_id(intval($ref_page['id']));
             if (isset($ref_page_partent['parent']) and intval($ref_page_partent['parent']) != 0) {
                 $ref_page = $this->app->content_manager->get_by_id(intval($ref_page_partent['id']));
             } else {
                 $ref_page_parents = $this->app->content_manager->get_parents(intval($ref_page['id']));
                 if (!empty($ref_page_parents)) {
                     $ref_page_parent = array_pop($ref_page_parents);
                     $ref_page = $this->app->content_manager->get_by_id($ref_page_parent);
                 }
             }
         }
     } else {
         $ref_page = $params;
     }
     if (!is_array($ref_page) or empty($ref_page)) {
         return false;
     }
     $pd = $ref_page;
     if ($is_admin == true and is_array($pd)) {
         $save_page = $pd;
         if (isset($save_page["layout_file"]) and $save_page["layout_file"] == 'inherit') {
             $inherit_from_id = $this->app->content_manager->get_inherited_parent($save_page["id"]);
             $inherit_from = $this->app->content_manager->get_by_id($inherit_from_id);
             if (is_array($inherit_from) and isset($inherit_from['active_site_template'])) {
                 $save_page['active_site_template'] = $inherit_from['active_site_template'];
                 $save_page['layout_file'] = $inherit_from['layout_file'];
             }
         }
         $template = false;
         if (!isset($save_page['active_site_template']) or $save_page['active_site_template'] == '') {
             $template = 'default';
         } else {
             if (isset($save_page['active_site_template'])) {
                 $template = $save_page['active_site_template'];
             }
         }
         if ($template == 'default') {
             $site_template_settings = $this->app->option_manager->get('current_template', 'template');
             if ($site_template_settings != false and $site_template_settings != 'default') {
                 $template = $site_template_settings;
             }
         }
         $final_file_blocks = array();
         if ($template != false) {
             if (isset($_POST['save_template_settings'])) {
                 $json = json_encode($_POST);
                 $option = array();
                 $option['option_value'] = $json;
                 $option['option_key'] = 'template_settings';
                 $option['option_group'] = 'template_' . $template;
                 save_option($option);
             }
             $template_folder = templates_path() . $template . DS;
             $template_url = templates_url() . $template . '/';
             $this_template_url = THIS_TEMPLATE_URL;
             $template_folder = userfiles_path() . 'css' . DS . $template . DS;
             if (!is_dir($template_folder)) {
                 mkdir_recursive($template_folder);
             }
             $live_edit_css = $template_folder . 'live_edit.css';
             $fcont = '';
             if (is_file($live_edit_css)) {
                 $fcont = file_get_contents($live_edit_css);
             }
             $css_cont = $fcont;
             $css_cont_new = $css_cont;
             //@import on top
             $sort_params = array();
             $sort_params2 = array();
             foreach ($params as $item) {
//.........这里部分代码省略.........
开发者ID:hyrmedia,项目名称:microweber,代码行数:101,代码来源:LayoutsManager.php

示例12: get_import_location

 function get_import_location()
 {
     if (defined('MW_CRON_EXEC')) {
     } else {
         if (!is_admin()) {
             return false;
         }
     }
     $loc = $this->imports_folder;
     if ($loc != false) {
         return $loc;
     }
     $folder_root = false;
     if (function_exists('userfiles_path')) {
         $folder_root = userfiles_path();
     } elseif (mw_cache_path()) {
         $folder_root = normalize_path(mw_cache_path());
     }
     $here = $folder_root . "import" . DS;
     if (!is_dir($here)) {
         mkdir_recursive($here);
         $hta = $here . '.htaccess';
         if (!is_file($hta)) {
             touch($hta);
             file_put_contents($hta, 'Deny from all');
         }
     }
     $here = $folder_root . "import" . DS . get_table_prefix() . DS;
     $here2 = $this->app->option_manager->get('import_location', 'admin/import');
     if ($here2 != false and is_string($here2) and trim($here2) != 'default' and trim($here2) != '') {
         $here2 = normalize_path($here2, true);
         if (!is_dir($here2)) {
             mkdir_recursive($here2);
         }
         if (is_dir($here2)) {
             $here = $here2;
         }
     }
     if (!is_dir($here)) {
         mkdir_recursive($here);
     }
     $loc = $here;
     $this->imports_folder = $loc;
     return $here;
 }
开发者ID:newaltcoin,项目名称:microweber,代码行数:45,代码来源:Import.php

示例13: install_log

 private function install_log($text)
 {
     $log_file = userfiles_path() . 'install_log.txt';
     if (!is_file($log_file)) {
         @touch($log_file);
     }
     if (is_file($log_file)) {
         $json = array('date' => date('H:i:s'), 'msg' => $text);
         if ($text == 'done' or $text == 'Preparing to install') {
             @file_put_contents($log_file, $text . "\n");
         } else {
             @file_put_contents($log_file, $text . "\n", FILE_APPEND);
         }
     }
 }
开发者ID:newaltcoin,项目名称:microweber,代码行数:15,代码来源:InstallController.php

示例14: thumbnails_path

 public function thumbnails_path()
 {
     $userfiles_dir = userfiles_path();
     $userfiles_cache_dir = normalize_path($userfiles_dir . 'cache' . DS . 'thumbnails' . DS);
     // media_base_path() . 'thumbnail' . DS;
     return $userfiles_cache_dir;
 }
开发者ID:microweber,项目名称:microweber,代码行数:7,代码来源:MediaManager.php

示例15: export_orders1

 public function export_orders1()
 {
     $data = get_orders('no_limit=true&order_completed=1');
     if (!$data) {
         return array('error' => 'You do not have any orders');
     }
     $csv_output = '';
     $head = reset($data);
     foreach ($head as $k => $v) {
         $csv_output .= $this->app->format->no_dashes($k) . ',';
         // $csv_output .= "\t";
     }
     $csv_output .= "\n";
     foreach ($data as $item) {
         foreach ($item as $k => $v) {
             $csv_output .= $this->app->format->no_dashes($v) . ',';
             //  $csv_output .= "\t";
         }
         $cart_items = mw()->shop_manager->order_items($item['id']);
         if (!empty($cart_items)) {
         }
         dd($cart_items);
         $csv_output .= "\n";
     }
     //dd($csv_output);
     $filename = 'orders' . '_' . date('Y-m-d_H-i', time()) . uniqid() . '.csv';
     $filename_path = userfiles_path() . 'export' . DS . 'orders' . DS;
     $filename_path_index = userfiles_path() . 'export' . DS . 'orders' . DS . 'index.php';
     if (!is_dir($filename_path)) {
         mkdir_recursive($filename_path);
     }
     if (!is_file($filename_path_index)) {
         @touch($filename_path_index);
     }
     $filename_path_full = $filename_path . $filename;
     file_put_contents($filename_path_full, $csv_output);
     $download = $this->app->url_manager->link_to_file($filename_path_full);
     return array('success' => 'Your file has been exported!', 'download' => $download);
     dd('export_orders');
 }
开发者ID:microweber,项目名称:microweber,代码行数:40,代码来源:OrderManager.php


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