Exemplo n.º 1
0
  function isAbsolute($path)
  {
    $path = Fs :: cleanPath($path);
    $separator = Fs :: separator();

    if($path{0} == $separator)
      return true;
    elseif(Sys :: osType() == 'win32' &&  preg_match('~^[a-zA-Z]+:~', $path))
      return true;
    else
      return false;
  }
Exemplo n.º 2
0
  function testPath()
  {
    $this->assertEqual(Fs :: path(array('test')), 'test');
    $this->assertEqual(Fs :: path(array('test', 'wow')), 'test' . Fs :: separator() . 'wow');
    $this->assertEqual(Fs :: path(array('test', 'wow/')), 'test' . Fs :: separator() . 'wow');

    $this->assertEqual(Fs :: path(array('test'), true), 'test' . Fs :: separator());
    $this->assertEqual(Fs :: path(array('test', 'wow'), true), 'test' . Fs :: separator() . 'wow' . Fs :: separator());
  }
  protected function _generateDebugEditorLinkHtml($code, $file_path)
  {
    if(!defined('WS_SCRIPT_WRITTEN'))
    {

      $code->writeHtml('	<SCRIPT LANGUAGE="JScript">
                          function run_template_editor(path)
                          {
                            WS = new ActiveXObject("WScript.shell");
                            WS.exec("uedit32.exe " + path);
                          }
                          </SCRIPT>');

      define('WS_SCRIPT_WRITTEN', true);
    }

    if(Fs :: isPathRelative($file_path))
    {
      $items = Fs :: explodePath($_SERVER['PATH_TRANSLATED']);
      array_pop($items);

      $file_path = Fs :: path($items) . Fs :: separator() . $file_path;
    }

    $file_path = addslashes(Fs :: cleanPath($file_path));
    $code->writeHtml("<a href='#'><img onclick='runTemplateEditor(\"{$file_path}\");' src='/shared/images/i.gif' alt='{$file_path}' title='{$file_path}' border='0'></a>");
  }
  function testFlush()
  {
    $this->_writeSimpleCache('p_test1', $content1 = 'test-content1');
    $this->_writeSimpleCache('p_test2', $content2 ='test-content2');
    $this->_writeSimpleCache('not_page_file', $content3 ='test-content3');

    $cache_manager = new PartialPageCacheManager();
    $cache_manager->flush();

    $files = Fs :: findSubitems(PAGE_CACHE_DIR);

    $this->assertEqual(sizeof($files), 1);

    $file = reset($files);
    $this->assertEqual(Fs :: cleanPath($file), Fs :: cleanPath(PAGE_CACHE_DIR . Fs :: separator() . 'not_page_file'));

    $this->_cleanSimpleCache('not_page_file');
  }
Exemplo n.º 5
0
  function walkDir($dir, $function_def, $params=array(), $include_first=false)
  {
    $return_params = array();

    $separator = Fs :: separator();
    $dir = Fs :: normalizePath($dir);
    $dir = Fs :: chop($dir);

    $params['separator'] = $separator;

    Fs :: _doWalkDir($dir,
                     $separator,
                     $function_def,
                     $return_params,
                     $params,
                     $include_first);

    return $return_params;
  }