本文整理汇总了PHP中is_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP is_enabled函数的具体用法?PHP is_enabled怎么用?PHP is_enabled使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_enabled函数的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: save_with_relations
public function save_with_relations($member_id, $values)
{
if (!empty($this->member_id) && $this->member_id != $member_id) {
throw new \InvalidArgumentException('Parameter member_id is invalid.');
}
$is_new = $this->_is_new;
$this->member_id = $member_id;
if (isset($values['title'])) {
$this->title = $values['title'];
}
if (isset($values['body'])) {
$this->body = $values['body'];
}
if (isset($values['public_flag'])) {
$this->public_flag = $values['public_flag'];
}
$is_changed_public_flag = $this->is_changed('public_flag');
$is_changed = $this->is_changed();
if ($is_changed) {
$this->save();
}
if (is_enabled('timeline')) {
if (!$is_new && $is_changed_public_flag) {
// timeline の public_flag の更新
\Timeline\Model_Timeline::update_public_flag4foreign_table_and_foreign_id($this->public_flag, 'thread', $this->id, \Config::get('timeline.types.thread'));
} else {
// timeline 投稿
\Timeline\Site_Model::save_timeline($member_id, $this->public_flag, 'thread', $this->id, $this->updated_at);
}
}
return $is_changed;
}
示例3: delete_timeline4id
public static function delete_timeline4id($timeline_id)
{
$delete_target_notice_cache_member_ids = array();
$writable_connection = \MyOrm\Model::connection(true);
\DBUtil::set_connection($writable_connection);
\DB::start_transaction();
if (is_enabled('notice')) {
\Notice\Site_NoOrmModel::delete_member_watch_content_multiple4foreign_data('timeline', $timeline_id);
$notice_ids = \Notice\Site_NoOrmModel::get_notice_ids4foreign_data('timeline', $timeline_id);
$delete_target_notice_cache_member_ids = \Notice\Site_NoOrmModel::get_notice_status_member_ids4notice_ids($notice_ids);
\Notice\Site_NoOrmModel::delete_notice_multiple4ids($notice_ids);
}
if (!\DB::delete('timeline')->where('id', $timeline_id)->execute()) {
throw new \FuelException('Failed to delete timeline. id:' . $timeline_id);
}
\DB::commit_transaction();
\DBUtil::set_connection(null);
// delete caches
if ($delete_target_notice_cache_member_ids) {
foreach ($delete_target_notice_cache_member_ids as $member_id) {
\Notice\Site_Util::delete_unread_count_cache($member_id);
}
}
Site_Util::delete_cache($timeline_id);
}
示例4: before_delete
public function before_delete(\Orm\Model $obj)
{
// カバー写真の確認 & 削除
if (!($album = \Album\Model_Album::find($obj->album_id))) {
throw new \FuelException('Invalid album id.');
}
if ($album->cover_album_image_id == $obj->id) {
$album->cover_album_image_id = null;
$album->save();
}
// プロフィール写真の確認 & 削除
if ($album->foreign_table == 'member') {
if ($album->member->file_name == $obj->file_name) {
$album->member->file_name = null;
$album->member->save();
}
// timeline 投稿の削除
if (is_enabled('timeline')) {
\Timeline\Model_Timeline::delete4foreign_table_and_foreign_ids('album_image', $obj->id);
}
}
if (is_enabled('timeline')) {
// timeline_child_data の削除
\Timeline\Model_TimelineChildData::delete4foreign_table_and_foreign_ids('album_image', $obj->id);
// timeline view cache の削除
if (is_enabled('note') && \Config::get('timeline.articles.cache.is_use') && $obj->album->foreign_table == 'note') {
\Timeline\Site_Model::delete_note_view_cache4album_image_id($obj->id);
}
}
// file 削除
if ($file = \Model_File::get4name($obj->file_name)) {
$file->delete();
}
}
示例5: action_index
/**
* Site index
*
* @access public
* @return Response
*/
public function action_index()
{
$data = array();
if (Config::get('page.site.index.timeline.isEnabled') && is_enabled('timeline')) {
$data['timelines'] = \Timeline\Site_Util::get_list4view(\Auth::check() ? $this->u->id : 0, 0, false, null, $this->common_get_list_params(array('desc' => 1, 'latest' => 1, 'limit' => Config::get('page.site.index.timeline.list.limit')), Config::get('page.site.index.timeline.list.limit_max'), true));
$data['timelines']['see_more_link'] = array('uri' => 'timeline');
//$this->template->post_footer = \View::forge('timeline::_parts/load_timelines');
}
if (Config::get('page.site.index.news.isEnabled') && is_enabled('news')) {
list($limit, $page) = $this->common_get_pager_list_params(\Config::get('page.site.index.news.list.limit'), \Config::get('page.site.index.news.list.limit_max'));
$data['news_list'] = \News\Site_Model::get_list($limit, $page, \Auth::check());
$data['news_list']['see_more_link'] = array('uri' => 'news');
}
if (Config::get('page.site.index.albumImage.isEnabled') && is_enabled('album')) {
list($limit, $page) = $this->common_get_pager_list_params(\Config::get('page.site.index.albumImage.list.limit'), \Config::get('page.site.index.albumImage.list.limit_max'));
$data['album_images'] = \Album\Model_AlbumImage::get_pager_list(array('related' => array('album'), 'where' => \Site_Model::get_where_params4list(0, \Auth::check() ? $this->u->id : 0), 'order_by' => array('id' => 'desc'), 'limit' => $limit), $page);
$data['album_images']['liked_album_image_ids'] = conf('like.isEnabled') && \Auth::check() ? \Site_Model::get_liked_ids('album_image', $this->u->id, $data['album_images']['list']) : array();
$data['album_images']['column_count'] = \Config::get('page.site.index.albumImage.list.column_count');
//$this->template->post_footer = \View::forge('image/_parts/list_footer');
}
$this->template->post_footer = \View::forge('site/_parts/index_footer');
if (conf('site.index.slide.isEnabled', 'page')) {
if (conf('site.index.slide.recentAlbumImage.isEnabled', 'page')) {
$images = \Album\Site_Util::get_top_slide_image_uris();
} else {
$images = Config::get('page.site.index.slide.images');
}
$this->template->post_header_content = View::forge('site/_parts/slide', array('image_uris' => $images));
}
$this->set_title_and_breadcrumbs('', null, null, null, null, true, true);
$this->template->content = View::forge('site/index', $data);
if (!empty($data['news_list']['list'])) {
$this->template->content->set_safe('html_bodys', \News\Site_Model::convert_raw_bodys($data['news_list']['list']));
}
}
示例6: _init
public static function _init()
{
if (is_enabled('notice')) {
static::$_observers['MyOrm\\Observer_InsertNotice'] = array('events' => array('after_insert'), 'update_properties' => array('foreign_table' => array('thread_comment' => 'value'), 'foreign_id' => array('thread_comment_id' => 'property'), 'type_key' => array('like' => 'value'), 'member_id_from' => array('member_id' => 'property'), 'member_id_to' => array('related' => array('thread_comment' => 'member_id'))));
$type = \Notice\Site_Util::get_notice_type('like');
static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('thread_comment' => 'value'), 'foreign_id' => array('thread_comment_id' => 'property'), 'type' => array($type => 'value')));
}
}
示例7: test_like_notice
/**
* @dataProvider like_notice_provider
*/
public function test_like_notice($member_id_to, $mc_notice_like, $member_id_from, $is_test_after_read, $is_cahce_deleted_exp, $countup_num, $countup_num_all)
{
if (!is_enabled('notice')) {
\Util_Develop::output_test_info(__FILE__, __LINE__);
$this->markTestSkipped('notice module is disabled.');
}
// 事前準備
\Model_MemberConfig::set_value($member_id_to, \Notice\Form_MemberConfig::get_name('like'), $mc_notice_like);
$is_new = false;
if (!self::$commented_member_id_before || $member_id_to != self::$commented_member_id_before) {
self::$timeline = Site_Test::setup_timeline(self::$member_id);
self::$timeline_comment = \Site_Test::save_comment('timeline', self::$timeline->id, $member_id_to);
$is_new = true;
}
self::$commented_member_id_before = $member_id_to;
if ($is_test_after_read) {
$read_count = \Notice\Site_Util::change_status2read($member_id_to, self::$foreign_table, self::$timeline_comment->id, self::$type_key);
}
$notice_count_all_before = \Notice\Model_Notice::get_count();
// set cache
$notice_count_before = \Notice\Site_Util::get_unread_count($member_id_to);
if (self::$is_check_notice_cache) {
$this->assertFalse(\Notice\Site_Test::check_no_cache4notice_unread($member_id_to));
}
// cache が生成されていることを確認
// like save
$is_liked = (bool) Model_TimelineCommentLike::change_registered_status4unique_key(array('timeline_comment_id' => self::$timeline_comment->id, 'member_id' => $member_id_from));
if (self::$is_check_notice_cache) {
if ($is_cahce_deleted_exp) {
$this->assertTrue(\Notice\Site_Test::check_no_cache4notice_unread($member_id_to));
} else {
$this->assertFalse(\Notice\Site_Test::check_no_cache4notice_unread($member_id_to));
}
}
// notice count 取得
$notice_count = \Notice\Site_Util::get_unread_count($member_id_to);
if (self::$is_check_notice_cache) {
$this->assertFalse(\Notice\Site_Test::check_no_cache4notice_unread($member_id_to));
}
// cache が生成されていることを確認
// execute test
$this->assertEquals($notice_count_before + $countup_num, $notice_count);
// count up を確認
// Model_Notice
// 件数
$notice_count_all = \Notice\Model_Notice::get_count();
$this->assertEquals($notice_count_all_before + $countup_num_all, $notice_count_all);
// record
if ($notice = \Notice\Model_Notice::get_last4foreign_data(self::$foreign_table, self::$timeline_comment->id, \Notice\Site_Util::get_notice_type(self::$type_key))) {
$notice_status = \Notice\Model_NoticeStatus::get4member_id_and_notice_id($member_id_to, $notice->id);
$notice_member_from = \Notice\Model_NoticeMemberFrom::get_last();
if ($mc_notice_like !== 0 && $member_id_to != $member_id_from) {
$this->assertEquals($member_id_from, $notice_member_from->member_id);
}
$this->assertEquals($notice_member_from->created_at, $notice_status->sort_datetime);
}
}
示例8: _init
public static function _init()
{
if (\Module::loaded('timeline')) {
static::$_observers['MyOrm\\Observer_InsertMemberFollowTimeline'] = array('events' => array('after_insert'), 'timeline_relations' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('album_image_id' => 'property')), 'property_from_member_id' => 'member_id');
}
if (is_enabled('notice')) {
static::$_observers['MyOrm\\Observer_InsertNotice'] = array('events' => array('after_insert'), 'update_properties' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('album_image_id' => 'property'), 'type_key' => array('like' => 'value'), 'member_id_from' => array('member_id' => 'property'), 'member_id_to' => array('related' => array('album_image' => array('album' => 'member_id')))));
$type = \Notice\Site_Util::get_notice_type('like');
static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('album_image_id' => 'property'), 'type' => array($type => 'value')));
}
}
示例9: after_insert
public function after_insert(\Notice\Model_MemberWatchContent $obj)
{
if (is_enabled('timeline')) {
if (!($timelines = \Notice\Site_Model::get_timelines4foreign_table_and_id($obj->foreign_table, $obj->foreign_id))) {
return false;
}
foreach ($timelines as $timeline) {
$member_follow_timeline = \Timeline\Model_MemberFollowTimeline::check_and_create($timeline->id, $obj->member_id);
}
}
}
示例10: before_delete
public function before_delete(\Orm\Model $obj)
{
// Delete album_image file.
$album_images = \Album\Model_AlbumImage::get4album_id($obj->id);
foreach ($album_images as $album_image) {
$album_image->delete();
}
// delete timeline
if (is_enabled('timeline')) {
\Timeline\Model_Timeline::delete4foreign_table_and_foreign_ids('album', $obj->id);
}
}
示例11: get_enabled_modules_str
function get_enabled_modules_str($target_modules, $delimitter = '|')
{
foreach ($target_modules as $key => $module) {
if (!is_enabled($module)) {
unset($target_modules[$key]);
}
}
if (!$target_modules) {
return '';
}
return implode($delimitter, $target_modules);
}
示例12: delete_with_timeline
public static function delete_with_timeline($name)
{
if (!($obj = self::get4name($name))) {
return false;
}
if (is_enabled('timeline')) {
\Timeline\Model_Timeline::delete4foreign_table_and_foreign_ids('file', $obj->id);
}
$deleted_filesize = $obj->filesize;
$obj->delete();
return $deleted_filesize;
}
示例13: before_delete
public function before_delete(\Notice\Model_MemberWatchContent $obj)
{
if (is_enabled('timeline')) {
if (!($timelines = \Notice\Site_Model::get_timelines4foreign_table_and_id($obj->foreign_table, $obj->foreign_id))) {
return false;
}
foreach ($timelines as $timeline) {
$member_follow_timeline = \Timeline\Model_MemberFollowTimeline::get4timeline_id_and_member_id($timeline->id, $obj->member_id);
$member_follow_timeline->delete();
}
}
}
示例14: action_index
/**
* Mmeber_Profile_Image index
*
* @access public
* @return Response
*/
public function action_index($member_id = null)
{
list($is_mypage, $member, $access_from) = $this->check_auth_and_is_mypage($member_id);
$member_profiles = Model_MemberProfile::get4member_id($member->id, true);
$title = term('profile', 'site.picture', $is_mypage ? 'site.setting' : '');
$this->set_title_and_breadcrumbs($title, array('/member/' . $member_id => sprintf('%sさんの%s', $member->name, term('site.page.kana'))), $member);
$images = array();
if (is_enabled('album') && conf('upload.types.img.types.m.save_as_album_image')) {
$album_id = \Album\Model_Album::get_id_for_foreign_table($member->id, 'member');
$images = \Album\Model_AlbumImage::query()->related('album')->where('album_id', $album_id)->order_by('id', 'desc')->get();
$this->template->post_footer = \View::forge('_parts/load_masonry');
}
$this->template->content = View::forge('member/profile/image/index', array('is_mypage' => $is_mypage, 'member' => $member, 'access_from' => $access_from, 'images' => $images, 'member_profiles' => $member_profiles));
}
示例15: action_home
/**
* Mmeber home
*
* @access public
* @return Response
*/
public function action_home($id = null)
{
$id = (int) $id;
list($is_mypage, $member, $access_from) = $this->check_auth_and_is_mypage($id);
$member_profiles = Model_MemberProfile::get4member_id($member->id, true);
$data = array('member' => $member, 'member_profiles' => $member_profiles, 'is_mypage' => $is_mypage, 'access_from' => $access_from, 'display_type' => 'summary');
if (is_enabled('timeline')) {
$data['timeline'] = \Timeline\Site_Util::get_list4view(\Auth::check() ? $this->u->id : 0, $member->id, false, null, $this->common_get_list_params(array('desc' => 1, 'latest' => 1, 'limit' => conf('articles.limit', 'timeline')), conf('articles.limit_max', 'timeline'), true));
$data['timeline']['member'] = $member;
$this->template->post_footer = \View::forge('timeline::_parts/load_timelines');
}
$this->set_title_and_breadcrumbs($member->name . ' さんのページ', array('member/list' => term('member.view', 'site.list')), null, null, array(), false, false, array('title' => $member->name . ' さんのページ', 'image' => Site_Util::get_image_uri4file_name($member->get_image(), 'P_L', 'profile')));
$this->template->content = \View::forge('member/home', $data);
}