timeGetFormat() 공개 메소드

Returns the current dateformat as a string
public timeGetFormat ( )
예제 #1
0
 function Pommo_Template()
 {
     // set theme -- TODO; extend this to the theme selector
     $this->_pommoTheme = 'default';
     // set directories
     $this->_themeDir = Pommo::$_baseDir . 'themes/';
     $this->template_dir = $this->_themeDir . $this->_pommoTheme;
     $this->config_dir = $this->template_dir . '/inc/config';
     // set base/core variables available to all template
     $this->assign('url', array('theme' => array('shared' => Pommo::$_baseUrl . 'themes/shared/', 'this' => Pommo::$_baseUrl . 'themes/' . $this->_pommoTheme . '/'), 'base' => Pommo::$_baseUrl, 'http' => Pommo::$_http));
     $this->assign('config', @array('app' => array('path' => Pommo::$_baseDir, 'weblink' => '<a href="http://github.com/soonick/poMMo">' . Pommo::_T('poMMo Website') . '</a>', 'dateformat' => Pommo_Helper::timeGetFormat()), 'site_name' => Pommo::$_config['site_name'], 'site_url' => Pommo::$_config['site_url'], 'list_name' => Pommo::$_config['list_name'], 'admin_email' => Pommo::$_config['admin_email'], 'demo_mode' => Pommo::$_config['demo_mode']));
     // set gettext overload functions (see block.t.php...)
     $this->_gettext_func = array('Pommo', '_T');
     // calls Pommo::_T($str)
     $this->_gettext_plural_func = array('Pommo', '_TP');
     // assign page title
     $this->assign('title', '. ..poMMo.. .');
     // assign section (used for sidebar template)
     $this->assign('section', Pommo::$_section);
 }
예제 #2
0
 function subscriberData(&$in, $p = array())
 {
     $defaults = array('prune' => true, 'active' => true, 'log' => true, 'ignore' => false, 'ignoreInactive' => true, 'skipReq' => false);
     $p = Pommo_Api::getParams($defaults, $p);
     require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
     $logger = Pommo::$_logger;
     $fields = Pommo_Fields::get(array('active' => $p['active']));
     $valid = true;
     foreach ($fields as $id => $field) {
         $inactive = $field['active'] == 'on' ? false : true;
         if (!isset($in[$id]) && $p['skipReq']) {
             continue;
         }
         $in[$id] = @trim($in[$id]);
         if (empty($in[$id])) {
             unset($in[$id]);
             // don't include blank values
             if ($field['required'] == 'on') {
                 if ($p['log']) {
                     $logger->addErr(sprintf(Pommo::_T('%s is a required field.'), $field['prompt']));
                 }
                 $valid = false;
             }
             continue;
         }
         // shorten
         $in[$id] = substr($in[$id], 0, 255);
         switch ($field['type']) {
             case "checkbox":
                 if (strtolower($in[$id]) == 'true') {
                     $in[$id] = 'on';
                 }
                 if (strtolower($in[$id]) == 'false') {
                     $in[$id] = '';
                 }
                 if ($in[$id] != 'on' && $in[$id] != '') {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
             case "multiple":
                 if (is_array($in[$id])) {
                     foreach ($in[$id] as $key => $val) {
                         if (!in_array($val, $field['array'])) {
                             if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                                 unset($in[$id]);
                                 break;
                             }
                             if ($p['log']) {
                                 $logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
                             }
                             $valid = false;
                         }
                     }
                 } elseif (!in_array($in[$id], $field['array'])) {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Illegal input for field %s.'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
             case "date":
                 // convert date to timestamp [float; using adodb time library]
                 if (is_numeric($in[$id])) {
                     $in[$id] = Pommo_Helper::timeToStr($in[$id]);
                 }
                 $in[$id] = Pommo_Helper::timeFromStr($in[$id]);
                 if (!$in[$id]) {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Field (%s) must be a date (' . Pommo_Helper::timeGetFormat() . ').'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
             case "number":
                 if (!is_numeric($in[$id])) {
                     if ($p['ignore'] || $inactive && $p['ignoreInactive']) {
                         unset($in[$id]);
                         break;
                     }
                     if ($p['log']) {
                         $logger->addErr(sprintf(Pommo::_T('Field (%s) must be a number.'), $field['prompt']));
                     }
                     $valid = false;
                 }
                 break;
         }
     }
     // prune
     if ($p['prune']) {
         $in = Pommo_Helper::arrayIntersect($in, $fields);
     }
     return $valid;
 }