本文整理汇总了PHP中root函数的典型用法代码示例。如果您正苦于以下问题:PHP root函数的具体用法?PHP root怎么用?PHP root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了root函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_template
function render_template($locals, $fileName)
{
extract($locals);
ob_start();
include root() . 'views/' . $fileName . '.php';
return ob_get_clean();
}
示例2: pad_write
function pad_write($p, $o, $res)
{
$pad = 'pad' . ses('USE') . date('ymd');
$f = 'plug/_data/' . $pad . '.txt';
write_file($f, ajxg($res));
return lkt('popbt', root() . $f, $pad);
}
示例3: combine
public static function combine($type, $files, $compress = false)
{
$root = root('panel.assets') . DS . $type;
$cache = new Media($root . DS . 'panel.' . $type);
$media = new Collection(array_map(function ($file) use($root) {
return new Media($root . DS . str_replace('/', DS, $file));
}, $files));
// get the max modification date
$modified = max($media->pluck('modified'));
if (is_writable($root) and (!$cache->exists() or $cache->modified() < $modified)) {
$cache->remove();
$content = '';
foreach ($media as $asset) {
$content .= $asset->read() . PHP_EOL;
}
if ($compress) {
$content = static::compress($content);
}
f::write($root . DS . 'panel.' . $type, $content);
}
if ($cache->exists()) {
return $type('panel/assets/' . $type . '/panel.' . $type);
}
return $type(array_map(function ($item) use($type) {
return 'panel/assets/' . $type . '/' . $item;
}, $files));
}
示例4: systeminfo
/**
* Simple Debug info
*
* @version 1.0
* @since 1.0.0
* @author Dan Aldridge
*
* @return void
*/
public function systeminfo()
{
$objSQL = Core_Classes_coreObj::getDBO();
$objTPL = Core_Classes_coreObj::getTPL();
$objTime = Core_Classes_coreObj::getTime();
$objForm = Core_Classes_coreObj::getForm();
$objTPL->set_filenames(array('body' => cmsROOT . Core_Classes_Page::$THEME_ROOT . 'block.tpl'));
// checkers
// grab some info about GD
if (function_exists('gd_info')) {
$a = gd_info();
$gdVer = preg_replace('/[[:alpha:][:space:]()]+/', '', $a['GD Version']);
} else {
$gdVer = 'Not Installed.';
}
$info = '<div class="alert alert-info"><strong>Important!</strong> This panel needs more updating to output more useful data that has been made avaliable during the last overhaul</div>';
$content = 'This panel gives the CMS dev team some information about your setup.
;--System Setup
CMS Version: ' . CMS_VERSION . '
PHP Version: ' . PHP_VERSION . ' (' . (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on' ? 'Safe Mode Enabled' : 'Safe Mode Disabled') . ')
MySQL Version: ' . mysql_get_server_info() . '
GD Version: ' . $gdVer . '
;--CMS Setup
Install Path: /' . root() . '
' . json_encode($objSQL->fetchAll('SELECT * FROM `#__config`')) . '';
Core_Classes_coreObj::getAdminCP()->setupBlock('body', array('cols' => 3, 'vars' => array('TITLE' => 'System Info', 'CONTENT' => $info . $objForm->textarea('sysInfo', $content, array('style' => 'width: 99%', 'rows' => 20)), 'ICON' => 'fa-icon-user')));
}
示例5: bindPaths
/**
* Bind paths
*
* @return void
*/
public function bindPaths()
{
$root = root();
$source = $root . '/' . Conf::get('source', 'source');
$paths = ['root' => $root, 'source' => $source, 'posts' => $source . '/posts', 'pages' => $source . '/pages', 'themes' => $source . '/themes', 'theme' => $source . '/themes/' . Conf::get('theme'), 'plugins' => $root . '/' . Conf::get('plugins', 'plugins')];
foreach ($paths as $key => $value) {
App::instance("path.{$key}", $value);
}
}
示例6: plug_imtx
function plug_imtx($p, $o)
{
$rid = 'plg' . randid();
ses('out', '/plug/_data/imtx.png');
$j = $rid . '_plug__2_imtx_imt*j_' . $w . '_' . $h . '_txtarec';
$sj = 'SaveJ(\'' . $j . '\')';
$ret .= txarea('txtarec', $p, 44, 14, atc('console') . atb('onkeyup', $sj) . atb('onclick', $sj));
$ret .= lj('', $j, picto('reload')) . ' ';
return $ret . divd($rid, image(root() . ses('out')));
}
示例7: chatdata
function chatdata($p)
{
$dr = root() . 'msql/users/';
$dfb['_menus_'] = array('time', 'name', 'msg');
$r = read_vars($dr, ses('qb') . '_chat_' . $p, $dfb);
if ($r) {
unset($r['_menus_']);
}
return $r;
}
示例8: login_process
public function login_process()
{
$objUser = Core_Classes_coreObj::getUser();
$objLogin = Core_Classes_coreObj::getLogin();
$objPage = Core_Classes_coreObj::getPage();
if ($objLogin->process() !== true) {
$this->login_form();
return;
}
$objPage->redirect(doArgs('referer', '/' . root(), $_SESSION['login']), 0);
}
示例9: __construct
function __construct($parent = null, $params_json = "{}")
{
$this->interactive = true;
$this->game = 0;
$this->round = 0;
parent::__construct($parent, $params_json);
$this->name = "game";
$db_dices = root($this)->db->load("Dice");
if (count($db_dices)) {
$this->interactive = false;
}
}
示例10: __construct
public function __construct()
{
$root = root();
$config_path = $this->app('config_path') ?: 'config.yml';
$this->path = $root . '/' . $config_path;
if (!is_readable($this->path)) {
// @codeCoverageIgnoreStart
throw new \LogicException('cannot read config file: ' . $this->path);
// @codeCoverageIgnoreEnd
}
$this->data = Yaml::parse(file_get_contents($this->path));
}
示例11: fetchTemplate
/**
* Fetch template HTML and parse vars.
*
* @param array $vars Vars to pass to template.
*
* @return string
*/
private function fetchTemplate($vars = array())
{
$html = rfile_get_contents(appdir('template/mail/' . $this->template . '.html'));
foreach ($this->vars as $key => $var) {
$html = str_replace('{{ ' . $key . ' }}', $var, $html);
}
$css = array();
preg_match_all('/\\{\\%css\\:\\ (.*?)\\ \\%\\}/', $html, $css);
if (!empty($css[1][0])) {
$style = rfile_get_contents(root('www/asset/css/' . $css[1][0]));
$html = str_replace($css[0][0], '<style>' . $style . '</style>', $html);
}
return $html;
}
示例12: dump
/**
* Pretty wrapper to print_r()
*
* @version 3.0
* @since 1.0.0
* @author Dan Aldridge
*
* @param variable $var
* @param string $info
* @param string $color Changes the debug header color
* @param bool $specialFX
*
* @return string
*/
function dump(&$var, $info = false, $color = '', $specialFX = true)
{
if (file_exists('debug')) {
return;
}
$objPage = Core_Classes_coreObj::getPage();
$scope = false;
$prefix = 'unique';
$suffix = 'value';
$return = null;
$specialFX = $specialFX !== false ? true : false;
if (is_object($objPage)) {
if ($specialFX) {
/*$objPage->addJSFile(array(
'src' => '/'.root().'assets/javascript/tree.js',
'priority' => LOW,
));*/
}
} else {
static $run;
if (!isset($run) || $run != true) {
echo '<link rel="stylesheet" type="text/css" href="/' . root() . 'assets/styles/debug.css" />' . "\n";
}
$run = true;
}
$vals = $scope ? $scope : $GLOBALS;
$old = $var;
$var = $new = $prefix . rand() . $suffix;
$vname = false;
foreach ($vals as $key => $val) {
if ($val === $new) {
$vname = $key;
}
}
$var = $old;
$debug = debug_backtrace();
$call_info = array_shift($debug);
$code_line = $call_info['line'];
$file = explode(stristr(PHP_OS, 'WIN') ? '\\' : '/', $call_info['file']);
$file = array_pop($file);
$id = substr(md5(microtime()), 0, 6);
$return .= sprintf('<div class="debug"><div><div class="header" style="background-color: ' . $color . ';"></div>DEBUG! (<strong>%s : %s</strong>)', $file, $code_line);
if ($info != false) {
$return .= ' | <strong style="color: red;">' . $info . ':</strong>';
}
$return .= '</div><ul id="debug_' . $id . '"' . ($specialFX ? ' data-switch="true"' : '') . '>' . doDump($var, '$' . $vname) . '</ul>';
$return .= '</div>';
return $return;
}
示例13: form
protected function form($user = null)
{
$mode = $user ? 'edit' : 'add';
$fields = data::read(root('panel.app') . DS . 'forms' . DS . 'user.' . $mode . '.php', 'yaml');
$content = $user ? $user->data() : array();
// add all languages
$fields['language']['options'] = array();
$fields['language']['default'] = c::get('panel.language', 'en');
foreach (app::languages() as $code => $lang) {
$fields['language']['options'][$code] = $lang->title();
}
// make sure the password is never shown in the form
unset($content['password']);
return new Form($fields, $content);
}
示例14: _codemirrorHighlight
function _codemirrorHighlight($content, $language = '')
{
$objPage = Core_Classes_coreObj::getPage();
if (is_empty($content)) {
return false;
}
$objPage->addCSSFile(array('href' => '/' . root() . 'assets/styles/codemirror-min.css', 'priority' => LOW));
$objPage->addJSFile(array('src' => '/' . root() . 'assets/javascript/codemirror-min.js', 'priority' => LOW), 'footer');
$objPage->addJSFile(array('src' => '/' . root() . 'assets/javascript/codemirror-langs-min.js', 'priority' => LOW), 'footer');
$objPage->addJSFile(array('src' => '/' . root() . 'assets/javascript/codemirror/highlighter.js', 'priority' => LOW), 'footer');
$language = grabLangInfo($language, 'mime');
$content = trim($content);
$content = html_entity_decode($content, ENT_NOQUOTES);
$content = str_replace('<?php', '<?php', $content);
//return $content;
return dump($content) . "\n<pre><span data-lang=\"" . $language . "\" data-codemir3ror=\"true\">" . $content . "</span></pre>\n";
}
示例15: call
function call($params)
{
$houses = findall(root($this), "House");
$this->numhouses = count($houses);
//return json_encode( $houses );
//return $this->numhouses;
if (count($houses) > 0) {
$this->dice1 = rand(1, 6);
$this->dice2 = rand(1, 6);
//save to db
root($this)->db->save($this);
//root( $this )->db->save( $house );
return json_encode(clean($this));
} else {
//dialog
return false;
}
}