Exemple #1
0
 protected function getOptionalProperty($propertyName, $default)
 {
     if (!$this->_properties->containsKey($propertyName)) {
         return $default;
     }
     return $this->_properties->get($propertyName);
 }
 private function _getUrls($cacheKey, $themeGetter, $eventName)
 {
     if (!$this->_cache->containsKey($cacheKey)) {
         $currentTheme = $this->_currentThemeService->getCurrentTheme();
         $themeScripts = $this->_recursivelyGetFromTheme($currentTheme, $themeGetter);
         $urls = $this->_fireEventAndReturnSubject($eventName, $themeScripts);
         $this->_cache->put($cacheKey, $urls);
     }
     return $this->_cache->get($cacheKey);
 }
 /**
  * @return array An associative array of filenames to template display names.
  */
 public function getPageTemplates()
 {
     if (!$this->_cache->containsKey('templates')) {
         $wpTheme = $this->_wpFunctions->wp_get_theme();
         /* @noinspection PhpUndefinedMethodInspection */
         $toReturn = $wpTheme->get_page_templates();
         $toReturn['index.php'] = 'default';
         asort($toReturn);
         $this->_cache->put('templates', $toReturn);
     }
     return $this->_cache->get('templates');
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 public function getAjaxEndpointUrl()
 {
     if (!$this->_properties->containsKey(self::$_PROPERTY_URL_AJAX)) {
         /*
          * See if it was defined in boot settings.
          */
         $fromBootSettings = $this->_bootSettings->getUrlAjaxEndpoint();
         if ($fromBootSettings) {
             $this->_properties->put(self::$_PROPERTY_URL_AJAX, $fromBootSettings);
             return $fromBootSettings;
         }
         if ($this->_isWordPress()) {
             $url = $this->_wpFunctionsInterface->admin_url('admin-ajax.php');
         } else {
             $url = $this->getBaseUrl()->getClone()->setPath('/web/php/ajaxEndpoint.php');
         }
         $url = $this->_toUrl($url);
         $this->_properties->put(self::$_PROPERTY_URL_AJAX, $url);
     }
     return $this->_properties->get(self::$_PROPERTY_URL_AJAX);
 }
Exemple #5
0
 public function hasAttribute($key)
 {
     return $this->_properties->containsKey($key);
 }