本文整理汇总了PHP中term函数的典型用法代码示例。如果您正苦于以下问题:PHP term函数的具体用法?PHP term怎么用?PHP term使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了term函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init
public static function _init()
{
static::$_properties['name']['label'] = term('member.name');
static::$_properties['name']['validation']['min_length'][] = conf('member.name.validation.length.min');
static::$_properties['name']['validation']['max_length'][] = conf('member.name.validation.length.max');
if (is_enabled('notice') && conf('mention.isEnabled', 'notice')) {
static::$_properties['name']['validation']['match_pattern'][] = sprintf('/^(%s)$/u', conf('member.name.validation.match_patterns.register'));
$method = conf('member.name.validation.blacklist.method');
if (is_callable($method)) {
static::$_properties['name']['validation']['not_in_array'][] = call_user_func($method);
}
}
static::$_properties['register_type']['validation']['in_array'][] = Site_Member::get_accept_member_register_types();
$sex_options = Site_Form::get_form_options4config('term.member.sex.options');
static::$_properties['sex']['label'] = term('member.sex.label');
static::$_properties['sex']['form']['options'] = $sex_options;
static::$_properties['sex']['validation']['in_array'][] = array_keys($sex_options);
$options_public_flag = Site_Util::get_public_flags();
static::$_properties['sex_public_flag']['label'] = sprintf('%sの%s', term('member.sex.label'), term('public_flag.label'));
static::$_properties['sex_public_flag']['form'] = Site_Form::get_public_flag_configs();
static::$_properties['sex_public_flag']['validation']['in_array'][] = $options_public_flag;
static::$_properties['birthyear']['label'] = term('member.birthyear');
$options = Form_Util::get_year_options(conf('member.profile.birthday.year_from'), conf('member.profile.birthday.year_to'));
static::$_properties['birthyear']['form']['options'] = $options;
static::$_properties['birthyear']['validation']['in_array'][] = array_keys($options);
static::$_properties['birthyear_public_flag']['label'] = sprintf('%sの%s', term('member.birthyear'), term('public_flag.label'));
static::$_properties['birthyear_public_flag']['form'] = Site_Form::get_public_flag_configs();
static::$_properties['birthyear_public_flag']['validation']['in_array'][] = $options_public_flag;
static::$_properties['birthday']['label'] = term('member.birthday');
static::$_properties['birthday_public_flag']['label'] = sprintf('%sの%s', term('member.birthday'), term('public_flag.label'));
static::$_properties['birthday_public_flag']['form'] = Site_Form::get_public_flag_configs();
static::$_properties['birthday_public_flag']['validation']['in_array'][] = $options_public_flag;
static::$_properties['invite_member_id'] = Util_Orm::get_relational_numeric_key_prop(false);
}
示例2: action_viewtype
/**
* Mmeber setting timeline_view
*
* @access public
* @return Response
*/
public function action_viewtype()
{
$page_name = term('timeline', 'site.view', 'site.setting');
$val = \Form_MemberConfig::get_validation($this->u->id, 'timeline_viewType');
if (Input::method() == 'POST') {
Util_security::check_csrf();
try {
if (!$val->run()) {
throw new \FuelException($val->show_errors());
}
$post = $val->validated();
\DB::start_transaction();
\Form_MemberConfig::save($this->u->id, $val, $post);
\DB::commit_transaction();
\Session::set_flash('message', $page_name . 'を変更しました。');
\Response::redirect('member/setting');
} catch (\FuelException $e) {
if (\DB::in_transaction()) {
\DB::rollback_transaction();
}
\Session::set_flash('error', $e->getMessage());
}
}
$this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
$this->template->content = \View::forge('member/setting/timeline_viewtype', array('val' => $val));
}
示例3: action_list
/**
* Notice list
*
* @access public
* @return Response
*/
public function action_list()
{
$data = array();
$this->set_title_and_breadcrumbs(term('notice'), null, $this->u);
$this->template->subtitle = \View::forge('_parts/link_read_all', array('tag_attr' => array('class' => 'pull-right')));
$this->template->content = \View::forge('_parts/list_block', $data);
}
示例4: action_edit
/**
* Mmeber_profile edit
*
* @access public
* @return Response
*/
public function action_edit($type = null)
{
list($type, $is_regist) = self::validate_type($type, $this->u->id);
$form_member_profile = new Form_MemberProfile($type == 'regist' ? 'regist-config' : 'config', $this->u);
$form_member_profile->set_validation();
if (\Input::method() == 'POST') {
\Util_security::check_csrf();
try {
$form_member_profile->validate(true);
\DB::start_transaction();
$form_member_profile->seve();
if ($is_regist) {
Model_MemberConfig::delete_value($this->u->id, 'terms_un_agreement');
}
\DB::commit_transaction();
$message = $is_regist ? sprintf('%sが%sしました。', term('site.registration'), term('form.complete')) : term('profile') . 'を編集しました。';
$redirect_uri = $is_regist ? $this->after_auth_uri : 'member/profile';
\Session::set_flash('message', $message);
\Response::redirect($redirect_uri);
} catch (\FuelException $e) {
if (\DB::in_transaction()) {
\DB::rollback_transaction();
}
\Session::set_flash('error', $e->getMessage());
}
}
$this->set_title_and_breadcrumbs(term('profile') . term($is_regist ? 'site.registration' : 'form.edit'), $is_regist ? array() : array('member/profile' => term('common.my', 'profile')), $is_regist ? null : $this->u);
$this->template->content = View::forge('member/profile/edit', array('is_regist' => $is_regist, 'val' => $form_member_profile->get_validation(), 'member_public_flags' => $form_member_profile->get_member_public_flags(), 'profiles' => $form_member_profile->get_profiles(), 'member_profile_public_flags' => $form_member_profile->get_member_profile_public_flags()));
}
示例5: _init
public static function _init()
{
//static::$_properties['member_id'] = Util_Orm::get_relational_numeric_key_prop();
static::$_properties['member_id'] = array('form' => array('type' => false));
static::$_properties['email']['label'] = term('site.email');
static::$_properties['password']['label'] = term('site.password');
}
示例6: action_index
/**
* Mmeber setting viewtype
*
* @access public
* @return Response
*/
public function action_index()
{
$page_name = term('notice', 'site.setting');
$val = \Form_MemberConfig::get_validation($this->u->id, 'notice', 'Notice');
if (\Input::method() == 'POST') {
\Util_security::check_csrf();
try {
if (!$val->run()) {
throw new \FuelException($val->show_errors());
}
$post = $val->validated();
\DB::start_transaction();
\Form_MemberConfig::save($this->u->id, $val, $post);
\DB::commit_transaction();
\Session::set_flash('message', $page_name . 'を変更しました。');
\Response::redirect('member/setting');
} catch (\FuelException $e) {
if (\DB::in_transaction()) {
\DB::rollback_transaction();
}
\Session::set_flash('error', $e->getMessage());
}
}
$this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
$this->template->content = \View::forge('member/setting/_parts/form', array('val' => $val, 'label_size' => 5, 'form_params' => array('common' => array('radio' => array('layout_type' => 'grid')))));
}
示例7: post_update
/**
* post_update
*
* @access public
* @return Response (json)
*/
public function post_update($member_id_to = null, $relation_type = null)
{
$this->controller_common_api(function () use($member_id_to, $relation_type) {
$this->response_body['errors']['message_default'] = sprintf('%sの%sに%sしました。', term('follow'), term('form.update'), term('site.failure'));
if (!self::check_relation_type($relation_type)) {
throw new HttpNotFoundException();
}
if (!is_null(Input::post('id'))) {
$member_id_to = (int) Input::post('id');
}
$member = Model_Member::check_authority($member_id_to);
if ($member_id_to == $this->u->id) {
throw new HttpInvalidInputException();
}
$member_relation = Model_MemberRelation::get4member_id_from_to($this->u->id, $member_id_to);
if (!$member_relation) {
$member_relation = Model_MemberRelation::forge();
}
$prop = 'is_' . $relation_type;
$status_before = (bool) $member_relation->{$prop};
$status_after = !$status_before;
\DB::start_transaction();
$member_relation->{$prop} = $status_after;
$member_relation->member_id_to = $member_id_to;
$member_relation->member_id_from = $this->u->id;
$member_relation->save();
\DB::commit_transaction();
$this->response_body['isFollow'] = (int) $status_after;
$this->response_body['html'] = $status_after ? sprintf('<span class="glyphicon glyphicon-ok"></span> %s', term('followed')) : term('do_follow');
$this->response_body['attr'] = $status_after ? array('class' => array('add' => 'btn-primary')) : array('class' => array('remove' => 'btn-primary'));
$this->response_body['message'] = sprintf('%s%s', term('follow'), $status_after ? 'しました。' : 'を解除しました。');
return $this->response_body;
});
}
示例8: post_update_watch_status
/**
* Update watch status
*
* @access public
* @param string $foreign_table target related table
* @param int $foreign_id target related table id
* @return Response (json)
* @throws Exception in Controller_Base::controller_common_api
* @see Controller_Base::controller_common_api
*/
public function post_update_watch_status($foreign_table = null, $foreign_id = null)
{
$this->controller_common_api(function () use($foreign_table, $foreign_id) {
if (!is_enabled('notice')) {
throw new \HttpNotFoundException();
}
if (\Input::post('foreign_table')) {
$foreign_table = \Input::post('foreign_table');
}
$foreign_id = intval(\Input::post('foreign_id') ?: $foreign_id);
if (!$foreign_table || !$foreign_id) {
throw new \HttpNotFoundException();
}
if (!in_array($foreign_table, Site_Util::get_accept_foreign_tables())) {
throw new \HttpNotFoundException();
}
$this->response_body['errors']['message_default'] = term('form.watch') . '状態の変更に失敗しました。';
$model = \Site_Model::get_model_name($foreign_table);
$foreign_obj = $model::check_authority($foreign_id);
$member_id = $foreign_table == 'album_image' ? $foreign_obj->album->member_id : $foreign_obj->member_id;
$this->check_browse_authority($foreign_obj->public_flag, $member_id);
if ($member_id == $this->u->id) {
throw new \HttpBadRequestException();
}
\DB::start_transaction();
$is_registerd = (bool) Model_MemberWatchContent::change_registered_status4unique_key(array('foreign_table' => $foreign_table, 'foreign_id' => $foreign_id, 'member_id' => $this->u->id));
\DB::commit_transaction();
$data = array('result' => $is_registerd, 'message' => $is_registerd ? term('form.watch') . '対象に追加しました。' : term('form.watch') . 'を解除しました。', 'html' => icon_label($is_registerd ? 'form.do_unwatch' : 'form.do_watch', 'both', false));
$this->set_response_body_api($data);
});
}
示例9: icon_label
function icon_label($icon_term, $type = 'both', $is_hidden_xs = true, $absolute_icon_key = null, $class_prefix = 'glyphicon glyphicon-', $tag = 'i', $delimitter = ' ')
{
if (empty($type)) {
$type = 'both';
}
if (!in_array($type, array('both', 'icon', 'label'))) {
throw new \InvalidArgumentException('Second parameter is invalid.');
}
$term = term($icon_term);
$label = $is_hidden_xs ? sprintf('<span class="hidden-xs-inline">%s%s</span>', $delimitter, $term) : $delimitter . $term;
if ($type == 'label') {
return $label;
}
if ($absolute_icon_key) {
$icon_key = $absolute_icon_key;
} else {
$icon_key = Config::get('icon.' . $icon_term);
}
$icon = '';
if ($icon_key) {
if (is_array($icon_key)) {
$key = isset($icon_key['key']) ? $icon_key['key'] : '';
if (isset($icon_key['prefix'])) {
$class_prefix = $icon_key['prefix'];
}
$icon = icon($key, $class_prefix, $tag);
} else {
$icon = icon($icon_key, $class_prefix, $tag);
}
}
if ($type == 'icon') {
return $icon;
}
return $icon . $label;
}
示例10: get_options_watch
public static function get_options_watch($value = null, $is_simple = false)
{
$options = array('1' => $is_simple ? term('symbol.bool.true') : term('form.do_watch'), '0' => $is_simple ? term('symbol.bool.false') : term('form.watch') . 'しない');
if (!is_null($value) && isset($options[$value])) {
return $options[$value];
}
return $options;
}
示例11: action_delete
/**
* Note delete
*
* @access public
* @params integer
* @return Response
*/
public function action_delete($id = null)
{
\Util_security::check_csrf(\Input::get(\Config::get('security.csrf_token_key')));
$comment = Model_NoteComment::check_authority($id, $this->u->id);
$comment->delete();
\Session::set_flash('message', term('note') . 'を削除しました。');
\Response::redirect('note/detail/' . $comment->note_id);
}
示例12: get_validation_object
private static function get_validation_object()
{
$val = Validation::forge('invite');
$email = Form_Util::get_model_field('member_auth', 'email');
$email['attributes']['placeholder'] = sprintf('%sの%s', term('form.do_invite', 'common.friend'), term('site.email'));
$val->add('email', $email['label'], $email['attributes'], $email['rules']);
$val->add('message', term('common.message'), array('rows' => 3, 'placeholder' => sprintf('%sへの%s', term('common.friend'), term('form.invite', 'common.message', 'form._not_required'))), array('trim'));
return $val;
}
示例13: get_gruop_name
public static function get_gruop_name($target_group_key, $is_simple = false)
{
$key_prefix = 'admin.user.groups.type';
if ($is_simple) {
$key_prefix .= '_simple';
}
$key_prefix .= '.';
return term($key_prefix . $target_group_key);
}
示例14: _init
public static function _init()
{
static::$_properties['member_id'] = Util_Orm::get_relational_numeric_key_prop();
static::$_properties['email'] = Model_MemberAuth::property('email');
static::$_properties['token'] = Model_MemberPre::property('token');
static::$_properties['token']['form']['type'] = false;
static::$_properties['code']['label'] = term('form.confirm', 'site.code');
static::$_properties['code']['form']['validation']['exact_length'] = array(conf('member.setting.email.codeLength'));
}
示例15: action_list
/**
* Mmeber list
*
* @access public
* @return Response
*/
public function action_list()
{
$this->set_title_and_breadcrumbs(term('member.view', 'site.list'));
$default_params = array('latest' => 1, 'desc' => 1, 'limit' => conf('member.view_params.list.limit'));
list($limit, $is_latest, $is_desc, $since_id, $max_id) = $this->common_get_list_params($default_params, conf('member.view_params.list.limit_max'));
list($list, $next_id) = Model_Member::get_list(null, $limit, $is_latest, $is_desc, $since_id, $max_id);
$this->template->main_container_attrs = array('data-not_render_site_summary' => 1);
$this->template->content = \View::forge('_parts/member_list', array('list' => $list, 'next_id' => $next_id, 'since_id' => $since_id, 'get_uri' => 'member/api/list.json', 'history_key' => 'max_id', 'is_display_load_before_link' => $max_id ? true : false));
$this->template->post_footer = \View::forge('_parts/load_item');
}