Ejemplo n.º 1
0
 /**
  * Init internal vars
  */
 private function __construct()
 {
     // get links to global vars
     $this->doc = JFactory::getDocument();
     $this->config = JFactory::getConfig();
     $this->url = JUri::getInstance();
     $this->app = JFactory::getApplication();
     $this->menu = $this->app->getMenu();
     $this->params = $this->app->getTemplate(true)->params;
     $this->user = JFactory::getUser();
     $this->baseurl = $this->_getBaseUrl();
     // relative paths
     $this->path = $this->_getTemplatePath();
     $this->img = $this->path . '/images';
     $this->less = $this->path . '/less';
     $this->scss = $this->path . '/scss';
     $this->css = $this->path . '/css';
     $this->js = $this->path . '/js';
     // absolute paths
     $this->pathFull = $this->_getTemplatePathFull();
     $this->imgFull = JPath::clean($this->pathFull . '/images');
     $this->cssFull = JPath::clean($this->pathFull . '/css');
     $this->lessFull = JPath::clean($this->pathFull . '/less');
     $this->scssFull = JPath::clean($this->pathFull . '/scss');
     $this->jsFull = JPath::clean($this->pathFull . '/js');
     $this->partial = JPath::clean($this->pathFull . '/partial');
     // init template vars
     $this->lang = $this->_getLangCurrent();
     $this->langDef = $this->_getLangDefault();
     $this->request = $this->_getRequest();
     $this->dir = $this->doc->getDirection();
     // init mobile detect
     $this->mobile = $this->_getMobile();
 }
Ejemplo n.º 2
0
 protected function preparePageHeading()
 {
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menus = $this->app->getMenu();
     $menu = $menus->getActive();
     // Prepare page heading
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', JText::sprintf('COM_CROWDFUNDING_BACKING_DEFAULT_PAGE_TITLE', $this->item->title));
     }
 }
 private function preparePageHeading()
 {
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menus = $this->app->getMenu();
     $menu = $menus->getActive();
     // Prepare page heading
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', $this->item->name);
     }
 }
Ejemplo n.º 4
0
 private function preparePageTitle()
 {
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menus = $this->app->getMenu();
     $menu = $menus->getActive();
     // Prepare page title
     if (!$menu) {
         $title = $this->item->title;
     } else {
         $title = $this->params->get('page_title', '');
     }
     // Add title before or after Site Name
     if (!$title) {
         $title = $this->app->get('sitename');
     } elseif ((int) $this->app->get('sitename_pagetitles', 0) === 1) {
         $title = JText::sprintf('JPAGETITLE', $this->app->get('sitename'), $title);
     } elseif ((int) $this->app->get('sitename_pagetitles', 0) === 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $this->app->get('sitename'));
     }
     $this->document->setTitle($title);
 }
Ejemplo n.º 5
0
 /**
  * Tests the JApplicationCms::getMenu method.
  *
  * @return  void
  *
  * @since   3.2
  */
 public function testGetMenu()
 {
     $this->assertInstanceOf('JMenuSite', $this->class->getMenu());
 }
Ejemplo n.º 6
0
 /**
  * Prepares the document
  */
 protected function prepareDocument()
 {
     // Prepare page suffix
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $menus = $this->app->getMenu();
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $menu->title);
     } else {
         $this->params->def('page_heading', JText::_('COM_CROWDFUNDING_RAISE_DEFAULT_PAGE_TITLE'));
     }
     // Prepare page title
     $title = $menu->title;
     if (!$title) {
         $title = $this->app->get('sitename');
         // Set site name if it is necessary ( the option 'sitename' = 1 )
     } elseif ($this->app->get('sitename_pagetitles', 0)) {
         $title = JText::sprintf('JPAGETITLE', $this->app->get('sitename'), $title);
         // Item title to the browser title.
     } else {
         if (!empty($this->item)) {
             $title .= " | " . $this->escape($this->item->title);
         }
     }
     $this->document->setTitle($title);
     // Meta Description
     $this->document->setDescription($this->params->get('menu-meta_description'));
     // Meta keywords
     $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     // Add current layout into breadcrumbs.
     $pathway = $this->app->getPathway();
     $pathway->addItem($this->pathwayName);
     // Scripts
     if ($this->userId) {
         JHtml::_('behavior.core');
         JHtml::_('behavior.keepalive');
         if ($this->params->get("enable_chosen", 1)) {
             JHtml::_('formbehavior.chosen', '.cf-advanced-select');
         }
     }
     switch ($this->layout) {
         case "rewards":
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_REWARD');
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
             JText::script('COM_CROWDFUNDING_PICK_IMAGE');
             // Scripts
             if ($this->params->get("rewards_images", 0)) {
                 JHtml::_('prism.ui.bootstrap3Fileinput');
             }
             JHtml::_('prism.ui.pnotify');
             JHtml::_("prism.ui.joomlaHelper");
             $this->document->addScript('media/' . $this->option . '/js/site/project_rewards.js');
             break;
         case "funding":
             JHtml::_('prism.ui.parsley');
             JHtml::_('prism.ui.bootstrap3Datepicker');
             $this->document->addScript('media/' . $this->option . '/js/site/project_funding.js');
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_THIS_VALUE_IS_REQUIRED');
             break;
         case "story":
             // Scripts
             JHtml::_('prism.ui.bootstrap3FileInput');
             // Include translation of the confirmation question for image removing.
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
             JText::script('COM_CROWDFUNDING_PICK_IMAGE');
             JText::script('COM_CROWDFUNDING_REMOVE');
             $this->document->addScript('media/' . $this->option . '/js/site/project_story.js');
             break;
         case "manager":
             $this->document->addScript('media/' . $this->option . '/js/site/project_manager.js');
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_QUESTION_LAUNCH_PROJECT');
             JText::script('COM_CROWDFUNDING_QUESTION_STOP_PROJECT');
             break;
         case "extras":
             break;
         default:
             // Basic
             if ($this->userId) {
                 JHtml::_('prism.ui.bootstrapMaxLength');
                 JHtml::_('prism.ui.bootstrap3Typeahead');
                 JHtml::_('prism.ui.parsley');
                 JHtml::_('prism.ui.cropper');
                 JHtml::_('prism.ui.fileupload');
                 JHtml::_('prism.ui.pnotify');
                 JHtml::_("prism.ui.joomlaHelper");
                 $this->document->addScript('media/' . $this->option . '/js/site/project_basic.js');
                 // Load language string in JavaScript
                 JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
                 // Provide image size.
                 $js = "\r\n                    var cfImageWidth  = " . $this->params->get("image_width", 200) . ";\r\n                    var cfImageHeight = " . $this->params->get("image_height", 200) . ";\r\n                ";
                 $this->document->addScriptDeclaration($js);
             }
             break;
     }
 }
Ejemplo n.º 7
0
 /**
  * Tests the JApplicationCms::getMenu method.
  *
  * @return  void
  *
  * @since   3.2
  */
 public function testGetMenu()
 {
     $this->assertThat($this->class->getMenu(), $this->isInstanceOf('JMenuSite'));
 }
Ejemplo n.º 8
0
 /**
  * Prepares the document.
  *
  * @throws \InvalidArgumentException
  */
 protected function prepareDocument()
 {
     // Prepare page suffix
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $menus = $this->app->getMenu();
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $menu->title);
     } else {
         $this->params->def('page_heading', JText::_('COM_CROWDFUNDING_RAISE_DEFAULT_PAGE_TITLE'));
     }
     // Prepare page title
     $title = $menu->title;
     if (!$title) {
         $title = $this->app->get('sitename');
         // Set site name if it is necessary ( the option 'sitename' = 1 )
     } elseif ($this->app->get('sitename_pagetitles', 0)) {
         $title = JText::sprintf('JPAGETITLE', $this->app->get('sitename'), $title);
         // Item title to the browser title.
     } else {
         if ($this->item !== null) {
             $title .= ' | ' . $this->escape($this->item->title);
         }
     }
     $this->document->setTitle($title);
     // Meta Description
     $this->document->setDescription($this->params->get('menu-meta_description'));
     // Meta keywords
     $this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
     // Add current layout into breadcrumbs.
     $pathway = $this->app->getPathway();
     $pathway->addItem($this->pathwayName);
     JHtml::_('jquery.framework');
     // Scripts
     if ($this->userId) {
         JHtml::_('behavior.core');
         JHtml::_('behavior.keepalive');
         if ($this->params->get('enable_chosen', 1)) {
             JHtml::_('formbehavior.chosen', '.cf-advanced-select');
         }
     }
     $version = new Crowdfunding\Version();
     switch ($this->layout) {
         case 'rewards':
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_REWARD');
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
             JText::script('COM_CROWDFUNDING_PICK_IMAGE');
             // Scripts
             if ($this->params->get('rewards_images', 0)) {
                 JHtml::_('Prism.ui.bootstrap3Fileinput');
             }
             JHtml::_('Prism.ui.pnotify');
             JHtml::_('Prism.ui.joomlaHelper');
             $this->document->addScript('media/' . $this->option . '/js/site/project_rewards.js?v=' . $version->getShortVersion());
             break;
         case 'funding':
             JHtml::_('Prism.ui.parsley');
             JHtml::_('Prism.ui.bootstrap3Datepicker');
             $this->document->addScript('media/' . $this->option . '/js/site/project_funding.js?v=' . $version->getShortVersion());
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_THIS_VALUE_IS_REQUIRED');
             break;
         case 'story':
             JHtml::_('Prism.ui.bootstrap3FileInput');
             // Include translation of the confirmation question for image removing.
             JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
             JText::script('COM_CROWDFUNDING_PICK_IMAGE');
             JText::script('COM_CROWDFUNDING_REMOVE');
             $this->document->addScript('media/' . $this->option . '/js/site/project_story.js?v=' . $version->getShortVersion());
             break;
         case 'manager':
             $this->document->addScript('media/' . $this->option . '/js/site/project_manager.js?v=' . $version->getShortVersion());
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_QUESTION_LAUNCH_PROJECT');
             JText::script('COM_CROWDFUNDING_QUESTION_STOP_PROJECT');
             break;
         case 'extras':
             JHtml::_('Prism.ui.serializeJson');
             break;
         default:
             // Basic
             if ($this->userId) {
                 JHtml::_('Prism.ui.bootstrapMaxLength');
                 JHtml::_('Prism.ui.bootstrap3Typeahead');
                 JHtml::_('Prism.ui.parsley');
                 JHtml::_('Prism.ui.cropper');
                 JHtml::_('Prism.ui.fileupload');
                 JHtml::_('Prism.ui.pnotify');
                 JHtml::_('Prism.ui.joomlaHelper');
                 $this->document->addScript('media/' . $this->option . '/js/site/project_basic.js?v=' . $version->getShortVersion());
                 // Load language string in JavaScript
                 JText::script('COM_CROWDFUNDING_QUESTION_REMOVE_IMAGE');
                 $js = '
                 var crowdfundingOptions = {
                     imageWidth:  ' . $this->params->get('image_width', 200) . ',
                     imageHeight: ' . $this->params->get('image_width', 200) . ',
                     aspectRatio: ' . $this->params->get('image_aspect_ratio', '""') . '
                 }';
                 $this->document->addScriptDeclaration($js);
             }
             break;
     }
 }