本文整理汇总了PHP中normalize_path函数的典型用法代码示例。如果您正苦于以下问题:PHP normalize_path函数的具体用法?PHP normalize_path怎么用?PHP normalize_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了normalize_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: user_styles_css
function user_styles_css($params)
{
if (!is_array($params)) {
$template_name = $params;
} else {
extract($params);
}
if (!isset($template_name)) {
exit;
}
$template_name = str_replace('..', '', $template_name);
if (defined('TEMPLATE_NAME') == false) {
define('TEMPLATE_NAME', $template_name);
}
$custom_fn = TEMPLATES_DIR . $template_name;
// d( $custom_fn);
if (is_dir($custom_fn)) {
$custom_fn = $custom_fn . DS . 'global_styles.php';
$custom_fn = normalize_path($custom_fn, false);
if (is_file($custom_fn)) {
header("Content-type: text/css", true);
include $custom_fn;
exit;
}
//d( $custom_fn);
}
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:27,代码来源:unctions.php
示例2: rglob
/**
*
*
* Recursive glob()
*
* @access public
* @package Utils
* @category Files
*
* @uses is_array()
* @param int|string $pattern
* the pattern passed to glob()
* @param int $flags
* the flags passed to glob()
* @param string $path
* the path to scan
* @return mixed
* an array of files in the given path matching the pattern.
*/
function rglob($pattern = '*', $flags = 0, $path = '')
{
if (!$path && ($dir = dirname($pattern)) != '.') {
if ($dir == '\\' || $dir == '/') {
$dir = '';
}
return rglob(basename($pattern), $flags, $dir . DS);
}
$path = normalize_path($path, 1);
$paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($path . $pattern, $flags);
if (is_array($paths)) {
foreach ($paths as $p) {
$temp = rglob($pattern, false, $p . DS);
if (is_array($temp) and is_array($files) and !empty($files)) {
$files = array_merge($files, $temp);
} else {
if (is_array($temp) and !empty($temp)) {
$files = $temp;
}
}
}
}
return $files;
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:44,代码来源:filesystem.php
示例3: installTemplateContent
private function installTemplateContent($template_name)
{
$default_content_folder = mw_includes_path() . 'install' . DIRECTORY_SEPARATOR;
$default_content_file = $default_content_folder . 'mw_default_content.zip';
if ($template_name) {
if (function_exists('templates_path')) {
$template_dir = templates_path() . DS . $template_name;
$template_dir = normalize_path($template_dir, true);
if (is_dir($template_dir)) {
$template_default_content = $template_dir . 'mw_default_content.zip';
if (is_file($template_default_content) and is_readable($template_default_content)) {
$default_content_file = $template_default_content;
$default_content_folder = $template_dir;
}
}
}
}
if (is_file($default_content_file)) {
$restore = new \Microweber\Utils\Backup();
$restore->backups_folder = $default_content_folder;
$restore->backup_file = 'mw_default_content.zip';
ob_start();
try {
$rest = $restore->exec_restore();
} catch (Exception $e) {
return false;
}
ob_get_clean();
return true;
} else {
return false;
}
}
开发者ID:Git-Host,项目名称:microweber,代码行数:33,代码来源:TemplateInstaller.php
示例4: get_parent
public function get_parent(&$cache)
{
$parent_abs_path = normalize_path(dirname($this->abs_path));
if (starts_with($parent_abs_path, $this->app->get_root_abs_path())) {
return Entry::get($this->app, $parent_abs_path, $cache);
}
return null;
}
开发者ID:avidys,项目名称:camunda.org,代码行数:8,代码来源:Entry.php
示例5: userfiles_path
function userfiles_path()
{
static $folder;
if (!$folder) {
$folder = normalize_path(public_path() . DIRECTORY_SEPARATOR . MW_USERFILES_FOLDER_NAME . DIRECTORY_SEPARATOR);
}
return $folder;
}
开发者ID:microweber,项目名称:microweber,代码行数:8,代码来源:paths.php
示例6: __construct
public function __construct($composer_path = false)
{
if ($composer_path == false) {
$composer_path = normalize_path(base_path() . '/', false);
}
$this->composer_home = $composer_path;
putenv('COMPOSER_HOME=' . $composer_path);
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:8,代码来源:ComposerUpdate.php
示例7: get_abs_path
public function get_abs_path($abs_href = null)
{
if ($abs_href === null) {
return $this->abs_path;
}
$abs_href = substr($abs_href, strlen($this->root_abs_href));
return normalize_path($this->root_abs_path . "/" . rawurldecode($abs_href));
}
开发者ID:avidys,项目名称:camunda.org,代码行数:8,代码来源:App.php
示例8: path_segment
/**
* Obtiene un segmento de una ruta a partir de la posición de la
* primera ocurrencia de un substring en $needle.
*
* @param string $path
* @param string $needle
* @return mixed
*/
function path_segment($path, $needle)
{
if ($path) {
$path = normalize_path($path);
$path = substr($path, strrpos($path, $needle, 0) - 1);
} else {
$path = null;
}
return $path;
}
开发者ID:egalink,项目名称:fastener,代码行数:18,代码来源:Paths.php
示例9: to_path
function to_path($path)
{
if (trim($path) == '') {
return false;
}
$path = str_ireplace($this->site_url(), MW_ROOTPATH, $path);
$path = str_replace('\\', '/', $path);
$path = str_replace('//', '/', $path);
return normalize_path($path, false);
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:10,代码来源:UrlManager.php
示例10: createStaticFolderQuery
public function createStaticFolderQuery()
{
$target_path = normalize_path(APPPATH . '../static');
$link_path = normalize_path(APPPATH . 'static/common');
@$this->_symlink($target_path, $link_path);
$target_path = normalize_path(PLUGINSPATH . 'static');
$link_path = normalize_path(APPPATH . 'static/plugins');
@$this->_symlink($target_path, $link_path);
return $this->success(array('title' => '指向成功', 'content' => 'static目录指向成功'), FALSE);
}
开发者ID:unionbt,项目名称:hanpaimall,代码行数:10,代码来源:ToolsController.php
示例11: setSettingWatermarkFilePath
/**
* @param string $path
*/
public function setSettingWatermarkFilePath($path)
{
$path = normalize_path($path);
if ($this->isImage($path)) {
$imagePath = $this->folderPath($path);
$this->fieldSettings['watermark_file_path'] = $imagePath;
$this->fieldSettings['watermark'] = true;
} else {
$this->fieldSettings['watermark'] = false;
$this->fieldSettings['watermark_file_path'] = null;
}
}
开发者ID:KodiComponents,项目名称:module-datasource,代码行数:15,代码来源:Image.php
示例12: 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
示例13: inst
/** @return DirItem */
public static function inst($path, $name = null, $ext = null)
{
$absPath = normalize_path(file_path($path, $name, $ext));
if (!$absPath || DIR_SEPARATOR == $absPath || PATH_BASE_DIR == $absPath || PATH_BASE_DIR == $absPath . DIR_SEPARATOR) {
$absPath = PATH_BASE_DIR;
} else {
if (!starts_with($absPath, PATH_BASE_DIR)) {
$absPath = next_level_dir(PATH_BASE_DIR, $absPath);
}
}
if (array_key_exists($absPath, self::$items)) {
return self::$items[$absPath];
}
$relPath = cut_string_start($absPath, PATH_BASE_DIR);
$relPath = ensure_dir_startswith_dir_separator($relPath);
return self::$items[$absPath] = new DirItem($relPath, $absPath);
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:18,代码来源:DirItem.php
示例14: check
public function check($mail)
{
// list is from here https://gist.github.com/hassanazimi/d6e49469258d7d06f9f4
$file = __DIR__ . DS . 'disposable_email_addresses.txt';
$file = normalize_path($file, false);
$mail_domains_ko = file_get_contents($file);
$mail_domains_ko = explode("\n", $mail_domains_ko);
if (empty($mail_domains_ko)) {
return false;
}
foreach ($mail_domains_ko as $ko_mail) {
list(, $mail_domain) = explode('@', $mail);
if (strcasecmp($mail_domain, trim($ko_mail)) == 0) {
return TRUE;
}
}
return FALSE;
}
开发者ID:microweber,项目名称:microweber,代码行数:18,代码来源:DisposableEmailChecker.php
示例15: add_hrefs
private function add_hrefs($hrefs)
{
foreach ($hrefs as $href) {
$d = normalize_path(dirname($href), true);
$n = basename($href);
$code = $this->app->get_http_code($d);
if ($code == App::$MAGIC_SEQUENCE && !$this->app->is_ignored($n)) {
$real_file = $this->app->get_abs_path($href);
// $archived_file = preg_replace("!^" . normalize_path($this->app->get_root_abs_path(), true) . "!", "", $real_file);
$archived_file = preg_replace("!^" . normalize_path($this->app->get_abs_path(), true) . "!", "", $real_file);
if (is_dir($real_file)) {
$this->add_dir($real_file, $archived_file);
} else {
$this->add_file($real_file, $archived_file);
}
}
}
}
开发者ID:avidys,项目名称:camunda.org,代码行数:18,代码来源:Archive.php
示例16: inst
/** @return DirItem */
public static function inst($path, $name = null, $ext = null)
{
$itemPath = normalize_path(file_path($path, $name, $ext));
$corePath = normalize_path(PATH_BASE_DIR);
//Обезопасим пути, в которых есть русские буквы
try {
$itemPath = iconv('UTF-8', 'cp1251', $itemPath);
} catch (Exception $e) {
//Если произойдёт ошибка - игнорируем
}
$isAbs = starts_with($itemPath, $corePath);
$absPath = $isAbs ? $itemPath : next_level_dir($corePath, $itemPath);
if (array_key_exists($absPath, self::$items)) {
return self::$items[$absPath];
}
$relPath = cut_string_start($absPath, $corePath);
$relPath = ensure_starts_with($relPath, DIR_SEPARATOR);
return self::$items[$absPath] = new DirItem($relPath, $absPath);
}
开发者ID:ilivanoff,项目名称:www,代码行数:20,代码来源:DirItem.php
示例17: inst
/** @return DirManager */
public static function inst($notCkeckDirs = null, $dirs = null)
{
$dirPath = next_level_dir($notCkeckDirs);
$corePath = normalize_path(PATH_BASE_DIR);
$isAbs = starts_with($dirPath, $corePath);
$absPathNotCheck = $isAbs ? $dirPath : next_level_dir($corePath, $dirPath);
$absPathNotCheck = ensure_dir_endswith_dir_separator($absPathNotCheck);
$absPath = next_level_dir($absPathNotCheck, $dirs);
$absPath = ensure_dir_endswith_dir_separator($absPath);
//Проверим, нужно ли создать структуру директорий
if ($absPathNotCheck != $absPath && !is_dir($absPath)) {
@mkdir($absPath, 0777, true);
}
if (array_key_exists($absPath, self::$insts)) {
return self::$insts[$absPath];
}
$relPath = cut_string_start($absPath, $corePath);
$relPath = ensure_dir_startswith_dir_separator($relPath);
return self::$insts[$absPath] = new DirManager($relPath, $absPath);
}
开发者ID:ilivanoff,项目名称:www,代码行数:21,代码来源:DirManager.php
示例18: load_all_functions_files_for_modules
function load_all_functions_files_for_modules($options = false)
{
$is_installed = mw_is_installed();
if (!$is_installed) {
return;
}
$modules = mw()->modules->get('ui=any&installed=1&limit=99999');
$files = array();
if (!empty($modules)) {
foreach ($modules as $module) {
if (isset($module['module'])) {
$is_function = normalize_path(modules_path() . $module['module'] . DS . 'functions.php', false);
if (is_file($is_function)) {
include_once $is_function;
$files[] = $is_function;
}
}
}
return $files;
}
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:21,代码来源:modules.php
示例19: define_constants
//.........这里部分代码省略.........
//
}
}
}
if (isset($content['parent']) and $content['parent'] != 0 and isset($content['layout_file']) and $content['layout_file'] == 'inherit') {
$inh = $this->get_inherited_parent($content['id']);
if ($inh != false) {
$inh_parent = $this->get_by_id($inh);
if (isset($inh_parent['active_site_template']) and $inh_parent['active_site_template'] != '' and strtolower($inh_parent['active_site_template']) != 'default') {
$the_active_site_template = $inh_parent['active_site_template'];
} else {
if (isset($inh_parent['active_site_template']) and $inh_parent['active_site_template'] != '' and strtolower($inh_parent['active_site_template']) == 'default') {
$the_active_site_template = $this->app->option_manager->get('current_template', 'template');
} else {
if (isset($inh_parent['active_site_template']) and $inh_parent['active_site_template'] == '') {
$the_active_site_template = $this->app->option_manager->get('current_template', 'template');
}
}
}
}
}
if (isset($the_active_site_template) and $the_active_site_template != 'default' and $the_active_site_template == 'mw_default') {
$the_active_site_template = 'default';
}
if ($the_active_site_template == false) {
$the_active_site_template = 'default';
}
if (defined('THIS_TEMPLATE_DIR') == false and $the_active_site_template != false) {
define('THIS_TEMPLATE_DIR', templates_path() . $the_active_site_template . DS);
}
if (defined('THIS_TEMPLATE_FOLDER_NAME') == false and $the_active_site_template != false) {
define('THIS_TEMPLATE_FOLDER_NAME', $the_active_site_template);
}
$the_active_site_template_dir = normalize_path(templates_path() . $the_active_site_template . DS);
if (defined('DEFAULT_TEMPLATE_DIR') == false) {
define('DEFAULT_TEMPLATE_DIR', templates_path() . 'default' . DS);
}
if (defined('DEFAULT_TEMPLATE_URL') == false) {
define('DEFAULT_TEMPLATE_URL', templates_url() . '/default/');
}
if (trim($the_active_site_template) != 'default') {
if (!strstr($the_active_site_template, DEFAULT_TEMPLATE_DIR)) {
$use_default_layouts = $the_active_site_template_dir . 'use_default_layouts.php';
if (is_file($use_default_layouts)) {
if (isset($page['layout_file'])) {
$template_view = DEFAULT_TEMPLATE_DIR . $page['layout_file'];
} else {
$template_view = DEFAULT_TEMPLATE_DIR;
}
if (isset($page)) {
if (!isset($page['layout_file']) or (isset($page['layout_file']) and $page['layout_file'] == 'inherit' or $page['layout_file'] == '')) {
$par_page = $this->get_inherited_parent($page['id']);
if ($par_page != false) {
$par_page = $this->get_by_id($par_page);
}
if (isset($par_page['layout_file'])) {
$the_active_site_template = $par_page['active_site_template'];
$page['layout_file'] = $par_page['layout_file'];
$page['active_site_template'] = $par_page['active_site_template'];
$template_view = templates_path() . $page['active_site_template'] . DS . $page['layout_file'];
}
}
}
if (is_file($template_view) == true) {
if (defined('THIS_TEMPLATE_DIR') == false) {
define('THIS_TEMPLATE_DIR', templates_path() . $the_active_site_template . DS);
开发者ID:Git-Host,项目名称:microweber,代码行数:67,代码来源:ContentManager.php
示例20: create_full
public function create_full()
{
if (!defined('INI_SYSTEM_CHECK_DISABLED')) {
define('INI_SYSTEM_CHECK_DISABLED', ini_get('disable_functions'));
}
if (!strstr(INI_SYSTEM_CHECK_DISABLED, 'ini_set')) {
ini_set('memory_limit', '512M');
}
if (!strstr(INI_SYSTEM_CHECK_DISABLED, 'set_time_limit')) {
set_time_limit(600);
}
$backup_actions = array();
$backup_actions[] = 'make_db_backup';
$userfiles_folder = userfiles_path();
$media_folder = media_base_path();
$all_images = $this->app->media_manager->get_all('limit=10000');
if (!empty($all_images)) {
foreach ($all_images as $image) {
if (isset($image['filename']) and $image['filename'] != false) {
$fn = url2dir($image['filename']);
if (is_file($fn)) {
$backup_actions[] = $fn;
}
}
}
}
$host = parse_url(site_url());
$host_dir = false;
if (isset($host['host'])) {
$host_dir = $host['host'];
$host_dir = str_ireplace('www.', '', $host_dir);
$host_dir = str_ireplace('.', '-', $host_dir);
}
$userfiles_folder_uploaded = $media_folder . DS . $host_dir . DS . 'uploaded' . DS;
$userfiles_folder_uploaded = $media_folder . DS . $host_dir . DS;
$userfiles_folder_uploaded = \normalize_path($userfiles_folder_uploaded);
$folders = \rglob($userfiles_folder_uploaded . '*', GLOB_NOSORT);
if (!is_array($folders)) {
$folders = array();
}
$cust_css_dir = $userfiles_folder . 'css' . DS;
if (is_dir($cust_css_dir)) {
$more_folders = \rglob($cust_css_dir . '*', GLOB_NOSORT);
if (!empty($more_folders)) {
$folders = array_merge($folders, $more_folders);
}
}
if (!empty($folders)) {
$text_files = array();
foreach ($folders as $fold) {
if (!stristr($fold, 'backup')) {
if (stristr($fold, '.php') or stristr($fold, '.js') or stristr($fold, '.css')) {
$text_files[] = $fold;
} else {
$backup_actions[] = $fold;
}
}
}
if (!empty($text_files)) {
$backup_actions = array_merge($text_files, $backup_actions);
}
}
$cache_id = 'backup_queue';
$cache_id_loc = 'backup_progress';
$cache_state_id = 'backup_zip_state';
$this->app->cache_manager->save($backup_actions, $cache_id, 'backup');
$this->app->cache_manager->save(false, $cache_id_loc, 'backup');
$this->app->cache_manager->save(false, $cache_state_id, 'backup');
if (!defined('MW_NO_SESSION')) {
define('MW_NO_SESSION', 1);
}
return;
}
开发者ID:microweber,项目名称:microweber,代码行数:73,代码来源:Backup.php
注:本文中的normalize_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论