本文整理汇总了PHP中BBCode::bbcode2html方法的典型用法代码示例。如果您正苦于以下问题:PHP BBCode::bbcode2html方法的具体用法?PHP BBCode::bbcode2html怎么用?PHP BBCode::bbcode2html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBCode
的用法示例。
在下文中一共展示了BBCode::bbcode2html方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveInfo
/**
* This is save info function, use it whatever saving or updating
*
* @param string $lowerItem
* @param array $fields
* @param array $systemFields
* @param string $actionType
* @return array
*/
public function saveInfo($lowerItem, $fields, $systemFields, $actionType, $compatible = false)
{
$item = ucfirst($lowerItem);
$modelName = $item . 'InfoView';
$model = new $modelName();
$basicInfoFields = array_keys($model->attributes);
$basicInfoFields[] = 'action_note';
$basicInfo = array();
$customInfo = array();
$isNeedBBCodeTransfer = true;
if (isset($fields['no_bbcode_transfer']) && !empty($fields['no_bbcode_transfer'])) {
$isNeedBBCodeTransfer = false;
}
foreach ($fields as $key => $field) {
if (in_array($key, $systemFields)) {
continue;
}
if ($compatible) {
if ('AssignedTo' == $key || 'ScriptedBy' == $key) {
$field = $this->getRealNameByName($field);
} else {
if ('MailTo' == $key) {
$field = $this->getRealNamesByMailTo($field);
}
}
$key = $this->fieldOld2New($key, $lowerItem);
}
if ($isNeedBBCodeTransfer && in_array($key, array('action_note', 'repeat_step', 'case_step', 'result_step'))) {
$field = BBCode::bbcode2html($field);
}
if ('no_bbcode_transfer' != $key && !in_array($key, $basicInfoFields)) {
$customInfo[$key] = $field;
continue;
}
$basicInfo[$key] = $field;
}
if (Info::ACTION_OPEN == $actionType && isset($basicInfo['id'])) {
unset($basicInfo['id']);
}
if (Info::ACTION_OPEN_EDIT == $actionType && 'bug' == $lowerItem && isset($basicInfo['id'])) {
$bug = BugInfo::model()->findByPk($basicInfo['id']);
if (!isset($basicInfo['bug_status'])) {
$basicInfo['bug_status'] = $bug->bug_status;
}
if (null !== $bug) {
switch ($basicInfo['bug_status']) {
case BugInfo::STATUS_ACTIVE:
if (BugInfo::STATUS_ACTIVE !== $bug->bug_status) {
$actionType = BugInfo::ACTION_ACTIVATE;
} else {
$actionType = BugInfo::ACTION_OPEN_EDIT;
}
break;
case BugInfo::STATUS_RESOLVED:
if (BugInfo::STATUS_RESOLVED !== $bug->bug_status) {
$actionType = BugInfo::ACTION_RESOLVE;
} else {
$actionType = BugInfo::ACTION_RESOLVE_EDIT;
}
break;
case BugInfo::STATUS_CLOSED:
if (BugInfo::STATUS_CLOSED !== $bug->bug_status) {
$actionType = BugInfo::ACTION_CLOSE;
} else {
$actionType = BugInfo::ACTION_CLOSE_EDIT;
}
break;
default:
break;
}
}
}
$code = API::ERROR_NONE;
$attachmentFile = CUploadedFile::getInstancesByName('attachment_file');
$result = InfoService::saveInfo($lowerItem, $actionType, $basicInfo, $customInfo, $attachmentFile);
$info = $result['detail'];
if (CommonService::$ApiResult['FAIL'] === $result['status']) {
$code = API::ERROR_SAVE_INFO;
}
return array($code, $info);
}