本文整理汇总了PHP中Module::loaded方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::loaded方法的具体用法?PHP Module::loaded怎么用?PHP Module::loaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::loaded方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
/**
* Método que despacha la página solicitada
* @author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl)
* @version 2014-03-21
*/
public static function dispatch()
{
$request = new Network_Request();
$response = new Network_Response();
// Verificar si el recurso solicitado es un archivo físico dentro del
// directorio webroot
if (self::_asset($request->request, $response)) {
// retorna el método Dispatcher::dispatch, con lo cual termina el
// procesado de la página
return;
}
// Parsear parámetros del request
$request->params = Routing_Router::parse($request->request);
// Si se solicita un módulo tratar de cargar y verificar que quede activo
if (!empty($request->params['module'])) {
Module::load($request->params['module']);
if (!Module::loaded($request->params['module'])) {
throw new Exception_Module_Missing(array('module' => $request->params['module']));
}
}
// Obtener controlador
$controller = self::_getController($request, $response);
// Verificar que lo obtenido sea una instancia de la clase Controller
if (!$controller instanceof Controller) {
throw new Exception_Controller_Missing(array('class' => 'Controller_' . Utility_Inflector::camelize($request->params['controller'])));
}
// Invocar a la acción del controlador
return self::_invoke($controller, $request, $response);
}
示例2: _init
public static function _init()
{
if (\Module::loaded('timeline')) {
// album_image 追加時に note の sort_datetime を更新
static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_insert'), 'relations' => array('model_to' => '\\Note\\Model_Note', 'conditions' => array('id' => array('note_id' => 'property')), 'update_properties' => array('sort_datetime' => array('created_at' => 'property'))));
}
}
示例3: is_enabled
function is_enabled($module_name)
{
if (!Module::loaded($module_name)) {
return false;
}
if (!conf($module_name . '.isEnabled')) {
return false;
}
return true;
}
示例4: _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('note' => 'value'), 'foreign_id' => array('note_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('note' => 'value'), 'foreign_id' => array('note_id' => 'property'), 'type_key' => array('like' => 'value'), 'member_id_from' => array('member_id' => 'property'), 'member_id_to' => array('related' => array('note' => '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('note' => 'value'), 'foreign_id' => array('note_id' => 'property'), 'type' => array($type => 'value')));
}
}
示例5: merge_module_configs
public static function merge_module_configs($config, $config_name)
{
$modules = Module::loaded();
foreach ($modules as $module => $path) {
Config::load($module . '::' . $config_name, $module . '_' . $config_name);
if (!($module_config = Config::get($module . '_' . $config_name))) {
continue;
}
$config = Arr::merge_assoc($config, $module_config);
}
return $config;
}
示例6: update_public_flag_with_relations
public function update_public_flag_with_relations($public_flag, $is_update_album_images = false)
{
// album_image の public_flag の更新
if ($is_update_album_images) {
Model_AlbumImage::update_public_flag4album_id($this->id, $public_flag);
}
// timeline の public_flag の更新
if (\Module::loaded('timeline')) {
\Timeline\Model_Timeline::update_public_flag4foreign_table_and_foreign_id($public_flag, 'album', $this->id, \Config::get('timeline.types.album'));
}
$this->public_flag = $public_flag;
$this->save();
}
示例7: force_save_album
public static function force_save_album($member_id, $values, Model_Album $album = null)
{
// album save
if (!$album) {
$album = Model_Album::forge();
}
$album->name = $values['name'];
$album->body = $values['body'];
$album->public_flag = $values['public_flag'];
$album->member_id = $member_id;
$album->save();
if (\Module::loaded('timeline')) {
\Timeline\Site_Model::save_timeline($member_id, $values['public_flag'], 'album', $album->id, $album->updated_at);
}
return $album;
}
示例8: action_index
public function action_index()
{
//$testModel = Model_Sales_Disposition::test();
/*
if (\Reports\Query::forge(\Reports\Query::LOAD, 3)->isComplete())
{
print_r('complete');
}
*/
// Load the required data module
if (!\Module::loaded('data') && \Module::exists('data')) {
\Module::load('data');
} else {
throw new \Exception("Data Module not found!");
}
$impData = \Data\Import::forge(\Data\Import::COPY, 1);
$this->template->title = 'Example Page';
$this->template->content = "hello";
}
示例9: run
/**
* Usage (from command line):
*
* php oil r setupmodule
*
* @return string
*/
public static function run($target_module = null)
{
$is_execued = false;
try {
$modules = $target_module ? (array) $target_module : \Module::loaded();
if (!$modules) {
return;
}
foreach ($modules as $module => $module_dir_path) {
if ($messages = self::setup_assets($module, $module_dir_path)) {
foreach ($messages as $message) {
echo $message . PHP_EOL;
}
$is_execued = true;
}
}
} catch (\FuelException $e) {
return \Util_Task::output_message(sprintf('Setup modules error: %s', $e->getMessage()), false);
}
return $is_execued ? \Util_Task::output_result_message(true, 'setup modules') : '';
}
示例10: get_active_modules
public static function get_active_modules()
{
$active_modules = array();
$modules = Module::loaded();
foreach ($modules as $module => $module_path) {
if (!conf($module . '.isEnabled')) {
continue;
}
$active_modules[$module] = $module_path;
}
return $active_modules;
}
示例11: exexute_install_db
private static function exexute_install_db($database = null)
{
$setup_sql_file = sprintf('%sdata/sql/setup/setup%s.sql', FBD_BASEPATH, self::$charset == 'utf8mb4' ? '_utf8mb4' : '');
if (!\DBUtil::shell_exec_sql4file($setup_sql_file, $database)) {
return false;
}
if (!($modules = \Module::loaded())) {
return true;
}
foreach ($modules as $module => $path) {
$setup_sql_file = $path . 'data/sql/setup/setup.sql';
if (!file_exists($setup_sql_file)) {
continue;
}
if (!\DBUtil::shell_exec_sql4file($setup_sql_file, $database)) {
return false;
}
}
return true;
}
示例12: convert_body
<div class="article_body">
<?php
echo convert_body($note->body, array('is_truncate' => false));
?>
</div>
<?php
if (Module::loaded('album')) {
echo render('album::image/_parts/list', array('list' => $images, 'is_simple_view' => true));
}
?>
<?php
if ($note->is_published) {
?>
<div class="comment_info">
<?php
// comment_count_and_link
echo render('_parts/comment/count_and_link_display', array('id' => $note->id, 'count' => $all_comment_count, 'link_hide_absolute' => true));
?>
<?php
// like_count_and_link
if (conf('like.isEnabled') && Auth::check()) {
$data_like_link = array('id' => $note->id, 'post_uri' => \Site_Util::get_api_uri_update_like('note', $note->id), 'get_member_uri' => \Site_Util::get_api_uri_get_liked_members('note', $note->id), 'count_attr' => array('class' => 'unset_like_count'), 'count' => $note->like_count, 'is_liked' => $is_liked_self);
echo render('_parts/like/count_and_link_execute', $data_like_link);
}
?>
<?php
// Facebook feed
示例13: render
<?php
echo render('_parts/member_contents_box', array('member' => $note->member, 'model' => 'note', 'id' => $id, 'size' => 'M', 'public_flag' => $note->public_flag, 'date' => array('datetime' => $note->published_at ? $note->published_at : $note->updated_at)));
$dropdown_btn_group_attr = array('id' => 'btn_dropdown_' . $id, 'class' => array('dropdown', 'boxBtn'));
$dropdown_btn_attr = array('class' => 'js-dropdown_content_menu', 'data-uri' => sprintf('note/api/menu/%d.html', $id), 'data-member_id' => $note->member_id, 'data-menu' => '#menu_' . $note->id, 'data-loaded' => 0);
$menus = array(array('icon_term' => 'site.show_detail', 'href' => 'note/' . $id));
echo btn_dropdown('noterm.dropdown', $menus, false, 'xs', null, true, $dropdown_btn_group_attr, $dropdown_btn_attr, false);
?>
</div><!-- list_subtitle -->
</div><!-- header -->
<div class="body">
<?php
echo convert_body($note->body, array('truncate_line' => conf('view_params_default.list.truncate_lines.body'), 'read_more_uri' => 'note/' . $id));
?>
</div>
<?php
if (Module::loaded('album') && ($images = \Note\Model_NoteAlbumImage::get_album_image4note_id($id, 4, array('id' => 'desc')))) {
echo render('_parts/thumbnails', array('images' => array('list' => $images, 'additional_table' => 'note', 'size' => 'N_M', 'column_count' => 4), 'is_modal_link' => conf('site.common.thumbnailModalLink.isEnabled', 'page')));
}
?>
<?php
if ($note->is_published) {
// note_comment
list($comments, $comment_next_id, $all_comment_count) = \Note\Model_NoteComment::get_list(array('note_id' => $id), conf('view_params_default.list.comment.limit'), true, false, 0, 0, null, false, true);
?>
<div class="comment_info">
<?php
// comment_count_and_link
$link_comment_attr = array('id' => 'link_show_comment_form_' . $id, 'class' => 'js-display_parts link_show_comment_' . $id, 'data-target_id' => 'commentPostBox_' . $id, 'data-hide_selector' => '.link_show_comment_' . $id, 'data-focus_selector' => '#textarea_comment_' . $id);
echo render('_parts/comment/count_and_link_display', array('id' => $id, 'count' => $all_comment_count, 'link_attr' => $link_comment_attr));
示例14: save_with_relations
public static function save_with_relations($album_id, \Model_Member $member = null, $public_flag = null, $file_path = null, $timeline_type_key = 'album_image', $optional_values = array())
{
if (!\Util_Array::array_in_array(array_keys($optional_values), array('name', 'shot_at', 'shot_at_time', 'public_flag'))) {
throw new \InvalidArgumentException('Parameter optional_values is invalid.');
}
if (is_null($public_flag)) {
$public_flag = isset($optional_values['public_flag']) ? $optional_values['public_flag'] : conf('public_flag.default');
}
$album = null;
if (empty($member)) {
$album = Model_Album::find($album_id, array('related' => 'member'));
$member = $album->member;
}
$options = \Site_Upload::get_uploader_options($member->id, 'ai', $album_id);
$uploadhandler = new \Site_Uploader($options);
$file = $uploadhandler->save($file_path);
if (!empty($file->error)) {
throw new \FuelException($file->error);
}
$self = new self();
$self->album_id = $album_id;
$self->file_name = $file->name;
$self->public_flag = $public_flag;
$self->shot_at = self::get_shot_at_for_insert($file->shot_at, isset($optional_values['shot_at_time']) ? $optional_values['shot_at_time'] : null, isset($optional_values['shot_at']) ? $optional_values['shot_at'] : null);
$self->save();
// カバー写真の更新
if ($timeline_type_key == 'album_image_profile') {
if (!$album) {
$album = Model_Album::find($album_id);
}
$album->cover_album_image_id = $self->id;
$album->save();
}
// timeline 投稿
if (\Module::loaded('timeline')) {
switch ($timeline_type_key) {
case 'album_image_profile':
$timeline_foreign_id = $self->id;
$timeline_child_foreign_ids = array();
break;
case 'album':
case 'album_image':
default:
$timeline_foreign_id = $self->album->id;
$timeline_child_foreign_ids = array($self->id);
break;
}
\Timeline\Site_Model::save_timeline($member->id, $public_flag, $timeline_type_key, $timeline_foreign_id, $self->updated_at, null, null, $timeline_child_foreign_ids);
}
return array($self, $file);
}
示例15:
<a href="<?php
echo Uri::Create('user');
?>
">Dashboard</a>
</li>
<li <?php
echo Uri::Current() == Uri::Create('user/urls') ? 'class="active"' : '';
?>
>
<a href="<?php
echo Uri::Create('user/urls');
?>
">My URLs</a>
</li>
<?php
if (Module::loaded('image') === true) {
?>
<li <?php
echo Uri::Current() == Uri::Create('user/images') ? 'class="active"' : '';
?>
>
<a href="<?php
echo Uri::Create('user/images');
?>
">My Images</a>
</li>
<?php
}
?>
<?php
if (Auth::member(5)) {