示例#1
0
function anchor($ref, $data, $params = array())
{
    if (!instr($ref, 'http://')) {
        if (!instr($ref, '?')) {
            $ref = urlstr(request::mapUri($ref));
        }
    }
    $params = formatParams($params);
    echo "<a href='{$ref}' {$params}>{$data}</a>";
}
示例#2
0
function formatSignature(\ReflectionFunctionAbstract $refl, $arg = -1)
{
    $params = $refl->getParameters();
    $n = $refl->getNumberOfRequiredParameters();
    $required = array_slice($params, 0, $n);
    $optional = array_slice($params, $n);
    if (count($optional) && count($required)) {
        return sprintf('%s[, %s]', formatParams($required, $arg), formatParams($optional, $arg));
    } else {
        if (count($required)) {
            return formatParams($required, $arg);
        } else {
            if (count($optional)) {
                return sprintf('[%s]', formatParams($optional, $arg));
            } else {
                return '';
            }
        }
    }
}
示例#3
0
 protected function jsIncludes()
 {
     $view = $this->view;
     $includes = '';
     if (isset($view->js_includes)) {
         foreach ($view->js_includes as $url) {
             if (is_array($url)) {
                 if (isset($url['src'])) {
                     $url['src'] = appendMTime($url['src']);
                     $includes .= '<script ' . formatParams($url) . ' ></script>';
                 }
             } else {
                 if ($url) {
                     $url = appendMTime($url);
                     $includes .= '<script type="text/javascript" src="' . $url . '" ></script>';
                 }
             }
         }
     }
     $view->js_includes = $includes;
     return $includes;
 }
示例#4
0
function generateOptions($params)
{
    if ($_GET["page_id"] == PAGE_2) {
        $cmd = 'blender -b /usr/lib/blender/scripts/addons/blend.blend -P';
        $cmd .= ' /usr/lib/blender/scripts/addons/' . SCRIPT . ' -- ';
    } else {
        if ($_GET["page_id"] == PAGE_2_ALT) {
            $cmd = 'blender -b /usr/lib/blender/scripts/addons/blend.blend -P';
            $cmd .= ' /usr/lib/blender/scripts/addons/' . SCRIPT_ALT . ' -- ';
        }
    }
    $cmd .= "options.data " . formatParams($params);
    $output = array();
    exec($cmd, $output);
    $options = parseOutput($output);
    if ($options != false) {
        usort($options, 'compareSlack');
    }
    return $options;
}