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'));
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 public function __construct(Filesystem $file)
 {
     require __DIR__ . '/../../vendor/mustache/mustache/src/Mustache/Autoloader.php';
     \Mustache_Autoloader::register();
     $this->file = $file;
     $this->mustache = new Mustache();
 }
예제 #4
0
 /**
  * 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;
 }
예제 #5
0
 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");
 }
예제 #6
0
 /**
  * @param string $handle
  */
 protected function require_php_library($handle)
 {
     parent::require_php_library($handle);
     if ($handle === self::LIB_MUSTACHE) {
         Mustache_Autoloader::register();
     }
 }
 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));
         }
     }
 }
 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)));
 }
 /**
  * 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);
 }
예제 #10
0
 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();
     }
 }
예제 #11
0
파일: auth.php 프로젝트: gagathos/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();
 }
예제 #12
0
 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'))));
 }
예제 #13
0
 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;
 }
예제 #14
0
 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);
 }
예제 #15
0
 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();
 }
예제 #16
0
 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()))));
 }
 /**
  * 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);
 }
예제 #18
0
 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;
 }
예제 #19
0
 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;
 }
예제 #20
0
 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;
     }
 }
예제 #21
0
 /**
  * Return an instance of the mustache class.
  *
  * @since 2.9
  * @return Mustache_Engine
  */
 protected function get_mustache()
 {
     global $CFG;
     if ($this->mustache === null) {
         require_once $CFG->dirroot . '/lib/mustache/src/Mustache/Autoloader.php';
         Mustache_Autoloader::register();
         $themename = $this->page->theme->name;
         $themerev = theme_get_revision();
         $cachedir = make_localcache_directory("mustache/{$themerev}/{$themename}");
         $loader = new \core\output\mustache_filesystem_loader();
         $stringhelper = new \core\output\mustache_string_helper();
         $jshelper = new \core\output\mustache_javascript_helper($this->page->requires);
         $pixhelper = new \core\output\mustache_pix_helper($this);
         // We only expose the variables that are exposed to JS templates.
         $safeconfig = $this->page->requires->get_config_for_javascript($this->page, $this);
         $helpers = array('config' => $safeconfig, 'str' => array($stringhelper, 'str'), 'js' => array($jshelper, 'help'), 'pix' => array($pixhelper, 'pix'));
         $this->mustache = new Mustache_Engine(array('cache' => $cachedir, 'escape' => 's', 'loader' => $loader, 'helpers' => $helpers, 'pragmas' => [Mustache_Engine::PRAGMA_BLOCKS]));
     }
     return $this->mustache;
 }
예제 #22
0
 /**
  * Internal class initialization method
  * 
  * @param  string $views_path       Full base path to the views
  * @param  string $partials_path    Optional full base path to the partials
  * @param  array  $mustache_options Optional named array of options to pass to Mustache.
  * @return null
  */
 public function init(&$controller = null)
 {
     if ($controller !== null) {
         $this->controller =& $controller;
     }
     $config = $this->stf->getConfig();
     $this->cache_path = $config['app']['cache'];
     $this->views_path = $config['app']['views'];
     $this->templates_path = $config['mustache']['templates'];
     $this->partials_path = $config['mustache']['partials'];
     $this->mustache_options = $config['mustache']['options'];
     $this->site_conf = $config['site'];
     // echo '<pre>'.__METHOD__.' $this->site_conf: '.print_r($this->site_conf, true)."</pre>\n";
     // echo '<pre>'.__METHOD__.' $this->cache_path: '.print_r($this->cache_path, true)."</pre>\n";
     // echo '<pre>'.__METHOD__.' $this->views_path: '.print_r($this->views_path, true)."</pre>\n";
     // echo '<pre>'.__METHOD__.' $this->templates_path: '.print_r($this->templates_path, true)."</pre>\n";
     // echo '<pre>'.__METHOD__.' $this->partials_path: '.print_r($this->partials_path, true)."</pre>\n";
     // echo '<pre>'.__METHOD__.' $this->mustache_options: '.print_r($this->mustache_options, true)."</pre>\n";
     \Mustache_Autoloader::register($config['php']['vendor']);
     $this->log->debug('$this->cache_path:', $this->cache_path);
     $this->log->debug('$this->views_path:', $this->views_path);
     $this->log->debug('$this->templates_path:', $this->templates_path);
     $this->log->debug('$this->partials_path:', $this->partials_path);
     $this->log->debug('$this->mustache_options:', $this->mustache_options);
     if (empty($this->mustache_options)) {
         // $this->mustache_options = array(
         // 	'loader' => new Mustache_Loader_FilesystemLoader($this->views_path),
         // 	'partials_loader' => new Mustache_Loader_MutableFilesystemLoader($this->partials_path),
         // 	'partials' => !empty($mustache_options['template_partials']) ? $mustache_options['template_partials'] : array()
         // );
         $this->mustache_options = array();
         $this->mustache_options['cache'] = $this->cache_path;
         // $this->mustache_options['loader'] = new \Mustache_Loader_FilesystemLoader($this->templates_path);
         $this->mustache_options['logger'] = new \Mustache_Logger_StreamLogger('php://stderr');
         if (!empty($partials)) {
             $this->mustache_options['partials'] = $partials;
         }
         $this->mustache_options['partials_loader'] = new \Mustache_Loader_FilesystemLoader($this->partials_path);
     }
     $this->log->debug('$this->mustache_options:', $this->mustache_options);
 }
예제 #23
0
파일: MY_Parser.php 프로젝트: siburny/stats
 function __construct()
 {
     $this->ci =& get_instance();
     if (!class_exists('Mustache_Autoloader', FALSE)) {
         require_once APPPATH . 'third_party/Mustache/Autoloader.php';
         Mustache_Autoloader::register();
     }
     define('MUSTACHE_CACHE', APPPATH . 'cache/mustache/');
     file_exists(MUSTACHE_CACHE) or @mkdir(MUSTACHE_CACHE, 0755, TRUE);
     // Default configuration options.
     $this->config = array('extension' => '.php', 'cache' => MUSTACHE_CACHE, 'cache_file_mode' => FILE_WRITE_MODE, 'escape' => null, 'charset' => null, 'entity_flags' => ENT_COMPAT, 'full_path' => FALSE);
     if ($this->ci->config->load('parser_mustache', TRUE, TRUE)) {
         $this->config = array_merge($this->config, $this->ci->config->item('parser_mustache'));
     }
     // Injecting configuration options directly.
     if (isset($this->_parent) && !empty($this->_parent->params) && is_array($this->_parent->params)) {
         $this->config = array_merge($this->config, $this->_parent->params);
         if (array_key_exists('parser_driver', $this->config)) {
             unset($this->config['parser_driver']);
         }
     }
     log_message('info', 'MY_Parser Class Initialized');
 }
예제 #24
0
 public function __construct()
 {
     Mustache_Autoloader::register();
     $this->_mustachio = new Mustache_Engine();
 }
예제 #25
0
<?php

/*
 * This file is part of Mustache.php.
 *
 * (c) 2012 Justin Hileman
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require dirname(__FILE__) . '/../src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php';
예제 #26
0
 /**
  * Creates new Mustache_Engine if it doesn't already exist, and returns it.
  *
  * @return \Mustache_Engine
  */
 public function getInstance()
 {
     if (!$this->parserInstance) {
         /**
          * Check if Mustache_Autoloader class exists
          * otherwise include and register it.
          */
         if (!class_exists('\\Mustache_Autoloader')) {
             require_once $this->parserDirectory . '/Autoloader.php';
             \Mustache_Autoloader::register();
         }
         $parserOptions = array('loader' => new \Mustache_Loader_FilesystemLoader($this->getTemplatesDirectory()));
         // Check if the partials directory exists, otherwise Mustache will throw a exception
         if (is_dir($this->getTemplatesDirectory() . '/partials')) {
             $parserOptions['partials_loader'] = new \Mustache_Loader_FilesystemLoader($this->getTemplatesDirectory() . '/partials');
         }
         $parserOptions = array_merge((array) $parserOptions, (array) $this->parserOptions);
         $this->parserInstance = new \Mustache_Engine($parserOptions);
     }
     return $this->parserInstance;
 }
 private function create_meta_pkg_properties($files)
 {
     $metaFiles = array();
     foreach ($files as $key => $value) {
         $metaFiles[] = array("path" => $key, "date" => date("Y-m-d\\TH:i:s\\Z"));
     }
     if (!class_exists('Mustache_Autoloader')) {
         Mustache_Autoloader::register();
     }
     $m = new Mustache_Engine();
     $contents = $m->render(file_get_contents(dirname(__DIR__) . "/views/templates/pkgproperties.mustache"), array("file" => $metaFiles));
     $file = tempnam(DPSFA_TMPDIR, "dps-");
     $result = file_put_contents($file, $contents);
     return $result ? $file : false;
 }
    static function generateSlides($fetch_data, $refresh_cache, $id, $type, $markup = null, $slides = null, $options = null, $template = null, $skin = null, $disable_cache = false)
    {
        $arr = false;
        $refresh_hours = NewRoyalSliderMain::$refresh_hours;
        if (!$disable_cache) {
            if ($refresh_hours > 0) {
                $disable_cache = false;
            } else {
                $disable_cache = true;
            }
        }
        if (!$disable_cache) {
            $transient_key = NewRoyalSliderMain::get_transient_key($id, $type);
            if (!$id) {
                $refresh_cache = true;
            }
            if ($refresh_cache) {
                // delete cached version
                delete_transient($transient_key);
            } else {
                $arr = get_transient($transient_key);
            }
        }
        if ($arr === false) {
            if ($fetch_data) {
                if ($type != 'nextgen') {
                    $rsdata = NewRoyalSliderMain::query_slider_data($id);
                } else {
                    $rsdata = NewRoyalSliderMain::query_nextgen_slider_config();
                }
                if (!$rsdata || !$rsdata[0]) {
                    if ($type == 'nextgen') {
                        return NewRoyalSliderMain::frontend_error(__('NextGEN configuration not found. Likely you just haven\'t created it yet, please go to "RoyalSlider admin page > Create New Slider > NextGEN config" and create it.', 'new_royalslider'));
                    } else {
                        return NewRoyalSliderMain::frontend_error(__('Incorrect RoyalSlider ID or problem with query.', 'new_royalslider'));
                    }
                }
                $rsdata = $rsdata[0];
                $rsdata = apply_filters('new_rs_slider_data', $rsdata);
                $type = $rsdata['type'];
                $markup = $rsdata['template_html'];
                if (!$slides) {
                    $slides = $rsdata['slides'];
                }
                $options = $rsdata['options'];
                $template = $rsdata['template'];
                $skin = $rsdata['skin'];
            }
            if (!is_array($slides)) {
                $slides = json_decode($slides, ARRAY_A);
            }
            if (!class_exists('Mustache_Autoloader')) {
                require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'lib/Mustache/Autoloader.php';
            }
            require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'classes/NewRoyalSliderOptions.php';
            Mustache_Autoloader::register();
            $m = new Mustache_Engine(array('escape' => array('NewRoyalSliderGenerator', 'escapeMustache')));
            $css_id = 'new-royalslider-' . $id;
            $t = NewRoyalSliderOptions::getRsTemplates();
            $add_js = '';
            $curr_template;
            $selector = '';
            if (!isset($t[$template])) {
                $template = ' noTemplate';
            } else {
                $curr_template = $t[$template];
                if (isset($curr_template['add_js'])) {
                    $add_js = $curr_template['add_js'];
                    $add_js = str_replace('{{selector}}', '.' . $css_id, $add_js);
                }
                $template = ' ' . $curr_template['template-css-class'];
            }
            if ($options) {
                if (!is_array($options)) {
                    $options = json_decode($options, ARRAY_A);
                } else {
                }
                $gen_opts = self::preParseOpts($options);
                if (isset($options['sopts'])) {
                    $o = array_merge($options, $options['sopts']);
                    $to_unset = array('sopts', 'posts', 'rs_500px', 'flickr', 'rs_instagram');
                    foreach ($to_unset as $key => $value) {
                        if (isset($o[$value])) {
                            unset($o[$value]);
                        }
                    }
                    foreach ($o as $key => $option) {
                        if (is_array($option)) {
                            foreach ($option as $subkey => $suboption) {
                                if (is_numeric($suboption)) {
                                    $o[$key][$subkey] = (double) $suboption;
                                }
                            }
                        } else {
                            if (is_numeric($option)) {
                                $o[$key] = (double) $option;
                            }
                        }
                    }
                    //return;
                    $init_opts = json_encode($o);
                    $init_opts = str_replace(':"true"', ':!0', $init_opts);
                    $init_opts = str_replace(':"false"', ':!1', $init_opts);
                    $init_opts = str_replace('"', '\'', $init_opts);
                    $init_opts = str_replace(',\'', ',', $init_opts);
                    $init_opts = str_replace('\':', ':', $init_opts);
                    $init_opts = str_replace('{\'', '{', $init_opts);
                } else {
                    $init_opts = $options;
                }
            } else {
                $options = array();
                $gen_opts = self::preParseOpts(null);
                $init_opts = '';
            }
            $js_init_code = "\t\$('." . $css_id . "').royalSlider(" . $init_opts . ");\n" . $add_js;
            if (!isset($skin)) {
                $skin = 'rsDefault';
            }
            $skin = ' ' . $skin;
            $out = '';
            if (NewRoyalSliderMain::$include_style_tag) {
                if ($gen_opts['thumb_width'] != 96 || $gen_opts['thumb_height'] != 72) {
                    $out .= "\n<style type=\"text/css\">\n";
                    $out .= '.' . $css_id . ' .rsThumbsHor { height:' . $gen_opts['thumb_height'] . 'px; }' . "\n";
                    $out .= '.' . $css_id . ' .rsThumbsVer { width:' . $gen_opts['thumb_width'] . 'px; } 
			.' . $css_id . ' .rsThumb { width: ' . $gen_opts['thumb_width'] . 'px; height: ' . $gen_opts['thumb_height'] . 'px; }';
                    $out .= "\n</style>\n";
                }
            }
            if (isset($curr_template) && isset($curr_template['wrapHTML'])) {
                $out .= str_replace('%width%', $gen_opts['width'], $curr_template['wrapHTML']['before']);
            }
            $options['id'] = $id;
            $slides = apply_filters('new_rs_slides_filter', $slides, $options, $type);
            if ($type === 'custom') {
                require_once 'renderers/DefaultRenderer.php';
            } else {
                if ($type === 'gallery') {
                    require_once 'renderers/PostGalleryRenderer.php';
                } else {
                    if ($type === 'flickr' || $type === '500px') {
                        require_once 'renderers/CustomSourceRenderer.php';
                    } else {
                        if ($type === 'posts') {
                            require_once 'renderers/PostsListRenderer.php';
                        } else {
                            if ($type === 'nextgen') {
                                require_once 'renderers/NextGenRenderer.php';
                            } else {
                                if ($type === 'instagram') {
                                    require_once 'renderers/InstagramRenderer.php';
                                }
                            }
                        }
                    }
                }
            }
            if (is_array($slides) && count($slides) > 0) {
                $width = $gen_opts['width'];
                if (is_numeric($width)) {
                    $width .= 'px';
                }
                if ($width) {
                    $width = 'width:' . $width . ';';
                } else {
                    $width = '';
                }
                $height = $gen_opts['height'];
                if (is_numeric($height)) {
                    $height .= 'px';
                }
                if ($height) {
                    $height = 'height:' . $height . ';';
                } else {
                    $height = '';
                }
                $out .= '<div id="' . $css_id . '" class="royalSlider ' . $css_id . $skin . $template . '" style="' . $width . $height . ';">' . "\n";
                foreach ($slides as $key => $slide) {
                    if ($type === 'custom') {
                        $renderer = new NewRoyalSliderDefaultRenderer($slide, $gen_opts, $options);
                    } else {
                        if ($type === 'gallery') {
                            $renderer = new NewRoyalSliderPostGalleryRenderer($key, $slide, $gen_opts, $options);
                        } else {
                            if ($type === 'flickr' || $type === '500px') {
                                $renderer = new NewRoyalSliderCustomSourceRenderer($slide, $gen_opts, $options);
                            } else {
                                if ($type === 'posts') {
                                    $renderer = new NewRoyalSliderPostsRenderer($slide, $gen_opts, $options);
                                } else {
                                    if ($type === 'nextgen') {
                                        $renderer = new NewRoyalSliderNextGenRenderer($slide, $gen_opts, $options);
                                    } else {
                                        if ($type === 'instagram') {
                                            $renderer = new NewRoyalSliderInstagramRenderer($slide, $gen_opts, $options);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $m->getHelpers()->clear();
                    apply_filters('new_rs_slides_renderer_helper', $m, $slide, $options);
                    $out .= $m->render($markup, $renderer) . "\n";
                }
                $out = apply_filters('new_rs_slides_output_before_end', $out, $id, $type);
                $out .= "\n" . '</div>' . "\n";
            } else {
                if ($type !== 'posts') {
                    $error_message = print_r($slides, true);
                    if (strlen($error_message) > 5) {
                        $out .= NewRoyalSliderMain::frontend_error(print_r($slides, true));
                    } else {
                        $out .= NewRoyalSliderMain::frontend_error(__('Slides are missing. ', 'new_royalslider') . print_r($slides, true));
                    }
                } else {
                    $out .= NewRoyalSliderMain::frontend_error(__('No posts found matching your criteria.', 'new_royalslider'));
                }
            }
            if (isset($curr_template) && isset($curr_template['wrapHTML'])) {
                $out .= $curr_template['wrapHTML']['after'];
            }
            if ($type != '500px' && $type != 'flickr' && $type != 'instagram') {
                $pattern = '\\[(\\[?)(gallery|new_royalslider)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
                preg_match_all('/' . $pattern . '/s', $out, $matches);
                $out = preg_replace_callback("/{$pattern}/s", array('NewRoyalSliderGenerator', 'strip_shortcode_tag'), $out);
                $out = do_shortcode($out);
            }
            $arr = array('out' => $out, 'js_init' => $js_init_code);
            if (!$disable_cache) {
                set_transient($transient_key, $arr, 60 * 60 * $refresh_hours);
            }
        }
        NewRoyalSliderMain::register_slider($id, $arr['js_init']);
        return $arr['out'];
    }
예제 #29
0
<?php

if (!$include_flag) {
    exit;
}
echo '<script src="' . _HTML_LIB_PATH . '/chartjs/Chart.js"></script>';
echo '<script src="' . _HTML_LIB_PATH . '/mustache/mustache.js"></script>';
include _TRACK_SHOW_COMMON_PATH . '/lib/mustache/Autoloader.php';
Mustache_Autoloader::register(_TRACK_SHOW_COMMON_PATH . '/lib/mustache');
$mTemplate = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader(_TRACK_SHOW_COMMON_PATH . '/templates/views')));
$arr_currencies_list = get_active_currencies();
$selected_currency = current($arr_currencies_list);
$arr_report_data = prepare_report('main-report', $_REQUEST + array('report_params' => array('act' => 'reports'), 'type' => 'sales', 'main_column' => 'source_name'));
list($more, $arr_flow_data, $s, $s1) = get_sales_flow_data($_REQUEST, 'flow_report');
$arr_report_data['flow_rows'] = $arr_flow_data;
$arr_report_data['show_more'] = $more;
// Fill sales table header names
$arr_report_data['flow-table-header']['values'] = array('short_date' => array('caption' => 'Дата'), 'offer_name' => array('caption' => 'Оффер'), 'network' => array('caption' => 'Сеть'), 'source_name' => array('caption' => 'Источник'), 'campaign_name' => array('caption' => 'Кампания'), 'placement' => array('caption' => 'Площадка'), 'profit' => array('caption' => 'Сумма'), 'status' => array('caption' => 'Статус'));
// ********************************************************************************
// Prepare data for sales chart
$i = 0;
$arr_sales_chart_data = array();
foreach ($arr_report_data['table-columns'] as $cur) {
    if ($i++ == 0) {
        continue;
    }
    $arr_sales_chart_data['captions'][] = "'" . $cur['caption'] . "'";
}
$i = 0;
$total_sales = 0;
foreach ($arr_report_data['table-total']['values'] as $cur) {
예제 #30
0
 private function mustacheLoader()
 {
     Mustache_Autoloader::register();
     $templates = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader($_SERVER['DOCUMENT_ROOT'])));
     return $templates;
 }