本文整理汇总了PHP中path类的典型用法代码示例。如果您正苦于以下问题:PHP path类的具体用法?PHP path怎么用?PHP path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了path类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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", " ", $text);
$text = str_replace(" ", " ", $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
示例16: dc_admin_icon_url
function dc_admin_icon_url($img)
{
global $core;
$core->auth->user_prefs->addWorkspace('interface');
$user_ui_iconset = @$core->auth->user_prefs->interface->iconset;
if ($user_ui_iconset && $img) {
$icon = false;
if (preg_match('/^images\\/menu\\/(.+)$/', $img, $m) || preg_match('/^index\\.php\\?pf=(.+)$/', $img, $m)) {
if ($m[1]) {
$icon = path::real(dirname(__FILE__) . '/../../admin/images/iconset/' . $user_ui_iconset . '/' . $m[1], false);
if ($icon !== false) {
$allow_types = array('png', 'jpg', 'jpeg', 'gif');
if (is_file($icon) && is_readable($icon) && in_array(files::getExtension($icon), $allow_types)) {
return DC_ADMIN_URL . 'images/iconset/' . $user_ui_iconset . '/' . $m[1];
}
}
}
}
}
return $img;
}
开发者ID:nikrou,项目名称:dotclear,代码行数:21,代码来源:prepend.php
示例17: install
public function install($id, $path = '')
{
$path = empty($path) ? $id : $path;
$modulePath = ZOTOP_MODULES . DS . $id;
$modulePath = path::clean($modulePath);
$moduleFile = $modulePath . DS . 'module.php';
$module = @(include $moduleFile);
$module['path'] = $path;
$module['type'] = '1';
$module['url'] = $path;
$module['status'] = 1;
$module['order'] = $this->max() + 1;
$module['installtime'] = time::now();
$module['updatetime'] = time::now();
if (is_array($module)) {
$insert = $this->insert($module);
if ($insert) {
return $this->reload();
}
}
return false;
}
开发者ID:dalinhuang,项目名称:zotop,代码行数:22,代码来源:module.php
示例18: actionInstall
public function actionInstall($path)
{
$module = zotop::model('zotop.module');
if (form::isPostBack()) {
$install = $module->install($path);
if ($install) {
$module->cache(true);
msg::success(zotop::t('模块安装成功'), zotop::url('zotop/module'));
}
}
$moduleFile = $path . DS . 'module.php';
if (!file::exists($moduleFile)) {
msg::error(array('content' => zotop::t('未找到模块标记文件<b>module.php</b>,请检查?')));
}
$m = @(include path::decode($moduleFile));
$id = $m['id'];
$modules = $module->getUnInstalled();
$page = new dialog();
$page->set('title', '安装模块');
$page->set('module', $modules[$id]);
$page->display();
}
开发者ID:dalinhuang,项目名称:zotop,代码行数:22,代码来源:module.php
示例19: loadStyle
public static function loadStyle($load_style_widget = false)
{
global $core;
$current_theme = tplMenu::getTheme();
$config = path::fullFromRoot($core->blog->settings->system->themes_path . '/' . $current_theme, DC_ROOT) . '/menu.' . $current_theme . '.php';
if (!file_exists($config)) {
$config = dirname(__FILE__) . '/themes-config/menu.' . $current_theme . '.php';
}
if (file_exists($config)) {
require $config;
if ($load_style_widget == false && isset($template_theme_style)) {
foreach ($template_theme_style as $k => $v) {
define($k, $v);
}
} elseif (isset($widget_theme_style)) {
foreach ($widget_theme_style as $k => $v) {
define($k, $v);
}
}
}
return;
}
开发者ID:mrbidon,项目名称:menu,代码行数:22,代码来源:_public.php
示例20: create_thumb
function create_thumb($filename, $max_width, $max_height)
{
$size = GetImageSize(path::file("images") . $filename);
// Read the size
$width = $size[0];
$height = $size[1];
// Proportionally resize the image to the
// max sizes specified above
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if ($width <= $max_width && $height <= $max_height) {
$tn_width = $width;
$tn_height = $height;
} elseif ($x_ratio * $height < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
} else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
return "<img src='" . path::http("images") . "{$filename}' style='height: {$tn_height}px; width: {$tn_width}px;' />";
}
开发者ID:BackupTheBerlios,项目名称:wcms,代码行数:22,代码来源:Magic.php
注:本文中的path类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论