本文整理汇总了PHP中doLabel函数的典型用法代码示例。如果您正苦于以下问题:PHP doLabel函数的具体用法?PHP doLabel怎么用?PHP doLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doLabel函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_download_list
function file_download_list($atts)
{
global $thisfile;
extract(lAtts(array('break' => br, 'category' => '', 'class' => __FUNCTION__, 'form' => 'files', 'label' => '', 'labeltag' => '', 'limit' => '10', 'offset' => '0', 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
$where = array('1=1');
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
if ($status) {
$where[] = "status = '" . doSlash($status) . "'";
}
$qparts = array('order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', join(' and ', $where) . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($thisfile = nextRow($rs)) {
$out[] = parse_form($form);
$thisfile = '';
}
if ($out) {
if ($wraptag == 'ul' or $wraptag == 'ol') {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
return $wraptag ? tag(join($break, $out), $wraptag) : join(n, $out);
}
}
return '';
}
示例2: renderAuthors
/**
* Generates a list of authors.
*
* @param array $atts
* @param string $thing
* @return string
*/
public static function renderAuthors($atts, $thing = null)
{
global $thisauthor, $txp_groups;
extract(lAtts(array('break' => '', 'class' => '', 'form' => '', 'group' => '', 'label' => '', 'labeltag' => '', 'limit' => '', 'name' => '', 'offset' => '', 'sort' => 'name ASC', 'wraptag' => ''), $atts));
$sql = array('1 = 1');
$sql_limit = '';
$sql_sort = " ORDER BY " . doSlash($sort);
if ($name) {
$sql[] = "name IN (" . join(', ', quote_list(do_list($name))) . ")";
}
if ($group !== '') {
$privs = do_list($group);
$groups = array_flip($txp_groups);
foreach ($privs as &$priv) {
if (isset($groups[$priv])) {
$priv = $groups[$priv];
}
}
$sql[] = 'convert(privs, char) in (' . join(', ', quote_list($privs)) . ')';
}
if ($limit !== '' || $offset) {
$sql_limit = " LIMIT " . intval($offset) . ", " . ($limit === '' ? PHP_INT_MAX : intval($limit));
}
$rs = safe_rows_start("user_id as id, name, RealName as realname, email, privs, last_access", 'txp_users', join(" AND ", $sql) . " {$sql_sort} {$sql_limit}");
if ($rs && numRows($rs)) {
$out = array();
if ($thing === null && $form !== '') {
$thing = fetch_form($form);
}
while ($a = nextRow($rs)) {
$oldauthor = $thisauthor;
$thisauthor = $a;
$out[] = parse($thing);
$thisauthor = $oldauthor;
}
unset($thisauthor);
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
return '';
}
示例3: sed_lib_zemcontact_form
function sed_lib_zemcontact_form()
{
$field = '<div class="screenreader" >' . doLabel('Phone') . finput('text', 'phone', htmlspecialchars(ps('phone')), '', '', '', '', '', 'phone') . '<br />' . doLabel('Address') . finput('text', 'mail', htmlspecialchars(ps('mail')), '', '', '', '', '', 'mail') . '</div>';
return $field;
}
示例4: doArticles
//.........这里部分代码省略.........
$time = " AND Posted <= " . now('posted');
}
if (!$expired) {
$time .= " AND (" . now('expires') . " <= Expires OR Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
// Allow keywords for no-custom articles. That tagging mode, you know.
if ($keywords) {
$keys = doSlash(do_list_unique($keywords));
foreach ($keys as $key) {
$keyparts[] = "FIND_IN_SET('" . $key . "', Keywords)";
}
$keywords = " AND (" . join(' or ', $keyparts) . ")";
}
if ($q and $searchsticky) {
$statusq = " AND Status >= " . STATUS_LIVE;
} elseif ($id) {
$statusq = " AND Status >= " . STATUS_LIVE;
} else {
$statusq = " AND Status = " . intval($status);
}
$where = "1 = 1" . $statusq . $time . $search . $id . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
// Do not paginate if we are on a custom list.
if (!$iscustom and !$issticky) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
$numPages = ceil($total / $pageby);
$pg = !$pg ? 1 : $pg;
$pgoffset = $offset + ($pg - 1) * $pageby;
// Send paging info to txp:newer and txp:older.
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['context'] = 'article';
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
global $thispage;
if (empty($thispage)) {
$thispage = $pageout;
}
if ($pgonly) {
return;
}
} else {
$pgoffset = $offset;
}
// Preserve order of custom article ids unless 'sort' attribute is set.
if (!empty($atts['id']) && empty($atts['sort'])) {
$safe_sort = "FIELD(id, " . join(',', $ids) . ")";
} else {
$safe_sort = doSlash($sort);
}
$rs = safe_rows_start("*, UNIX_TIMESTAMP(Posted) AS uPosted, UNIX_TIMESTAMP(Expires) AS uExpires, UNIX_TIMESTAMP(LastMod) AS uLastMod" . $match, 'textpattern', "{$where} ORDER BY {$safe_sort} LIMIT " . intval($pgoffset) . ", " . intval($limit));
// Get the form name.
if ($q and !$iscustom and !$issticky) {
$fname = $searchform ? $searchform : 'search_results';
} else {
$fname = !empty($listform) ? $listform : $form;
}
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
// Article form preview.
if (txpinterface === 'admin' && ps('Form')) {
doAuth();
if (!has_privs('form')) {
txp_status_header('401 Unauthorized');
exit(hed('401 Unauthorized', 1) . graf(gTxt('restricted_area')));
}
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// Sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例5: doArticles
//.........这里部分代码省略.........
$section = !$section ? '' : " and Section IN ('" . join("','", doSlash(do_list($section))) . "')";
$excerpted = $excerpted == 'y' ? " and Excerpt !=''" : '';
$author = !$author ? '' : " and AuthorID IN ('" . join("','", doSlash(do_list($author))) . "')";
$month = !$month ? '' : " and Posted like '" . doSlash($month) . "%'";
$id = !$id ? '' : " and ID IN (" . join(',', array_map('intval', do_list($id))) . ")";
switch ($time) {
case 'any':
$time = "";
break;
case 'future':
$time = " and Posted > now()";
break;
default:
$time = " and Posted <= now()";
}
if (!$publish_expired_articles) {
$time .= " and (now() <= Expires or Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
//Allow keywords for no-custom articles. That tagging mode, you know
if ($keywords) {
$keys = doSlash(do_list($keywords));
foreach ($keys as $key) {
$keyparts[] = "FIND_IN_SET('" . $key . "',Keywords)";
}
$keywords = " and (" . join(' or ', $keyparts) . ")";
}
if ($q and $searchsticky) {
$statusq = ' and Status >= 4';
} elseif ($id) {
$statusq = ' and Status >= 4';
} else {
$statusq = ' and Status = ' . intval($status);
}
$where = "1=1" . $statusq . $time . $search . $id . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
//do not paginate if we are on a custom list
if (!$iscustom and !$issticky) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
$numPages = ceil($total / $pageby);
$pg = !$pg ? 1 : $pg;
$pgoffset = $offset + ($pg - 1) * $pageby;
// send paging info to txp:newer and txp:older
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
global $thispage;
if (empty($thispage)) {
$thispage = $pageout;
}
if ($pgonly) {
return;
}
} else {
$pgoffset = $offset;
}
$rs = safe_rows_start("*, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod" . $match, 'textpattern', $where . ' order by ' . doSlash($sort) . ' limit ' . intval($pgoffset) . ', ' . intval($limit));
// get the form name
if ($q and !$iscustom and !$issticky) {
$fname = $searchform ? $searchform : 'search_results';
} else {
$fname = $listform ? $listform : $form;
}
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
if (@constant('txpinterface') === 'admin' and gps('Form')) {
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例6: file_download_list
function file_download_list($atts, $thing = NULL)
{
global $s, $c, $context, $thisfile, $thispage, $pretext;
extract(lAtts(array('break' => br, 'category' => '', 'author' => '', 'realname' => '', 'auto_detect' => 'category, author', 'class' => __FUNCTION__, 'form' => 'files', 'id' => '', 'label' => '', 'labeltag' => '', 'pageby' => '', 'limit' => 10, 'offset' => 0, 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
// N.B. status treated slightly differently
$where = $statwhere = array();
$filters = isset($atts['id']) || isset($atts['category']) || isset($atts['author']) || isset($atts['realname']) || isset($atts['status']);
$context_list = empty($auto_detect) || $filters ? array() : do_list($auto_detect);
$pageby = $pageby == 'limit' ? $limit : $pageby;
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
$ids = array_map('intval', do_list($id));
if ($id) {
$where[] = "id IN ('" . join("','", $ids) . "')";
}
if ($status) {
$statwhere[] = "status = '" . doSlash($status) . "'";
}
if ($author) {
$where[] = "author IN ('" . join("','", doSlash(do_list($author))) . "')";
}
if ($realname) {
$authorlist = safe_column('name', 'txp_users', "RealName IN ('" . join("','", doArray(doSlash(do_list($realname)), 'urldecode')) . "')");
$where[] = "author IN ('" . join("','", doSlash($authorlist)) . "')";
}
// If no files are selected, try...
if (!$where && !$filters) {
foreach ($context_list as $ctxt) {
switch ($ctxt) {
case 'category':
// ... the global category in the URL
if ($context == 'file' && !empty($c)) {
$where[] = "category = '" . doSlash($c) . "'";
}
break;
case 'author':
// ... the global author in the URL
if ($context == 'file' && !empty($pretext['author'])) {
$where[] = "author = '" . doSlash($pretext['author']) . "'";
}
break;
}
// Only one context can be processed
if ($where) {
break;
}
}
}
if (!$where && !$statwhere && $filters) {
return '';
// If nothing matches, output nothing
}
if (!$where) {
$where[] = "1=1";
// If nothing matches, start with all files
}
$where = join(' AND ', array_merge($where, $statwhere));
// Set up paging if required
if ($limit && $pageby) {
$grand_total = safe_count('txp_file', $where);
$total = $grand_total - $offset;
$numPages = $pageby > 0 ? ceil($total / $pageby) : 1;
$pg = !$pretext['pg'] ? 1 : $pretext['pg'];
$pgoffset = $offset + ($pg - 1) * $pageby;
// send paging info to txp:newer and txp:older
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['context'] = 'file';
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
if (empty($thispage)) {
$thispage = $pageout;
}
} else {
$pgoffset = $offset;
}
// preserve order of custom file ids unless 'sort' attribute is set
if (!empty($atts['id']) && empty($atts['sort'])) {
$safe_sort = 'field(id, ' . join(',', $ids) . ')';
} else {
$safe_sort = doSlash($sort);
}
$qparts = array('order by ' . $safe_sort, $limit ? 'limit ' . intval($pgoffset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*', 'txp_file', $where . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
$thisfile = file_download_format_info($a);
$out[] = $thing ? parse($thing) : parse_form($form);
$thisfile = '';
}
if ($out) {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
//.........这里部分代码省略.........
示例7: doHomeArticles
function doHomeArticles($atts, $thing = NULL)
{
global $pretext, $prefs;
extract($pretext);
extract($prefs);
$customFields = getCustomFields();
$customlAtts = array_null(array_flip($customFields));
//getting attributes
$theAtts = lAtts(array('form' => 'default', 'listform' => '', 'searchform' => '', 'limit' => 10, 'category' => '', 'section' => '', 'excerpted' => '', 'author' => '', 'sort' => '', 'month' => '', 'keywords' => '', 'frontpage' => '', 'time' => 'past', 'pgonly' => 0, 'searchall' => 1, 'allowoverride' => true, 'offset' => 0, 'wraptag' => '', 'break' => '', 'label' => '', 'labeltag' => '', 'class' => '') + $customlAtts, $atts);
$theAtts['category'] = $c ? $c : '';
$theAtts['section'] = $s && $s != 'default' && $s != 'home' ? $s : '';
$theAtts['author'] = !empty($author) ? $author : '';
$theAtts['month'] = !empty($month) ? $month : '';
$theAtts['frontpage'] = $s && $s == 'home' ? true : false;
$theAtts['excerpted'] = '';
extract($theAtts);
// if a listform is specified, $thing is for doArticle() - hence ignore here.
if (!empty($listform)) {
$thing = '';
}
$pageby = empty($pageby) ? $limit : $pageby;
$match = $search = '';
if (!$sort) {
$sort = 'Posted desc';
}
//Building query parts
$frontpage = filterFrontPage();
$category = join("','", doSlash(do_list($category)));
$category = !$category ? '' : " and (Category1 IN ('" . $category . "') or Category2 IN ('" . $category . "'))";
$section = !$section ? '' : " and Section IN ('" . join("','", doSlash(do_list($section))) . "')";
$excerpted = $excerpted == 'y' ? " and Excerpt !=''" : '';
$author = !$author ? '' : " and AuthorID IN ('" . join("','", doSlash(do_list($author))) . "')";
$month = !$month ? '' : " and Posted like '" . doSlash($month) . "%'";
$id = !$id ? '' : " and ID IN (" . join(',', array_map('intval', do_list($id))) . ")";
switch ($time) {
case 'any':
$time = "";
break;
case 'future':
$time = " and Posted > now()";
break;
default:
$time = " and Posted <= now()";
}
if (!$publish_expired_articles) {
$time .= " and (now() <= Expires or Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
$statusq = ' and Status = 5';
$where = "1=1" . $statusq . $time . $search . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
$rs = safe_rows_start("*, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod" . $match, 'textpattern', $where . ' order by ' . doSlash($sort) . ' limit 0' . intval($limit));
// get the form name
$fname = $listform ? $listform : $form;
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
if (@constant('txpinterface') === 'admin' and gps('Form')) {
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例8: sed_cp_new_comment_digest
function sed_cp_new_comment_digest($atts)
{
global $_sed_cp_new_cmts;
/*
Outputs a digest of comments since the viewer's last visit to the site (if any)...
*/
extract(lAtts(array('class' => __FUNCTION__, 'wraptag' => 'ul', 'break' => 'li', 'label' => '', 'labeltag' => '', 'limit' => '0', 'more' => ' …', 'max_visit' => 7200, 'empty' => gTxt('none')), $atts));
$new_comments = _sed_cp_get_comments($max_visit);
if ($_sed_cp_new_cmts > 0) {
$row_count = count($new_comments);
if ($limit === '0' || intval($limit) < 0 || $row_count === intval($limit)) {
$limit = $row_count + 1;
} else {
$limit = intval($limit);
}
foreach ($new_comments as $comment) {
extract($comment);
$item = href(escape_title($Title) . "({$new_com_count})", permlinkurl_id($parentid) . '#c' . $first_new);
if (--$limit <= 0) {
$items[] = $item . $more;
break;
} else {
$items[] = $item;
}
}
} else {
$items[] = $empty;
}
return doLabel($label, $labeltag) . doWrap($items, $wraptag, $break, $class);
}
示例9: file_download_list
function file_download_list($atts)
{
global $thisfile;
extract(lAtts(array('break' => br, 'category' => '', 'class' => __FUNCTION__, 'form' => 'files', 'label' => '', 'labeltag' => '', 'limit' => '10', 'offset' => '0', 'sort' => 'filename asc', 'wraptag' => ''), $atts));
$qparts = array($category ? "category = '" . doSlash($category) . "'" : '1', 'order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('id, filename, category, description, downloads', 'txp_file', join(' ', $qparts));
if ($rs) {
$form = fetch_form($form);
$out = array();
while ($a = nextRow($rs)) {
$GLOBALS['thisfile'] = file_download_format_info($a);
$out[] = parse($form);
$GLOBALS['thisfile'] = '';
}
if ($out) {
if ($wraptag == 'ul' or $wraptag == 'ol') {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
return $wraptag ? tag(join($break, $out), $wraptag) : join(n, $out);
}
}
return '';
}
示例10: sed_pcf_for_each_value
function sed_pcf_for_each_value($atts, $thing)
{
global $thisarticle;
assert_article();
$def_custom_name = 'custom1';
extract($merged = lAtts(array('debug' => 0, 'name' => $def_custom_name, 'id' => '', 'form' => '', 'label' => '', 'labeltag' => '', 'wraptag' => 'ul', 'break' => 'li', 'class' => ''), $atts));
if ($debug) {
echo dmp($merged);
}
$field = @$thisarticle[$name];
if (empty($field)) {
if ($debug) {
echo "Returning early - nothing to do in CF[{$name}].";
}
return '';
}
if (empty($class)) {
$class = $name;
}
if (!empty($form)) {
# grab the form (if any)
$thing = fetch_form($form);
}
if (empty($thing)) {
# if no form, and no enclosed thing, use built-in formula...
$thing = '{value}';
}
$out = array();
$field = do_list($field);
foreach ($field as $value) {
$out[] = parse(str_replace('{value}', $value, $thing));
}
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class, '', '', '', $id);
}
示例11: file_download_list
function file_download_list($atts, $thing = NULL)
{
global $thisfile;
extract(lAtts(array('break' => br, 'category' => '', 'class' => __FUNCTION__, 'form' => 'files', 'label' => '', 'labeltag' => '', 'limit' => 10, 'offset' => 0, 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
$where = array('1=1');
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
if ($status) {
$where[] = "status = '" . doSlash($status) . "'";
}
$qparts = array('order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*', 'txp_file', join(' and ', $where) . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
$thisfile = file_download_format_info($a);
$out[] = $thing ? parse($thing) : parse_form($form);
$thisfile = '';
}
if ($out) {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
}
return '';
}
示例12: file_download_list
function file_download_list($atts)
{
global $thisfile;
extract(lAtts(array('form' => 'files', 'sort' => 'filename', 'label' => '', 'break' => br, 'limit' => '10', 'wraptag' => '', 'category' => '', 'class' => __FUNCTION__, 'labeltag' => ''), $atts));
$qparts = array($category ? "category='{$category}'" : '1', "order by", $sort, $limit ? "limit {$limit}" : '');
$rs = safe_rows_start("*", "txp_file", join(' ', $qparts));
if ($rs) {
while ($a = nextRow($rs)) {
$thisfile = fileDownloadFetchInfo("id='{$a['id']}'");
$outlist[] = file_download(array('id' => $a['id'], 'filename' => $a['filename'], 'form' => $form));
}
if (!empty($outlist)) {
if ($wraptag == 'ul' or $wraptag == 'ol') {
return doLabel($label, $labeltag) . doWrap($outlist, $wraptag, $break, $class);
}
return $wraptag ? tag(join($break, $outlist), $wraptag) : join(n, $outlist);
}
}
return '';
}
示例13: image_index
function image_index($atts)
{
global $s, $c, $p, $img_dir, $path_to_site;
extract(lAtts(array('label' => '', 'break' => br, 'wraptag' => '', 'class' => __FUNCTION__, 'labeltag' => '', 'c' => $c, 'limit' => 0, 'offset' => 0, 'sort' => 'name ASC'), $atts));
$qparts = array("category = '" . doSlash($c) . "' and thumbnail = 1", 'order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*', 'txp_image', join(' ', $qparts));
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
extract($a);
$impath = $img_dir . '/' . $id . 't' . $ext;
$imginfo = getimagesize($path_to_site . '/' . $impath);
$dims = !empty($imginfo[3]) ? ' ' . $imginfo[3] : '';
$url = pagelinkurl(array('c' => $c, 's' => $s, 'p' => $id));
$out[] = '<a href="' . $url . '">' . '<img src="' . hu . $impath . '"' . $dims . ' alt="' . $alt . '" />' . '</a>';
}
if (count($out)) {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
}
return '';
}
示例14: oui_dailymotion
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('&', $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);
}