Example #1
0
 function testTimberGetCallingScriptFile()
 {
     $calling_file = LocationManager::get_calling_script_file();
     $file = getcwd() . '/tests/test-timber.php';
     $this->assertEquals($calling_file, $file);
 }
Example #2
0
 /**
  * Get sidebar from PHP
  * @api
  * @param string  $sidebar
  * @param array   $data
  * @return string
  */
 public static function get_sidebar_from_php($sidebar = '', $data)
 {
     $caller = LocationManager::get_calling_script_dir(1);
     $uris = LocationManager::get_locations($caller);
     ob_start();
     $found = false;
     foreach ($uris as $uri) {
         if (file_exists(trailingslashit($uri) . $sidebar)) {
             include trailingslashit($uri) . $sidebar;
             $found = true;
             break;
         }
     }
     if (!$found) {
         Helper::error_log('error loading your sidebar, check to make sure the file exists');
     }
     $ret = ob_get_contents();
     ob_end_clean();
     return $ret;
 }
Example #3
0
 /**
  * @param bool|string   $caller the calling directory or false
  */
 public function __construct($caller = false)
 {
     $this->locations = LocationManager::get_locations($caller);
     $this->cache_mode = apply_filters('timber_cache_mode', $this->cache_mode);
     $this->cache_mode = apply_filters('timber/cache/mode', $this->cache_mode);
 }