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


PHP JFactory::getDate方法代码示例

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


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

示例1: display

 function display($tpl = null)
 {
     global $mainframe, $option;
     $cid = JRequest::getVar('cid_user');
     if (!is_array($cid)) {
         $mainframe->redirect('index.php?option=' . $option);
         return;
     }
     $user_id = $cid[0];
     $model = $this->getModel('user');
     $model->load($user_id);
     $this->_setToolBar();
     $say = JText::sprintf('USER_RESOURCES_TITLE', $model->user->username);
     $root_node = JText::_('RESOURCES_TREE_ROOT_NODE');
     $nowdate = JFactory::getDate();
     $str_now = JHTML::_('date', $nowdate->toMySQL(), '%Y-%m-%d %H:%M:%S');
     $this->assign('nowdate', $str_now);
     $this->assign('say', $say);
     $this->assign('root_node', $root_node);
     $this->assignRef('uid', $user_id);
     $this->assignRef('option', $option);
     //hide the menu
     JRequest::setVar('hidemainmenu', 1);
     parent::display();
 }
开发者ID:laiello,项目名称:yrm,代码行数:25,代码来源:view.resources.php

示例2: store

 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     // Attempt to store the user data.
     return parent::store($updateNulls);
 }
开发者ID:konstantinosDMS,项目名称:jNotification,代码行数:7,代码来源:domain.php

示例3: store

 public function store($updateNulls = true)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         $this->modified_time = $date->toSql();
         $this->modified_user_id = $user->get('id');
     } else {
         if (!(int) $this->created_time) {
             $this->created_time = $date->toSql();
         }
         if (empty($this->created_user_id)) {
             $this->created_user_id = $user->get('id');
         }
     }
     $table = JTable::getInstance('Page', 'SppagebuilderTable');
     $alias = JFilterOutput::stringURLSafe($this->alias);
     if ($alias == '') {
         $alias = JFilterOutput::stringURLSafe($this->title);
     }
     $this->alias = $alias;
     if ($table->load(array('alias' => $alias)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_SPPAGEBUILDER_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
开发者ID:spikart,项目名称:spikart.com.ua,代码行数:27,代码来源:page.php

示例4: _canonicalizeSlug

 /**
  * Make sure the slug is unique
  *
  * This function checks if the slug already exists and if so appends a number to the slug to make it unique. The
  * slug will get the form of slug-x.
  *
  * If the slug is empty it returns the current date in the format Y-m-d-H-i-s
  *
  * @return void
  */
 protected function _canonicalizeSlug()
 {
     if (trim(str_replace($this->_separator, '', $this->slug)) == '') {
         $this->slug = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     parent::_canonicalizeSlug();
 }
开发者ID:daodaoliang,项目名称:nooku-framework,代码行数:17,代码来源:sluggable.php

示例5: getTree

 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if ($xmap->isNews || !self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['include_topics'] = JArrayHelper::getValue($params, 'include_topics', 1);
     $params['include_topics'] = $params['include_topics'] == 1 || $params['include_topics'] == 2 && $xmap->view == 'xml' || $params['include_topics'] == 3 && $xmap->view == 'html';
     $params['include_pagination'] = JArrayHelper::getValue($params, 'include_pagination', 0);
     $params['include_pagination'] = $params['include_pagination'] == 1 || $params['include_pagination'] == 2 && $xmap->view == 'xml' || $params['include_pagination'] == 3 && $xmap->view == 'html';
     $params['cat_priority'] = JArrayHelper::getValue($params, 'cat_priority', $parent->priority);
     $params['cat_priority'] = $params['cat_priority'] == -1 ? $parent->priority : $params['cat_priority'];
     $params['cat_changefreq'] = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq);
     $params['cat_changefreq'] = $params['cat_changefreq'] == -1 ? $parent->changefreq : $params['cat_changefreq'];
     $params['topic_priority'] = JArrayHelper::getValue($params, 'topic_priority', $parent->changefreq);
     $params['topic_priority'] = $params['topic_priority'] == -1 ? $parent->priority : $params['topic_priority'];
     $params['topic_changefreq'] = JArrayHelper::getValue($params, 'topic_changefreq', $parent->changefreq);
     $params['topic_changefreq'] = $params['topic_changefreq'] == -1 ? $parent->changefreq : $params['topic_changefreq'];
     if ($params['include_topics']) {
         if ((int) ($limit = JArrayHelper::getValue($params, 'max_topics', 0))) {
             $params['limit'] = $limit;
         } else {
             $params['limit'] = 0;
         }
         if ((int) ($days = JArrayHelper::getValue($params, 'max_age', 0))) {
             $params['days'] = JFactory::getDate()->toUnix() - intval($days) * 86400;
         } else {
             $params['days'] = '';
         }
     }
     self::getCategoryTree($xmap, $parent, $params, $uri->getVar('catid', 0));
 }
开发者ID:b2un0,项目名称:joomla-plugin-xmap-kunena,代码行数:37,代码来源:com_kunena.php

示例6: update_cats_and_links_count

function update_cats_and_links_count($cat_id = 0, $updateOrder = true, $visible_links_only = false)
{
    $database =& JFactory::getDBO();
    $nullDate = $database->getNullDate();
    $sql = "SELECT cat_id FROM #__mt_cats WHERE cat_parent={$cat_id} ";
    if ($visible_links_only) {
        $sql .= "AND cat_published = '1' AND cat_approved = '1'";
    }
    $database->setQuery($sql);
    $retval["cats"] = 0;
    $retval["links"] = 0;
    //all children and their links
    $cat_ids = $database->loadResultArray();
    foreach ($cat_ids as $cid) {
        $val = update_cats_and_links_count($cid, $updateOrder, $visible_links_only);
        $retval["cats"] += $val["cats"] + 1;
        $retval["links"] += $val["links"];
        $database->setQuery("UPDATE #__mt_cats SET cat_cats=" . $val["cats"] . ", cat_links=" . $val["links"] . " WHERE cat_id = " . $cid);
        $database->query();
    }
    # Update its own links
    $jdate = JFactory::getDate();
    $now = $jdate->toMySQL();
    $sql2 = "SELECT count(l.link_id) FROM #__mt_links AS l, #__mt_cl AS cl WHERE l.link_id = cl.link_id AND cl.cat_id={$cat_id} ";
    if ($visible_links_only) {
        $sql2 .= "AND link_published = '1' AND link_approved = '1'" . " AND ( l.publish_up = " . $database->Quote($nullDate) . " OR l.publish_up <= '{$now}'  ) " . " AND ( l.publish_down = " . $database->Quote($nullDate) . " OR l.publish_down >= '{$now}' ) ";
    }
    $database->setQuery($sql2);
    $count_links = $database->loadResult();
    if ($count_links >= 0) {
        $retval["links"] += $count_links;
    }
    return $retval;
}
开发者ID:rsemedo,项目名称:Apply-Within,代码行数:34,代码来源:recount.mtree.php

示例7: loadFromFile

 /**
  * Load properties from a given file properties
  * 
  * @param $file string The filename to scan
  * @param $contents boolean Load the contents
  * @param $loadId boolean Load id from database
  * @return boolean result
  */
 function loadFromFile($file, $contents = false, $loadId = false)
 {
     if (!JFile::exists($file) && !JFolder::exists($file . DS)) {
         return false;
     }
     $info = @stat($file);
     $this->scandate = $this->_db->getNullDate();
     $this->filename = basename($file);
     $this->fullpath = $file;
     $this->permission = fileperms($file) & 0777;
     $this->size = filesize($file);
     $ctime =& JFactory::getDate($info['ctime']);
     $mtime =& JFactory::getDate($info['mtime']);
     $this->ctime = $ctime->toMySQL();
     $this->mtime = $mtime->toMySQL();
     $this->uid = $info['uid'];
     $this->gid = $info['gid'];
     $this->type = '';
     if (is_file($file)) {
         $this->type = 'file';
         $this->hash_md = md5_file($file);
         if ($contents) {
             $f = new JD_File($file);
             $this->contents = $f->read();
         }
     } elseif (is_dir($file)) {
         $this->type = 'dir';
     }
     if ($loadId) {
         $this->_db->setQuery('SELECT id FROM #__jdefender_filesystem WHERE fullpath = ' . $this->fullpath . ' LIMIT 1');
         $this->id = $this->_db->loadResult();
     }
     return true;
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:42,代码来源:filesystem.php

示例8: check

 public function check()
 {
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_JUDOWNLOAD_TITLE_MUST_NOT_BE_EMPTY'));
         return false;
     }
     if (trim($this->alias) == '') {
         $this->alias = $this->title;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     if (trim(str_replace('&nbsp;', '', $this->description)) == '') {
         $this->description = '';
     }
     if (!empty($this->metakeyword)) {
         $bad_characters = array("\n", "\r", "\"", "<", ">");
         $after_clean = JString::str_ireplace($bad_characters, "", $this->metakeyword);
         $keys = explode(',', $after_clean);
         $clean_keys = array();
         foreach ($keys as $key) {
             if (trim($key)) {
                 $clean_keys[] = trim($key);
             }
         }
         $this->metakeyword = implode(", ", $clean_keys);
     }
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:30,代码来源:license.php

示例9: save

 function save($data)
 {
     $oldData = array();
     if ($data['id'] > 0) {
         $table = $this->getTable();
         $table->load($data['id']);
         $oldData['id'] = $table->id;
         $oldData['provider'] = $table->provider;
         $oldData['type'] = $table->type;
         $oldData['attribs'] = (array) $table->attribs;
     }
     // Set the dates
     $date = JFactory::getDate();
     if ($data['id'] == 0) {
         $data['created'] = $date->toSql();
     }
     $data['modified'] = $date->toSql();
     if ($data['provider'] != '--' && $data['type'] != '--') {
         $channel = JFBCFactory::provider($data['provider'])->channel($data['type']);
         $data = $channel->onBeforeSave($data);
         // Manipulate the data however may be necessary
     }
     $return = parent::save($data);
     // Used to removed permissions from users that aren't associated with this channel (or anything else needed for cleanup)
     if ($return && $data['provider'] != '--' && $data['type'] != '--') {
         $data['id'] = $this->getState('channel.id');
         $channel->onAfterSave($data, $oldData);
     }
     return $return;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:30,代码来源:channel.php

示例10: prepareTable

 protected function prepareTable($table)
 {
     jimport('joomla.filter.output');
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
     $table->alias = JApplication::stringURLSafe($table->alias);
     if (empty($table->alias)) {
         $table->alias = JApplication::stringURLSafe($table->title);
     }
     if (intval($table->date) == 0) {
         $table->date = JFactory::getDate()->toSql();
     }
     if (empty($table->id)) {
         // Set the values
         //$table->created	= $date->toSql();
         // Set ordering to the last item if not set
         if (empty($table->ordering)) {
             $db = JFactory::getDbo();
             $db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_comments WHERE catid = ' . (int) $table->catid);
             $max = $db->loadResult();
             $table->ordering = $max + 1;
         }
     } else {
         // Set the values
         //$table->modified	= $date->toSql();
         //$table->modified_by	= $user->get('id');
     }
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:29,代码来源:phocagalleryco.php

示例11: check

 /**
  * Overloaded check function
  *
  * @return  boolean  True on success
  *
  * @see     JTable::check
  * @since   11.1
  */
 public function check()
 {
     // If the alias field is empty, set it to the title.
     $this->alias = trim($this->alias);
     if (empty($this->alias) && ($this->type != 'alias' && $this->type != 'url')) {
         $this->alias = $this->title;
     }
     // Make the alias URL safe.
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     // Cast the home property to an int for checking.
     $this->home = (int) $this->home;
     // Verify that a first level menu item alias is not 'component'.
     if ($this->parent_id == 1 && $this->alias == 'component') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT'));
         return false;
     }
     // Verify that a first level menu item alias is not the name of a folder.
     jimport('joomla.filesystem.folder');
     if ($this->parent_id == 1 && in_array($this->alias, JFolder::folders(JPATH_ROOT))) {
         $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER', $this->alias, $this->alias));
         return false;
     }
     // Verify that the home item a component.
     if ($this->home && $this->type != 'component') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT'));
         return false;
     }
     return true;
 }
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:40,代码来源:menu.php

示例12: array

 /**
  * Method to get newsfeed data.
  *
  * @param   integer	The id of the newsfeed.
  *
  * @return  mixed  Menu item data object on success, false on failure.
  * @since   1.6
  */
 public function &getItem($pk = null)
 {
     $pk = !empty($pk) ? $pk : (int) $this->getState('newsfeed.id');
     if ($this->_item === null) {
         $this->_item = array();
     }
     if (!isset($this->_item[$pk])) {
         try {
             $db = $this->getDbo();
             $query = $db->getQuery(true)->select($this->getState('item.select', 'a.*'))->from('#__newsfeeds AS a');
             // Join on category table.
             $query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access')->join('LEFT', '#__categories AS c on c.id = a.catid');
             // Join on user table.
             $query->select('u.name AS author')->join('LEFT', '#__users AS u on u.id = a.created_by');
             // Join over the categories to get parent category titles
             $query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')->join('LEFT', '#__categories as parent ON parent.id = c.parent_id')->where('a.id = ' . (int) $pk);
             // Filter by start and end dates.
             $nullDate = $db->quote($db->getNullDate());
             $nowDate = $db->quote(JFactory::getDate()->toSql());
             // Filter by published state.
             $published = $this->getState('filter.published');
             $archived = $this->getState('filter.archived');
             if (is_numeric($published)) {
                 $query->where('(a.published = ' . (int) $published . ' OR a.published =' . (int) $archived . ')')->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')')->where('(c.published = ' . (int) $published . ' OR c.published =' . (int) $archived . ')');
             }
             $db->setQuery($query);
             $data = $db->loadObject();
             if (empty($data)) {
                 JError::raiseError(404, JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
             }
             // Check for published state if filter set.
             if ((is_numeric($published) || is_numeric($archived)) && ($data->published != $published && $data->published != $archived)) {
                 JError::raiseError(404, JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
             }
             // Convert parameter fields to objects.
             $registry = new JRegistry();
             $registry->loadString($data->params);
             $data->params = clone $this->getState('params');
             $data->params->merge($registry);
             $registry = new JRegistry();
             $registry->loadString($data->metadata);
             $data->metadata = $registry;
             // Compute access permissions.
             if ($access = $this->getState('filter.access')) {
                 // If the access filter has been set, we already know this user can view.
                 $data->params->set('access-view', true);
             } else {
                 // If no access filter is set, the layout takes some responsibility for display of limited information.
                 $user = JFactory::getUser();
                 $groups = $user->getAuthorisedViewLevels();
                 $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups));
             }
             $this->_item[$pk] = $data;
         } catch (Exception $e) {
             $this->setError($e);
             $this->_item[$pk] = false;
         }
     }
     return $this->_item[$pk];
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:68,代码来源:newsfeed.php

示例13: getAliasName

 public static function getAliasName($name)
 {
     $paramsC = JComponentHelper::getParams('com_phocagallery');
     $alias_iconv = $paramsC->get('alias_iconv', 0);
     $iconv = 0;
     if ($alias_iconv == 1) {
         if (function_exists('iconv')) {
             $name = preg_replace('~[^\\pL0-9_.]+~u', '-', $name);
             $name = trim($name, "-");
             $name = iconv("utf-8", "us-ascii//TRANSLIT", $name);
             $name = strtolower($name);
             $name = preg_replace('~[^-a-z0-9_.]+~', '', $name);
             $iconv = 1;
         } else {
             $iconv = 0;
         }
     }
     if ($iconv == 0) {
         $name = JFilterOutput::stringURLSafe($name);
     }
     if (trim(str_replace('-', '', $name)) == '') {
         JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     return $name;
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:25,代码来源:text.php

示例14: setLastScanDate

 /**
  * Sets last scan date
  * @param JDate $now
  */
 function setLastScanDate($now = false)
 {
     if (empty($now) || !@is_a($now, 'JDate')) {
         $now =& JFactory::getDate();
     }
     JD_Vars_Helper::setVar('last_scan_date', 'jdefender', $now->toMySQL());
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:11,代码来源:scan.php

示例15: parseValue

 public function parseValue($value)
 {
     if (!$this->isPublished()) {
         return null;
     }
     $config = JFactory::getConfig();
     $user = JFactory::getUser();
     $filter = strtoupper((string) $this->getFilter());
     switch ($filter) {
         case 'SERVER_UTC':
             if (intval($value)) {
                 $date = JFactory::getDate($value, 'UTC');
                 $date->setTimezone(new DateTimeZone($config->get('offset')));
                 $value = $date->format('Y-m-d H:i:s', true, false);
             }
             break;
         case 'USER_UTC':
             if (intval($value)) {
                 $date = JFactory::getDate($value, 'UTC');
                 $date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
                 $value = $date->format('Y-m-d H:i:s', true, false);
             }
             break;
     }
     return $value;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:26,代码来源:datetime.php


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