Example #1
0
 function __timeInput($box, $fieldName, $value, $format = null)
 {
     global $wp_locale;
     $date = !empty($value) ? $value : time();
     $hour = mysql2date('H', $date);
     $mins = mysql2date('i', $date);
     $months = '';
     echo csml::tag('input[type="text"]', array('name' => $fieldName . "[hour]", 'size' => "2", 'value' => $hour));
     echo " : ";
     echo csml::tag('input[type="text"]', array('name' => $fieldName . "[mins]", 'size' => "2", 'value' => $mins));
     return;
 }
Example #2
0
File: html.php Project: soska/dte
 /**
  * Returns a properly formatted html attributes;
  *
  * @param string $atts 
  * @return void
  * @author Armando Sosa
  */
 function attr($atts = array())
 {
     return csml::attr($atts);
 }
Example #3
0
File: csml.php Project: soska/dte
 /**
  * Generate HTML tags using CSS selectors
  *
  * @param string $selector 
  * @param string $comment 
  * @return void
  * @author Armando Sosa
  */
 function tag($selector = "div", $attr = '', $format = BREAK_AND_TABS, $comment = '')
 {
     // initialize variables
     $element = $id = $classes = '';
     $tagMask = '<%1$s%4$s%2$s%3$s%5$s>';
     // ugly, I know. Translation 1:element, 4: attributes, 2:id, 3:classes, 5:auto close tag
     $autoClose = '';
     $tabs = '';
     if (is_array($attr)) {
         $attr = self::attributes($attr);
     }
     // parse bracked attributes;
     list($selector, $attr) = self::getBracketAttributes($selector, $attr);
     // separate selector into parts
     list($element, $id, $classes) = self::getSelectorParts($selector);
     // defaul $element to 'div'
     $element = empty($element) ? 'div' : $element;
     // if there's a closing slash in element name
     $slashPosition = strpos($element, "/");
     // if the slash is at the start,  we skip the attributes processing
     if ($slashPosition === 0) {
         $idclasses = "{$id}{$classes}";
         if (empty($comment) && !empty($idclasses)) {
             $comment = "/{$idclasses}";
         }
         $id = $classes = $attr = '';
     } else {
         // if the slash is at the end of the element, then set the autoclose variable
         $length = strlen($element) - 1;
         if ($slashPosition == $length && $length != 0) {
             $element = str_replace('/', '', $element);
             $autoClose = '/';
         }
         $id = !empty($id) ? " id=\"" . str_replace('#', '', $id) . "\"" : $id;
         $classes = !empty($classes) ? " class=\"" . trim(str_replace('.', ' ', $classes)) . "\"" : $classes;
     }
     // not a closing element
     if ($slashPosition === false) {
         self::$chain[] = $element;
         self::$tabsCount = count(self::$chain);
     } else {
         self::$tabsCount = count(self::$chain);
         $chain = (array) self::$chain;
         self::$chain = array_slice($chain, 0, -1);
     }
     $comment = !empty($comment) ? "<!-- {$comment} -->" : $comment;
     $tag = sprintf($tagMask, $element, $id, $classes, $attr, $autoClose);
     $tag = html_entity_decode($tag);
     // formatting options
     return self::format($tag . $comment, $format, $slashPosition !== false);
 }
Example #4
0
 function section($title)
 {
     $h = csml::entag($title, 'h3') . "<hr/>";
     $th = csml::entag($h, 'th', array('colspan' => '2'));
     return csml::entag($th, 'tr[valign="top"]');
 }