• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP midgardmvc_core类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中midgardmvc_core的典型用法代码示例。如果您正苦于以下问题:PHP midgardmvc_core类的具体用法?PHP midgardmvc_core怎么用?PHP midgardmvc_core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了midgardmvc_core类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: can_view

 public function can_view($user = null)
 {
     if (midgardmvc_core::get_instance()->context->mimetype === 'text/html') {
         return true;
     }
     return false;
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:uimessages.php


示例2: load_object

 /**
  * Loads a program
  */
 public function load_object(array $args)
 {
     $this->object = com_meego_devprogram_devutils::get_device_by_name($args['device_name']);
     if (is_object($this->object)) {
         midgardmvc_core::get_instance()->head->set_title($this->object->name);
     }
 }
开发者ID:nemein,项目名称:com_meego_devprogram,代码行数:10,代码来源:devices.php


示例3: action_messages

 public function action_messages($route_id, &$data, $args)
 {
     if (!midgardmvc_core::get_instance()->uimessages->supports('comet') || !midgardmvc_core::get_instance()->uimessages->can_view()) {
         return;
     }
     $type = null;
     $name = null;
     if (isset(midgardmvc_core::get_instance()->dispatcher->get["cometType"])) {
         $type = midgardmvc_core::get_instance()->dispatcher->get["cometType"];
     }
     if (isset(midgardmvc_core::get_instance()->dispatcher->get["cometName"])) {
         $name = midgardmvc_core::get_instance()->dispatcher->get["cometName"];
     }
     if ($type == null && $name == null) {
         throw new midgardmvc_exception_notfound("No comet name or type defined");
     }
     if (ob_get_level() == 0) {
         ob_start();
     }
     while (true) {
         $messages = '';
         if (midgardmvc_core::get_instance()->uimessages->has_messages()) {
             $messages = midgardmvc_core::get_instance()->uimessages->render_as('comet');
         } else {
             midgardmvc_core::get_instance()->uimessages->add(array('title' => 'Otsikko from comet', 'message' => 'viesti from comet...'));
         }
         midgardmvc_core_helpers_comet::pushdata($messages, $type, $name);
         ob_flush();
         flush();
         sleep(5);
     }
     // $data['messages'] = $messages;
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:33,代码来源:comet.php


示例4: tearDown

 public function tearDown()
 {
     // Delete the context
     $this->_core->context->delete();
     midgardmvc_core::clear_instance();
     parent::tearDown();
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:testcase.php


示例5: get_avatar

 public function get_avatar(array $args)
 {
     $storage = new midgard_query_storage('midgard_user');
     $q = new midgard_query_select($storage);
     $cnstr1 = new midgard_query_constraint(new midgard_query_property('username', $storage), 'LIKE', new midgard_query_value('%' . $args['username'] . '%'));
     $q->execute();
     $cnt = $q->get_results_count();
     if ($cnt > 0) {
         $user = $q->list_objects();
         if ($user[0]) {
             $attachments = $user[0]->list_attachments();
             //Check if attachement exists
             if (count($attachments) == 0) {
                 //fetch avatar from meego.com
                 $employeenumber = $user[0]->get_person()->get_parameter('midgardmvc_core_services_authentication_ldap', 'employeenumber');
                 $attachment = $user[0]->create_attachment('meego:avatar', 'meego:avatar', 'image/png');
                 midgardmvc_helper_attachmentserver::copy_file_to_attachment('http://meego.com/sites/all/files/imagecache/user_pics/user_pics/picture-' . $employeenumber . '.png', $attachment);
                 $attachments[0] = $attachment;
             }
             if (count($attachments) > 0) {
                 //serve attachment
                 $this->serve_attachement($attachments[0]);
                 return;
             }
         }
     }
     //redirect to default avatar
     midgardmvc_core::get_instance()->head->relocate('http://meego.com/sites/all/themes/meego/images/peep_skate.png');
 }
开发者ID:nemein,项目名称:com_meego_website,代码行数:29,代码来源:avatar.php


示例6: PHPTAL_GetTextTranslator

 public function &set_translation_domain($component_name)
 {
     // If no component name is set, then it's from the core
     // translations are going to get searched.
     if (!$component_name) {
         $component_name = 'midgardmvc_core';
     }
     // Checking if TAL translator is already available
     if (isset($this->tr[$component_name])) {
         // useDomain must be called. Otherwise gettext context is not changed
         $this->tr[$component_name]->useDomain($component_name);
         return $this->tr[$component_name];
     }
     try {
         $this->tr[$component_name] = new PHPTAL_GetTextTranslator();
         $this->tr[$component_name]->setLanguage($this->language . '.utf8', $this->language);
     } catch (Exception $e) {
         echo $e;
     }
     // register gettext domain to use
     $path = midgardmvc_core::get_component_path($component_name) . '/locale/';
     $this->tr[$component_name]->addDomain($component_name, $path);
     // specify current domain
     $this->tr[$component_name]->useDomain($component_name);
     return $this->tr[$component_name];
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:26,代码来源:gettext.php


示例7: get_cache_name

 private function get_cache_name()
 {
     if (!isset(midgardmvc_core::get_instance()->context->host)) {
         return 'MidgardMVC';
     }
     return midgardmvc_core::get_instance()->context->host->name;
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:7,代码来源:sqlite3.php


示例8: get_invalidate

 public function get_invalidate(array $args)
 {
     midgardmvc_core::get_instance()->authorization->require_user();
     midgardmvc_core::get_instance()->cache->invalidate_all();
     midgardmvc_core::get_instance()->context->cache_enabled = false;
     midgardmvc_core::get_instance()->head->relocate(midgardmvc_core::get_instance()->dispatcher->generate_url('index', array(), $this->request));
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:cache.php


示例9: post_start_package_instance

 /**
  *
  */
 public function post_start_package_instance(array $args)
 {
     $this->mvc->log(__CLASS__, 'Posted start QA', 'info');
     $this->package = self::load_package_instance($args);
     if (!$this->package->metadata->hidden) {
         $workflow_class = self::load_workflow($args);
         $this->mvc->component->load_library('Workflow');
         $workflow = new $workflow_class();
         $values = $workflow->start($this->package);
         if (isset($values['execution'])) {
             // Workflow suspended and needs input, redirect to workflow page
             $formurl = $this->mvc->dispatcher->generate_url('package_instance_workflow_resume', array('package' => $this->package->name, 'version' => $this->package->version, 'project' => $args['project'], 'repository' => $args['repository'], 'arch' => $args['arch'], 'workflow' => $args['workflow'], 'execution' => $values['execution']), $this->request);
             $this->mvc->head->relocate($formurl);
         }
     }
     // Workflow completed, redirect to package instance
     if ($this->request->isset_data_item('redirect_link')) {
         $redirect_link = $this->request->get_data_item('redirect_link');
     } elseif (isset($_POST['redirect_link'])) {
         $redirect_link = $_POST['redirect_link'];
     } else {
         $redirect_link = midgardmvc_core::get_instance()->dispatcher->generate_url('package_instance', array('package' => $this->package->name, 'version' => $this->package->version, 'project' => $args['project'], 'repository' => $args['repository'], 'arch' => $args['arch']), $this->request);
     }
     $this->mvc->log(__CLASS__, 'Posted start QA finished', 'info');
     // Workflow completed, redirect to package instance
     midgardmvc_core::get_instance()->head->relocate($redirect_link);
 }
开发者ID:nemein,项目名称:com_meego_packages,代码行数:30,代码来源:workflow.php


示例10: __construct

 /**
  * The constructor will initialize the sessioning, set the output nocacheable
  * and initialize the session data. This might involve creating an empty
  * session array.
  */
 public function __construct()
 {
     static $started = false;
     if ($started) {
         throw new Exception("Midgard MVC Sessioning has already been started, it must not be started twice. Aborting");
     }
     $started = true;
     $this->dispatcher = midgardmvc_core::get_instance()->dispatcher;
     try {
         if (!$this->dispatcher->headers_sent()) {
             $this->dispatcher->session_start();
         }
     } catch (Exception $e) {
         midgardmvc_core::get_instance()->log(__CLASS__, "Couldn't start session: " . $e->getMessage(), 'warn');
         $this->enabled = false;
         return;
     }
     /* Cache disabling made conditional based on domain/key existence */
     // Check for session data and load or initialize it, if necessary
     if ($this->dispatcher->session_has_var(self::ROOT)) {
         $this->data = $this->dispatcher->session_get_var(self::ROOT);
     } else {
         $this->data['midgardmvc_core_services_sessioning'] = array();
         $this->data['midgardmvc_core_services_sessioning']['startup'] = array();
         $this->dispatcher->session_set_var(self::ROOT, $this->data);
     }
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:32,代码来源:midgard.php


示例11: start

 private function start()
 {
     if (self::$started) {
         return;
     }
     self::$started = true;
     $this->dispatcher = midgardmvc_core::get_instance()->dispatcher;
     try {
         if (!$this->dispatcher->headers_sent()) {
             $this->dispatcher->session_start();
         }
     } catch (Exception $e) {
         midgardmvc_core::get_instance()->log(__CLASS__, "Couldn't start session: " . $e->getMessage(), 'warning');
         $this->enabled = false;
         return;
     }
     /* Cache disabling made conditional based on domain/key existence */
     // Check for session data and load or initialize it, if necessary
     if ($this->dispatcher->session_has_var(self::ROOT)) {
         $this->data = $this->dispatcher->session_get_var(self::ROOT);
     } else {
         $this->data['midgardmvc_core_services_sessioning'] = array();
         $this->data['midgardmvc_core_services_sessioning']['startup'] = array();
         $this->dispatcher->session_set_var(self::ROOT, $this->data);
     }
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:26,代码来源:midgard.php


示例12: test_singleton

 public function test_singleton()
 {
     $this->_core->newproperty = true;
     $midcom_new = midgardmvc_core::get_instance();
     $this->assertEquals($midcom_new->newproperty, true);
     unset($this->_core->newproperty);
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:7,代码来源:core.php


示例13: get_feed

 public function get_feed(array $args)
 {
     // Read items from Content Repository
     $this->get_items($args);
     // Set up feed
     midgardmvc_core::get_instance()->component->load_library('Feed');
     $feed = new ezcFeed();
     $feed->title = $this->data['title'];
     $feed->description = '';
     $now = new DateTime();
     $feed->published = $now->format(DateTime::RSS);
     $link = $feed->add('link');
     $link->href = midgardmvc_core::get_instance()->dispatcher->generate_url('index', array(), $this->request);
     array_walk($this->data['items'], function ($item) use($feed) {
         $feeditem = $feed->add('item');
         $feeditem->title = $item->title;
         $feeditem->description = $item->content;
         $feeditem->published = $item->published->format(DateTime::RSS);
         $author = $feeditem->add('author');
         $author->name = $item->firstname;
         $link = $feeditem->add('link');
         $link->href = $item->url;
     });
     $this->data['feed'] = $feed;
 }
开发者ID:nemein,项目名称:com_meego_planet,代码行数:25,代码来源:latest.php


示例14: extend_provider

 /**
  * Adds some handy properties to provider object
  *
  * @param object com_meego_devprogram_provider object
  * @return object extended com_meego_devprogram_provider object
  */
 private function extend_provider($object = null)
 {
     // q->toggle_readonly(false) does not work so we need a new object
     $provider = new com_meego_devprogram_provider($object->guid);
     $provider->read_url = com_meego_devprogram_utils::get_url('provider_read', array('provider_name' => $provider->name));
     $provider->update_url = com_meego_devprogram_utils::get_url('provider_update', array('provider_name' => $provider->name));
     $provider->delete_url = com_meego_devprogram_utils::get_url('provider_delete', array('provider_name' => $provider->name));
     $provider->join_url = com_meego_devprogram_utils::get_url('my_membership_create', array('provider_name' => $provider->name));
     // if current user is owner then we can add more goodies
     $user = com_meego_devprogram_utils::get_current_user();
     $provider->number_of_members = false;
     $mvc = midgardmvc_core::get_instance();
     // set the can join flag to true by default
     $provider->can_join = true;
     // set management fflag to false by default
     $provider->can_manage = false;
     // can current user manage the provider
     if (com_meego_devprogram_utils::is_current_user_creator_or_admin($object) || com_meego_devprogram_membutils::is_current_user_member_of_provider($object->id)) {
         $provider->can_manage = true;
         $provider->can_join = false;
         // set the url for the membership list page
         $provider->list_memberships_url = com_meego_devprogram_utils::get_url('provider_members', array('provider_name' => $provider->name));
         // set the approved number of members (all but the cancelled ones) of this provider
         $provider->number_of_members = count(com_meego_devprogram_membutils::get_memberships_by_provider($provider->id));
         // set the number of pending membership requests
         $provider->number_of_members = count(com_meego_devprogram_membutils::get_memberships_by_provider($provider->id));
     }
     // can the provider be deleted; ie. check if provider has devices that belong to open programs
     $provider->can_not_delete = com_meego_devprogram_provutils::has_provider_devices($object->id);
     return $provider;
 }
开发者ID:nemein,项目名称:com_meego_devprogram,代码行数:37,代码来源:provutils.php


示例15: __construct

 public function __construct(array $local_configuration = null)
 {
     if (!is_null($local_configuration)) {
         $this->local_configuration = $local_configuration;
     }
     $this->mvc = midgardmvc_core::get_instance();
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:7,代码来源:chain.php


示例16: handle_exception

 public function handle_exception(Exception $exception)
 {
     if (!(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) && isset($_SERVER['HTTP_AUTHORIZATION'])) {
         $auth_params = explode(":", base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
         $_SERVER['PHP_AUTH_USER'] = $auth_params[0];
         unset($auth_params[0]);
         $_SERVER['PHP_AUTH_PW'] = implode('', $auth_params);
     }
     if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
         $app = midgardmvc_core::get_instance();
         $app->dispatcher->header("WWW-Authenticate: Basic realm=\"MidgardMVC\"");
         $app->dispatcher->header('HTTP/1.0 401 Unauthorized');
         // TODO: more fancy 401 output ?
         echo "<h1>Authorization required</h1>\n";
         // Clean up the context
         $app->context->delete();
         $app->dispatcher->end_request();
     }
     $tokens = array('login' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']);
     if (!$this->login($tokens)) {
         // Wrong password: Recurse until auth ok or user gives up
         unset($_SERVER['HTTP_AUTHORIZATION'], $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
         $this->handle_exception($exception);
     }
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:25,代码来源:basic.php


示例17: clean_store

 public function clean_store()
 {
     $mvc = midgardmvc_core::get_instance();
     if (!$mvc->sessioning->exists('midgardmvc_helper_forms', "stored_{$this->namespace}")) {
         return;
     }
     $mvc->sessioning->remove('midgardmvc_helper_forms', "stored_{$this->namespace}");
 }
开发者ID:TomiS,项目名称:midgardmvc_helper_forms,代码行数:8,代码来源:form.php


示例18: __construct

 public function __construct($name, $required = false, array $actions = array())
 {
     $this->name = $name;
     //Name is always prefixed with group name
     $this->required = $required;
     $this->actions = $actions;
     $this->mvc = midgardmvc_core::get_instance();
 }
开发者ID:TomiS,项目名称:midgardmvc_helper_forms,代码行数:8,代码来源:field.php


示例19: unlock

 public static function unlock(&$object)
 {
     midgardmvc_core::get_instance()->authorization->require_do('midgard:update', $object);
     if (!$object->is_locked()) {
         return;
     }
     $object->unlock();
 }
开发者ID:piotras,项目名称:midgardmvc_core,代码行数:8,代码来源:metadata.php


示例20: test_render_key

 public function test_render_key()
 {
     $message = array('title' => 'Foo', 'message' => 'Bar', 'type' => 'ok');
     $id = midgardmvc_core::get_instance()->uimessages->add($message);
     $content = midgardmvc_core::get_instance()->uimessages->render($id);
     $this->assertTrue(strpos($content, '<div class="midgardmvc_services_uimessages_message_title">Foo</div>') !== false);
     $this->assertEquals(null, midgardmvc_core::get_instance()->uimessages->get($id), 'Ensure the message was removed after rendering');
 }
开发者ID:bergie,项目名称:midgardmvc_core,代码行数:8,代码来源:uimessagesTest.php



注:本文中的midgardmvc_core类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP misc类代码示例发布时间:2022-05-23
下一篇:
PHP midcom_helper_datamanager2_schema类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap