本文整理汇总了PHP中path::file方法的典型用法代码示例。如果您正苦于以下问题:PHP path::file方法的具体用法?PHP path::file怎么用?PHP path::file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::file方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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";
}
示例2: 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);
}
示例3: 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);
}
示例4: 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;' />";
}
示例5: output_page
/**
* Load required filters and output final page from main template
*
*/
function output_page($type = false)
{
global $smarty, $settings;
$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"));
}
//$etag = md5($output);
//$length = strlen($output);
//header("ETag: {$etag}");
//header("Content-Length: {$length}");
echo $output;
//echo "Memory Usage: ".get_memory_usage();
}
示例6: header
* @copyright 2005 Martin Nicholls
* @author Martin Nicholls <webmasta at streakyland dot co dot uk>
* @package wCMS
* @version $Revision: 1.9 $
*/
/* $Id: login.php,v 1.9 2005/09/06 12:33:06 streaky Exp $ */
require_once "boot.php";
if ($settings['secure_login'] == true && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")) {
$QUERY = $_SERVER['QUERY_STRING'] ? "?{$_SERVER['QUERY_STRING']}" : "";
$path = "https://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}{$QUERY}";
header("Location: {$path}");
}
$response = "";
$content_output = "";
// require form page and create $form object
require_once path::file("classes") . "form_handling_class.php";
$form_options = array('action' => "login.php", 'method' => "post", 'title' => "User Login", 'description' => "Cookies must be enabled to log in", 'response' => $response, 'smarty' => &$smarty);
$form = new form_handling($form_options);
$form_item = array('label' => "User Name", 'max_length' => 40, 'name' => "login[username]", 'id' => "login-username", 'size' => 30, 'description' => "", 'value' => "", 'required' => true);
$form->add_text_field($form_item);
$form_item = array('label' => "User Password", 'max_length' => 40, 'name' => "login[userpass]", 'id' => "login-userpass", 'size' => 30, 'description' => "", 'value' => "", 'required' => true, 'type' => 'password');
$form->add_text_field($form_item);
/*$form_item = array (
'label' => "Remember Me",
'checked' => false,
'name' => "login[remember]",
'id' => "login-remember",
'description' => "Store my user credentials and log me in automatically",
);
$form->add_checkbox($form_item);*/
$form->build_fieldset("User Credentials");
示例7: foreach
// header("Location: {$page}");
}
$query = "SELECT cont_id, cont_ident, cont_title FROM {$db_prefix}content ORDER BY cont_ident";
$result = $db->query($query);
$rows = $result->fetchAll(MDB2_FETCHMODE_ASSOC);
$result->free();
foreach ($rows as $tag_item) {
$pages[] = array('value' => $tag_item['cont_id'], 'title' => $tag_item['cont_ident']);
if ($tag_item['cont_ident'] == "home_page") {
$home_id = $tag_item['cont_id'];
}
}
$path = path::http();
$smarty->assign("breadcrumb", "/ <a href='{$path}'>Home</a> / Editing: {$tag} /");
$query = "SELECT * FROM {$db_prefix}content WHERE cont_ident = " . $db->quote($item, 'text');
$db->setLimit(1);
$result = $db->query($query);
$rows = $result->fetchAll(MDB2_FETCHMODE_ASSOC);
$result->free();
$row = $rows[0];
// require form page and create $form object
require_once path::file("classes") . "form_handling_class.php";
$form_options = array('action' => path::http() . "edit.php" . ($_SERVER['QUERY_STRING'] ? "?{$_SERVER['QUERY_STRING']}" : ""), 'method' => "post", 'title' => "Editing: " . ($row['content_title'] != "" ? $row['contenttitle'] : $item), 'description' => "", 'response' => $diff_out ? "<h3>Changes Saved:</h3> (New revision: {$new_rev}){$diff_out}<hr />" : "", 'smarty' => &$smarty);
$form = new form_handling($form_options);
include path::file("classes") . "forms/edit_content_form.php";
$content_output .= $form->return_form();
unset($form);
$smarty->assign("breadcrumb", $page['breadcrumb']);
$smarty->assign("page_content", $content_output);
output_page();
}
示例8: Text_Wiki
require_once 'Text/Wiki.php';
// Using include path (PEAR Class)
// instantiate a Text_Wiki object with the default rule set
$wiki =& new Text_Wiki();
// when rendering XHTML, make sure wiki links point to the base URL
$wiki->setRenderConf('xhtml', 'wikilink', 'view_url', path::http() . "?page=%s");
$wiki->setRenderConf('xhtml', 'wikilink', 'new_url', path::http() . "?page=%s");
$wiki->setParseConf('wikilink', 'ext_chars', true);
// setup images basedir
$wiki->setRenderConf('xhtml', 'image', 'base', path::http("images"));
$wiki->enableRule('html');
$sites = array('Site' => substr(path::http(), 0, -1) . '%s');
$wiki->setRenderConf('xhtml', 'interwiki', 'sites', $sites);
$pages = $content->get_pages_list();
$wiki->setRenderConf('xhtml', 'wikilink', 'pages', $pages['pages']);
$wiki->setRenderConf('xhtml', 'wikilink', 'titles', $pages['titles']);
$nav = "";
$nav = @file_get_contents(path::file() . "nav.html");
$nav = str_replace("#root#", path::http(), $nav);
$smarty->assign("nav", $nav);
foreach ($settings['menus'] as $menu) {
if ($menu['type'] == 'content') {
$menu_item = $content->retrieve($menu['data'], CONTENT_NO_CACHE);
$smarty->assign("menu_content", $menu_item['content']);
$smarty->assign("menu_title", $menu_item['title']);
$menus .= $smarty->fetch("{$settings['theme']}/menu_item.html");
} else {
// Implement non-content menu items here
}
}
$smarty->assign("menu_area", $menus);
示例9:
* File: $Source: /home/xubuntu/berlios_backup/github/tmp-cvs/wcms/Repository/wcms/index.php,v $
* Revision: $Revision: 1.4 $
* Last Edit: $Date: 2005/08/31 09:12:35 $
* By: $Author: streaky $
*
* Copyright © 2005 Martin Nicholls
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://wcms.berlios.de/
* @copyright 2005 Martin Nicholls
* @author Martin Nicholls <webmasta at streakyland dot co dot uk>
* @package wCMS
* @version $Revision: 1.4 $
*/
/* $Id: index.php,v 1.4 2005/08/31 09:12:35 streaky Exp $ */
require_once "boot.php";
require_once path::file() . "content.php";