本文整理汇总了PHP中object::add方法的典型用法代码示例。如果您正苦于以下问题:PHP object::add方法的具体用法?PHP object::add怎么用?PHP object::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addContent
/**
* 增加新的文章
*
* @param object $data 文章的信息
* @access public
* @return boolean
*/
public function addContent(ContentSave $data)
{
if (!$this->contentValidate->add($data)) {
$unValidateMsg = $this->contentValidate->getErrorMessage();
return $this->setErrorMsg($unValidateMsg);
}
$articleObj = new \stdClass();
$articleObj->time = time();
$articleObj->userId = SC::getLoginSession()->id;
try {
$articleObj->autoId = $this->saveContent($data, $articleObj);
$this->saveContentDetail($data, $articleObj);
$this->saveArticleTags($articleObj, $data['tags']);
$this->saveArticleClassify($articleObj, $data['classify']);
$this->saveSeachFullText($articleObj, $data);
$this->contentSaveSuccess($articleObj->autoId);
$result = true;
} catch (Exception $e) {
$result = false;
}
if (!$result) {
return $this->setErrorMsg(Lang::get('common.action_error'));
}
return true;
}
示例2: start
public function start(Application $app)
{
$this->app = new AppContainer();
foreach ($this->aliases as $key => $value) {
$this->app->add($value, $key)->withArgument($app);
}
}
示例3: setResponse
/**
* Set response for specific request.
*
* @param object|array $request
* Request object or array.
* @param object|array $response
* Response object or array to set.
*/
protected function setResponse($request, $response)
{
$request = (object) $request;
$response = (object) $response;
$response->criteria = $request;
$this->responseStorage->add($response);
}
示例4: add
/**
* Adds a new item that is to be cached
*
* @param string $key
* @param mixed $data
* @param bool $overwrite
* @return bool
*/
public function add($key, $data, $overwrite = false)
{
if ($overwrite == false) {
return $this->memcached->add($key, $data, $this->ttl());
} else {
return $this->memcached->set($key, $data, $this->ttl());
}
}
示例5: add_debug_log
/**
* Add debug log message
*
* @since 1.0
*
* @param string $message
*/
public static function add_debug_log($message)
{
if (!is_object(self::$log)) {
self::$log = WooCommerce_Grow_Compat::get_wc_logger();
}
if (self::is_debug_enabled()) {
self::$log->add('wc_grow', $message);
}
}
示例6: onmasteradminGetMenuContent
/**
* the menu item
* @param object $event
* @return void
*/
function onmasteradminGetMenuContent($event)
{
$chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/';
if (jAcl2::check('hfnu.admin.index')) {
$event->add(new masterAdminMenuItem('hfnuthemes', jLocale::get('hfnuthemes~theme.themes'), '', 30));
$item = new masterAdminMenuItem('theme', jLocale::get('hfnuthemes~theme.themes'), jUrl::get('hfnuthemes~default:index'), 10, 'hfnuthemes');
$item->icon = $chemin . 'images/theme.png';
$event->add($item);
}
}
示例7: onmasteradminGetMenuContent
/**
* the menu item
* @param object $event
* @return void
*/
function onmasteradminGetMenuContent($event)
{
$chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/';
if (jAcl2::check('hfnu.admin.contact')) {
$event->add(new masterAdminMenuItem('hfnucontact', 'Contact', '', 40));
$item = new masterAdminMenuItem('contact', jLocale::get('hfnucontact~contact.contact'), jUrl::get('hfnucontact~admin:index'), 100, 'hfnucontact');
$item->icon = $chemin . 'images/contact.png';
$event->add($item);
}
}
示例8: onmasteradminGetMenuContent
/**
* the menu item
* @param object $event
* @return void
*/
function onmasteradminGetMenuContent($event)
{
$chemin = jApp::config()->urlengine['basePath'] . 'hfnu/admin/';
$event->add(new masterAdminMenuItem('hfnusearch', jLocale::get('hfnusearch~search.admin.search.engine'), '', 50));
if (jAcl2::check('hfnu.admin.search')) {
$item = new masterAdminMenuItem('hfnusearch', jLocale::get('hfnusearch~search.admin.search.engine'), jUrl::get('hfnusearch~admin:index'), 100, 'hfnusearch');
$item->icon = $chemin . 'images/search_engine.png';
$event->add($item);
}
}
示例9: addData
/**
* Add data in a certain mime type format to the application.
* @param mixed $data data for adding to the application, the datatype depends on the mime type
* @param string $type specifies the mime type version of the passed data
* @param string $version specifies the mime type version of the passed data
* @return integer id of the added data
*/
function addData($data, $type, $version = '')
{
// 1: mapping the mime type to application data
$dataIntern = $this->_importData($data, $type, $version);
if ($dataIntern == false) {
return false;
}
// 2: add data to application
return $this->bo->add($dataIntern);
}
示例10: addPosition
/**
* 增加新的推荐位
*
* @param string $data
* @access public
* @return boolean true|false
*/
public function addPosition(\App\Services\Admin\Position\Param\PositionSave $data)
{
if (!$this->positionValidate->add($data)) {
return $this->setErrorMsg($this->positionValidate->getErrorMessage());
}
$data = $data->toArray();
$data['is_delete'] = PositionModel::IS_DELETE_NO;
if ($this->positionModel->addPosition($data) !== false) {
return true;
}
return $this->setErrorMsg(Lang::get('common.action_error'));
}
示例11: wooc_validate_extra_register_fields
/**
* Validate the extra register fields.
*
* @param string $username Current username.
* @param string $email Current email.
* @param object $validation_errors WP_Error object.
*
* @return void
*/
function wooc_validate_extra_register_fields($username, $email, $validation_errors)
{
if (isset($_POST['billing_first_name']) && empty($_POST['billing_first_name'])) {
$validation_errors->add('billing_first_name_error', __('<strong>Error</strong>: First name is required!', 'woocommerce'));
}
if (isset($_POST['billing_last_name']) && empty($_POST['billing_last_name'])) {
$validation_errors->add('billing_last_name_error', __('<strong>Error</strong>: Last name is required!.', 'woocommerce'));
}
if (isset($_POST['billing_phone']) && empty($_POST['billing_phone'])) {
$validation_errors->add('billing_phone_error', __('<strong>Error</strong>: Phone is required!.', 'woocommerce'));
}
}
示例12: addCategory
/**
* 增加新的分类
*
* @param object $data
* @access public
* @return boolean true|false
*/
public function addCategory(\App\Services\Admin\Category\Param\CategorySave $data)
{
if (!$this->categoryValidate->add($data)) {
return $this->setErrorMsg($this->categoryValidate->getErrorMessage());
}
$data = $data->toArray();
$data['is_delete'] = CategoryModel::IS_DELETE_NO;
$data['time'] = time();
if ($this->categoryModel->addCategory($data) !== false) {
return true;
}
return $this->setErrorMsg(Lang::get('common.action_error'));
}
示例13: addGroup
/**
* 增加新的用户组
*
* @param object $data
* @return boolean true|false
* @access public
*/
public function addGroup(GroupSave $data)
{
if (!$this->groupValidate->add($data)) {
return $this->setErrorMsg($this->groupValidate->getErrorMessage());
}
if (!$this->acl->checkGroupLevelPermission($data->level, Acl::GROUP_LEVEL_TYPE_LEVEL)) {
return $this->setErrorMsg(Lang::get('common.account_level_deny'));
}
if ($this->groupModel->addGroup($data->toArray()) !== false) {
return true;
}
return $this->setErrorMsg(Lang::get('common.action_error'));
}
示例14: selectAddType
/**
* 以查询的方式添加类型
*
* @return int 类型ID
* @author Medz Seven <lovevipdsw@vip.qq.com>
**/
protected function selectAddType($type)
{
/* # 检查是否是合法的类型 */
if (!isset($this->types[$type]) or !$this->types[$type]) {
$this->_error = '保护字段不合法';
return false;
/* # 查询类型ID or 添加 */
} elseif (!($typeID = $this->typeModel->where('`type_name` LIKE \'' . $this->types[$type] . '\'')->field(`type_id`)->getField('type_id')) and !($typeID = $this->typeModel->add(array('type_name' => $this->types[$type])))) {
$this->_error = '无法增加反馈类型';
return false;
}
return $typeID;
}
示例15: buildQuickForm
/**
* Function used to build form element for new contact or select contact widget
*
* @param object $form form object
* @param int $blocNo by default it is one, except for address block where it is
* build for each block
* @param array $extrProfiles extra profiles that should be included besides reserved
*
* @access public
*
* @return void
*/
static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '')
{
// call to build contact autocomplete
$attributes = array('width' => '200px');
$form->add('text', "{$prefix}contact[{$blockNo}]", ts('Select Contact'), $attributes, $required);
$form->addElement('hidden', "{$prefix}contact_select_id[{$blockNo}]");
if (CRM_Core_Permission::check('edit all contacts') || CRM_Core_Permission::check('add contacts')) {
// build select for new contact
$contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles('Contact', $extraProfiles);
$form->add('select', "{$prefix}profiles[{$blockNo}]", ts('Create New Contact'), array('' => ts('- create new contact -')) + $contactProfiles, FALSE, array('onChange' => "if (this.value) { newContact{$prefix}{$blockNo}( this.value, {$blockNo}, '{$prefix}' );}"));
}
$form->assign('blockNo', $blockNo);
$form->assign('prefix', $prefix);
}