當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OX::realPathRelative方法代碼示例

本文整理匯總了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)) {
//.........這裏部分代碼省略.........
開發者ID:Jaree,項目名稱:revive-adserver,代碼行數:101,代碼來源:CodeMunger.php

示例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();
開發者ID:ballistiq,項目名稱:revive-adserver,代碼行數:31,代碼來源:schema.php


注:本文中的OX::realPathRelative方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。