Esempio n. 1
0
function parse_metadata($data, $meta_options, $html, $solr = false)
{
    if ($solr) {
        //this is necessary to not use default solr ordering
        $arr1 = (array) $data;
        $arr2 = $meta_options;
        $data = array();
        foreach ($arr2 as $key => $val) {
            $data[$val] = $arr1[$val];
        }
    }
    foreach ($data as $key => $value) {
        if ($meta_options == NULL || in_array($key, $meta_options) || array_key_exists($key, $meta_options)) {
            $html .= "<div class='drs-field-label'><b>";
            if (!isset($meta_options[$key])) {
                $html .= titleize($key);
            } else {
                $html .= $meta_options[$key];
            }
            $html .= "</b></div><div class='drs-field-value'>";
            if (is_array($value)) {
                for ($i = 0; $i < count($value); $i++) {
                    if (substr($value[$i], 0, 4) == "http") {
                        $html .= '<a href="' . $value[$i] . '" target="_blank">' . $value[$i] . '</a>';
                    } else {
                        $html .= $value[$i];
                    }
                    if ($i != count($value) - 1) {
                        $html .= "<br/> ";
                    }
                }
            } else {
                $html .= $value;
            }
            $html .= "</div>";
        }
    }
    return $html;
}
Esempio n. 2
0
 function text_titleize()
 {
     $this->assertEqual("Selected", titleize("selected"));
     $this->assertEqual("One Two", titleize("ONE TWO"));
     $this->assertEqual("Three Four", titleize("three four"));
 }
Esempio n. 3
0
function drstk_assoc_file_metadata_callback()
{
    global $all_assoc_meta_options;
    $assoc_options = drstk_get_assoc_meta_options();
    foreach ($all_assoc_meta_options as $option) {
        echo '<label><input type="checkbox" name="drstk_assoc_file_metadata[]" value="' . $option . '" ';
        if (is_array($assoc_options) && in_array($option, $assoc_options)) {
            echo 'checked="checked"';
        }
        echo '/> ' . titleize($option) . '</label><br/>';
    }
}
Esempio n. 4
0
function camelize($value)
{
    return str_replace(' ', '', titleize($value));
}
Esempio n. 5
0
function list_cruds()
{
    $filter = array('.', '..', 'css', 'lib');
    echo '<ul>';
    if ($handle = opendir('..')) {
        while (false !== ($file = readdir($handle))) {
            if (is_dir("../{$file}") && !in_array($file, $filter)) {
                echo "  <li><a href=\"../{$file}/\">" . titleize($file) . "</a></li>\n";
            }
        }
        closedir($handle);
    }
    echo '</ul>';
}