示例#1
0
 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     parent::init();
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     \JPluginHelper::importPlugin('gantry5');
     // Trigger the onGantryThemeInit event.
     $dispatcher = \JEventDispatcher::getInstance();
     $dispatcher->trigger('onGantry5ThemeInit', ['theme' => $this]);
     $lang = \JFactory::getLanguage();
     // FIXME: Do not hardcode this file.
     $lang->load('files_gantry5_nucleus', JPATH_SITE);
     if (\JFactory::getApplication()->isSite()) {
         // Load our custom positions file as frontend requires the strings to be there.
         $filename = $locator("gantry-theme://language/en-GB/en-GB.tpl_{$this->name}_positions.ini");
         if ($filename) {
             $lang->load("tpl_{$this->name}_positions", dirname(dirname(dirname($filename))), 'en-GB');
         }
     }
     $doc = \JFactory::getDocument();
     $this->language = $doc->language;
     $this->direction = $doc->direction;
     $this->url = \JUri::root(true) . '/templates/' . $this->name;
 }
示例#2
0
 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     parent::init();
     $this->url = dirname($_SERVER['SCRIPT_NAME']);
 }
示例#3
0
文件: Theme.php 项目: rishiv3/gantry5
 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     parent::init();
     $gantry = Gantry::instance();
     $global = $gantry['global'];
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     \Timber::$locations = $locator->findResources('gantry-engine://views');
     add_theme_support('html5', ['comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'widgets']);
     add_theme_support('title-tag');
     add_theme_support('post-formats');
     add_theme_support('post-thumbnails');
     add_theme_support('menus');
     add_theme_support('widgets');
     add_theme_support('woocommerce');
     add_filter('script_loader_tag', ['Gantry\\Framework\\Document', 'script_add_attributes'], 10, 2);
     add_filter('timber_context', [$this, 'getContext']);
     add_filter('get_twig', [$this, 'extendTwig'], 100);
     add_filter('the_content', [$this, 'url_filter'], 0);
     add_filter('the_excerpt', [$this, 'url_filter'], 0);
     add_filter('widget_text', [$this, 'url_filter'], 0);
     add_filter('widget_content', [$this, 'url_filter'], 0);
     add_filter('widget_text', 'do_shortcode');
     add_filter('widget_content', 'do_shortcode');
     add_filter('widget_update_callback', ['\\Gantry\\WordPress\\Widgets', 'widgetCustomClassesUpdate'], 10, 4);
     add_filter('dynamic_sidebar_params', ['\\Gantry\\WordPress\\Widgets', 'widgetCustomClassesSidebarParams']);
     add_action('template_redirect', [$this, 'set_template_layout'], -10000);
     add_action('init', [$this, 'register_post_types']);
     add_action('init', [$this, 'register_taxonomies']);
     add_action('init', [$this, 'register_menus']);
     add_action('template_redirect', [$this, 'disable_wpautop'], 10000);
     add_action('widgets_init', [$this, 'widgets_init']);
     add_action('wp_enqueue_scripts', [$this, 'prepare_particles'], 15);
     add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts'], 20);
     add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts'], 20);
     add_action('wp_head', [$this, 'print_styles'], 20);
     add_action('wp_head', [$this, 'print_scripts'], 30);
     add_action('admin_print_styles', [$this, 'print_styles'], 200);
     add_action('admin_print_scripts', [$this, 'print_scripts'], 200);
     add_action('wp_footer', [$this, 'print_inline_scripts']);
     add_action('in_widget_form', ['\\Gantry\\WordPress\\Widgets', 'widgetCustomClassesForm'], 10, 3);
     add_action('widgets_init', function () {
         register_widget('\\Gantry\\WordPress\\Widget\\Particle');
     });
     add_shortcode('loadposition', [$this, 'loadposition_shortcode']);
     // Offline support.
     add_action('init', function () use($global) {
         if ($global->get('offline') && !(is_super_admin() || current_user_can('manage_options') || $_GLOBALS['pagenow'] == 'wp-login.php')) {
             if (locate_template(['offline.php'])) {
                 add_filter('template_include', function () {
                     return locate_template(['offline.php']);
                 });
             } else {
                 wp_die($global->get('offline_message'), get_bloginfo('title'));
             }
         }
     });
     $this->preset_styles_init();
     // Load theme text domains
     $domain = $this->details()->get('configuration.theme.textdomain', $this->name);
     load_theme_textdomain($domain, $this->path . '/languages');
     $this->url = $gantry['site']->theme->link;
 }
示例#4
0
 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     parent::init();
     $this->url = \Mage::getBaseUrl(\Mage_Core_Model_Store::URL_TYPE_SKIN);
 }
示例#5
0
 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     parent::init();
     $this->url = './styles/' . $this->name;
 }