Ejemplo n.º 1
0
 function dspDayCell($day)
 {
     global $permlink_mode;
     $class = isset($this->events[$day]) ? 'hasarticle' : '';
     if ($this->is_today($day, time())) {
         $class = $class ? 'hasarticle today' : 'today';
     }
     if (isset($this->events[$day])) {
         if ($permlink_mode != 'year_month_day_title') {
             $href = ' href="' . hu . '?date=' . $this->year . '-' . $this->doubledigit($this->month) . '-' . $this->doubledigit($day);
             if ($this->section) {
                 $href = $href . a . 's=' . $this->section;
             }
             if ($this->category) {
                 $href = $href . a . 'c=' . $this->category;
             }
             $href .= '"';
         } else {
             $section = $this->section ? $this->section . '/' : '';
             $href = ' href="' . hu . $section . $this->year . '/' . $this->doubledigit($this->month) . '/' . $this->doubledigit($day) . '"';
         }
         $title = ' title="' . safe_strftime('%x', gmmktime(0, 0, 0, $this->month, $day + 1, $this->year)) . '"';
         // no idea why $day+1, but otherwise it won't work
         $c[] = doTag($day, 'a', '', $href . $title);
     } else {
         $c[] = $day;
     }
     return doTag(join('', $c), 'td', $class);
 }
Ejemplo n.º 2
0
function yab_shop_cart_link($atts)
{
    extract(lAtts(array('label' => yab_shop_lang('to_checkout'), 'break' => br, 'showalways' => '1', 'wraptag' => '', 'class' => ''), $atts));
    $cart =& $_SESSION['wfcart'];
    if (!is_object($cart)) {
        $cart = new wfCart();
    }
    $url = pagelinkurl(array('s' => yab_shop_config('checkout_section_name')));
    $label = htmlspecialchars($label);
    $out = '';
    if ($class and !$wraptag) {
        $link = href($label, $url, ' title="' . $label . '" class="' . $class . '"');
    } else {
        $link = href($label, $url, ' title="' . $label . '"');
    }
    if ($showalways == '1') {
        $out = doTag($link, $wraptag, $class) . $break;
    } else {
        if ($cart->itemcount > 0) {
            $out = doTag($link, $wraptag, $class) . $break;
        }
    }
    return $out;
}
Ejemplo n.º 3
0
function breadcrumb($atts)
{
    global $pretext, $thisarticle, $sitename;
    extract(lAtts(array('wraptag' => 'p', 'sep' => ' » ', 'link' => 'y', 'label' => $sitename), $atts));
    $linked = $link == 'y' ? true : false;
    if ($linked) {
        $label = '<a href="' . hu . '" class="noline">' . $sitename . '</a>';
    }
    $content = array();
    extract($pretext);
    if (!empty($s) && $s != 'default') {
        $content[] = $linked ? $GLOBALS['permlink_mode'] == 'messy' ? tag(htmlspecialchars($s), 'a', ' href="' . hu . '?s=' . urlencode($s) . '"') : tag(htmlspecialchars($s), 'a', ' href="' . hu . urlencode($s) . '/"') : $s;
    }
    $category = empty($c) ? '' : $c;
    $cattree = array();
    while ($category and $category != 'root' and $parent = safe_field('parent', 'txp_category', "name='{$category}'")) {
        //Use new /category/category_name scheme here too?
        $cattree[] = $linked ? tag(str_replace("& ", "&#38; ", $category), 'a', ' href="' . hu . '?c=' . urlencode($category) . '"') : $category;
        $category = $parent;
        unset($parent);
    }
    if (!empty($cattree)) {
        $cattree = array_reverse($cattree);
        $content = array_merge($content, $cattree);
    }
    //Add date month permlinks?
    //		$year = '';
    //		$month = '';
    //		$date = '';
    //Add the label at the end, to prevent breadcrumb for home page
    if (!empty($content)) {
        $content = array_merge(array($label), $content);
    }
    //Add article title without link if we're on an individual archive page?
    return doTag(join($sep, $content), $wraptag);
}
function sed_comment_time($atts)
{
    /*
    Extends the default txp:comment_time tag to include wraptag and class.
    */
    extract(lAtts(array('class' => 'comment_time', 'wraptag' => 'span', 'format' => '', 'gmt' => '', 'lang' => ''), $atts));
    if (isset($atts['class'])) {
        unset($atts['class']);
    }
    if (isset($atts['wraptag'])) {
        unset($atts['wraptag']);
    }
    return doTag(comment_time($atts), $wraptag, $class);
}
Ejemplo n.º 5
0
function file_download_description($atts)
{
    global $thisfile;
    assert_file();
    extract(lAtts(array('class' => '', 'escape' => 'html', 'wraptag' => ''), $atts));
    if ($thisfile['description']) {
        $description = $escape == 'html' ? txpspecialchars($thisfile['description']) : $thisfile['description'];
        return $wraptag ? doTag($description, $wraptag, $class) : $description;
    }
}
Ejemplo n.º 6
0
function mem_form_value($atts, $thing)
{
    global $mem_form_submit, $mem_form_values, $mem_form_default;
    extract(mem_form_lAtts(array('name' => '', 'wraptag' => '', 'class' => '', 'attributes' => '', 'id' => ''), $atts));
    $out = '';
    if ($mem_form_submit) {
        if (isset($mem_form_values[$name])) {
            $out = $mem_form_values[$name];
        }
    } else {
        if (isset($mem_form_default[$name])) {
            $out = $mem_form_default[$name];
        }
    }
    return doTag($out, $wraptag, $class, $attributes, $id);
}
Ejemplo n.º 7
0
function file_download_description($atts)
{
    global $thisfile;
    extract(lAtts(array('class' => '', 'escape' => '', 'wraptag' => ''), $atts));
    if ($thisfile['description']) {
        $description = $escape == 'html' ? escape_output($thisfile['description']) : $thisfile['description'];
        return $wraptag ? doTag($description, $wraptag, $class) : $description;
    }
}
 public function dump_listing($wraptag, $class)
 {
     //
     //	Add the title...
     //
     $result = doTag($this->default_title_string, 'p', $this->list_class . '_title');
     //
     //	Write the heading of the OL. Use the stashed first line number.
     // If it is not 1 (the standard value) use the deprecated START="number" attribute to get the numbering right.
     // It works but doesn't validate in strict xhtml.
     //
     if (1 != $this->first_line_number) {
         $result .= "\n<ol start=\"" . $this->first_line_number . '" class="' . $this->list_class . "\">\n";
     } else {
         $result .= "\n<ol class=\"" . $this->list_class . "\">\n";
     }
     //
     //	Append the listing body and close the ordered list...
     //
     $result .= $this->listing_body . "</ol>\n";
     //
     //	Append the download link (if any)...
     //
     $result .= $this->default_link_string;
     //
     //	Wrap the whole bundle up and return it...
     //
     $result = doTag($result, $wraptag, $class);
     return $result;
 }
Ejemplo n.º 9
0
function section_description($atts, $thing = NULL)
{
    global $thisarticle, $s, $thissection;
    extract(lAtts(array('class' => 'section_description', 'name' => '', 'wraptag' => 'p'), $atts));
    if ($name) {
        $sec = $name;
    } elseif (!empty($thissection['name'])) {
        $sec = $thissection['name'];
    } elseif (!empty($thisarticle['section'])) {
        $sec = $thisarticle['section'];
    } else {
        $sec = $s;
    }
    return doTag(parse_section_description($sec), $wraptag, $class);
}
function mem_self_user_count($atts)
{
    global $mem_self;
    extract(lAtts(array('user_levels' => '0,1,2,3,4,5,6', 'wraptag' => '', 'class' => ''), $atts));
    if (!empty($user_levels) || $user_levels == '0') {
        $user_levels = doSlash(split(',', $user_levels));
    } else {
        $user_levels = array($mem_self['new_user_priv']);
    }
    $levels = join(',', $user_levels);
    $count = safe_field('COUNT(*)', mem_get_user_table_name(), "privs IN ({$levels})");
    return doTag($count, $wraptag, $class);
}
Ejemplo n.º 11
0
function breadcrumb($atts)
{
    global $pretext, $thisarticle, $sitename;
    extract(lAtts(array('wraptag' => 'p', 'sep' => '&#160;&#187;&#160;', 'link' => 'y', 'label' => $sitename, 'title' => '', 'class' => '', 'linkclass' => 'noline'), $atts));
    $linked = $link == 'y' ? true : false;
    if ($linked) {
        $label = '<a href="' . hu . '" class="' . $linkclass . '">' . $sitename . '</a>';
    }
    if ($linked) {
        $label = doTag($sitename, 'a', $linkclass, ' href="' . hu . '"');
    }
    $content = array();
    extract($pretext);
    if (!empty($s) && $s != 'default') {
        $section_title = $title ? fetch_section_title($s) : $s;
        $section_title_html = escape_title($section_title);
        $content[] = $linked ? doTag($section_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('s' => $s)) . '"') : $section_title_html;
    }
    $category = empty($c) ? '' : $c;
    foreach (getTreePath($category, 'article') as $cat) {
        if ($cat['name'] != 'root') {
            $category_title_html = $title ? escape_title($cat['title']) : $cat['name'];
            $content[] = $linked ? doTag($category_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('c' => $cat['name'])) . '"') : $category_title_html;
        }
    }
    //Add the label at the end, to prevent breadcrumb for home page
    if (!empty($content)) {
        $content = array_merge(array($label), $content);
    }
    //Add article title without link if we're on an individual archive page?
    return doTag(join($sep, $content), $wraptag, $class);
}
Ejemplo n.º 12
0
function breadcrumb($atts)
{
    global $pretext, $sitename;
    extract(lAtts(array('wraptag' => 'p', 'sep' => '&#160;&#187;&#160;', 'link' => 1, 'label' => $sitename, 'title' => 1, 'class' => '', 'linkclass' => 'noline'), $atts));
    if ($link) {
        $label = doTag($label, 'a', $linkclass, ' href="' . hu . '"');
    }
    $content = array();
    extract($pretext);
    if (!empty($s) && $s != 'default') {
        $section_title = $title ? fetch_section_title($s) : $s;
        $section_title_html = escape_title($section_title);
        $content[] = $link ? doTag($section_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('s' => $s)) . '"') : $section_title_html;
    }
    $category = empty($c) ? '' : $c;
    foreach (getTreePath($category, 'article') as $cat) {
        if ($cat['name'] != 'root') {
            $category_title_html = $title ? escape_title($cat['title']) : $cat['name'];
            $content[] = $link ? doTag($category_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('c' => $cat['name'])) . '"') : $category_title_html;
        }
    }
    // add the label at the end, to prevent breadcrumb for home page
    if ($content) {
        $content = array_merge(array($label), $content);
        return doTag(join($sep, $content), $wraptag, $class);
    }
}
Ejemplo n.º 13
0
function jmd_rate($atts, $thing)
{
    extract(lAtts(array('class' => 'rating', 'stars' => 4, 'star_width' => 19, 'wraptag' => 'div'), $atts));
    global $jmd_rate_instance;
    $jmd_rate_instance = new jmd_rate($stars, $star_width);
    $out = $jmd_rate_instance->getRating() . parse($thing);
    return $wraptag ? doTag($out, $wraptag, $class) : $out;
}
Ejemplo n.º 14
0
function sed_copyright($atts)
{
    #	Outputs a well formatted copyright message. It calls
    # sed_copyright_year to pull out the information for the
    # date-section then jois it with the copyright and owner
    # sections to give you your formatted copyright message.
    global $sed_copyright_owner;
    global $prefs;
    # define output variable(s)...
    $out_result = '';
    $debug = '';
    $sed_copyright_owner = '';
    # process attribute variables...
    extract(lAtts(array('debug' => '', 'custom' => '', 'owner' => $prefs['sitename'], 'owner_href' => '', 'owner_title' => '', 'copy_text' => '&copy;', 'start_year' => '', 'end_year' => '', 'date_type' => 'range', 'order' => 'cdo', 'wraptag' => '', 'class' => 'copyright', 'custom' => ''), $atts));
    if (!empty($debug)) {
        print_r('<br/><br/><br/>');
        print_r($prefs);
    }
    #
    #	If being used with a custom field but outside and article, don't show anything!
    #
    if (!empty($custom) and !empty($thisarticle) and empty($thisarticle[$custom])) {
        return '';
    }
    # ----------- DATE SECTION PROCESSING ---------------
    #
    #	Simply call the date tag handler...
    #
    $date = sed_copyright_date($atts);
    # ----------- OWNER SECTION PROCESSING ---------------
    #
    #	Build the owner link (if required)...
    #
    if (!empty($sed_copyright_owner)) {
        $owner = $sed_copyright_owner;
    } elseif (!empty($owner_href)) {
        $owner = _sed_build_href($owner, $owner_href, $owner_title);
    }
    # ---------------- MERGE SECTIONS -------------------
    #
    #	Join it together...
    #
    $bits = array();
    switch ($order) {
        case 'cod':
            $bits[] = $copy_text;
            $bits[] = $owner;
            if (!empty($date)) {
                $bits[] = $date;
            }
            break;
        default:
            $bits[] = $copy_text;
            if (!empty($date)) {
                $bits[] = $date;
            }
            $bits[] = $owner;
            break;
    }
    $out_result = implode(' ', $bits);
    if (!empty($wraptag)) {
        $out_result = doTag($out_result, $wraptag, $class);
    }
    return $out_result;
}
function oui_dailymotion($atts, $thing)
{
    global $thisarticle;
    extract(lAtts(array('video' => '', 'custom' => 'dailymotion ID', 'width' => '0', 'height' => '0', 'ratio' => '4:3', 'api' => '', 'autoplay' => '0', 'chromeless' => '0', 'highlight' => 'ffcc33', 'html' => '0', 'playerid' => '', 'info' => '1', 'logo' => '1', 'network' => '', 'origin' => '', 'quality' => '', 'related' => '1', 'start' => '0', 'startscreen' => '', 'syndication' => '', 'wmode' => 'transparent', 'label' => '', 'labeltag' => '', 'wraptag' => '', 'class' => __FUNCTION__), $atts));
    $custom = strtolower($custom);
    if (!$video && isset($thisarticle[$custom])) {
        $video = $thisarticle[$custom];
    }
    /*
     * Check for dailymotion video ID or dailymotion URL to extract ID from
     */
    $match = _oui_dailymotion($video);
    if ($match) {
        $video = $match;
    } elseif (empty($video)) {
        return '';
    }
    $src = '//www.dailymotion.com/embed/video/' . $video;
    /*
     * Attributes.
     */
    $qAtts = array('highlight' => $highlight, 'id' => $playerid, 'origin' => $origin, 'start' => $start, 'syndication' => $syndication, 'autoplay' => array($autoplay => '0, 1'), 'chromeless' => array($chromeless => '0, 1'), 'html' => array($html => '0, 1'), 'info' => array($info => '0, 1'), 'logo' => array($logo => '0, 1'), 'related' => array($related => '0, 1'), 'api' => array($api => 'postMessage, fragment, location'), 'network' => array($network => 'dsl, cellular'), 'quality' => array($quality => '240, 380, 480, 720, 1080, 1440, 2160'), 'startscreen' => array($startscreen => 'flash, html'), 'wmode' => array($wmode => 'transparent, opaque'));
    $qString = array();
    foreach ($qAtts as $att => $value) {
        if ($value) {
            if (!is_array($value)) {
                $qString[] = $att . '=' . $value;
            } else {
                foreach ($value as $val => $valid) {
                    if ($val) {
                        if (in_list($val, $valid)) {
                            $qString[] = $att . '=' . $val;
                        } else {
                            trigger_error("unknown attribute value; oui_dailymotion " . $att . " attribute accepts the following values: " . $valid);
                            return;
                        }
                    }
                }
            }
        }
    }
    /*
     * Check if we need to append a query string to the video src.
     */
    if (!empty($qString)) {
        $src .= '?' . implode('&amp;', $qString);
    }
    /*
     * If the width and/or height has not been set we want to calculate new
     * ones using the aspect ratio.
     */
    if (!$width || !$height) {
        $toolbarHeight = 25;
        // Work out the aspect ratio.
        preg_match("/(\\d+):(\\d+)/", $ratio, $matches);
        if ($matches[0] && $matches[1] != 0 && $matches[2] != 0) {
            $aspect = $matches[1] / $matches[2];
        } else {
            $aspect = 1.333;
        }
        // Calcuate the new width/height.
        if ($width) {
            $height = $width / $aspect + $toolbarHeight;
        } elseif ($height) {
            $width = ($height - $toolbarHeight) * $aspect;
        } else {
            $width = 425;
            $height = 344;
        }
    }
    $out = '<iframe width="' . $width . '" height="' . $height . '" src="' . $src . '" frameborder="0" allowfullscreen></iframe>';
    return doLabel($label, $labeltag) . ($wraptag ? doTag($out, $wraptag, $class) : $out);
}
Ejemplo n.º 16
0
function zem_event_mini_calendar($atts)
{
    // a mini calendar intended as a navigation control for sidebars etc
    global $pretext;
    extract(lAtts(array('table' => 'table', 'tr' => 'tr', 'td' => 'td', 'th' => 'th', 'caption' => 'caption', 'col' => 'col', 'colgroup' => 'colgroup', 'thead' => 'thead', 'tbody' => 'tbody', 'cellspacing' => '', 'date' => gps('date'), 'class' => __FUNCTION__, 'class_row_num' => 'number', 'class_row_day' => 'day', 'class_event' => '', 'class_empty' => '', 'class_noday' => '', 'class_link' => '', 'labeltag' => 'h3', 'section' => @$pretext['s']), $atts));
    $y = '';
    $m = '';
    if ($date) {
        @(list($y, $m, $d) = split('-', $date));
    }
    if (!is_numeric($y)) {
        $y = strftime('%Y');
    }
    if (!is_numeric($m)) {
        $m = strftime('%m');
    }
    // day number of the first of the month (Sunday = 0)
    $first = mktime(0, 0, 0, $m, 1, $y);
    $firstday = strftime('%w', $first);
    // number of days in the month
    $numdays = strftime('%d', strtotime('-1 day', strtotime('+1 month', $first)));
    $out = array();
    # caption
    $out[] = doTag(strftime('%B %Y', $first), 'caption');
    # column groups
    $row = array();
    for ($d = 1; $d <= 7; $d++) {
        $row[] = doTag('', 'col', strftime('%a', mktime(0, 0, 0, $m, $d + 7 - $firstday, $y)));
    }
    $out[] = doTag(n . join(n, $row) . n, 'colgroup');
    # table headings
    $row = array();
    for ($d = 1; $d <= 7; $d++) {
        $row[] = doTag(strftime('%a', mktime(0, 0, 0, $m, $d + 7 - $firstday, $y)), $th, '', ' scope="col"');
    }
    $out[] = doTag(n . tr(n . join(n, $row) . n) . n, 'thead');
    $body = array();
    $numrows = ceil(($numdays + $firstday) / 7);
    $days = array();
    $w = zem_event_timeq("{$y}-{$m}-01", "{$y}-{$m}-{$numdays}");
    $rs = safe_rows(safe_pfx('zem_event_date') . '.*', 'zem_event_calendar,zem_event_date,textpattern', safe_pfx('zem_event_calendar') . '.id=' . safe_pfx('zem_event_date') . '.event_id and ' . safe_pfx('zem_event_calendar') . '.article_id = ' . safe_pfx('textpattern') . '.ID and ' . safe_pfx('textpattern') . '.Status >= 4 and ' . safe_pfx('textpattern') . '.Posted <= now()');
    foreach ($rs as $r) {
        $days[$r['event_date']] = true;
    }
    # display each cell in the calendar, 7 x 5 grid
    for ($w = 0; $w < $numrows; $w++) {
        $day_row = array();
        for ($d = 1; $d <= 7; $d++) {
            $daynum = $w * 7 + $d;
            $dayofmonth = $daynum - $firstday;
            if (checkdate($m, $dayofmonth, $y)) {
                // this is a real day
                if (isset($days["{$y}-{$m}-{$dayofmonth}"])) {
                    $url = '<a class="' . $class_link . '" href="' . pagelinkurl(array('date' => "{$y}-{$m}-{$dayofmonth}", 's' => $section, 'c' => @$pretext['c'], 'q' => @$pretext['q'])) . '">' . $dayofmonth . '</a>';
                    $day_row[] = doTag($url, $td, $class_event);
                } else {
                    $day_row[] = doTag($dayofmonth, $td, $class_empty);
                }
            } else {
                // just a blank to fill in the grid
                $day_row[] = doTag('&nbsp;', $td, $class_noday);
            }
        }
        $body[] = doTag(n . join(n, $day_row) . n, $tr, $class_row_day);
    }
    $out[] = doTag(n . join(n, $body) . n, 'tbody');
    return doTag(n . join(n, $out) . n, $table, $class, $cellspacing === '' ? '' : ' cellspacing="' . $cellspacing . '"');
}