本文整理匯總了PHP中XenForo_DataWriter::isUpdate方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_DataWriter::isUpdate方法的具體用法?PHP XenForo_DataWriter::isUpdate怎麽用?PHP XenForo_DataWriter::isUpdate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenForo_DataWriter
的用法示例。
在下文中一共展示了XenForo_DataWriter::isUpdate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postDataWriterSave
public static function postDataWriterSave(XenForo_DataWriter $writer, array $extraData = array())
{
if (!isset($extraData['styleId']) || !isset($extraData['self'])) {
return;
}
$styleId = $extraData['styleId'];
$self = $extraData['self'];
$oldPath = false;
$oldData = array_merge($writer->getMergedExistingData(), array('id' => $writer->get('template_id')));
if ($writer->isUpdate()) {
$oldPath = $self->getDirectory($writer->getMergedExistingData()) . self::$s . $self->getFileName($oldData);
}
$newPath = false;
$newData = array_merge($writer->getMergedData(), array('id' => $writer->get('template_id')));
if ($writer->isChanged('addon_id') or $writer->isChanged('title')) {
$newPath = $self->getDirectory($writer->getMergedData()) . self::$s . $self->getFileName($newData);
}
if (!$oldPath) {
$oldPath = $newPath;
}
$contents = XenForo_Model::create('XenForo_Model_StyleProperty')->replacePropertiesInTemplateForEditor($writer->get('template'), $styleId, $self->getPropertiesInStyle($styleId));
$contents = XenForo_Model::create('XenForo_Model_Template')->replaceIncludesWithLinkRel($contents);
if (!DevTools_Helper_File::write($oldPath, $contents, array('id' => $writer->get('template_id'), 'dbName' => XenForo_Application::getConfig()->db->dbname))) {
throw new XenForo_Exception("Failed to write template file to {$oldPath}");
return;
}
if ($newPath and $oldPath) {
rename($oldPath, $newPath);
}
$self->touchDb();
}
示例2: postDataWriterSave
public static function postDataWriterSave(XenForo_DataWriter $writer, array $extraData = array())
{
$self = new self();
$oldPath = false;
$oldData = array_merge($writer->getMergedExistingData(), array('id' => $writer->get('phrase_id')));
if ($writer->isUpdate()) {
$oldPath = $self->getDirectory($writer->getMergedExistingData()) . self::$s . $self->getFileName($oldData);
}
$newPath = false;
$newData = array_merge($writer->getMergedData(), array('id' => $writer->get('phrase_id')));
if ($writer->isChanged('addon_id') or $writer->isChanged('title')) {
$newPath = $self->getDirectory($newData) . self::$s . $self->getFileName($newData);
}
if (!$oldPath) {
$oldPath = $newPath;
}
if (!DevTools_Helper_File::write($oldPath, $writer->get('phrase_text'), array('id' => $writer->get('phrase_id')))) {
throw new XenForo_Exception("Failed to write phrase file to {$oldPath}");
return;
}
if ($newPath && $oldPath) {
rename($oldPath, $newPath);
}
$self->touchDb();
}
示例3: _logChanges
protected function _logChanges(XenForo_DataWriter $dw, array $content, $action, array $additionalChanges = array(), $contentType = 'xengallery_media', $userIdKey = 'user_id')
{
if ($dw->isUpdate() && !empty($content[$userIdKey]) && XenForo_Visitor::getUserId() != $content[$userIdKey]) {
$changes = array_merge($this->_getLogChanges($dw), $additionalChanges);
if ($changes) {
XenForo_Model_Log::logModeratorAction($contentType, $content, $action, $changes);
}
}
}