/** Convert value to HTML parseable format * @param mixed $value * @return string */ public static function to_html(\System\Template\Renderer $ren, $value) { if (is_object($value) && method_exists($value, 'to_html')) { return $value->to_html($ren); } if (is_array($value)) { $content = array(); foreach ($value as $val) { $content[] = li(self::to_html($ren, $val)); } return ul('plain inline', $content); } if ($value instanceof \DateTime) { return $ren->format_date($value, 'human'); } if (gettype($value) == 'boolean') { return span($value = $value ? 'yes' : 'no', $ren->trans($value)); } if (gettype($value) == 'float') { return number_format($value, 5); } if (gettype($value) == 'string') { return htmlspecialchars_decode($value); } return $value; }
function ul($array) { $string = begin_ul(); foreach ($array as $item) { $string .= li($item); } return $string . end_ul(); }
static function draw($r) { foreach ($r as $k => $v) { if ($v['txt']) { $ret .= li($k . ') ' . stripslashes_b($v['txt'])); } if ($v['r']) { $ret .= ul(self::draw($v['r'])); } } return ul($ret); }
function trick_names_ul($tricks) { if (count($tricks) > 0) { $content = ''; foreach ($tricks as $trick) { $content .= li(trick_link($trick['name'])); } $content = ul($content); } else { $content = 'you have no tricks'; } return $content; }
function tag_ids_checkbox_ul($tags, $tag_defaults = array()) { if (count($tags) > 0) { $content = ''; foreach ($tags as $tag) { $default = count($tag_defaults) > 0 ? in_array($tag['tag_id'], $tag_defaults) : false; $content .= li(checkbox_array('tag_ids', $tag['tag_id'], $default) . ' --- ' . tag_link($tag['name'])); } $content = ul($content); return $content; } else { return false; } }
function bullet($u, $tp) { global $bullet; foreach ($u as $v) { if (isIn($v, $bullet)) { $t = $v; $u = _drw($u)->remove($v)->O; break; } } $c = cEle($tp, array('type' => isset($t) ? $t : null)); foreach ($u as $v) { $a = isStr($v) || isDrw($v) ? li($v) : $v; $c->addChild($a); } return $c; }
function plug_menu($d, $p, $o, $dr) { if ($dr) { $dr = '/' . $dr; } //$ret.=li(lien('txtsmall','/plug/index',picto('phi'))); $ret .= popbub('plug', 'plugin', picto('phi2'), 'd', 1); //$ret.=llj('','popup_plup___plug_plug*slct',picto('list')); $ret .= li(lkc('txtsmall', host() . '/plug/' . $d . ($p ? '/' . $p : '' . ($o ? '/' . $o : '')), picto('reload'))); $ret .= li(call_plug('txtsmall', 'popup', 'codeview', 'plug' . $dr . '_' . ajx($d), picto('conn'))); //source if (auth(3)) { $ret .= msqlink('system', 'program_plugs') . ' '; } $ret .= plug_hlp($d); if (auth(4)) { $ret .= lj('', 'popup_editmsql___system/program*plugs_' . ajx($d) . '__1', picto('edit')) . ' '; $ret .= lj('', 'popup_editmsql___lang/fr/program*plugs_' . ajx($d) . '__1', picto('flag')) . ' '; } return mkbub($ret, 'inline', '', 'this.style.zIndex=popz+1;') . divc('admnu', ''); }
function table($rows, $attr = array(), $titles = '') { if (!is_array($rows)) { throw new Exception("Table must be an array"); } else { if (!is_array($rows[0])) { if (is_object($rows[0])) { foreach ($rows as $row) { $row = (array) $row; } } else { echo li('ul', $rows, $attr); return; } } } echo "<table "; foreach ($attr as $a => $b) { echo "{$a} = \"{$b}\" "; } echo ">"; if (!empty($titles)) { echo "<thead>"; foreach ($titles as $title) { echo "<th>{$title}</th>"; } echo "</thead>"; } foreach ($rows as $row) { echo "<tr>"; foreach ($row as $field) { echo "<td>{$field}</td>"; } echo "</tr>"; } echo "</table>"; }
li(field_data_if_set($document, 'outing_length', array('suffix' => 'kilometers'))); if ($document->get('geom_wkt')) { li(field_export($document->get('module'), $sf_params->get('id'), $sf_params->get('lang'), $sf_params->get('version'))); } li(field_bool_data($document, 'outing_with_public_transportation', array('show_only_yes' => true))); $access_elevation = field_data_if_set($document, 'access_elevation', array('suffix' => 'meters')); if (empty($access_elevation)) { li(field_data_from_list_if_set($document, 'access_status', 'mod_outings_access_statuses_list')); } else { $access_status = field_data_from_list_if_set($document, 'access_status', 'mod_outings_access_statuses_list', array('raw' => true, 'prefix' => ' - ')); li($access_elevation . $access_status); } if (array_intersect(array(1, 2, 5), $activities)) { li(field_data_range_if_set($document, 'up_snow_elevation', 'down_snow_elevation', array('separator' => 'elevation separator', 'suffix' => 'meters'))); } ?> </ul> <ul class="data col col_33"> <li style="display:none"></li> <?php li(field_data_from_list_if_set($document, 'conditions_status', 'mod_outings_conditions_statuses_list')); li(field_data_from_list_if_set($document, 'glacier_status', 'mod_outings_glacier_statuses_list')); if (array_intersect(array(1, 2, 5), $activities)) { li(field_data_from_list_if_set($document, 'track_status', 'mod_outings_track_statuses_list')); } li(field_data_from_list_if_set($document, 'frequentation_status', 'mod_outings_frequentation_statuses_list')); li(field_data_from_list_if_set($document, 'hut_status', 'mod_outings_hut_statuses_list')); li(field_data_from_list_if_set($document, 'lift_status', 'mod_outings_lift_statuses_list')); ?> </ul>
function as_string() { $o = array(); end($this->children); $lastkey = key($this->children); foreach ($this->children as $key => $node) { if (is_object($node)) { $t = array_pop($o); $r = $node->as_string(); $this->last_node = $r; $o[] = $t . " " . $r; } else { $e = $this->environment(); $handlers = $e->inline_markup_handlers(); $t = $handlers->run($node); $this->last_node = $t; if (!$key == $lastkey) { num_ref($this->last_node, $this->environment->uniq); if (WIKI_REPLY) { $this->environment->reply_link($this->last_node); } } $o[] = $t; //$o[] = wiki_render_simple($node); } } if (count($o)) { $r = ''; foreach ($o as $v) { $r .= li($v) . "\n"; } $sum = num_ref($this->last_node, $this->environment->uniq); if (isset($this->environment->notifies[$sum])) { $u = call_user_func($this->environment->notifies[$sum], $this->last_node); } else { $u = ''; } if (WIKI_REPLY) { return ul($r) . $u . $this->environment->reply_link($this->last_node); } else { return ul($r) . $u; } } else { return ''; } }
} li(field_data_from_list_if_set($document, 'rock_exposition_rating', 'app_routes_rock_exposition_ratings')); li(field_data_from_list_if_set($document, 'aid_rating', 'app_routes_aid_ratings')); li(field_data_range_from_list_if_set($document, 'rock_free_rating', 'rock_required_rating', 'app_routes_rock_free_ratings', array('name_if_equal' => 'rock_free_and_required_rating', 'separator' => 'rock rating separator', 'suffix' => $suffix))); } if (array_intersect(array(2, 5), $activities)) { li(field_data_from_list_if_set($document, 'ice_rating', 'app_routes_ice_ratings')); li(field_data_from_list_if_set($document, 'mixed_rating', 'app_routes_mixed_ratings')); } if (in_array(1, $activities)) { li(field_data_from_list($document, 'toponeige_technical_rating', 'app_routes_toponeige_technical_ratings'), array('class' => 'separator')); li(field_data_from_list($document, 'toponeige_exposition_rating', 'app_routes_toponeige_exposition_ratings')); li(field_data_from_list($document, 'labande_ski_rating', 'app_routes_labande_ski_ratings')); li(field_data_from_list($document, 'labande_global_rating', 'app_routes_global_ratings')); li(field_bool_data_from_list($document, 'sub_activities', 'mod_routes_sub_activities_list', array('single_value' => 2, 'show_only_yes' => true))); li(field_bool_data_from_list($document, 'sub_activities', 'mod_routes_sub_activities_list', array('single_value' => 4, 'show_only_yes' => true))); } if (in_array(6, $activities)) { li(field_data_from_list($document, 'hiking_rating', 'app_routes_hiking_ratings'), array('class' => 'separator')); } if (in_array(7, $activities)) { li(field_data_from_list($document, 'snowshoeing_rating', 'app_routes_snowshoeing_ratings'), array('class' => 'separator')); } li($first = field_bool_data_from_list($document, 'sub_activities', 'mod_routes_sub_activities_list', array('single_value' => 6, 'show_only_yes' => true)), array('class' => 'separator')); li(field_bool_data_from_list($document, 'sub_activities', 'mod_routes_sub_activities_list', array('single_value' => 8, 'show_only_yes' => true)), empty($first)); if ($document->get('geom_wkt')) { li(field_export($document->get('module'), $sf_params->get('id'), $sf_params->get('lang'), $sf_params->get('version')), array('class' => 'separator')); } ?> </ul>
function make_li_b($d) { $r = explode("\n", $d); foreach ($r as $v) { if (trim($v)) { $ret .= li(trim($v)); } } if ($ret) { return ul($ret); } }
<?php use_helper('Object', 'Language', 'Validation', 'MyForm', 'Field'); // Here document = route echo '<div>'; display_document_edit_hidden_tags($document); echo '</div>'; echo mandatory_fields_warning(); include_partial('documents/language_field', array('document' => $document, 'new_document' => $new_document)); echo object_group_tag($document, 'name', array('class' => 'long_input')); echo form_section_title('Information', 'form_info', 'preview_info'); if ($sf_user->hasCredential('moderator')) { echo object_group_dropdown_tag($document, 'area_type', 'mod_areas_area_types_list'); } else { ?> <ul class="data"> <?php li(field_data_from_list($document, 'area_type', 'mod_areas_area_types_list')); ?> </ul> <?php echo object_input_hidden_tag($document, 'getArea_type'); } echo form_section_title('Description', 'form_desc', 'preview_desc'); echo object_group_bbcode_tag($document, 'description', null, array('class' => 'largetext', 'abstract' => true)); include_partial('documents/form_history');
/** * Toggler template * @return string **/ public function tpl_toggler() { if (empty($this->toggler)) { return; } $OBJ =& get_instance(); $out = ''; foreach ($this->toggler as $key => $tab) { $attr = !isset($tab[2]) ? 'left' : 'right'; $float = $attr === 'right' ? "float:right;" : "float:left;"; $show = $key === 0 ? " class='tabOn'" : " class='tabOff'"; $out .= li(href($tab[0], "#"), "id='a{$tab['0']}' style='{$float}' onclick=\"editTab('{$tab['0']}');\"{$show}"); } return ul($out, "class='tabs'") . div('<!-- -->', "class='cl'"); }
} } sort($entries); $out = array(); foreach ($entries as $e) { if ($form == 'long') { $stats = stat($WIKI_PAGEDIR . "{$e}"); } if ($lastentry[0] != $e[0]) { if (count($out) > 0) { print ul(join('', $out)); $out = array(); } print "<h3>" . $e[0] . "</h3>"; } $out[] = li(hyperlink($_SERVER['SCRIPT_NAME'] . "/{$WIKI_REPOSITORY}{$e}", $e) . ($form == 'long' ? date(' Y/M/d H:i:s T', $stats[9]) : "")); $lastentry = $e; } if (count($out) > 0) { print ul(join('', $out)); } unset($out); } elseif ($action == 'revisions') { $revisions = rcs_get_revisions($WIKI_PAGEDIR . "{$pagename}"); $tags = array_flip(rcs_get_symbolic_names($WIKI_PAGEDIR . "{$pagename}")); print "<dl>"; foreach ($revisions as $revision => $rinfo) { print "<dt>" . hyperlink(preg_replace('/;.*$/', '', $_SERVER['PHP_SELF']) . ";{$revision}", $revision) . (isset($tags[$revision]) ? " A.K.A.\n\t\t\t\t" . hyperlink($SELF_NOVERSION . ";" . $tags[$revision], $tags[$revision]) : '') . "</dt>" . "<dd>" . date("Y/m/d H:i:s T (O)", strtotime($rinfo['date'] . ' GMT')) . "<br />" . wiki_render($rinfo['message'] . "\n") . "</dd>"; } print "</dl>"; } elseif ($action == 'info') {
$class .= ' small'; $routes_class = ' class="large"'; } } ?> <div class="<?php echo $class; ?> "><?php if ($image) { echo $image; } if (!empty($data_list)) { echo '<ul class="data">'; foreach ($data_list as $data) { li($data); } echo '</ul>'; } if ($description) { echo $description; } ?> </div> <?php } echo make_routes_title(__('Linked routes'), $nb_routes); if ($nb_routes) { if (empty($data_list) && !$description && !$image) { $routes_class = ' class="full"'; }
function getFileTree($path = "", $callBack = "", $root = false) { $content = ul(["class" => "tree"], ""); $files = scandir($path); foreach ($files as $fid => $file) { if ($file != "." && $file != "..") { $fileName = str_replace('\\', '/', $path . "/" . $file); if (is_dir($path . "/" . $file)) { $content->addContent($list = li(a(["href" => "#"], $file))); } else { $content->addContent($list = li(a(["href" => "#", "onclick" => "{$callBack}('{$fileName}')"], $file))); } if (is_dir($path . "/" . $file)) { $list->addContent($this->getFileTree($path . "/" . $file, $callBack)); } } } return $content; }
$lang = $document->getCulture(); $title = $document->get('name'); $route = "@document_by_id_lang?module=users&id={$id}&lang={$lang}"; echo make_popup_title($title, 'users', $route); $description = $document->getRaw('description'); if (!empty($description)) { $description = truncate_description($description, $route, 700, true); } else { $description = ''; } $image = make_thumbnail_slideshow($associated_images); ?> <div class="popup_desc"><?php if ($image) { echo $image; } ?> <ul class="data"> <?php li(field_activities_data_if_set($document)); li(field_data_from_list_if_set($document, 'category', 'mod_users_category_list')); ?> </ul> <?php if ($description) { echo $description; } ?> </div> <?php echo javascript_tag('C2C.init_popup();');
function disp_moderator($status) { li(_format_data('moderator status', __($status))); }
function bubble_menus($t, $inl = '') { //mods/submenus if (!$t) { return; } $nbo = 0; $n = "\n"; $r = explode("\n", $t . $n); foreach ($r as $n => $k) { $nb = substr_count(substr($k, 0, 9), '-'); $tit = substr($k, $nb); $tit = trim($tit); if ($tit) { list($lk, $d) = submn_t($tit); $cat[$nb] = $tit; $ct = ''; $ct = $cat[0]; for ($i = 2; $i <= $nb; $i++) { $ct .= '/' . $cat[$i - 1]; } $isdir = substr($r[$n + 1], 0, 1) == '-' ? 1 : 0; if ($nb == 0 && $isdir) { $ret .= popbub('bubses', ajx($d), $d, 'd'); } elseif ($nb == 0) { $ret .= li(lkc('', $lk, $d)); } else { $ra[] = array($d, 'link', '', $lk, '', '', $ct, ''); } } } $_SESSION['bubses'] = $ra; return mkbub($ret, $inl, 1, ''); }
function bub_exec($d) { if ($d == 'login') { req('pop'); return div(atd('nob'), loged('', '1', '')); } if ($d == 'cache') { req('boot,spe,art'); $_SESSION['rqt'] = ''; $_GET['refresh'] = 1; return li(cache_arts()); } }
echo h5("7th Lord: ", $relationship_calculator->female_seventh_house_lord); echo h5("Planets Influencing 7th House"); echo ul($relationship_calculator->female_influences[7]); echo ul($relationship_calculator->female_natures_influencing[7]); echo h5("Planets Influencing 7th Lord- ", $relationship_calculator->female_seventh_house_lord); echo ul($relationship_calculator->female_influences['7L']); echo ul($relationship_calculator->female_natures_influencing['7L']); echo h5("7th Lord Position"); echo $relationship_calculator->female_seventh_house_lord, " is in the ", $relationship_calculator->female_houses['7L'], " house from the 7th. ", $relationship_calculator->female_positionals['7L']; echo h3("Interplay of Relationship"), h4("Relative House Position of each other's Ascendant, Sun, Moon and Venus."), begin_ul(); foreach ($relationship_calculator->relative_positionals as $planet => $positional) { $positional_text = ''; if ($positional) { $positional_text = ", " . $positional; } echo li($planet, "- house ", $relationship_calculator->relative_houses[$planet], $positional_text); } echo end_ul(); echo h4("Deeper Synastry Analysis of each other's Ascendant, Sun, Moon and Venus."), h5("Influences to ", $female_data['report_name'], "'s Planets in ", $male_data['report_name'], "'s chart."); foreach (array('Ascendant', 'Sun', 'Moon', 'Venus') as $planet) { echo h5($planet), ul($relationship_calculator->female_male_influences[$planet]); } echo h5("Influences to ", $male_data['report_name'], "'s Planets in ", $female_data['report_name'], "'s chart."); foreach (array('Ascendant', 'Sun', 'Moon', 'Venus') as $planet) { echo h5($planet), ul($relationship_calculator->male_female_influences[$planet]); } echo h4("Marriage Compatibility Based on Indian Astrology"); echo "Male Nakshatra: "; echo $kuta_calculator->male_nakshatra, br(); echo "Female Nakshatra: "; echo $kuta_calculator->female_nakshatra, br(), br();
function make_li($d, $ul) { $r = explode("\n", $d); foreach ($r as $v) { if (substr($v, 0, 1) == '-') { $v = substr($v, 1); } if (strpos($v, '<li')) { $ret .= $v; } elseif (trim($v)) { $ret .= li(trim($v)); } } if ($ret) { return bal($ul, $ret); } }
/** * @return string **/ public function sectional() { $OBJ =& get_instance(); global $go, $default; $body = ''; // get sections $sections = $OBJ->db->fetchArray("SELECT * \n FROM " . PX . "sections \n ORDER BY sec_ord ASC"); // pages $i = 1; foreach ($sections as $key => $section) { $rs = $OBJ->db->fetchArray("SELECT * \n FROM " . PX . "objects \n WHERE object = '" . OBJECT . "' \n AND section_id = {$section['secid']} \n ORDER BY ord ASC"); if (!$rs) { $sect = span($section['sec_desc'], "class='inplace1' id='s{$section['secid']}'"); $checked = $section['sec_disp'] == 1 ? "checked='checked'" : ''; $body .= ul("\n" . li($sect . span(' ', "class='options switchBox' style='color: #000;'"), "class='group'"), "class='sortable' id='sort{$section['secid']}'"); } else { // make the list $list = ''; foreach ($rs as $key => $out) { $status = $out['status'] == 1 ? 'published' : 'draft'; $hidden = $out['hidden'] == 1 ? "<span class='hidden'>" . $OBJ->lang->word('hidden') . "</span> " : ''; $list .= li($out['title'] . span(href($OBJ->lang->word('preview'), "?a={$go['a']}&q=prv&id=" . $out['id']) . ' ' . href($OBJ->lang->word('edit'), "?a={$go['a']}&q=edit&id=" . $out['id']), "class='options' style='color: #000;'") . $hidden, "class='sortableitem {$status}' id='item" . $out['id'] . "'"); } $sect = span($section['sec_desc'], "class='inplace1' id='s{$section['secid']}'"); $checked = $section['sec_disp'] == 1 ? "checked='checked'" : ''; $body .= ul("\n" . li($sect . span(' ', "class='options switchBox' style='color: #000;'"), "class='group'") . $list, "class='sortable' id='sort{$section['secid']}'"); } $i++; } return $body; }
<?php use_helper('Field'); ?> <ul id="article_gauche_5050" class="data"> <?php disp_doc_type('map'); li(field_data_from_list_if_set($document, 'editor', 'mod_maps_editors_list')); li(field_data_from_list_if_set($document, 'scale', 'mod_maps_scales_list')); li(field_data_if_set($document, 'code')); ?> </ul>
<?php return html(div(array('id' => 'everything', 'class' => 'foo'), p('This is a ', strong(Sc('bold', true), 'bold'), span(Sc('bold', false), 'plain'), ' sentence.'), p(Sd('foo')), ul(Sforeach(array('asdf' => 'qwerty', 'foo' => 'bar', 'hooah' => 'woo'), li(Sd('_k'), ': ', Sd('_v'))))));
public function home($application) { $data = $this->Db->findAll($application, NULL, "DESC", _maxLimit); if ($data) { $i = 1; foreach ($data as $record) { switch ($application) { case "pages": $list[] = li(a(getLanguage($record["Language"], TRUE) . " {$i}. " . $record["Title"], path("pages/" . $record["Slug"]), $record["Title"], TRUE)); break; case "blog": $URL = path("blog/" . $record["Year"] . "/" . $record["Month"] . "/" . $record["Day"] . "/" . $record["Slug"]); $list[] = li(a(getLanguage($record["Language"], TRUE) . ' ' . $i . '. ' . $record["Title"], $URL, $record["Title"], TRUE)); break; case "links": $list[] = li(a($i . ". " . $record["Title"], $record["URL"], $record["Description"], TRUE)); break; case "users": $list[] = li(a($i . ". " . $record["Username"], path("users/profile/" . $record["ID_User"]), $record["Username"], TRUE)); break; } $i++; } } else { $list = "<p>   " . __(_("There are no new records")) . "</p>"; } return $list; }
<?php use_helper('Field'); // put here meta tags for microdata that cannot be inside ul tags echo microdata_meta('name', $document->getName()); if (isset($nb_comments) && $nb_comments) { echo microdata_meta('interactionCount', $nb_comments . ' UserComments'); echo microdata_meta('discussionUrl', url_for('@document_comment?module=articles&id=' . $sf_params->get('id') . '&lang=' . $sf_params->get('lang'))); } ?> <ul id="article_gauche_5050" class="data"> <?php disp_doc_type('article'); li(field_data_from_list($document, 'categories', 'mod_articles_categories_list', array('multiple' => true, 'microdata' => 'articleSection'))); li(field_activities_data_if_set($document)); li(field_data_from_list($document, 'article_type', 'mod_articles_article_types_list')); ?> </ul>
$route = "@document_by_id_lang_slug?module=maps&id={$id}&lang={$lang}&slug=" . get_slug($document); echo make_popup_title($title, 'maps', $route); $description = $document->getRaw('description'); if (!empty($description)) { $description = truncate_description($description, $route, 700, true); } else { $description = ''; } $image = make_thumbnail_slideshow($associated_images); if (!$raw && $image) { echo insert_popup_js(); } ?> <div class="popup_desc"><?php if ($image) { echo $image; } ?> <ul class="data"> <?php li(field_data_from_list_if_set($document, 'scale', 'mod_maps_scales_list')); ?> </ul> <?php if ($description) { echo $description; } ?> </div> <?php echo javascript_tag('C2C.init_popup();');
<?php use_helper('Field'); // put here meta tags for microdata which would be invalid inside ul tag echo microdata_meta('name', $document->getName()); if (isset($nb_comments) && $nb_comments) { echo microdata_meta('interactionCount', $nb_comments . ' UserComments'); echo microdata_meta('discussionUrl', url_for('@document_comment?module=summits&id=' . $sf_params->get('id') . '&lang=' . $sf_params->get('lang'))); } ?> <ul class="data"> <?php li(field_data_from_list($document, 'summit_type', 'app_summits_summit_types')); if (check_not_empty_doc($document, 'elevation') || check_not_empty_doc($document, 'lon')) { echo '<li><ul itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">'; li(field_data_if_set($document, 'elevation', array('suffix' => 'meters', 'microdata' => 'elevation'))); li(field_coord_data_if_set($document, 'lon', array('microdata' => 'longitude'))); li(field_coord_data_if_set($document, 'lat', array('microdata' => 'latitude'))); li(field_swiss_coords($document)); echo '</ul></li>'; } if (isset($preview) && $preview) { li(field_data_if_set($document, 'maps_info')); } if ($document->get('geom_wkt')) { li(field_export($document->get('module'), $sf_params->get('id'), $sf_params->get('lang'), $sf_params->get('version'))); } ?> </ul>