本文整理汇总了PHP中getRootPath函数的典型用法代码示例。如果您正苦于以下问题:PHP getRootPath函数的具体用法?PHP getRootPath怎么用?PHP getRootPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRootPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
public function process($name, $value)
{
if ($value != null && $value["name"] != null && $value["tmp_name"] != null) {
$strDest = getRootPath() . $this->options["path"];
$strName = ereg_replace("[^A-Za-z0-9\\.]", "-", $value["name"]);
if (!file_exists($strDest)) {
mkdir($strDest);
}
if ($this->options["conflict"] == "make-unique") {
// fancy action: make files unique
$strOrigName = $strName;
$i = 1;
while (file_exists("{$strDest}/{$strName}")) {
$strName = ereg_replace("(\\.[^\\.]*)\$", "_{$i}\\1", $strOrigName);
$i++;
}
} elseif (file_exists("{$strDest}/{$strName}")) {
// default action: overwrite
unlink("{$strDest}/{$strName}");
}
copy($value["tmp_name"], "{$strDest}/{$strName}");
return $strName;
}
return "";
}
开发者ID:joel-cass,项目名称:structure-cms,代码行数:25,代码来源:file.php
示例2: edit
public function edit($name, $id, $value)
{
$value = htmlentities($value);
$strReturn = "<!-- TINYMCE -->";
$strReturn .= "<textarea name=\"{$name}\" id=\"{$id}\" rows=\"30\" cols=\"80\" style=\"width: 100%\">{$value}</textarea>";
$strReturn .= "<script type=\"text/javascript\">\n\t\t\t\ttinyMCE.init({\n\t\t\t\t\t// General options\n\t\t\t\t\tmode : \"exact\",\n\t\t\t\t\ttheme : \"advanced\",\n\t\t\t\t\telements : \"{$id}\",\n\t\t\t\t\tplugins : \"safari,pagebreak,style,layer,table,save,advhr,advimage,imgmap,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount\",\n\t\t\t\t\trelative_urls : false,\n\t\t\t\t\t\n\t\t\t\t\t// Theme options\n\t\t\t\t\ttheme_advanced_buttons1 : \"save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect\",\n\t\t\t\t\ttheme_advanced_buttons2 : \"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,imgmap,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor\",\n\t\t\t\t\ttheme_advanced_buttons3 : \"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen\",\n\t\t\t\t\ttheme_advanced_buttons4 : \"insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak\",\n\t\t\t\t\ttheme_advanced_toolbar_location : \"top\",\n\t\t\t\t\ttheme_advanced_toolbar_align : \"left\",\n\t\t\t\t\ttheme_advanced_statusbar_location : \"bottom\",\n\t\t\t\t\ttheme_advanced_resizing : true,\n\t\t\t\t\t\n\t\t\t\t\t// Content CSS (should be your site CSS)\n\t\t\t\t\t";
if (file_exists(getRootPath() . "/styles/" . SettingsHelper::getSetting("Theme") . "/lib/editor.css")) {
$strReturn .= "content_css : \"" . getRootURL() . "/styles/" . SettingsHelper::getSetting("Theme") . "/lib/editor.css\",";
} else {
$strReturn .= "content_css : \"lib/tinymce/css/content.css\",";
}
$strReturn .= "\n\t\t\t\t\t\n\t\t\t\t\t// Drop lists for link/image/media/template dialogs\n\t\t\t\t\texternal_link_list_url : \"lib/tinymce/lists.php?type=link\",\n\t\t\t\t\texternal_image_list_url : \"lib/tinymce/lists.php?type=image\",\n\t\t\t\t\tmedia_external_list_url : \"lib/tinymce/lists.php?type=media\"\n\t\t\t\t});\n\t\t</script>";
$strReturn .= "<!-- /TINYMCE -->";
return $strReturn;
}
开发者ID:joel-cass,项目名称:structure-cms,代码行数:15,代码来源:html.php
示例3: edit
public function edit($name, $id, $value)
{
$strReturn = "<select name=\"{$name}\" id=\"{$id}\"";
if (array_key_exists("multiple", $this->options) && $this->options["multiple"] == true) {
$strReturn .= " multiple";
}
$strReturn .= ">";
$aryOptions = array();
if (array_key_exists("options", $this->options)) {
$xmlOptions = $this->options["options"];
foreach ($xmlOptions as $o) {
$stcOption = array();
$stcOption["text"] = $o->nodeValue;
$stcOption["value"] = $o->getAttribute("value");
$aryOptions[] = $stcOption;
}
} else {
$objDir = dir(getRootPath() . "/styles");
while (false !== ($strEntry = $objDir->read())) {
if (substr($strEntry, 0, 1) != ".") {
$stcOption = array();
$stcOption["text"] = $strEntry;
$stcOption["value"] = $strEntry;
$aryOptions[] = $stcOption;
}
}
}
$blnFound = false;
foreach ($aryOptions as $o) {
$v = $o["value"];
$t = $o["text"];
if ($v == null) {
$v = $t;
}
if ($v == $value) {
$strReturn .= "<option value=\"" . $v . "\" selected>" . $t . "</option>";
$blnFound = true;
} else {
$strReturn .= "<option value=\"" . $v . "\">" . $t . "</option>";
}
}
if (!$blnFound) {
$strReturn .= "<option value=\"" . $value . "\" selected>" . $value . "</option>";
}
$strReturn .= "</select>";
return $strReturn;
}
开发者ID:joel-cass,项目名称:structure-cms,代码行数:47,代码来源:theme.php
示例4: getRootPath
<?php
include_once getRootPath() . "/classes/controls/ListBuilder.php";
?>
<?php
ListBuilder::init();
?>
<form action="" method="POST" class="edit" id="frmLayout">
<h2>Editing Layout: <?php
echo $strNode;
?>
</h2>
<ul id="actions-nav">
<li>
<a href="node-edit.php?node=<?php
echo $strNode;
?>
">
<img src="images/go-previous.png" alt="Go back" width="16" height="16" border="0" align="left">
Go back
</a>
</li>
<li>
<a href="#" onclick="javascript:$('#frmLayout').submit();return false;">
<img src="images/page-save.png" alt="Save layout" width="16" height="16" border="0" align="left">
Save layout
</a>
开发者ID:joel-cass,项目名称:structure-cms,代码行数:31,代码来源:form.php
示例5: getFileUrl
/**
* get file url
*
* @param string $value
* @return string
*/
function getFileUrl($value)
{
$output = '';
$wwwroot = removeTrailingSlash(backslashToSlash(getRootPath()));
$urlprefix = "";
$urlsuffix = "";
$value = backslashToSlash(getRealPath($value));
$pos = stripos($value, $wwwroot);
if ($pos !== false )
{
$output = $urlprefix . substr($value, $pos + strlen($wwwroot)) . $urlsuffix;
}else
{
$output = $value;
}
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 'https' : 'http');
return $protocol . "://" . addTrailingSlash(backslashToSlash($_SERVER['HTTP_HOST'])) . removeBeginingSlash(backslashToSlash($output));
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:29,代码来源:function.base.php
示例6: getRootPath
<?php
include_once getRootPath() . "/classes/core/Page.php";
include_once getRootPath() . "/classes/core/ContentType.php";
if (array_key_exists("node", $_REQUEST)) {
$strNode = stripslashes($_REQUEST["node"]);
} else {
$strNode = "/home";
}
if ($strNode == "") {
$strName = "[root]";
} else {
$strName = $strNode;
}
if (Page::isPage($strNode)) {
$objPage = new Page($strNode);
$objType = $objPage->getContentTypeObject();
$strType = $objType->name;
} else {
$strType = "content";
}
$aryTypes = ContentType::getContentTypes();
开发者ID:joel-cass,项目名称:structure-cms,代码行数:22,代码来源:form.php
示例7: getRootPath
<?php
require_once getRootPath() . "/classes/core/Page.php";
if (array_key_exists("node", $_REQUEST)) {
$strNode = stripslashes($_REQUEST["node"]);
} else {
$strNode = "/home";
}
$objPage = new Page($strNode);
$objContentType = $objPage->getContentTypeObject();
$strType = $objContentType->getName();
$strName = $objPage->getName();
$aryTypes = ContentType::getContentTypes();
$aryFields = $objContentType->getFields();
if (!isset($aryInvalid)) {
$aryInvalid = array();
}
$blnActive = $objPage->getActive();
开发者ID:joel-cass,项目名称:structure-cms,代码行数:18,代码来源:form.php
示例8: getUploadPath
function getUploadPath()
{
global $UPLOAD_FOLDER;
return getRootPath() . $UPLOAD_FOLDER;
}
开发者ID:joel-cass,项目名称:structure-cms,代码行数:5,代码来源:paths.php
示例9: elseif
$width = $_GET["w"];
}
if (array_key_exists("h", $_GET) && is_numeric($_GET["h"])) {
$height = $_GET["h"];
}
if ($path == null) {
exit;
} elseif ($width == null && $height == null) {
header("location: {$path}");
exit;
}
$ext = strToLower(preg_replace("/^.*\\./", "", $path));
$image_path = realpath($path);
$cache_name = "path=" . $path . ";w=" . $width . ";h=;" . $height;
$cache_file = md5($cache_name) . "." . $ext;
$cache_folder_path = getRootPath() . "/" . "_image_cache/";
$cache_folder_url = getRootURL() . "/" . "_image_cache/";
$cache_path = $cache_folder_path . $cache_file;
$cache_url = $cache_folder_url . $cache_file;
if (file_exists($cache_path)) {
switch ($ext) {
case "gif":
header('Content-type: image/gif');
$cache = imageCreateFromGif($cache_path);
imageGif($cache);
break;
case "jpg":
header('Content-type: image/jpeg');
$cache = imageCreateFromJpeg($cache_path);
imageJpeg($cache);
break;
开发者ID:joel-cass,项目名称:structure-cms,代码行数:31,代码来源:image.php
示例10: test_getRootPath
public function test_getRootPath()
{
$result = getRootPath(__FILE__);
$this->assertEquals($result, __FILE__);
}
开发者ID:logiks,项目名称:logiks-core,代码行数:5,代码来源:test_helpers_pathfuncs.php
示例11: render
public function render(Page $PAGE)
{
require_once getRootPath() . "/classes/helpers/LayoutHelper.php";
require_once getRootPath() . "/classes/helpers/SettingsHelper.php";
include $this->path;
}
开发者ID:joel-cass,项目名称:structure-cms,代码行数:6,代码来源:Layout.php
示例12: getFileUrl
/**
* get file url
*
* @param string $value
* @return string
*/
function getFileUrl($value)
{
$wwwroot = removeTrailingSlash(backslashToSlash(getRootPath()));
$urlprefix = '';
$urlsuffix = '';
$value = backslashToSlash(getRealPath($value));
$pos = stripos($value, $wwwroot);
if ($pos !== false) {
$output = $urlprefix . substr($value, $pos + strlen($wwwroot)) . $urlsuffix;
} else {
$output = $value;
}
$protocol = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 'https' : 'http';
// Pick up URL up to /admin and exclude /admin . This is the phpMyFAQ directory
$pmfBase = strrev(str_replace('nimda/', '', stristr(strrev(backslashToSlash($_SERVER['HTTP_REFERER'])), 'nimda/')));
if ($pmfBase == $_SERVER['HTTP_HOST']) {
// phpMyFAQ is not in a subdirectory of a domain
$pmfRest = str_replace($_SERVER['DOCUMENT_ROOT'], '', stristr($output, $_SERVER['DOCUMENT_ROOT']));
} else {
// phpMyFAQ is in a subdirectory of a domain
// extract subdirectory from URL for comparison with path
$pmfSame = strrchr($pmfBase, '/');
// extract the rest of URL including file name from file path
$pmfRest = str_replace($pmfSame, '', substr(backslashToSlash($output), strrpos(backslashToSlash($output), $pmfSame)));
}
return $pmfBase . $pmfRest;
}
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:33,代码来源:function.base.php
示例13: Exception
if (!file_exists($path)) {
throw new Exception('Aucune fichier trouvé : ' . $path);
}
if (!is_writable($path)) {
throw new Exception('Impossible d\'écrire dans : ' . $path);
}
if (is_dir($path)) {
throw new Exception('Impossible de supprimer un dossier : ' . $path);
}
$allowRemovePath = config::byKey('allowRemoveDir', 'script');
$allowRemovePath[] = config::byKey('userScriptDir', 'script');
if (!hadFileRight($allowRemovePath, $path)) {
throw new Exception('Vous n\'etez pas autoriser supprimer : ' . $path);
}
unlink($path);
ajax::success();
}
if (init('action') == 'addUserScript') {
$path = config::byKey('userScriptDir', 'script') . '/' . init('name');
if (strpos($path, '/') !== 0 || strpos($path, '\\') !== 0) {
$path = getRootPath() . '/' . $path;
}
if (!touch($path)) {
throw new Exception('Impossible d\'écrire dans : ' . $path);
}
ajax::success($path);
}
throw new Exception('Aucune methode correspondante à : ' . init('action'));
} catch (Exception $e) {
ajax::error(displayExeption($e), $e->getCode());
}
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:31,代码来源:script.ajax.php
示例14: Exception
throw new Exception('Error 401 Unauthorized');
}
include_file('core', 'script', 'config', 'script');
include_file('3rdparty', 'jquery.fileTree/jqueryFileTree', 'css');
include_file('3rdparty', 'codemirror/lib/codemirror', 'js');
include_file('3rdparty', 'codemirror/lib/codemirror', 'css');
include_file('3rdparty', 'codemirror/addon/edit/matchbrackets', 'js');
include_file('3rdparty', 'codemirror/mode/htmlmixed/htmlmixed', 'js');
include_file('3rdparty', 'codemirror/mode/clike/clike', 'js');
include_file('3rdparty', 'codemirror/mode/php/php', 'js');
include_file('3rdparty', 'codemirror/mode/shell/shell', 'js');
include_file('3rdparty', 'codemirror/mode/python/python', 'js');
include_file('3rdparty', 'codemirror/mode/ruby/ruby', 'js');
include_file('3rdparty', 'codemirror/mode/perl/perl', 'js');
sendVarToJS('eqType', 'script');
sendVarToJS('userScriptDir', getRootPath() . '/' . config::byKey('userScriptDir', 'script'));
?>
<style>
.CodeMirror-scroll {height: 100%; overflow-y: auto; overflow-x: auto;}
</style>
<div class="row">
<div class="col-lg-2">
<div class="bs-sidebar affix">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav fixnav">
<a class="btn btn-default btn-sm tooltips" id="bt_getFromMarket" title="Récuperer du market" style="display: inline-block;"><i class="fa fa-shopping-cart"></i></a>
<li class="nav-header">Liste des scripts
<i class="fa fa-plus-circle pull-right cursor eqLogicAction" data-action="add" style="font-size: 1.5em;margin-bottom: 5px;"></i>
</li>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="Rechercher" style="width: 100%"/></li>
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:31,代码来源:script.php
示例15: getRootPath
<?php
require_once getRootPath() . "/classes/core/DataType.php";
class type_number extends DataType
{
}
/* ******* LICENSE *******
*
* Copyright 2009 Joel Cass
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
开发者ID:joel-cass,项目名称:structure-cms,代码行数:22,代码来源:number.php
示例16: getRootPath
<?php
require_once getRootPath() . "/classes/core/Page.php";
require_once getRootPath() . "/classes/helpers/FileSystemHelper.php";
class PageHelper
{
public function PageHelper()
{
}
/* STATIC METHODS */
public static function getInstance()
{
return new PageHelper();
}
public static function getDescendants($node, $contentType = "", array $aryPages = array())
{
$aryTemp = Page::getPages($node);
foreach ($aryTemp as $objPage) {
if ($contentType == "" || $objPage->getContentType() == $contentType) {
$aryPages[] = $objPage;
$aryPages = PageHelper::getDescendants($objPage->path, $contentType, $aryPages);
}
}
return $aryPages;
}
public static function search($node, $keyword, $contentType = "")
{
$aryPages = PageHelper::getDescendants($node, $contentType);
$aryResult = array();
$strKeyword = strToLower($keyword);
foreach ($aryPages as $objPage) {
开发者ID:joel-cass,项目名称:structure-cms,代码行数:31,代码来源:PageHelper.php
示例17: getRootPath
<?php
require_once getRootPath() . "/classes/core/View.php";
class PlaceHolder
{
/* PUBLIC VARS */
var $name;
var $xml;
/* PUBLIC METHODS */
public function PlaceHolder($name, DOMElement $xml)
{
$this->name = $name;
$this->xml = $xml;
}
public function render(Page $page)
{
$views = $this->getViews();
foreach ($views as $view) {
$view->render($page);
}
}
public function getViews()
{
$aryViews = array();
$views_xml = XmlHelper::xpath($this->xml->ownerDocument, "/content/options/placeholders/descendant::placeholder[@name='{$this->name}']/descendant::view");
foreach ($views_xml as $view_xml) {
$aryViews[] = new View($view_xml->getAttribute("path"), $view_xml);
}
return $aryViews;
}
public function setViews(array $views)
开发者ID:joel-cass,项目名称:structure-cms,代码行数:31,代码来源:PlaceHolder.php
示例18: getDatabasePath
function getDatabasePath()
{
return getRootPath() . '/database/data.db';
}
开发者ID:BattlePumpkin,项目名称:HundeBlog,代码行数:4,代码来源:common.php
示例19: getRootPath
<input type="file" name="<?php
echo $strFieldName;
?>
">
<input type="submit">
</form>
<?php
}
?>
<?php
if (array_key_exists($strFieldName, $_FILES) && $_FILES[$strFieldName] != null && array_key_exists("type", $_GET) && array_key_exists($_GET["type"], $stcTypes)) {
try {
$stcType = $stcTypes[$_GET["type"]];
$fldUpload = $_FILES[$strFieldName];
$strDest = getRootPath() . "/" . $stcType["path"];
$strURL = getRootURL() . "/" . $stcType["path"];
$strName = ereg_replace("[^A-Za-z0-9\\.]", "-", $fldUpload["name"]);
$strExt = preg_replace("/^.*\\./", "", $strName);
// check for existing file
if (array_search($strExt, $aryDenyFileExt, true)) {
echo "{error:\"Files of that type are not allowed to be uploaded. Sorry.\"}";
exit;
}
// make directory if it doesn't exist
if (!file_exists($strDest)) {
$aryDir = split("/", $strDest);
$strTmp = "";
for ($i = 0; $i < count($aryDir); $i++) {
$strTmp = $strTmp . $aryDir[$i] . "/";
if (!file_exists($strTmp)) {
开发者ID:joel-cass,项目名称:structure-cms,代码行数:31,代码来源:upload.php
示例20: getRootPath
<?php
include_once getRootPath() . "/classes/core/Page.php";
$strNode = stripslashes($_REQUEST["node"]);
Page::delete($strNode);
开发者ID:joel-cass,项目名称:structure-cms,代码行数:5,代码来源:save.php
注:本文中的getRootPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论