Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
 1: <?php
 2: /**
 3:  * Smarty plugin
 4:  *
 5:  * @package    Smarty
 6:  * @subpackage PluginsModifier
 7:  */
 8: 
 9: /**
10:  * Smarty date_format modifier plugin
11:  * Type:     modifier<br>
12:  * Name:     date_format<br>
13:  * Purpose:  format datestamps via strftime<br>
14:  * Input:<br>
15:  *          - string: input date string
16:  *          - format: strftime format for output
17:  *          - default_date: default date if $string is empty
18:  *
19:  * @link   http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
20:  * @author Monte Ohrt <monte at ohrt dot com>
21:  *
22:  * @param string $string       input date string
23:  * @param string $format       strftime format for output
24:  * @param string $default_date default date if $string is empty
25:  * @param string $formatter    either 'strftime' or 'auto'
26:  *
27:  * @return string |void
28:  * @uses   smarty_make_timestamp()
29:  */
30: function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto')
31: {
32:     if ($format === null) {
33:         $format = Smarty::$_DATE_FORMAT;
34:     }
35:     /**
36:      * Include the {@link shared.make_timestamp.php} plugin
37:      */
38:     require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
39:     if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') {
40:         $timestamp = smarty_make_timestamp($string);
41:     } elseif ($default_date != '') {
42:         $timestamp = smarty_make_timestamp($default_date);
43:     } else {
44:         return;
45:     }
46:     if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
47:         if (DS == '\\') {
48:             $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
49:             $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
50:             if (strpos($format, '%e') !== false) {
51:                 $_win_from[] = '%e';
52:                 $_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
53:             }
54:             if (strpos($format, '%l') !== false) {
55:                 $_win_from[] = '%l';
56:                 $_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
57:             }
58:             $format = str_replace($_win_from, $_win_to, $format);
59:         }
60: 
61:         return strftime($format, $timestamp);
62:     } else {
63:         return date($format, $timestamp);
64:     }
65: }
66: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen