本文整理汇总了PHP中OX::realPathRelative方法的典型用法代码示例。如果您正苦于以下问题:PHP OX::realPathRelative方法的具体用法?PHP OX::realPathRelative怎么用?PHP OX::realPathRelative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OX
的用法示例。
在下文中一共展示了OX::realPathRelative方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseFile
/**
* Parse the file uses the PHP tokeniser to analyse a php script and pull included/required files inline
*
* @param string $filename The full/path/to the file to be processed
* @return string The compiled script contents
*/
public function parseFile($filename)
{
// Don't try and process the file if the tokenizer isn't available
if (!function_exists('token_get_all')) {
return false;
}
// Track included files to allow require_once/include_once to work correctly
$thisFile = OX::realPathRelative(getcwd() . '/' . $filename);
$this->onlyOnce[$thisFile] = true;
// Read the file
$source = file_get_contents($filename);
// Tokenize the source
$tokens = token_get_all($source);
// Start in standard state
$state = STATE_STD;
// Track if we are in a STRIP_DELIVERY codeblock
$strip_delivery = false;
// Track if we just output a newline
$was_nl = false;
// The compiled script goes in here, return value
$ret = '';
// If we meet a require/require_once, we store the filename here for recursion
// (the filename may be build by concatination ...)
$cur = '';
// Hold the original content we left off from start of a require/require_once, so
// if we are currently waiting for the filename to be completed, and realize a
// dynamic filename (i.e. T_VARIABLE), we can give up on this filename, and
// output the original, unchanged source
$orig = '';
// Iterate over the file tokens (note: grey magic ;)
foreach ($tokens as $token) {
if (is_string($token)) {
// next token is a none special, simple character
// we can clear newline-flag ...
$was_nl = false;
// if we currently strip off none delivery code, ignore
// this token, start with next
if ($strip_delivery) {
continue;
}
// in normal state, just add to our return buffer
if ($state === STATE_STD) {
$ret .= $token;
} else {
// we waiting to complete a require/require_once, so
// this is just happen !!!
if ($token === ';') {
switch ($state) {
case STATE_REQUIRE_ONCE:
// if we have done this file, don't slurp it again
$thisfile = OX::realPathRelative($cur);
if (array_key_exists($thisfile, $this->onlyOnce)) {
break;
}
//fall through
//fall through
case STATE_REQUIRE:
// try to load the file, if ...
if (!($content = $this->flattenFile($cur))) {
// we are unable to slurp it, just add the original
// require-statement into our buffer
$ret .= $orig . ";\n";
} else {
$ret .= $content;
}
break;
}
// require/require_once statement finished, return to normal
$state = STATE_STD;
} else {
// we are currently collecting a require/require_once filename,
// so keep the original content
$orig .= $token;
// and capture the filename if not the concat op.
if (strpos('.()', $token) === false) {
$cur .= $token;
}
}
}
} else {
// token array
list($id, $text) = $token;
// if we currently strip off none delivery code, we could leave
// this mode only in a comment ...
if ($strip_delivery && !$this->isComment($id)) {
continue;
}
// is last was a newline and we don't like whitespace ...
if ($was_nl && !$this->echoWhite) {
// ... but this is one, cont. on next token
if ($id === T_WHITESPACE) {
continue;
} else {
if (!$this->echoComment && $this->isComment($id)) {
//.........这里部分代码省略.........
示例2: setcookie
$_POST['table_edit'] = '';
} else {
if (array_key_exists('schemaFile', $_COOKIE) && !empty($_COOKIE['schemaFile'])) {
$schemaPath = $_COOKIE['schemaPath'];
$schemaFile = $_COOKIE['schemaFile'];
}
}
}
if (empty($schemaPath) || empty($schemaFile)) {
$schemaPath = '';
//OX_CORE;
$schemaFile = 'tables_core.xml';
}
// ensure correct directory format. $schemaPath requires trailing '/'. Using trailing DIRECTORY_SEPARATOR fails on Windows for reasons unknown
if (isset($schemaPath) && $schemaPath != '') {
$schemaPath = OX::realPathRelative(urldecode($schemaPath));
$schemaPath .= '/';
}
setcookie('schemaPath', $schemaPath);
setcookie('schemaFile', $schemaFile);
global $oaSchema;
$oaSchema = new Openads_Schema_Manager($schemaFile, '', $schemaPath);
if (is_array($aErrs = OX_DevToolbox::checkFilePermissions(array(PATH_DEV, PATH_VAR, MAX_PATH . $pluginPath)))) {
setcookie('schemaFile', '');
setcookie('schemaPath', '');
$errorMessage = join("<br />\n", $aErrs['errors']) . "<br /><br ><hr /><br />\n" . 'To fix, please execute the following commands:' . "<br /><br >\n" . join("<br />\n", $aErrs['fixes']);
die($errorMessage);
}
require_once PATH_DEV . '/lib/xajax.inc.php';
if (array_key_exists('btn_copy_final', $_POST)) {
$oaSchema->createTransitional();