本文整理汇总了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];
}
示例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();
}
示例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'));
}
示例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();
}
示例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)
示例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 {
示例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
*/
示例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");
}
}
示例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);
}
示例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());
}
示例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);
}