Usage: $short = String::substr($str, 32); $html = String::substrHtml($str, 32); $xhtml = String::toXhtml($html5);
 /**
  * Resolve a flagged URL such as assets/js/core.js|static|10184084.
  *
  * @param string $url The URL.
  *
  * @return \stdClass The options object
  */
 public static function resolveFlaggedUrl(&$url)
 {
     if (self::isStringUtilAvailable()) {
         return StringUtil::resolveFlaggedUrl($url);
     }
     return \Contao\String::resolveFlaggedUrl($url);
 }
コード例 #2
0
 /**
  * Generate module
  */
 protected function compile()
 {
     parent::compile();
     // load Google Maps JavaScript
     $arrParams = $this->anystores_signedIn ? array('signed_in' => 'true') : array();
     GoogleMaps::includeJs($arrParams);
     $GLOBALS['TL_JAVASCRIPT']['markerclusterer'] = 'system/modules/anyStores/assets/js/markerclusterer/src/markerclusterer_compiled.js';
     // map height
     $this->Template->mapHeight = deserialize($this->anystores_mapheight);
     $arrStores = array();
     if (count($this->Template->rawstores)) {
         foreach ($this->Template->rawstores as $key => $store) {
             $arrStores[$key] = $store;
             // encode email
             $arrStores[$key]['email'] = String::encodeEmail($store['email']);
             // encode logo uuid
             /*
             if ( \Validator::isBinaryUuid($store['logo']['uuid']) )
             {
                 $arrStores[$key]['logo'] = $store['logo']['path'];
             }
             */
             // get marker
             $objMarker = null;
             // global
             if (\Config::get('anystores_defaultMarker')) {
                 $objMarker = \FilesModel::findByPk(\Config::get('anystores_defaultMarker'));
             }
             // module
             if ($this->anystores_defaultMarker) {
                 $objMarker = \FilesModel::findByPk($this->anystores_defaultMarker);
             }
             // category
             $objCategory = AnyStoresCategoryModel::findByPk($store['pid']);
             if ($objCategory && $objCategory->defaultMarker) {
                 $objMarker = \FilesModel::findByPk($objCategory->defaultMarker);
             }
             // local
             if ($store['marker']) {
                 $objMarker = \FilesModel::findByPk($store['marker']);
             }
             if ($objMarker) {
                 $arrStores[$key]['marker'] = $objMarker->path;
             } else {
                 $arrStores[$key]['marker'] = null;
             }
         }
     }
     //encode json
     $strJson = json_encode($arrStores, JSON_NUMERIC_CHECK | JSON_PARTIAL_OUTPUT_ON_ERROR);
     if (!$strJson) {
         $this->log(json_last_error_msg(), __METHOD__, TL_ERROR);
         $this->Template->stores = json_encode(array());
     } else {
         $this->Template->stores = $strJson;
     }
     // center the map
     $arrCoordinates = AnyStores::getLonLat($this->strSearchValue, $this->strCountryValue);
     if ($arrCoordinates) {
         $this->Template->anystores_latitude = $arrCoordinates['latitude'];
         $this->Template->anystores_longitude = $arrCoordinates['longitude'];
     }
 }
コード例 #3
0
 function it_filters_empty_values()
 {
     $uuids = ['31092867-468d-11e5-945d-e766493b4cce', '8a4d64cc-73f7-11e5-a93d-236cb64a50b1'];
     $value = [String::uuidToBin('31092867-468d-11e5-945d-e766493b4cce'), '', null, false, String::uuidToBin('8a4d64cc-73f7-11e5-a93d-236cb64a50b1')];
     $this->format($value, 'test', [])->shouldReturn($uuids);
 }