當前位置: 首頁>>代碼示例>>PHP>>正文


PHP midgardmvc_core::get_component_path方法代碼示例

本文整理匯總了PHP中midgardmvc_core::get_component_path方法的典型用法代碼示例。如果您正苦於以下問題:PHP midgardmvc_core::get_component_path方法的具體用法?PHP midgardmvc_core::get_component_path怎麽用?PHP midgardmvc_core::get_component_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在midgardmvc_core的用法示例。


在下文中一共展示了midgardmvc_core::get_component_path方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: setUp

 public function setUp()
 {
     $path = midgardmvc_core::get_component_path('midgardmvc_core') . '/configuration/defaults.yml';
     $yaml = file_get_contents($path);
     $this->testConfiguration = midgardmvc_core::read_yaml($yaml);
     parent::setUp();
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:7,代碼來源:configurationTest.php

示例3: __construct

 public function __construct($name, array $manifest)
 {
     $this->path = midgardmvc_core::get_component_path($name);
     $this->name = $name;
     $this->manifest = $manifest;
     if ($manifest['extends']) {
         $this->parent = midgardmvc_core::get_instance()->component->get($manifest['extends']);
     }
     array_walk($manifest['observations'], array($this, 'register_observation'));
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:10,代碼來源:midgardmvc.php

示例4: test_get_element_include

 public function test_get_element_include()
 {
     $request = midgardmvc_core_request::get_for_intent('/subdir');
     $routes = midgardmvc_core::get_instance()->component->get_routes($request);
     $request->set_route($routes['index']);
     midgardmvc_core::get_instance()->context->create($request);
     $original_element = file_get_contents(midgardmvc_core::get_component_path('midgardmvc_core') . '/templates/ROOT.xhtml');
     $element = midgardmvc_core::get_instance()->templating->get_element($this->_core->context->get_request(), 'ROOT');
     $this->assertNotEquals($original_element, $element, 'Template returned by templating service should not be the same as the template file because of includes');
     $this->assertTrue(strpos($element, '<h1 property="mgd:title" tal:content="current_component/object/title">Title</h1>') !== false);
     midgardmvc_core::get_instance()->context->delete();
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:12,代碼來源:templatingTest.php

示例5: __construct

<?php

/**
 * @package midgardmvc_core
 * @author The Midgard Project, http://www.midgard-project.org
 * @copyright The Midgard Project, http://www.midgard-project.org
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 */
require_once midgardmvc_core::get_component_path('midgardmvc_core') . '/services/cache.php';
/**
 * Midgard cache backend.
 *
 * This cache backend stores cached data to host's parameter
 * Primary use for the backend is for testing and developing purposes
 *
 * @package midgardmvc_core
 */
class midgardmvc_core_services_cache_midgard extends midgardmvc_core_services_cache_base implements midgardmvc_core_services_cache
{
    private $cache_object = null;
    public function __construct()
    {
        parent::__construct();
        $this->cache_object = midgardmvc_core::get_instance()->hierarchy->get_root_node()->get_object();
    }
    public function put($module, $identifier, $data)
    {
        return;
        $this->cache_object->set_parameter("midgardmvc_core_services_cache_midgard:{$module}", $identifier, serialize($data));
    }
    public function get($module, $identifier)
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:31,代碼來源:midgard.php

示例6: __construct

<?php

/**
 * @package midgardmvc_core
 * @author The Midgard Project, http://www.midgard-project.org
 * @copyright The Midgard Project, http://www.midgard-project.org
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 */
include midgardmvc_core::get_component_path('midgardmvc_core') . '/services/cache.php';
/**
 * memcached cache backend.
 * 
 * Backend requires Memcache PECL package for PHP, and memcached to be running.
 *
 * @package midgardmvc_core
 */
class midgardmvc_core_services_cache_memcached extends midgardmvc_core_services_cache_base implements midgardmvc_core_services_cache
{
    private $memcache;
    private $name;
    private $memcache_operational = false;
    public function __construct()
    {
        if (!extension_loaded('memcache')) {
            throw new Exception('memcached cache configured but "Memcache" PHP extension not installed.');
        }
        $this->memcache = new Memcache();
        $this->memcache_operational = @$this->memcache->pconnect('localhost', 11211);
        if (!isset(midgardmvc_core::get_instance()->context->host)) {
            $this->name = 'MidgardMVC';
        } else {
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:31,代碼來源:memcached.php

示例7: array

<?php

/**
 * @package midgardmvc_core
 * @author The Midgard Project, http://www.midgard-project.org
 * @copyright The Midgard Project, http://www.midgard-project.org
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 */
include midgardmvc_core::get_component_path('midgardmvc_core') . '/services/uimessages.php';
/**
 * Basic UI Message class
 *
 * @package midgardmvc_core
 */
class midgardmvc_core_services_uimessages_midgard extends midgardmvc_core_services_uimessages_baseclass implements midgardmvc_core_services_uimessages
{
    private $configuration = array();
    private $jsconfiguration = '{}';
    /**
     * The current message stack
     *
     * @var Array
     * @access private
     */
    private $message_stack = array();
    /**
     * List of messages retrieved from session to avoid storing them again
     *
     * @var Array
     * @access private
     */
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:31,代碼來源:midgard.php

示例8: load_all_manifests

 private function load_all_manifests()
 {
     // Load manifests enabled in site configuration and cache them
     $components = midgardmvc_core::get_instance()->configuration->components;
     foreach ($components as $component => $setup_info) {
         $component_path = midgardmvc_core::get_component_path($component);
         if (!file_exists("{$component_path}/manifest.yml")) {
             throw new Exception("Component {$component} specified in application configuration is not installed");
         }
         $this->manifests[$component] = $this->load_manifest_file($component, "{$component_path}/manifest.yml");
     }
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:12,代碼來源:midgardmvc.php

示例9: write_yaml

 public static function write_yaml($yaml)
 {
     if (empty($yaml)) {
         return '';
     }
     static $use_yaml = null;
     static $yaml_function = null;
     if (is_null($use_yaml)) {
         // Check for YAML extension
         if (extension_loaded('yaml')) {
             $yaml_function = 'yaml_emit';
             $use_yaml = true;
         } elseif (extension_loaded('syck')) {
             $yaml_function = 'syck_dump';
             $use_yaml = true;
         }
         if (!$use_yaml) {
             // YAML PHP extension is not loaded, include the pure-PHP implementation
             if (!class_exists('sfYaml')) {
                 require midgardmvc_core::get_component_path('midgardmvc_core') . '/helpers/sfYaml/sfYaml.php';
             }
         }
     }
     if (!$use_yaml) {
         return sfYaml::dump($yaml);
     }
     return $yaml_function($yaml);
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:28,代碼來源:interface.php

示例10: test_get_description

 public function test_get_description()
 {
     $component = midgardmvc_core::get_instance()->component->get('midgardmvc_core');
     $original = file_get_contents(midgardmvc_core::get_component_path('midgardmvc_core') . '/README.md');
     $this->assertEquals($original, $component->get_description());
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:6,代碼來源:componentTest.php

示例11: load_module

 /**
  * Helper for module initialization. Usually called via getters
  *
  * @param string $module Name of module to load
  */
 private function load_module($module)
 {
     if (isset($this->modules[$module])) {
         return;
     }
     $module_file = midgardmvc_core::get_component_path('midgardmvc_core') . "/services/cache/module/{$module}.php";
     if (!file_exists($module_file)) {
         throw new Exception("Cache module {$module} not installed");
     }
     $module_class = "midgardmvc_core_services_cache_module_{$module}";
     $module_config = array();
     if (isset($this->configuration["module_{$module}"])) {
         $module_config = $this->configuration["module_{$module}"];
     }
     $this->modules[$module] = new $module_class($module_config);
 }
開發者ID:bergie,項目名稱:midgardmvc_core,代碼行數:21,代碼來源:cache.php


注:本文中的midgardmvc_core::get_component_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。