本文整理汇总了PHP中lAtts函数的典型用法代码示例。如果您正苦于以下问题:PHP lAtts函数的具体用法?PHP lAtts怎么用?PHP lAtts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lAtts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: oui_if_dailymotion
function oui_if_dailymotion($atts, $thing)
{
global $thisarticle;
extract(lAtts(array('custom' => null, 'video' => null), $atts));
$result = $video ? _oui_dailymotion($video) : _oui_dailymotion($thisarticle[strtolower($custom)]);
return defined('PREF_PLUGIN') ? parse($thing, $result) : parse(EvalElse($thing, $result));
}
示例2: rss_article_edit
function rss_article_edit($atts, $thing = "")
{
global $thisarticle, $rss_ae_cookie, $prefs;
extract(lAtts(array('hidelive' => '', 'prefix' => '', 'suffix' => ''), $atts));
$hidelive = !empty($hidelive) && 'live' === $prefs['production_status'];
return isset($_COOKIE[$rss_ae_cookie]) && !$hidelive ? $prefix . '<a href="' . hu . 'textpattern/index.php?event=article&step=edit&ID=' . $thisarticle['thisid'] . '">' . parse($thing) . '</a>' . $suffix : '';
}
示例3: ckr_if_image_count
function ckr_if_image_count($atts, $thing)
{
// Extract attributes from tag
extract(lAtts(array('category' => false, 'min' => false, 'max' => false, 'equal' => false, 'not' => false), $atts));
// Count the images in specified category if given or globally
$count = $category ? intval(ckr_image_count(array('category' => $category))) : intval(ckr_image_count());
// Instead of almost unreadable if-else syntax, we use this clever switch-true/case-if counstruct
switch (true) {
case $min && !$max && !$equal && !$not:
// Is greater than min value
return parse(EvalElse($thing, $count >= intval($min) ? true : false));
break;
case $max && !$min && !$equal && !$not:
// Is lesser than max value
return parse(EvalElse($thing, $count <= intval($max) ? true : false));
break;
case $equal && !$min && !$max && !$not:
// Is equal
return parse(EvalElse($thing, $count == intval($equal) ? true : false));
break;
case $not && !$min && !$max && !$equal:
// Is not equal
return parse(EvalElse($thing, $count != intval($not) ? true : false));
break;
case $min && $max && !$equal && !$not:
// Between min and max
return parse(EvalElse($thing, $count >= intval($min) && $count <= intval($max) ? true : false));
break;
default:
// Anything else will output an error message
return '<!-- ckr_if_image_count: Wrong attribute count or combination. -->';
}
}
示例4: column_multi_head
function column_multi_head($head_items, $class = '')
{
$o = n . t . '<th' . ($class ? ' class="' . $class . '"' : '') . '>';
$first_item = true;
foreach ($head_items as $item) {
if (empty($item)) {
continue;
}
extract(lAtts(array('value' => '', 'sort' => '', 'event' => '', 'is_link' => '', 'dir' => '', 'crit' => '', 'method' => ''), $item));
$o .= $first_item ? '' : ', ';
$first_item = false;
if ($is_link) {
$o .= '<a href="index.php?step=list';
$o .= $event ? a . "event={$event}" : '';
$o .= $sort ? a . "sort={$sort}" : '';
$o .= $dir ? a . "dir={$dir}" : '';
$o .= $crit ? a . "crit={$crit}" : '';
$o .= $method ? a . "search_method={$method}" : '';
$o .= '">';
}
$o .= gTxt($value);
if ($is_link) {
$o .= '</a>';
}
}
$o .= '</th>';
return $o;
}
示例5: section_add
function section_add($parent, $name, $atts)
{
$rec = lAtts(array('path' => '', 'parent' => $parent, 'name' => '', 'title' => $name, 'inherit' => 0, 'page' => 'default', 'css' => 'default', 'in_rss' => '1', 'on_frontpage' => '1', 'searchable' => '1'), $atts);
$default = section_default();
if (empty($rec['parent'])) {
$rec['parent'] = $default['id'];
}
if (empty($rec['name'])) {
$rec['name'] = dumbDown($rec['title']);
}
if ($rec['inherit']) {
// find the closest ancestor
// we do this at insert to save time when fetching pages
$ancestor = section_inherit($parent);
$rec['page'] = $ancestor['page'];
$rec['css'] = $ancestor['css'];
$rec['in_rss'] = $ancestor['in_rss'];
$rec['on_frontpage'] = $ancestor['on_frontpage'];
$rec['searchable'] = $ancestor['searchable'];
}
if ($parent) {
list($lft, $rgt) = tree_insert_space('txp_section', $parent);
} else {
$lft = $rgt = 0;
}
$rec['lft'] = $lft;
$rec['rgt'] = $rgt;
$res = safe_insert_rec('txp_section', doSlash($rec));
return $res;
}
示例6: renderIfYield
/**
* Conditional for yield.
*
* @param array $atts
* @param string $thing
* @return string
*/
public static function renderIfYield($atts, $thing)
{
global $yield;
extract(lAtts(array('value' => null), $atts));
$inner = end($yield);
return parse(EvalElse($thing, $inner !== null && ($value === null || (string) $inner === (string) $value)));
}
示例7: mck_google_map
function mck_google_map($atts)
{
extract(lAtts(array('center' => '45.689274,9.105949', 'zoom' => '12', 'idmap' => 'map', 'width' => '500', 'height' => '300', 'mapctrl' => '', 'typectrl' => '', 'mark' => '', 'markpoint' => 'map.getCenter()', 'poly' => ''), $atts));
//valuto ed inserisco il controllo mappa
if ($mapctrl != "") {
$ctrlscript = "map.addControl(new GSmallMapControl());\n";
}
//valuto ed inserisco il controllo tipologia mappa
if ($typectrl != "") {
$typescript = "map.addControl(new GMapTypeControl());\n";
}
//valuto ed inserisco il marker
if ($mark != "") {
$scriptmarker = "\n\nvar marker = new GMarker({$markpoint});\n\nGEvent.addListener(marker, \"click\", function() {\n\n marker.openInfoWindowHtml(\"<span style='color:#000'>{$mark}</span>\");\n\n });\n\nmap.addOverlay(marker);\n";
} else {
$scriptmarker = "";
}
//valuto ed inserisco le polyline
if ($poly != "") {
list($pline, $plevel) = split(",", $poly, 2);
$polyscript = "\n var encodedPolyline = new GPolyline.fromEncoded({\n color: \"#FF0000\",\n weight: 10,\n points: \"{$pline}\",\n levels: \"{$plevel}\",\n zoomFactor: 32,\n numLevels: 4\n });\n map.addOverlay(encodedPolyline);\n";
}
//preparo il codice da scrivere nella pagina
$script = "\n<div id=\"{$idmap}\" style=\"width:" . $width . "px; height:" . $height . "px;\"></div>\n";
$script .= "<script type=\"text/javascript\">\n\n \t\t\t//<![CDATA[\n\n window.onload = show{$idmap};\n function show{$idmap}() {\n\n\n \t if (GBrowserIsCompatible()) {\n\n \t\tvar map = new GMap(document.getElementById(\"{$idmap}\"));\n\n{$ctrlscript}\n{$typescript}\n var center = new GLatLng({$center});\n map.setCenter(center, {$zoom});\n\n }\n\n{$polyscript}\n{$scriptmarker}\n }\n\n //]]>\n\n </script>\n";
return $script;
}
示例8: jmd_if_count
/**
* Evaluate counting results.
*
* @param array $atts
* @property string $atts['eval'] Valid PHP comparison operator.
* @property string $atts['table'] MySQL table name.
* @property string $atts['where'] MySQL WHERE clause.
*/
function jmd_if_count($atts, $thing)
{
extract(lAtts(array('eval' => '', 'table' => '', 'where' => ''), $atts));
global $jmd_count_value;
$jmd_count_value = jmd_count(array('table' => $table, 'where' => $where));
$condition = eval("return({$jmd_count_value} {$eval});");
$out = EvalElse($thing, $condition);
return parse($out);
}
示例9: fox_files_stats
function fox_files_stats($atts) {
extract(lAtts(array(
'downloaded' => '0',
'category' => '',
'format' => 'M',
'size' => '0',
'children' => '1'
), $atts));
if ($size=='1') {
if ($downloaded ==' 0')
$things = 'sum(size)';
else
$things = 'sum(downloads*size)';
} else {
if ($downloaded == '0')
$things = 'count(*)';
else
$things = 'sum(downloads)';
}
if ($category!='') {
if ($children == '1') {
$c = safe_row('lft, rgt', 'txp_category', "`type`='file' AND name='".mysql_escape_string($category)."'");
$where = "category IN (SELECT name FROM txp_category WHERE type='file' AND lft >= ". $c['lft'] . " AND rgt <= " . $c['rgt'] . ")";
} else {
$where = 'category=\''.mysql_escape_string($category).'\'';
}
} else {
$where = '1';
}
$stats = safe_row("$things as s", 'txp_file', $where);
$stats = $stats['s'];
if ($size=='1')
switch (strtoupper($format)) {
case 'G':
$stats /= 1024;
case 'M':
$stats /= 1024;
case 'K':
$stats /= 1024;
default:
$stats = round($stats,2);
}
if ($format_number == '1') {
$localeconv = localeconv();
$dec_point = isset($localeconv['decimal_point']) ? $localeconv['decimal_point'] : '.';
$thousands_sep = isset($localeconv['thousands_sep']) ? $localeconv['thousands_sep'] : ',';
$stats = number_format($stats, $size=='1' ? 2 : 0, $dec_point, $thousands_sep);
}
return $stats;
}
示例10: __construct
/**
* Constructor.
*
* @param mixed $value
* @param array $options
*/
public function __construct($value, $options = array())
{
static $choices = null;
$options = lAtts(array('allow_blank' => true, 'type' => '', 'message' => 'unknown_form'), $options, false);
if (null === $choices) {
$choices = safe_column('name', 'txp_form', $options['type'] !== '' ? 'type=\'' . doSlash($options['type']) . '\'' : '1=1');
}
$options['choices'] = $choices;
parent::__construct($value, $options);
}
示例11: spreadly
function spreadly($atts = "")
{
global $thisarticle;
extract(lAtts(array("url" => permlinkurl($thisarticle), "title" => $thisarticle['title'], "social" => 0, "description" => "", "photo" => ""), $atts));
if ($social == 0) {
$height = "24";
} else {
$height = "60";
}
$output = '<iframe src="http://button.spread.ly/?url=' . urlencode($url) . '&social=' . urlencode($social) . '&title=' . urlencode($title) . '&description=' . urlencode($description) . '&photo=' . urlencode($photo) . '" style="overflow:hidden; width: 420px; height: ' . $height . 'px; padding: 0;" frameborder="0" scrolling="no" marginheight="0" allowTransparency="true"></iframe>';
return $output;
}
示例12: sed_plugin_list
function sed_plugin_list($atts)
{
extract(lAtts(array('debug' => 0, 'type' => '', 'link_name' => 1, 'show_author' => 1, 'link_author' => 0, 'show_description' => 1, 'descriptionwrap' => 'p', 'descriptionclass' => 'plugin-description', 'show_version' => 1, 'versionwrap' => 'span', 'versionclass' => 'plugin-version', 'hide_disabled' => 1, 'sort_dir' => 'asc', 'sort_field' => 'name', 'wraptag' => 'ul', 'wrapclass' => 'plugin-list', 'break' => 'li', 'breakclass' => 'plugin-item', 'show_count' => 0, 'exclusions' => ''), $atts));
$exclusions = explode(',', $exclusions);
#
# Create out plugin search criteria...
#
$where = '';
$w = array();
if ('' !== $type) {
$type = 'type=\'' . doSlash($type) . '\'';
$w[] = $type;
}
if ($hide_disabled) {
$w[] = 'status=\'1\'';
}
$where = join(' and ', $w);
if (empty($where)) {
$where = '1=1';
}
$sort = '';
if ('' !== $sort_field) {
$sort = ' order by `' . doSlash($sort_field) . '` ' . doSlash($sort_dir);
}
#
# Grab the actual data...
#
$plugins = safe_rows('name,author,author_uri,version,description,status,type', 'txp_plugin', '(' . $where . ')' . $sort, $debug);
#
# Generate the XHTML results...
#
if ($plugins) {
foreach ($plugins as $plugin) {
if (in_array($plugin['name'], $exclusions)) {
continue;
}
$item = tag($plugin['name'], 'span', ' class="plugin-name" ');
if ($link_name) {
$item = tag($item, 'a', ' href="' . $plugin['author_uri'] . '" rel="nofollow" ');
}
if ($show_version) {
$item .= tag(' v' . $plugin['version'], $versionwrap, ' class="' . $versionclass . '" ');
}
if ($show_description) {
$item .= tag($plugin['description'], $descriptionwrap, ' class="' . $descriptionclass . '" ');
}
$o[] = tag($item, $break, ' class="' . $breakclass . '" ');
}
}
$o = n . join(n, $o);
return n . tag($o, $wraptag, ' class="' . $wrapclass . '" ') . n . n;
}
示例13: pax_grep
function pax_grep($atts, $thing)
{
global $pretext;
extract(lAtts(array('from' => '', 'to' => '', 'delimiter' => ','), $atts));
$from = explode($delimiter, $from);
$to = explode($delimiter, $to);
$count = count($to);
if ($count == 1) {
$to = implode('', $to);
}
if ($count == 0) {
$to = '';
}
return preg_replace($from, $to, parse($thing));
}
示例14: ckr_truncate
/**
* Textpattern plugin: ckr_truncate
*
* Truncates a given string to a predefined length
*
* @package textpattern-plugins
* @copyright (c) 2009, all rights reserved
* @author Cedric Kastner <cedric@nur-text.de>
* @version 1.0
*/
function ckr_truncate($atts, $thing)
{
// Extract attributes from tag
extract(lAtts(array('length' => '90', 'etc' => '…'), $atts));
// No length given, do nothing and return original string
if ((int) $length === 0) {
return parse($thing);
}
// String is longer then max length, so we start truncating
if (strlen(parse($thing)) > (int) $length) {
// Calculate remaining length
$length -= min((int) $length, strlen(html_entity_decode($etc)));
// Returns the truncated string plus etc string (default "…")
return substr(parse($thing), 0, (int) $length) . $etc;
}
// The if-condition wasn't evaluated, so just return the original string
return parse($thing);
}
示例15: jmd_author
/**
* Provides access to an author's username and email address.
* Replaces the spaces in an author's real name with any character.
*
* @param array $atts
* @param string $atts['display'] 'email', 'name', 'username'
* @param bool $atts['lowercase'] Lowercases $display
* @param string $atts['separator'] Replace spaces in $display with any char.
* @param string $atts['username'] Username to base output on. Default:
* article author
*/
function jmd_author($atts)
{
global $thisarticle;
extract(lAtts(array('display' => 'username', 'lowercase' => 0, 'separator' => ' ', 'username' => $thisarticle['authorid']), $atts));
$out = $username;
switch ($display) {
case 'email':
$out = eE(safe_field("email", "txp_users", "name='{$username}'"));
break;
case 'name':
$out = get_author_name($username);
break;
default:
}
if ($lowercase == 1) {
$out = strtolower($out);
}
return str_replace(' ', $separator, $out);
}