当前位置: 首页>>代码示例>>PHP>>正文


PHP i18n::get_date_format方法代码示例

本文整理汇总了PHP中i18n::get_date_format方法的典型用法代码示例。如果您正苦于以下问题:PHP i18n::get_date_format方法的具体用法?PHP i18n::get_date_format怎么用?PHP i18n::get_date_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在i18n的用法示例。


在下文中一共展示了i18n::get_date_format方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDateFormatCustom

 public function testDateFormatCustom()
 {
     i18n::set_locale('en_US');
     $this->assertEquals('MMM d, y', i18n::get_date_format());
     i18n::config()->date_format = 'd/MM/yyyy';
     $this->assertEquals('d/MM/yyyy', i18n::get_date_format());
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:7,代码来源:i18nTest.php

示例2: testDateFormatCustom

 function testDateFormatCustom()
 {
     i18n::set_locale('en_US');
     $this->assertEquals('MM/dd/yyyy', i18n::get_date_format());
     i18n::set_date_format('d/MM/yyyy');
     $this->assertEquals('d/MM/yyyy', i18n::get_date_format());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:i18nTest.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet('Root', new Tab('Main', _t('SiteTree.TABMAIN', 'Main'), new TextField('Title', _t('UniadsObject.db_Title', 'Title')))));
     if ($this->ID) {
         $previewLink = Director::absoluteBaseURL() . 'admin/' . UniadsAdmin::config()->url_segment . '/UniadsObject/preview/' . $this->ID;
         $fields->addFieldToTab('Root.Main', new ReadonlyField('Impressions', _t('UniadsObject.db_Impressions', 'Impressions')), 'Title');
         $fields->addFieldToTab('Root.Main', new ReadonlyField('Clicks', _t('UniadsObject.db_Clicks', 'Clicks')), 'Title');
         $fields->addFieldsToTab('Root.Main', array(DropdownField::create('CampaignID', _t('UniadsObject.has_one_Campaign', 'Campaign'), DataList::create('UniadsCampaign')->map())->setEmptyString(_t('UniadsObject.Campaign_none', 'none')), DropdownField::create('ZoneID', _t('UniadsObject.has_one_Zone', 'Zone'), DataList::create('UniadsZone')->map())->setEmptyString(_t('UniadsObject.Zone_select', 'select one')), new NumericField('Weight', _t('UniadsObject.db_Weight', 'Weight (controls how often it will be shown relative to others)')), new TextField('TargetURL', _t('UniadsObject.db_TargetURL', 'Target URL')), new Treedropdownfield('InternalPageID', _t('UniadsObject.has_one_InternalPage', 'Internal Page Link'), 'Page'), new CheckboxField('NewWindow', _t('UniadsObject.db_NewWindow', 'Open in a new Window')), $file = new UploadField('File', _t('UniadsObject.has_one_File', 'Advertisement File')), $AdContent = new TextareaField('AdContent', _t('UniadsObject.db_AdContent', 'Advertisement Content')), $Starts = new DateField('Starts', _t('UniadsObject.db_Starts', 'Starts')), $Expires = new DateField('Expires', _t('UniadsObject.db_Expires', 'Expires')), new NumericField('ImpressionLimit', _t('UniadsObject.db_ImpressionLimit', 'Impression Limit')), new CheckboxField('Active', _t('UniadsObject.db_Active', 'Active')), new LiteralField('Preview', '<a href="' . $previewLink . '" target="_blank">' . _t('UniadsObject.Preview', 'Preview this advertisement') . "</a>")));
         $app_categories = File::config()->app_categories;
         $file->setFolderName($this->config()->files_dir);
         $file->getValidator()->setAllowedMaxFileSize(array('*' => $this->config()->max_file_size));
         $file->getValidator()->setAllowedExtensions(array_merge($app_categories['image'], $app_categories['flash']));
         $AdContent->setRows(10);
         $AdContent->setColumns(20);
         $Starts->setConfig('showcalendar', true);
         $Starts->setConfig('dateformat', i18n::get_date_format());
         $Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
         $Expires->setConfig('showcalendar', true);
         $Expires->setConfig('dateformat', i18n::get_date_format());
         $Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
         $Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:unisolutions-silverstripe-uniads,代码行数:26,代码来源:UniadsObject.php

示例4: __construct

 function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     if (!$this->getConfig('dateformat')) {
         $this->setConfig('dateformat', i18n::get_date_format());
     }
     parent::__construct($name, $title, $value, $form, $rightTitle);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:10,代码来源:DateField.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $Starts = $fields->fieldByName('Root.Main.Starts');
     $Starts->setConfig('showcalendar', true);
     $Starts->setConfig('dateformat', i18n::get_date_format());
     $Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
     $Expires = $fields->fieldByName('Root.Main.Expires');
     $Expires->setConfig('showcalendar', true);
     $Expires->setConfig('dateformat', i18n::get_date_format());
     $Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
     $Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
     $fields->changeFieldOrder(array('Title', 'ClientID', 'Starts', 'Expires', 'Active'));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:unisolutions-silverstripe-uniads,代码行数:15,代码来源:UniadsCampaign.php

示例6: __construct

 function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     if (!$this->getConfig('dateformat')) {
         $this->setConfig('dateformat', i18n::get_date_format());
     }
     foreach (self::$default_config as $defaultK => $defaultV) {
         if ($defaultV) {
             if ($defaultK == 'locale') {
                 $this->locale = $defaultV;
             } else {
                 $this->setConfig($defaultK, $defaultV);
             }
         }
     }
     parent::__construct($name, $title, $value, $form, $rightTitle);
 }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:19,代码来源:DateField.php

示例7: getFormField

    /**
     * Return the form field.
     *
     * @todo Make a jQuery safe form field. The current CalendarDropDown
     * 			breaks on the front end.
     */
    public function getFormField()
    {
        // scripts for jquery date picker
        Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js');
        Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.datepicker.js');
        $dateFormat = DateField_View_JQuery::convert_iso_to_jquery_format(i18n::get_date_format());
        Requirements::customScript(<<<JS
\t\t\t(function(jQuery) {
\t\t\t\t\$(document).ready(function() {
\t\t\t\t\t\$('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker({ dateFormat: '{$dateFormat}' });
\t\t\t\t});
\t\t\t})(jQuery);
JS
, 'UserFormsDate');
        // css for jquery date picker
        Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui-1.8rc3.custom.css');
        $default = $this->getSetting('DefaultToToday') ? date('d/m/Y') : $this->Default;
        return new DateField($this->Name, $this->Title, $default);
    }
开发者ID:notioncollective,项目名称:silverstripe-userforms,代码行数:25,代码来源:EditableDateField.php

示例8: __construct

 public function __construct($name, $title = null, $value = null)
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     $this->config = $this->config()->default_config;
     if (!$this->getConfig('dateformat')) {
         $this->setConfig('dateformat', i18n::get_date_format());
     }
     foreach ($this->config()->default_config as $defaultK => $defaultV) {
         if ($defaultV) {
             if ($defaultK == 'locale') {
                 $this->locale = $defaultV;
             } else {
                 $this->setConfig($defaultK, $defaultV);
             }
         }
     }
     parent::__construct($name, $title, $value);
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:20,代码来源:DateField.php

示例9: getDateFormat

 /**
  * Override the default getter for DateFormat so the
  * default format for the user's locale is used
  * if the user has not defined their own.
  * 
  * @return string ISO date format
  */
 public function getDateFormat()
 {
     if ($this->getField('DateFormat')) {
         return $this->getField('DateFormat');
     } elseif ($this->getField('Locale')) {
         require_once 'Zend/Date.php';
         return Zend_Locale_Format::getDateFormat($this->Locale);
     } else {
         return i18n::get_date_format();
     }
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:18,代码来源:Member.php


注:本文中的i18n::get_date_format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。