Example #1
0
function register($tag, $func)
{
    $tags =& \ui\global_var('shortcode_tags', array());
    $tags[] = $tag;
    \ui\global_var('shortcode_tags_regx', join('|', array_map('preg_quote', $tags)), 1);
    \ui\register_hook('shortcode_tag_' . $tag, $func);
}
Example #2
0
 function write()
 {
     //Automatically populate the language file.
     global $_LANG_POT;
     //file_get_contents('lang/'.$_LANG_POT['lang_code'].'.php',$php);
     $php = '<' . '?php $_LANG_POT=' . PHP_EOL . var_export($_LANG_POT, 1) . ';';
     file_put_contents(\ui\global_var('app_dir') . 'lang/' . $_LANG_POT['lang_code'] . '.php', $php);
 }
Example #3
0
/**
 * Makes an identifier for a cache block using various parameters
 * @return string md5() hash
 */
function make_id($custom = 'none', $ignore_param = false, $ignore_get = false, $ignore_post = false)
{
    $params = $custom;
    $params .= \ui\global_var('controller');
    if (!$ignore_param) {
        $params .= \ui\global_var('path');
    }
    if (!$ignore_get) {
        $params .= serialize($_GET);
    }
    if (!$ignore_post) {
        $params .= serialize($_POST);
    }
    return md5($params);
}
Example #4
0
File: index.php Project: 1upon0/ui
        $ui_controller .= ($i === 0 ? '' : '/') . $params[$i];
    } elseif (file_exists($proposed . '.php')) {
        $is_dir = false;
        $ui_controller .= ($i === 0 ? '' : '/') . $params[$i];
    } else {
        break;
    }
}
$_PARAM = array_slice($params, $i);
$_ENV['param'] = $_ENV['PARAM'] = $_ENV['_PARAM'] = $_ENV['_param'] =& $_PARAM;
if ($is_dir === true) {
    $ui_controller .= $i === 0 ? 'index' : '/index';
}
\ui\global_var('controller', $ui_controller, true);
$ui_filepath = $_APP_DIR . 'app/' . $ui_controller . '.php';
\ui\global_var('controller_file', $ui_filepath, true);
include dirname(__FILE__) . '/core/init.php';
if ($i === 0 && !file_exists($ui_filepath)) {
    http_response_code(404);
    if (file_exists($_APP_DIR . '/app/404.php')) {
        include $_APP_DIR . '/app/404.php';
    } else {
        echo "Error #404 - Requested url does not point to a valid resource";
    }
    trigger_error('UI: ' . $_APP_DIR . 'app/index.php is required for handeling a completely non-existant path', E_USER_ERROR);
    exit;
}
/**
 * Clean up all variables no longer required for minimum footprint
 */
unset($ui_controller);
Example #5
0
File: init.php Project: 1upon0/ui
\ui\benchmark();
include $_APP_DIR . 'inc/autoload.php';
foreach ($autoload['lib'] as $ui_lib) {
    \ui\load_lib($ui_lib);
}
unset($ui_lib);
foreach ($autoload['plugin'] as $ui_plugin) {
    \ui\load_plugin($ui_plugin);
}
unset($ui_plugin);
unset($autoload);
$ctrl = '/' . \ui\global_var('controller');
$offset = strpos($ctrl, '/');
$inc_dir = substr($ctrl, 0, $offset);
$inc_paths = array();
while ($offset !== false) {
    $inc_path = $_APP_DIR . 'app' . $inc_dir . '/_include.php';
    if (file_exists($inc_path)) {
        $inc_paths[] = $inc_path;
        include $inc_path;
    }
    $offset = strpos($ctrl, '/', $offset + 1);
    if ($offset === false) {
        break;
    }
    $inc_dir = substr($ctrl, 0, $offset);
}
\ui\global_var('includes', $inc_paths, 1);
unset($ctrl);
unset($inc_dir);
unset($offset);