本文整理汇总了PHP中Foundry::date方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::date方法的具体用法?PHP Foundry::date怎么用?PHP Foundry::date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundry
的用法示例。
在下文中一共展示了Foundry::date方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
/**
* Installs a new theme
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function install($file)
{
$source = $file['tmp_name'];
$fileName = md5($file['name'] . Foundry::date()->toMySQL());
$fileExtension = '_themes_install.zip';
$destination = JPATH_ROOT . '/tmp/' . $fileName . $fileExtension;
// Upload the zip archive
$state = JFile::upload($source, $destination);
if (!$state) {
$this->setError(JText::_('COM_EASYBLOG_THEMES_INSTALLER_ERROR_COPY_FROM_PHP'));
return false;
}
// Extract the zip
$extracted = dirname($destination) . '/' . $fileName . '_themes_install';
$state = JArchive::extract($destination, $extracted);
// Once it is extracted, delete the zip file
JFile::delete($destination);
// Get the configuration file.
$manifest = $extracted . '/config/template.json';
$manifest = JFile::read($manifest);
// Get the theme object
$theme = json_decode($manifest);
// Move it to the appropriate folder
$themeDestination = EBLOG_THEMES . '/' . strtolower($theme->element);
$exists = JFolder::exists($themeDestination);
// If folder exists, overwrite it. For now, just throw an error.
if ($exists) {
// Delete teh etracted folder
JFolder::delete($extracted);
$this->setError(JText::sprintf('COM_EASYBLOG_THEMES_INSTALLER_ERROR_SAME_THEME_FOLDER_EXISTS', $theme->element));
return false;
}
// Move extracted folder
$state = JFolder::move($extracted, $themeDestination);
if (!$state) {
// Delete the etracted folder
JFolder::delete($extracted);
$this->setError(JText::_('COM_EASYBLOG_THEMES_INSTALLER_ERROR_MOVING_FOLDER_TO_THEMES_FOLDER'));
return false;
}
return true;
}
示例2: dateform
/**
* Renders a date form
*
* @since 1.0
* @access public
* @param string The key name for the input.
* @param string The date value.
* @param string The id of the date form. (optional, will fallback to name by default)
* @param string/array The attributes to add to the select list.
*
* @return string The html output.
*
* @author Jason Rey <jasonrey@stackideas.com>
*/
public static function dateform($name, $value = '', $id = '', $attributes = '', $withOffset = true)
{
if (is_array($attributes)) {
$attributes = implode(' ', $attributes);
}
if (empty($value)) {
$value = Foundry::date('now', $withOffset);
} else {
$value = Foundry::date($value, $withOffset);
}
$theme = Foundry::get('Themes');
$theme->set('name', $name);
$theme->set('value', $value);
$theme->set('id', $id);
$theme->set('attributes', $attributes);
return $theme->output('admin/html/grid.dateform');
}
示例3: injectLike
public function injectLike( $comment )
{
if( !$this->exists() )
{
return false;
}
if( !empty( $comment->params->social->stream ) )
{
$likeTable = Foundry::table( 'likes' );
$liked = $likeTable->load( array( 'type' => 'komento.user', 'uid' => $comment->params->social->stream, 'created_by' => Foundry::user()->id ) );
if( !$liked )
{
$likeTable->type = 'komento.user';
$likeTable->uid = $comment->params->social->stream;
$likeTable->created_by = Foundry::user()->id;
$likeTable->created = Foundry::date()->toSQL();
$state = $likeTable->store();
}
}
}