public static function getPath($templateName)
 {
     if (self::$paths === false) {
         self::init();
     }
     $filePath = self::$paths->find($templateName . self::$ext);
     if ($filePath === false) {
         throw new Exception('Could not locate template: ' . $templateName);
     }
     return $filePath;
 }
Example #2
0
 public function testCombinePaths()
 {
     $this->assertEquals('', Paths::combinePaths('', ''));
     $this->assertEquals('', Paths::combinePaths('', '/'));
     $this->assertEquals('/', Paths::combinePaths('/', ''));
     $this->assertEquals('foo/bar', Paths::combinePaths('foo', 'bar'));
 }
Example #3
0
 /**
  * Constructs Framework
  */
 public function __construct()
 {
     $this->paths = Paths::create();
     $this->viewManager = new ViewManager($this->paths);
     $this->theme = new Theme($this->paths);
     $this->assets = new Assets($this->paths, $this->theme->getThemeInfo('version'));
     $this->viewMeta = new ViewMeta();
     $this->customizer = new Customizer();
 }
Example #4
0
 public function testIsAbsolutePath()
 {
     $this->assertTrue(Paths::isAbsolutePath('C:\\windows\\system32'));
     $this->assertTrue(Paths::isAbsolutePath('http://google.com'));
     $this->assertTrue(Paths::isAbsolutePath('/usr/share'));
     $this->assertTrue(Paths::isAbsolutePath('/'));
     $this->assertFalse(Paths::isAbsolutePath(''));
     $this->assertFalse(Paths::isAbsolutePath('./test'));
     $this->assertFalse(Paths::isAbsolutePath('foo/bar'));
     $this->assertFalse(Paths::isAbsolutePath('../foo'));
 }
Example #5
0
 function parameter_source($name, $value, $parameters, $origin = null)
 {
     $default = null;
     if (preg_match('/^source:([^:]+)(?:\\:(.+))?$/', $value, $aux)) {
         $value = $aux[1];
         $default = isset($aux[2]) ? $aux[2] : null;
     }
     if ($origin == 'configuration_file') {
         $paths = new Paths();
         $this->target = $paths->compose(dirname($parameters->getParameter('configuration_file')), $value);
     } else {
         $this->target = $value;
     }
     //$this->__save(null, $default);
     if (!file_exists($this->target)) {
         if (!@touch($this->target)) {
             return $this->addError('can\'t create the target: ' . $this->target);
         }
     }
 }
Example #6
0
 /**
  * @param string $innerPath The path to append to the url without leading slash
  *
  * @return string The url to the baobab framework
  */
 public static function baobabFramework($innerPath = '')
 {
     $baobabPath = Paths::baobabFramework();
     $themePath = Paths::theme();
     $path = str_replace($themePath, '', $baobabPath);
     if (!empty($innerPath)) {
         $innerPath = untrailingslashit($innerPath);
         $path .= '/' . $innerPath;
     }
     return apply_filters('baobab/urls/storage', self::theme($path), $innerPath);
 }
Example #7
0
 /**
  * Pick the first view found in the stack
  *
  * @param array $stack A list of view names by priority order
  *
  * @return null|string The first view that really exists or null if no view was found
  */
 public static function pickView($stack)
 {
     $viewRoot = trailingslashit(Paths::views());
     foreach ($stack as $id) {
         $innerPath = str_replace('.', '/', $id);
         $innerPath .= '.blade.php';
         if (file_exists($viewRoot . $innerPath)) {
             return $id;
         }
     }
     return null;
 }
Example #8
0
 /**
  * Retrieves the dependencies config
  *
  * @return array
  */
 protected function getDependencies()
 {
     if (null === $this->dependencies) {
         if (file_exists(sprintf('%s/dependencies.json', $this->paths->getThemeConfigDir()))) {
             $depsContent = file_get_contents(sprintf('%s/dependencies.json', $this->paths->getThemeConfigDir()));
         } else {
             $depsContent = file_get_contents(sprintf('%s/dependencies.json', $this->paths->getBaseConfigDir()));
         }
         $this->dependencies = json_decode($depsContent, true);
     }
     return $this->dependencies;
 }
function getPathId($path)
{
    global $knownpaths;
    if (!$knownpaths[$path]) {
        $id = Paths::getPathId($path, false);
        if (DB::isError($id)) {
            die($id->getUserInfo() . "\n");
        }
        $knownpaths[$path] = $id;
    }
    //    if ($id < 0) { die("File id is < 0\n"); }
    return $knownpaths[$path];
}
Example #10
0
function startElementXML($parser, $name, $attrs)
{
    global $currentdir, $files, $paths, $rankcounts, $knownpaths;
    // Get the rank
    $depth = sizeof($rankcounts);
    $ranks =& $rankcounts[$depth - 1];
    $rank = $ranks[$name] = $ranks[$name] + 1;
    $path = $paths[$depth - 1] . "/{$name}[{$rank}]";
    if (!$knownpaths[$path]) {
        Paths::getPathId($path, true);
    }
    array_push($paths, $path);
    array_push($rankcounts, array());
}
Example #11
0
 static function __tt780_include($query, $uri, $search = null, $in_configuration = null, $pointer = null)
 {
     if (strpos('path:', $uri) !== false) {
         $uri = str_replace('path:', '', $uri);
         if ($search) {
             $uri = Paths::compose($search, dirname($pages[$uri])) . basename($pages[$uri]);
         }
         return file_exists($uri) ? $uri : null;
     }
     if (preg_match('/^\\w+$/', $uri)) {
         return $uri;
     }
     return true;
 }
Example #12
0
 static function __tt780_include($query, $uri, $search = null)
 {
     if (!is_string($uri)) {
         return null;
     }
     if (strpos($uri, ':') != -1) {
         $aux = explode(':', $uri);
         $uri = $aux[0];
     }
     // adjust path to be visible from 'search' location, maybe with absolute path (realpath) its more easy... anyway
     if ($uri && $search) {
         $uri = Paths::compose($search, $uri);
     }
     return file_exists($uri) ? $uri : null;
 }
Example #13
0
 static function __tt780_include($query, $uri, $search = null)
 {
     $query = explode('.', $query);
     $pages = !is_array($uri) ? array($query[1] => $uri) : $uri;
     if (!isset($pages[$query[1]])) {
         return null;
     }
     if (strpos('path:', $pages[$query[1]]) !== false) {
         $pages[$query[1]] = str_replace('path:', '', $pages[$query[1]]);
     }
     // adjust path to be visible from 'search' location, maybe with absolute path (realpath) its more easy... anyway
     if ($search) {
         $pages[$query[1]] = Paths::compose($search, dirname($pages[$query[1]])) . basename($pages[$query[1]]);
     }
     if (is_dir($pages[$query[1]])) {
         $pages[$query[1]] = "{$pages[$query[1]]}{$query[1]}.php";
     }
     return file_exists($pages[$query[1]]) ? $pages[$query[1]] : null;
 }
Example #14
0
 static function compose($path1, $path2)
 {
     // si path2 es ruta estatica no hay operaciones
     if ($path2 != '' && $path2[0] == '/') {
         return $path2;
     }
     $is_static = $path1 && $path1[0] == '/';
     // las rutas se descomponen en arreglos
     $ddir1 = Paths::__split($path1);
     $ddir2 = Paths::__split($path2);
     $res = array();
     $isDir = 0;
     foreach ($ddir1 as $directory) {
         if ($directory == ".." && $isDir > 0) {
             array_pop($res);
             $isDir--;
             continue;
         }
         if ($directory != "") {
             if ($directory != "..") {
                 $isDir++;
             }
             array_push($res, $directory);
         }
     }
     foreach ($ddir2 as $directory) {
         if ($directory == ".." && $isDir > 0) {
             array_pop($res);
             $isDir--;
             continue;
         }
         if ($directory != "..") {
             $isDir++;
         }
         array_push($res, $directory);
     }
     if (count($res) == 1 && $res[0] == "") {
         return "";
     }
     $res = implode("/", $res);
     return ($is_static ? '/' : '') . $res . (is_dir($res) ? '/' : '');
 }
 /**
  * Returns a multi-dimensional array that describes the inputs
  * of an assertive template. Data available: 
  *   array[$inputName]['required'] = boolean
  *   array[$inputName]['type'] = string type representation
  *   array[$inputName]['default'] = string default value
  *   
  * @param string Part name relative to AssertiveTemplate's paths.
  * @param string The class name to look for, i.e. for Part::input 'Part', Layout::input 'Layout'
  * @returns array Representation of required inputs.
  */
 public static function getInputs($template, $class = 'AssertiveTemplate')
 {
     if (!isset(self::$loaded[$template])) {
         $cacheKey = 'AssertiveTemplate::inputs::' . $template;
         if (($inputs = Cache::get($cacheKey)) !== false) {
             self::$loaded[$template] = $inputs;
         } else {
             if (self::$paths === false) {
                 self::init();
             }
             $templateFile = self::$paths->find($template);
             if ($templateFile === false) {
                 throw new RecessFrameworkException("The file \"{$template}\" does not exist.", 1);
             }
             $file = file_get_contents($templateFile);
             $pattern = self::getInputRegex($class);
             preg_match_all($pattern, $file, $matches);
             $inputs = array();
             foreach ($matches[0] as $key => $value) {
                 $input = array();
                 $name = $matches[1][$key];
                 $input['type'] = $matches[2][$key];
                 $input['required'] = !isset($matches[3][$key]) || $matches[3][$key] === '';
                 if (!$input['required']) {
                     $input['default'] = $matches[3][$key];
                 } else {
                     $input['default'] = null;
                 }
                 $inputs[$name] = $input;
             }
             self::$loaded[$template] = $inputs;
             Cache::set($cacheKey, $inputs);
         }
     }
     return self::$loaded[$template];
 }
Example #16
0
 private function __h_include($query, $tracking = false)
 {
     if (!isset($GLOBALS['tt780'][$this->id]['includes'])) {
         $GLOBALS['tt780'][$this->id]['includes'] = array();
     }
     if ($tracking) {
         echo "<b>include</b>: {$query}. <br>\n";
     }
     // in "cache"
     if (isset($GLOBALS['tt780'][$this->id]['includes'][$query])) {
         if ($tracking) {
             echo "localization in cache<br>\n";
         }
         return $GLOBALS['tt780'][$this->id]['includes'][$query];
     }
     list($handler, $method, $query, $explicit) = $this->__h_extract($query);
     // search
     // ... resource extern to configuration file,
     // "in-line" declared, run-time query  :       component:/path/file/class.php
     if ($explicit) {
         if (!file_exists($explicit[1])) {
             return null;
         }
         if ($tracking) {
             echo "extern configuration: {$explicit[1]}<br>\n";
         }
         return $GLOBALS['tt780'][$this->id]['includes'][$query] = array($explicit[1], $explicit[0], $query);
     }
     // ... resource lambda
     if (isset($GLOBALS['tt780'][$this->id]['configuration'][$query]) && is_object($GLOBALS['tt780'][$this->id]['configuration'][$query]) && $GLOBALS['tt780'][$this->id]['configuration'][$query] instanceof Closure) {
         if ($tracking) {
             echo "explicitly declared like: lambda function <br>\n";
         }
         return $GLOBALS['tt780'][$this->id]['includes'][$query] = array($GLOBALS['tt780'][$this->id]['configuration'][$query], 'lambda', $query);
     }
     // ... resource explicitly declared
     if (($pointer = isset($GLOBALS['tt780'][$this->id]['configuration']["{$handler}.{$method}"]) ? "{$handler}.{$method}" : null) || ($pointer = isset($GLOBALS['tt780'][$this->id]['configuration'][$handler]) ? $handler : null)) {
         if ($tracking) {
             echo "explicitly declared in configuration like: '{$pointer}'<br>\n";
         }
         // extends... 20140206
         if ($pointer == "{$handler}.{$method}" && isset($GLOBALS['tt780'][$this->id]['configuration'][$handler])) {
             $GLOBALS['tt780'][$this->id]['configuration'][$pointer] = array_merge($GLOBALS['tt780'][$this->id]['configuration'][$handler], $GLOBALS['tt780'][$this->id]['configuration']["{$handler}.{$method}"]);
         }
         foreach (Control::$types as $t_key => $t_handler) {
             if (is_array($GLOBALS['tt780'][$this->id]['configuration'][$pointer]) && isset($GLOBALS['tt780'][$this->id]['configuration'][$pointer][$t_key])) {
                 if ($tracking) {
                     echo "\t type explicitly declared like \"{$t_key}\" whit \"{$GLOBALS['tt780'][$this->id]['configuration'][$pointer][$t_key]}\"<br>\n";
                 }
                 if (!class_exists($t_handler)) {
                     tt780_loader($t_handler);
                 }
                 // $query
                 // $uri    ... uri, configuration string of the handlar
                 // $search ... if the values on uri string these need adjust in relation to this path
                 // $in_configuration ... parameters
                 // $pointer ... $query string is no necesary the same key on the configuration file (pointer)
                 eval("\n                        \$res = {$t_handler}::__TT780_include(\n                            '{$query}',\n                            \$GLOBALS['tt780'][\$this->id]['configuration'][\$pointer][\$t_key],\n                            \$GLOBALS['tt780'][\$this->id]['search_path'],\n\n                            \$GLOBALS['tt780'][\$this->id]['configuration'][\$pointer],\n                            \$pointer\n                        );\n                    ");
                 if ($tracking) {
                     echo "\t including with " . ($res ? print_r($res, true) : '--') . "<br>\n";
                 }
                 return $res ? $GLOBALS['tt780'][$this->id]['includes'][$query] = array($res, $t_key, $pointer) : null;
             }
         }
     }
     // ... resource localization by conventions
     if (!isset($GLOBALS['tt780'][$this->id]['configuration']['convention'])) {
         return null;
     }
     $h = array_keys($GLOBALS['tt780'][$this->id]['configuration']['convention']);
     foreach ($h as $mode) {
         // clean plural name ¬¬
         // $mode = "{$t_key}s";
         $t_key = preg_replace('/s$/', '', $mode);
         if (!isset(Control::$types[$t_key])) {
             continue;
         }
         $t_handler = Control::$types[$t_key];
         if ($tracking) {
             echo "localization by conventions: like {$mode}<br>\n";
         }
         if (!isset($GLOBALS['tt780'][$this->id]['configuration']['convention'][$mode])) {
             continue;
         }
         if (!is_array($GLOBALS['tt780'][$this->id]['configuration']['convention'][$mode])) {
             $GLOBALS['tt780'][$this->id]['configuration']['convention'][$mode] = array($GLOBALS['tt780'][$this->id]['configuration']['convention'][$mode]);
         }
         foreach ($GLOBALS['tt780'][$this->id]['configuration']['convention'][$mode] as $reg_exp => $template) {
             if ($tracking) {
                 echo "localization by conventions: try {$reg_exp} <br>\n";
             }
             $last = error_get_last();
             $preg_match = @preg_match($reg_exp, $query, $aux);
             if (($err = error_get_last()) !== null && $err['message'] != $last['message'] && $err['file'] != $last['file'] && $err['line'] != $last['line']) {
                 trigger_error(defined('TT780_DEBUG') ? "Regular expresion error: '{$reg_exp}': " . $err['message'] . "<br>In convention configuration \"" . $GLOBALS['tt780'][$this->id]['globals']->getParameter('configuration_file') . "\"" : "System Error", E_USER_ERROR);
             }
             if ($preg_match === false) {
                 if ($tracking) {
                     echo "... NO<br>\n";
                 }
                 continue;
             }
             $replaces = array('__HANDLER__' => $handler, '__METHOD__' => $method);
             for ($i = 1; $i < count($aux); $i++) {
                 $replaces["\${$i}"] = $aux[$i];
             }
             if (!is_array($template)) {
                 $template = array($template);
             }
             foreach ($template as $t) {
                 if (!class_exists($t_handler)) {
                     tt780_loader($t_handler);
                 }
                 if ($tracking) {
                     echo "&nbsp; &nbsp; search in: {$t}";
                 }
                 $res = Paths::compose($GLOBALS['tt780'][$this->id]['search_path'], str_replace(array_keys($replaces), $replaces, $t));
                 // check if can include
                 eval("\n                        \$exists = {$t_handler}::__TT780_include(\n                            '{$query}',\n                            '{$res}'\n                        );\n                    ");
                 if (!$exists) {
                     if ($tracking) {
                         echo "... NO<br>\n";
                     }
                     continue;
                 }
                 if ($tracking) {
                     echo "... <b>YES</b><br>\n";
                     echo "&nbsp; &nbsp; &nbsp; {$t_key}:{$handler} {$res}";
                 }
                 return $GLOBALS['tt780'][$this->id]['includes'][$query] = array($res, $t_key, $handler);
             }
         }
     }
     return null;
 }
Example #17
0
<article #{{ post_class() }}>
    <header class="entry-header">
        @if(has_post_thumbnail())
            <div class="featured-image">
                #{{ the_post_thumbnail() }}
            </div>
        @endif

        <h1>{{ get_the_title() }}</h1>
        @include('parts.single.meta.default')
    </header>

    <div class="entry-content">
        #{{ the_content() }}
    </div>

    <footer class="entry-footer">
        #{{ previous_post_link('<span class="previous-entry">%link</span>') }}
        #{{ next_post_link('<span class="next-entry">%link</span>') }}
    </footer>

    <?php 
// TODO CHANGE THIS IN ORDER TO USE BLADE IF POSSIBLE
comments_template(Paths::theme('app/views/parts/comments/list.php'));
?>
</article>
Example #18
0
<?php

include './paths.php';
$paths = new Paths();
$phpPath = $paths->getFullPath('php');
$analyticsPath = $paths->getHTTPPath("submitAnalytics");
$jsPath = $paths->getHTTPPath("js");
$libsjsPath = $paths->getHTTPPath("libsjs");
$countriesjsPath = $paths->getHTTPPath("countriesjs");
require_once $phpPath . "libs.php";
?>
<html>
<head>
<style>


table.main {
    border-collapse: collapse;
    border-color: #000000;
    border-spacing: 0;
    border-style: solid;
    border-width: 1px;
    font-size: 10px;
    font-family: Verdana,Arial,Helvetica,sans-serif;
}

td.main,th {
	border-color: #000000;
	border-style: solid;
	border-width: 1px;
	padding: 3.5px;
Example #19
0
    }
}
if (sizeof($_SERVER["argv"]) - $i != 6) {
    die("addPool [-update <poolid>] <state> <userid> <name> <default collection> <pool file>\n");
}
$poolstate = $_SERVER["argv"][1 + $i];
$userid = $_SERVER["argv"][2 + $i];
$poolname = $_SERVER["argv"][3 + $i];
$collection = $_SERVER["argv"][4 + $i];
$filename = $_SERVER["argv"][5 + $i];
if (!is_file($filename)) {
    die("'{$filename}' is not a file\n");
}
$xrai_db->autoCommit(false);
print "Starting processing of pool file '{$filename}'\n";
$emptypathid = Paths::getPathId("", true);
// ==================================================
// Parse of file
function getFileId($path)
{
    global $collection;
    $idFile = Files::getFileId($collection, $path, false);
    if (DB::isError($idFile)) {
        die($idFile->getUserInfo() . "\n");
    }
    if ($idFile < 0) {
        print "File '{$collection}, {$path}' id is < 0\n";
    }
    return $idFile;
}
$file = -1;
Example #20
0
 function parameter_path($name, $value, $parameters)
 {
     $paths = new Paths();
     $this->value = $paths->compose(dirname($parameters->getParameter('configuration_file')), substr($value, 5) . '/');
 }
Example #21
0
echo sizeof($toremove);
?>
 assessment(s) removed");
</script>

<?
   if (!DB::isError($res)) {
      // Save history (non blocking process)
      $xrai_db->autoCommit(true);
      $error=false;
      foreach($hist as $h) {
         if ($do_debug) print "<div>Saving hist $h</div>\n";
         $h = split(',',$h);
         while (true) {
            $res = $startid = Paths::getPathId($h[2]); if (DB::isError($startid)) break;
            $res = $endid = Paths::getPathId($h[3]); if (DB::isError($endid)) break;
            $res = $xrai_db->autoExecute($db_log, array("idpool" => $assessments->idPool, "idfile" => $assessments->idFile,
                     "startpath" => $startid, "endpath" => $endid, "action" => $h[0], "time" => $h[1]));
            break;
         }
         if (DB::isError($res)) {
            if ($do_debug) print "<div>" . $res->getUserInfo() ."</div>";
            $error = true;
         }
      }
      if ($error) {
         ?><script type="text/javascript">
            ref.Message.show("warning","Error while saving history.");
         </script><?
      }
   }
Example #22
0
 /**
  * @return string
  */
 public function GetReservationAttachmentsPath()
 {
     return Paths::ReservationAttachments();
 }
 public function CreateDataModel($name)
 {
     $userSettings = self::GetSettings();
     foreach ($userSettings->DataModels as $item) {
         if ($item->Name == $name) {
             throw new Exception("Data model with name '" . $name . "' already exists");
         }
     }
     $userDataModel = new UserDataModel();
     $userDataModel->Name = $name;
     $userDataModel->ServerLanguage = "php";
     $userSettings->DataModels[] = $userDataModel;
     $userSettings->Save(Paths::getWDMConfigPath());
     return $userDataModel;
 }
Example #24
0
 public function Execute(Database $database)
 {
     $database->Execute(new RemoveReservationAttachmentCommand($this->event->FileId()));
     ServiceLocator::GetFileSystem()->RemoveFile(Paths::ReservationAttachments() . $this->event->FileName());
 }
Example #25
0
<?php

include '../paths.php';
$paths = new Paths();
$phpPath = $paths->getFullPath("php");
require_once $phpPath . "libs.php";
header("content-type:text/javascript");
$analytics_DBName = 'tsanalyticsdb';
$analytics_tableName = 'ts_analytics_data_01';
$analytics_username = '******';
$analytics_password = "******";
$analyticsPrefixString = 'ts_an_';
function tsan_connect()
{
    global $analytics_username;
    global $analytics_password;
    global $analytics_DBName;
    $connection = mysql_connect("topperstudioscom.ipagemysql.com", $analytics_username, $analytics_password) or kill_script('1');
    mysql_select_db($analytics_DBName, $connection) or kill_script('2');
    return $connection;
}
$COLS = $_GET["columns"] ? tsescape($_GET["columns"]) : "ID";
$link = tsan_connect();
$result = mysql_query("SELECT " . $COLS . " FROM " . $analytics_tableName . " WHERE ABS(ts_an_lastupdate - " . time() . ") < 10", $link);
$ARR = array();
while ($row = mysql_fetch_assoc($result)) {
    array_push($ARR, $row);
}
echo $_GET['callback'] . "(" . json_encode($ARR) . ");";
<?php

$IS_ON = true;
$DEBUG = $_GET['debug'] == '1' ? true : false;
if (!$IS_ON) {
    kill_script('5');
}
include './paths.php';
$paths = new Paths();
$phpPath = $paths->getFullPath('php');
require_once $phpPath . "libs.php";
ini_set('display_errors', 0);
header('Content-Type:text/javascript');
$countryCode = iptocountry($_SERVER["REMOTE_ADDR"]);
$analytics_DBName = 'tsanalyticsdb';
$analytics_tableName = 'ts_analytics_data_01';
$analytics_username = '******';
$analytics_password = "******";
$analyticsPrefixString = 'ts_an_';
$analytics_fields = array("__update__", "winsize", "coords", "avg_conn", "reqid", "usrid", "referer", "screen", "time", "mouse", "clicks", "scroll", "keys", "events", "duration", "s_REMOTE_PORT", "s_REMOTE_HOST", "s_REMOTE_ADDR", "s_TIME", "s_REQUEST_METHOD", "s_URL", "s_SERVER_PORT", "s_COUNTRY", "s_UA");
$server_vars = array("s_REMOTE_PORT" => $_SERVER['REMOTE_PORT'], "s_REMOTE_HOST" => $_SERVER['REMOTE_HOST'], "s_REMOTE_ADDR" => $_SERVER['REMOTE_ADDR'], "s_URL" => $_SERVER['HTTP_REFERER'], "s_SERVER_PORT" => $_SERVER['SERVER_PORT'], "s_COUNTRY" => $countryCode, "s_UA" => $_SERVER['HTTP_USER_AGENT']);
foreach ($server_vars as $key => $value) {
    $_GET[$analyticsPrefixString . $key] = $value;
}
foreach ($analytics_fields as $anKey => $anfield) {
    $analytics_fields[$anKey] = $analyticsPrefixString . $anfield;
}
$debug_array = array();
function debugLog($str)
{
    global $DEBUG;
Example #27
0
 function parameter_file($name, $value, $parameters, $origin = null)
 {
     $this->name = basename(substr($value, 5));
     $paths = new Paths();
     $this->path = $paths->compose(dirname($parameters->getParameter('configuration_file')), substr(dirname($value) . '/', 5));
 }
Example #28
0
 /**
  * Method: action_wp_loaded
  * =========================================================================
  * At this point we setup the laravel router and completely take over
  * the frontend routing. I hate all the wordpress template hierarchy
  * and the wordpress rewrite rules, etc. A simple HTTP router is so
  * much easier to follow.
  *
  * Parameters:
  * -------------------------------------------------------------------------
  * n/a
  *
  * Returns:
  * -------------------------------------------------------------------------
  * void
  */
 public function action_wp_loaded()
 {
     // We only want the router to run for requests that get
     // funneled through index.php by the .htaccess rewrite rules.
     // wp-admin, wp-cron, wp-login, xmlrpc, etc should run as expected.
     if ($_SERVER['SCRIPT_NAME'] == '/index.php') {
         // Are we being run from a child theme?
         if (Paths::currentTheme() != Paths::parentTheme()) {
             try {
                 \Gears\Router::install(Paths::currentTheme() . '/routes', false);
             } catch (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e) {
                 // do nothing for now
             }
         }
         // Check to see if we have a 404 view
         if (\View::exists('errors.404')) {
             $notfound = \View::make('errors.404');
         } else {
             $notfound = null;
         }
         /*
          * If the execution gets to here it means either there is no child
          * theme. Or that the child theme router returned a 404. Either way
          * we will now run a second router, pointing to our route files.
          */
         \Gears\Router::install(Paths::parentTheme() . '/routes', $notfound);
         // The router by default exits php after it has done it's thing.
         // Statements after here are pointless...
     }
 }
Example #29
0
 private static function __scp($query, $origin, $destiny)
 {
     if (handler_lend::$trace) {
         var_dump(Handler::__from());
     }
     if (handler_lend::$hl[$query]['type'] == 'ssh-client') {
         return handler_lend::__exec("scp " . " {$origin}" . " " . handler_lend::$hl[$query]['user'] . "@" . handler_lend::$hl[$query]['host'] . ":{$destiny}", $query);
     }
     if (handler_lend::$hl[$query]['type'] == 'local') {
         //            $destiny = handler_lend::$hl[$query]['path'] . $destiny;
         $destiny = Paths::compose(handler_lend::$hl[$query]['path'], $destiny);
         return handler_lend::__exec("cp {$origin} {$destiny}", $query);
     }
     return null;
 }
Example #30
0
						}
					}
				}
				
				$http_path = $this->protocol . $http_path;
			
			}
			
			$this->full = $full_path;
			$this->http = $http_path;
		}
	}
	
}

$paths = new Paths;
echo $paths->getFullPath("pages");


class Paths {
	/*
	public function currentPath($path_str){
		$this->current_path = $path_str;
	}
	public function getRelativePath($path_str){
		$directories_down = ('/',$this->current_path);
		$dir_count = $directories_down.count;
		$dir_str = '';
		for ($i = 0; $i < $dir_count; $i++){
			$dir_str .= '../';
		}