本文整理汇总了PHP中Mustache_Autoloader类的典型用法代码示例。如果您正苦于以下问题:PHP Mustache_Autoloader类的具体用法?PHP Mustache_Autoloader怎么用?PHP Mustache_Autoloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mustache_Autoloader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testAutoloader
public function testAutoloader()
{
$loader = new Mustache_Autoloader(dirname(__FILE__) . '/../../fixtures/autoloader');
$this->assertNull($loader->autoload('NonMustacheClass'));
$this->assertFalse(class_exists('NonMustacheClass'));
$loader->autoload('Mustache_Foo');
$this->assertTrue(class_exists('Mustache_Foo'));
$loader->autoload('\\Mustache_Bar');
$this->assertTrue(class_exists('Mustache_Bar'));
}
开发者ID:adeagboola,项目名称:wordpress-to-jekyll-exporter,代码行数:10,代码来源:AutoloaderTest.php
示例2: build_templates
function build_templates()
{
global $LANG;
if (!$this->build_language_file()) {
return false;
}
Model::load_library('mustache.php/src/Mustache/Autoloader');
Mustache_Autoloader::register();
$m = new Mustache_Engine();
$base_template_dir = APP_ROUTE . "/templates/app";
$template = file_get_contents("{$base_template_dir}/all-templates.mustache");
$rendered = $m->render($template, $LANG);
// "Hello, world!"
$template_directory = $base_template_dir . "/{$this->language_code}/build/";
$template_name = 'all-templates.html';
$template_full_path = $template_directory . $template_name;
if (!is_writable($template_directory)) {
AppMessage::set('Template directory is not writable. Please make sure to read the instructions in the Translation section of the documentation before using this functionality');
return false;
}
$this->version_existing_file($template_full_path, $template_directory, $template_name);
$build = fopen($template_full_path, 'w');
if ($build) {
fwrite($build, "<script type=\"text/x-templates\">\n\n");
fwrite($build, '<!-- ' . date('F j, Y, g:i:s a', time()) . " -->\n\n");
fwrite($build, $rendered);
fwrite($build, '</script>');
return true;
} else {
AppMessage::set('Error building template file');
return false;
}
}
开发者ID:neevan1e,项目名称:Done,代码行数:33,代码来源:language.class.php
示例3: __construct
public function __construct(Filesystem $file)
{
require __DIR__ . '/../../vendor/mustache/mustache/src/Mustache/Autoloader.php';
\Mustache_Autoloader::register();
$this->file = $file;
$this->mustache = new Mustache();
}
开发者ID:mosaiqo,项目名称:packet,代码行数:7,代码来源:TemplateHelper.php
示例4: get_instance
/**
* Creates or returns an instance of this class.
*
* @return Vimeography A single instance of this class.
*/
public static function get_instance()
{
if (!isset(self::$instance) and !self::$instance instanceof Vimeography) {
self::$instance = new self();
self::$instance->_define_constants();
self::$instance->_include_files();
Mustache_Autoloader::register();
if (is_admin()) {
new Vimeography_Admin_Scripts();
new Vimeography_Admin_Actions();
new Vimeography_Base();
new Vimeography_Admin_Menu();
new Vimeography_Admin_Welcome();
new Vimeography_Admin_Plugins();
self::$instance->updater = new Vimeography_Update();
}
// Can save these in public vars if need to access
new Vimeography_Database();
new Vimeography_Upgrade();
new Vimeography_Deprecated();
new Vimeography_Init();
new Vimeography_Ajax();
self::$instance->addons = new Vimeography_Addons();
new Vimeography_Robots();
new Vimeography_Shortcode();
}
return self::$instance;
}
开发者ID:raulmontejo,项目名称:vimeography,代码行数:33,代码来源:vimeography.php
示例5: loadMustache
protected final function loadMustache()
{
require_once "../cls/includes/Mustache/Autoloader.php";
Mustache_Autoloader::register();
$this->m = new Mustache_Engine(array("loader" => new Mustache_Loader_FilesystemLoader("../tpl/html/")));
$this->baseTpl = $this->m->loadTemplate("base");
}
开发者ID:svgorbunov,项目名称:ScrollsModRepo,代码行数:7,代码来源:HTMLRequest.php
示例6: require_php_library
/**
* @param string $handle
*/
protected function require_php_library($handle)
{
parent::require_php_library($handle);
if ($handle === self::LIB_MUSTACHE) {
Mustache_Autoloader::register();
}
}
开发者ID:firatkarakusoglu,项目名称:feedback-cat,代码行数:10,代码来源:Loader.php
示例7: showFields
public static function showFields($mb)
{
$adminTemplatesFolderLocation = dirname(__FILE__) . '/admin_views/';
Mustache_Autoloader::register();
$template = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($adminTemplatesFolderLocation), 'partials_loader' => new Mustache_Loader_FilesystemLoader($adminTemplatesFolderLocation)));
$fields = $mb->fields;
foreach ($fields as $field) {
if (empty($field['name']) || empty($field['fieldType']) || empty($field['labelTitle'])) {
continue;
}
$mb->the_field($field['name']);
if ($field['fieldType'] == 'textarea') {
wp_editor(html_entity_decode($mb->get_the_value()), $mb->get_the_name(), array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => true, 'dfw' => false, 'tinymce' => false, 'quicktags' => true));
} else {
switch ($field['fieldType']) {
case 'imageUploader':
$fieldHtml = self::getImageUploaderHtml($mb, $template);
break;
default:
$fieldHtml = $template->render('text_field', array('theValue' => $mb->get_the_value(), 'theName' => $mb->get_the_name()));
}
echo $template->render('field_container', array('labelText' => $field['labelTitle'], 'fieldHTML' => $fieldHtml));
}
}
}
开发者ID:zakirsajib,项目名称:Chester-WordPress-MVC-Theme-Framework,代码行数:25,代码来源:wp_alchemy_helpers.php
示例8: __construct
public function __construct()
{
$patternPrimerViewsLocation = dirname(__FILE__) . '/templates/';
$templatesFolderLocation = ChesterBaseController::getTemplatesFolderLocation();
Mustache_Autoloader::register();
$this->patternPrimerTemplateLoader = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($patternPrimerViewsLocation), 'partials_loader' => new Mustache_Loader_FilesystemLoader($patternPrimerViewsLocation)));
$this->coreTemplateLoader = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($templatesFolderLocation), 'partials_loader' => new Mustache_Loader_FilesystemLoader($templatesFolderLocation)));
}
开发者ID:zakirsajib,项目名称:Chester-WordPress-MVC-Theme-Framework,代码行数:8,代码来源:pattern_primer_controller.php
示例9: render
/**
* Renders a template using Mustache.php.
*
* @see View::render()
* @param string $template The template name specified in Slim::render()
* @return string
*/
public function render($template)
{
require_once self::$mustacheDirectory . '/Autoloader.php';
\Mustache_Autoloader::register(dirname(self::$mustacheDirectory));
$m = new \Mustache_Engine();
$contents = file_get_contents($this->getTemplatesDirectory() . '/' . ltrim($template, '/'));
return $m->render($contents, $this->data);
}
开发者ID:Alexander173,项目名称:angular-noCaptcha-reCaptcha,代码行数:15,代码来源:Mustache.php
示例10: __construct
public function __construct(View $View, $settings = array())
{
parent::__construct($View, $settings);
if (class_exists('Mustache_Autoloader', false) === false) {
App::import('Vendor', 'Mustache_Autoloader', array('file' => 'mustache' . DS . 'mustache' . DS . 'src' . DS . 'Mustache' . DS . 'Autoloader.php'));
Mustache_Autoloader::register();
$this->Engine = new Mustache_Engine();
}
}
开发者ID:ExpandOnline,项目名称:CakeMustache,代码行数:9,代码来源:MustacheHelper.php
示例11: auth_plugin_mcae
/**
* Constructor.
*/
function auth_plugin_mcae()
{
global $CFG;
require_once $CFG->dirroot . '/lib/mustache/src/Mustache/Autoloader.php';
$this->authtype = 'mcae';
$this->config = get_config(self::COMPONENT_NAME);
Mustache_Autoloader::register();
$this->mustache = new Mustache_Engine();
}
开发者ID:gagathos,项目名称:mcae,代码行数:12,代码来源:auth.php
示例12: init
public static function init()
{
if (!class_exists('Mustache_Autoloader')) {
require dirname(__FILE__) . '/Mustache/Autoloader.php';
}
Mustache_Autoloader::register();
self::$dir = dirname(__FILE__) . '/Admin/templates';
$m_opts = array('extension' => 'html');
self::$engine = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader(self::$dir, $m_opts), 'partials_loader' => new Mustache_Loader_FilesystemLoader(self::$dir, $m_opts), 'helpers' => array('format_date' => array(__CLASS__, 'helper_format_date'), 'edit_link' => array(__CLASS__, 'helper_edit_link'), 'permalink' => array(__CLASS__, 'helper_permalink'))));
}
开发者ID:gregoryfu,项目名称:wp-draft-revisions,代码行数:10,代码来源:Mustachio.php
示例13: getMustacheInstance
public static function getMustacheInstance()
{
if (TemplateEngine::$mustacheInstance == NULL) {
// $requireFolder = str_replace("app", "libs/Mustache/Autoloader.php", Utils::getUtilsFolder());
require_once 'libs/Mustache/Autoloader.php';
Mustache_Autoloader::register();
TemplateEngine::$mustacheInstance = new Mustache_Engine();
}
return TemplateEngine::$mustacheInstance;
}
开发者ID:alex2stf,项目名称:phpquick,代码行数:10,代码来源:TemplateEngine.php
示例14: render
static function render($view, $data)
{
global $aplication;
global $debugbar;
$app = $aplication->getApp();
$path = $app->getViews();
Mustache_Autoloader::register();
$options = array('extension' => '.mustache');
$template = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($path, $options)));
echo $template->render($view, $data);
}
开发者ID:elephantphp,项目名称:ElephantFreamwork,代码行数:11,代码来源:View.php
示例15: __construct
protected function __construct()
{
require_once PATH_LOCAL . '/vendor/mustache/mustache/src/Mustache/Autoloader.php';
\Mustache_Autoloader::register();
//mustache para o trabalhar com os templates do app_default
$this->mustache = new \Mustache_Engine($this->getEngineData(PATH_DEFAULT . '/view'));
//mustache para trabalhar com os templates do app
$this->mustacheapp = new \Mustache_Engine($this->getEngineData(PATH_APP . '/' . $this->templatename));
//mustache generico ?
$this->mm = new \Mustache_Engine();
}
开发者ID:diego3,项目名称:myframework-core,代码行数:11,代码来源:Template.php
示例16: __construct
public function __construct()
{
parent::__construct('pw_' . $this->widget_id_base(), sprintf('ProteusThemes: %s', $this->widget_name()), array('description' => $this->widget_description(), 'classname' => $this->widget_class()));
// Include PHP mustache with composer
// require_once( get_template_directory() . '/vendor/mustache/mustache/src/Mustache/Autoloader.php' );
Mustache_Autoloader::register();
/*
* Set the mustache engine
* Learn more: https://github.com/bobthecow/mustache.php/wiki/Template-Loading
*/
$this->mustache = new Mustache_Engine(array('loader' => new Mustache_Loader_CascadingLoader(array(new Mustache_Loader_FilesystemLoader(apply_filters('pw/widget_views_path', PW_PATH . '/widgets/views')), new Mustache_Loader_FilesystemLoader(PW_PATH . '/widgets/views'), new Mustache_Loader_StringLoader()))));
}
开发者ID:apeachdev,项目名称:bioconSite,代码行数:12,代码来源:class-pw-widget.php
示例17: __construct
/**
* Initialize Mustache and set defaults
*/
public function __construct()
{
parent::__construct();
$this->template_extension = 'mustache';
require_once 'lib/Mustache/Autoloader.php';
Mustache_Autoloader::register();
// Init template engine.
$options = array('loader' => new Mustache_Loader_FilesystemLoader($this->template_path));
if (is_dir($this->template_path . 'partials/')) {
$options['partials_loader'] = new Mustache_Loader_FilesystemLoader($this->template_path . 'partials/');
}
$this->engine = new Mustache_Engine($options);
}
开发者ID:moorscode,项目名称:stencil-sample-theme-mustache,代码行数:16,代码来源:stencil-engine.php
示例18: _loadMustache
protected function _loadMustache()
{
if (!class_exists('Mustache_Autoloader')) {
$path = 'unit-tests/engines/mustache.php/src/Mustache/Autoloader.php';
if (file_exists($path)) {
require $path;
Mustache_Autoloader::register();
} else {
$this->markTestSkipped('Mustache engine could not be found');
return false;
}
}
return true;
}
开发者ID:racklin,项目名称:cphalcon,代码行数:14,代码来源:ViewEnginesTest.php
示例19: init
public static function init()
{
require_once PATH . '/app/Vendor/Mustache/Autoloader.php';
Mustache_Autoloader::register();
$themePath = PATH . '/themes/' . Base::$g['theme'] . '/html';
self::$mst = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($themePath), 'partials_loader' => new Mustache_Loader_FilesystemLoader($themePath . '/partials'), 'entity_flags' => ENT_QUOTES, 'strict_callables' => true));
self::$tpl['url'] = URL;
self::$tpl['link'] = URL . '/themes/' . Base::$g['theme'];
self::$tpl['notification'] = Base::getNotification();
// Check notifications
self::$tpl['toes'] = Page::filter('all');
// Get footer pages
self::$tpl['admin'] = ADMIN;
}
开发者ID:nytr0gen,项目名称:plur-music-explorer,代码行数:14,代码来源:View.php
示例20: construct
public function construct($plugin_override = '')
{
$configuration = $this->configuration;
$view_dir = $this->tplBaseDir($plugin_override);
$domain = $this->core->activePlugin();
if (!is_object($this->template->view)) {
require BASEPATH . 'plugins/Mustache/resources/src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
$loader = new Mustache_Loader_FilesystemLoader($view_dir . '/views', array('extension' => $this->extension));
$this->view = new Mustache_Engine(array('template_class_prefix' => '__view_', 'cache' => BASEPATH . $configuration['compile_path'], 'loader' => $loader, 'helpers' => array('i' => function ($text) {
global $domain;
return dgettext($domain, $text);
}), 'escape' => function ($value) {
return htmlspecialchars($value, ENT_COMPAT);
}, 'charset' => $configuration['charset']));
} else {
$this->view = $this->template->view;
}
}
开发者ID:TitanKing,项目名称:PHPDevShell,代码行数:19,代码来源:views.class.php
注:本文中的Mustache_Autoloader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论