本文整理汇总了PHP中FLEXIUtilities::getVersionsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::getVersionsCount方法的具体用法?PHP FLEXIUtilities::getVersionsCount怎么用?PHP FLEXIUtilities::getVersionsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::getVersionsCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
//.........这里部分代码省略.........
// Update Joomla Featured FLAG
// ***************************
if (FLEXI_J16GE) {
$this->featured(array($item->id), $item->featured);
}
// *****************************************************************************************************
// Trigger Event 'onAfterContentSave' (J1.5) OR 'onContentAfterSave' (J2.5 ) of Joomla's Content plugins
// *****************************************************************************************************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
// Some compatibility steps
JRequest::setVar('view', 'article');
JRequest::setVar('option', 'com_content');
if (FLEXI_J16GE) {
$dispatcher->trigger($this->event_after_save, array('com_content.article', &$item, $isnew));
} else {
$dispatcher->trigger('onAfterContentSave', array(&$item, $isnew));
}
// Reverse compatibility steps
JRequest::setVar('view', $view);
JRequest::setVar('option', 'com_flexicontent');
if ($print_logging_info) {
@($fc_run_times['onContentAfterSave_event'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
}
// *************************************************************************************************
// Trigger Event 'onAfterSaveItem' of FLEXIcontent plugins (such plugin is the 'flexinotify' plugin)
// *************************************************************************************************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$results = $dispatcher->trigger('onAfterSaveItem', array(&$item, &$data));
if ($print_logging_info) {
@($fc_run_times['onAfterSaveItem_event'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
// *********************************************************************
// ITEM DATA NOT SAVED: NEITHER new, NOR approving current item version
// *********************************************************************
if (!$version_approved) {
// Warn editor that his/her changes will need approval to before becoming visible
if ($canEditState) {
JError::raiseNotice(11, JText::_('FLEXI_SAVED_VERSION_WAS_NOT_APPROVED_NOTICE'));
} else {
JError::raiseNotice(10, JText::_('FLEXI_SAVED_VERSION_MUST_BE_APPROVED_NOTICE'));
}
// Set modifier and modification time (as if item has been saved), so that we can use this information for updating the versioning tables
$datenow = JFactory::getDate();
$item->modified = FLEXI_J16GE ? $datenow->toSql() : $datenow->toMySQL();
$item->modified_by = $user->get('id');
}
// *********************************************
// Create and store version METADATA information
// *********************************************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
if ($use_versioning) {
$v = new stdClass();
$v->item_id = (int) $item->id;
$v->version_id = $isnew && !empty($data['type_id_not_set']) ? 0 : (int) $last_version + 1;
$v->created = $item->created;
$v->created_by = $item->created_by;
if ($item->modified != $nullDate) {
// NOTE: We set modifier as creator of the version, and modication date as creation date of the version
$v->created = $item->modified;
$v->created_by = $item->modified_by;
}
$v->comment = isset($data['versioncomment']) ? htmlspecialchars($data['versioncomment'], ENT_QUOTES) : '';
$this->_db->insertObject('#__flexicontent_versions', $v);
}
// *************************************************************
// Delete old versions that are above the limit of kept versions
// *************************************************************
$vcount = FLEXIUtilities::getVersionsCount($item->id);
$vmax = $cparams->get('nr_versions', 10);
if ($vcount > $vmax) {
$deleted_version = FLEXIUtilities::getFirstVersion($item->id, $vmax, $current_version);
$query = 'DELETE' . ' FROM #__flexicontent_items_versions' . ' WHERE item_id = ' . (int) $item->id . ' AND version <=' . $deleted_version . ' AND version!=' . (int) $current_version;
$this->_db->setQuery($query);
$this->_db->query();
$query = 'DELETE' . ' FROM #__flexicontent_versions' . ' WHERE item_id = ' . (int) $item->id . ' AND version_id <=' . $deleted_version . ' AND version_id!=' . (int) $current_version;
$this->_db->setQuery($query);
$this->_db->query();
}
if ($print_logging_info) {
@($fc_run_times['ver_cleanup_ver_metadata'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
// ****************************************************************************************************
// Trigger Event 'onCompleteSaveItem' of FLEXIcontent plugins (such plugin is the 'flexinotify' plugin)
// ****************************************************************************************************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$results = $dispatcher->trigger('onCompleteSaveItem', array(&$item, &$fields));
if ($print_logging_info) {
@($fc_run_times['onCompleteSaveItem_event'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10);
}
return true;
}