本文整理汇总了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;
}
示例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", " ", $text);
$text = str_replace(" ", " ", $text);
$text = "<code{$css_code}>{$text}</code>";
}
return "\n{$text}\n\n";
}
示例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();
}
示例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);
}
}
示例5: join_with
static function join_with($Separator, $Paths)
{
if (!$Paths) {
return '';
}
return path::normal(implode($Separator, array_filter($Paths, __NAMESPACE__ . '\\type::str')), $Separator);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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'));
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
}