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


PHP Mustache_Autoloader類代碼示例

本文整理匯總了PHP中Mustache_Autoloader的典型用法代碼示例。如果您正苦於以下問題:PHP Mustache_Autoloader類的具體用法?PHP Mustache_Autoloader怎麽用?PHP Mustache_Autoloader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Mustache_Autoloader類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


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