當前位置: 首頁>>代碼示例>>PHP>>正文


PHP path類代碼示例

本文整理匯總了PHP中path的典型用法代碼示例。如果您正苦於以下問題:PHP path類的具體用法?PHP path怎麽用?PHP path使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了path類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: decode

 public static function decode($path)
 {
     $p = array('$modules' => ZPATH_MODULES);
     $path = strtr($path, $p);
     $path = path::clean($path);
     return $path;
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:7,代碼來源:path.php

示例2: token

 /**
  * 
  * Renders a token into text matching the requested format.
  * 
  * @access public
  * 
  * @param array $options The "options" portion of the token (second
  * element).
  * 
  * @return string The text rendered from the token options.
  * 
  */
 function token($options)
 {
     $text = $options['text'];
     $attr = $options['attr'];
     $type = strtolower($attr['type']);
     $css = $this->formatConf(' class="%s"', 'css');
     $css_code = $this->formatConf(' class="%s"', 'css_code');
     $css_php = $this->formatConf(' class="%s"', 'css_php');
     $css_html = $this->formatConf(' class="%s"', 'css_html');
     $geshi_class = path::file("plugins") . "geshi/geshi.php";
     if ($type != "" && file_exists(path::file("plugins") . "geshi/geshi.php") && is_readable(path::file("plugins") . "geshi/geshi.php")) {
         require_once path::file("plugins") . "geshi/geshi.php";
         $geshi = new GeSHi(trim($text), $type, path::file("plugins") . "geshi/geshi/");
         $geshi->set_encoding("utf-8");
         $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 1);
         $geshi->set_header_type(GESHI_HEADER_DIV);
         $geshi->enable_classes();
         $geshi->set_overall_class('geshi_code');
         $text = $geshi->parse_code();
         $style = $geshi->get_stylesheet();
         global $page_handler;
         $style = "<style type='text/css'>\n{$style}\n</style>";
         $page_handler->add_header_data($style);
     } else {
         //generic code example:
         //convert tabs to four spaces,
         //convert entities.
         $text = trim(htmlentities($text));
         $text = str_replace("\t", " &nbsp; &nbsp;", $text);
         $text = str_replace("  ", " &nbsp;", $text);
         $text = "<code{$css_code}>{$text}</code>";
     }
     return "\n{$text}\n\n";
 }
開發者ID:BackupTheBerlios,項目名稱:wcms,代碼行數:46,代碼來源:Code.php

示例3: actionSelect

 public function actionSelect($field = '', $dir = '')
 {
     $dir = empty($dir) ? zotop::get('dir') : $dir;
     $dir = trim(url::decode($dir), '/');
     $path = site::template();
     $path = $path . DS . str_replace('/', DS, $dir);
     $path = path::clean($path);
     $folders = folder::folders($path);
     $files = folder::files($path);
     $position = '<a href="' . zotop::url('system/template/select') . '">' . zotop::t('根目錄') . '</a><em> : //</em> ';
     if (!empty($dir)) {
         $dirs = arr::dirpath($dir, '/');
         foreach ($dirs as $d) {
             $position .= '<a href="' . zotop::url('system/template/select', array('dir' => rawurlencode($d[1]))) . '">' . $d[0] . '</a> <em>/</em>';
         }
     }
     $page = new dialog();
     $page->title = zotop::t('模板管理');
     $page->set('field', $field);
     $page->set('dir', $dir);
     $page->set('position', $position);
     $page->set('folders', $folders);
     $page->set('files', $files);
     $page->display();
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:25,代碼來源:template.php

示例4: __construct

 /**
 Inits dcBlog object
 
 @param	core		<b>dcCore</b>		Dotclear core reference
 @param	id		<b>string</b>		Blog ID
 */
 public function __construct(&$core, $id)
 {
     $this->con =& $core->con;
     $this->prefix = $core->prefix;
     $this->core =& $core;
     if (($b = $this->core->getBlog($id)) !== false) {
         $this->id = $id;
         $this->uid = $b->blog_uid;
         $this->name = $b->blog_name;
         $this->desc = $b->blog_desc;
         $this->url = $b->blog_url;
         $this->host = preg_replace('|^([a-z]{3,}://)(.*?)/.*$|', '$1$2', $this->url);
         $this->creadt = strtotime($b->blog_creadt);
         $this->upddt = strtotime($b->blog_upddt);
         $this->status = $b->blog_status;
         $this->settings = new dcSettings($this->core, $this->id);
         $this->themes_path = path::fullFromRoot($this->settings->themes_path, DC_ROOT);
         $this->public_path = path::fullFromRoot($this->settings->public_path, DC_ROOT);
         $this->post_status['-2'] = __('pending');
         $this->post_status['-1'] = __('scheduled');
         $this->post_status['0'] = __('unpublished');
         $this->post_status['1'] = __('published');
         $this->comment_status['-2'] = __('junk');
         $this->comment_status['-1'] = __('pending');
         $this->comment_status['0'] = __('unpublished');
         $this->comment_status['1'] = __('published');
         # --BEHAVIOR-- coreBlogConstruct
         $this->core->callBehavior('coreBlogConstruct', $this);
     }
 }
開發者ID:HackerMajor,項目名稱:root,代碼行數:36,代碼來源:class.dc.blog.php

示例5: join_with

 static function join_with($Separator, $Paths)
 {
     if (!$Paths) {
         return '';
     }
     return path::normal(implode($Separator, array_filter($Paths, __NAMESPACE__ . '\\type::str')), $Separator);
 }
開發者ID:amekusa,項目名稱:plz,代碼行數:7,代碼來源:path.php

示例6: install

 public function install($path = '')
 {
     $path = empty($path) ? $this->path : $path;
     $module = @(include path::decode($path . DS . 'module.php'));
     if (is_array($module)) {
         $module['path'] = $path;
         $module['url'] = $path;
         if (!isset($module['icon'])) {
             if (file::exists($path . '/icon.png')) {
                 $module['icon'] = $module['url'] . '/icon.png';
             }
         }
         $module['type'] = empty($module['type']) ? 'plugin' : $module['type'];
         $module['status'] = 0;
         $module['order'] = $this->max('order') + 1;
         $module['installtime'] = TIME;
         $module['updatetime'] = TIME;
         $insert = $this->insert($module);
     }
     if ($insert) {
         $driver = $this->db()->config('driver');
         $sqls = file::read($path . DS . 'install' . DS . $driver . '.sql');
         if ($sqls) {
             $this->db()->run($sqls);
         }
     }
     return true;
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:28,代碼來源:module.php

示例7: decode

 public static function decode($path)
 {
     $p = array('$system' => ZOTOP_PATH_SYSTEM, '$modules' => ZOTOP_PATH_MODULES);
     $path = strtr($path, $p);
     $path = path::clean($path);
     return $path;
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:7,代碼來源:path.php

示例8: __construct

 /**
 Inits dcBlog object
 
 @param	core		<b>dcCore</b>		Dotclear core reference
 @param	id		<b>string</b>		Blog ID
 */
 public function __construct($core, $id)
 {
     $this->con =& $core->con;
     $this->prefix = $core->prefix;
     $this->core =& $core;
     if (($b = $this->core->getBlog($id)) !== false) {
         $this->id = $id;
         $this->uid = $b->blog_uid;
         $this->name = $b->blog_name;
         $this->desc = $b->blog_desc;
         $this->url = $b->blog_url;
         $this->host = http::getHostFromURL($this->url);
         $this->creadt = strtotime($b->blog_creadt);
         $this->upddt = strtotime($b->blog_upddt);
         $this->status = $b->blog_status;
         $this->settings = new dcSettings($this->core, $this->id);
         $this->themes_path = path::fullFromRoot($this->settings->system->themes_path, DC_ROOT);
         $this->public_path = path::fullFromRoot($this->settings->system->public_path, DC_ROOT);
         $this->post_status['-2'] = __('Pending');
         $this->post_status['-1'] = __('Scheduled');
         $this->post_status['0'] = __('Unpublished');
         $this->post_status['1'] = __('Published');
         $this->comment_status['-2'] = __('Junk');
         $this->comment_status['-1'] = __('Pending');
         $this->comment_status['0'] = __('Unpublished');
         $this->comment_status['1'] = __('Published');
         # --BEHAVIOR-- coreBlogConstruct
         $this->core->callBehavior('coreBlogConstruct', $this);
     }
 }
開發者ID:nikrou,項目名稱:dotclear,代碼行數:36,代碼來源:class.dc.blog.php

示例9: delete

 /**
  * 刪除文件
  * @param string $file
  * @return boolean
  */
 public static function delete($file)
 {
     if (file::exists($file)) {
         $file = path::clean($file);
         return @unlink($file);
     }
     return true;
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:13,代碼來源:file.php

示例10: store_revision_history

 function store_revision_history($tag, $history)
 {
     if (!is_array($history)) {
         return false;
     }
     $data = var_export($history, true);
     return file_put_contents(path::file("data") . "wiki_history/{$tag}.hist", $data);
 }
開發者ID:BackupTheBerlios,項目名稱:wcms,代碼行數:8,代碼來源:revision_class.php

示例11: hooks

 /**
  * 打包全部的hook文件
  *
  */
 public static function hooks()
 {
     $modules = zotop::data('module');
     foreach ((array) $modules as $module) {
         if ((int) $module['status'] >= 0 && folder::exists($module['path'])) {
             //加載hook文件
             runtime::$hooks[] = $module['path'] . DS . 'hooks' . DS . ZOTOP_APPLICATION_GROUP . '.php';
             //加載庫文件
             zotop::register(@(include path::decode($module['path']) . DS . 'classes.php'));
         }
     }
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:16,代碼來源:runtime.php

示例12: hook

 public static function hook()
 {
     //打包全部hook
     $hooks = array();
     $modules = zotop::data('module');
     foreach ($modules as $module) {
         $path = $module['path'] . DS . 'hook';
         $path = path::decode($path);
         $hook = (array) dir::files($path, '', true, true);
         $hooks = array_merge($hooks, $hook);
     }
     $content = runtime::compile($hooks);
     if (!empty($content)) {
         file::write(ZPATH_RUNTIME . DS . 'hook.php', $content, true);
     }
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:16,代碼來源:runtime.php

示例13: isWritable

 /** Checks if the given directory is really writable. The standard PHP
  * function is_writable() does not work properly on Windows servers
  * @param string $dir
  * @return bool */
 public static function isWritable($dir)
 {
     $dir = path::normalize($dir);
     if (!is_dir($dir)) {
         return false;
     }
     $i = 0;
     do {
         $file = "{$dir}/is_writable_" . md5($i++);
     } while (file_exists($file));
     if (!@touch($file)) {
         return false;
     }
     unlink($file);
     return true;
 }
開發者ID:zelimirus,項目名稱:yard,代碼行數:20,代碼來源:helper_dir.php

示例14: output_page

 function output_page($page_title = "")
 {
     global $smarty, $settings, $time_start;
     $smarty->assign("page_content", $this->get_page());
     $smarty->assign("page_title", "{$settings['site']['long_name']} - {$page_title}");
     $smarty->assign("header_data", $this->get_header_data());
     $smarty->assign("page_footer", implode("\n", $this->footer_objects) . "\n#RENDERTIME#");
     $smarty->load_filter('output', 'rewrite_urls');
     if ($type == true && file_exists(path::file("templates") . "{$settings['theme']}/main_{$type}.html")) {
         $output = trim($smarty->fetch("{$settings['theme']}/main_{$type}.html"));
     } else {
         $output = trim($smarty->fetch("{$settings['theme']}/main.html"));
     }
     $time_end = microtime_float();
     $time = round($time_end - $time_start, 4);
     echo str_replace("#RENDERTIME#", "[Render Time: {$time}s]", $output);
 }
開發者ID:BackupTheBerlios,項目名稱:wcms,代碼行數:17,代碼來源:page_handling_class.php

示例15: __get

 public function __get($name)
 {
     switch ($name) {
         case 'name':
             return $this->name;
         case 'version':
             if (is_null($this->version)) {
                 $versionFile = path::glue($this->basePath(), 'VERSION');
                 if (file_exists($versionFile)) {
                     $this->version = trim(file_get_contents($versionFile));
                 }
                 if (!$this->version) {
                     throw new \RuntimeException('missing extension version');
                 }
             }
             return $this->version;
     }
 }
開發者ID:cepharum,項目名稱:txf,代碼行數:18,代碼來源:extension.php


注:本文中的path類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。