idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
16,800 | public static function create ( $ mapping = array ( ) ) { $ defaultMapping = array ( 'autoload' => self :: DEFAULT_INITIALIZER_NS . '\Autoload' , 'dependencies' => self :: DEFAULT_INITIALIZER_NS . '\Dependencies' , 'general-settings' => self :: DEFAULT_INITIALIZER_NS . '\ThemeSettings' , 'customizer' => self :: DEFAULT_INITIALIZER_NS . '\Customizer' , 'image-sizes' => self :: DEFAULT_INITIALIZER_NS . '\ImageSizes' , 'widget-areas' => self :: DEFAULT_INITIALIZER_NS . '\WidgetAreas' , 'menu-locations' => self :: DEFAULT_INITIALIZER_NS . '\MenuLocations' , 'theme-supports' => self :: DEFAULT_INITIALIZER_NS . '\ThemeSupports' , 'assets' => self :: DEFAULT_INITIALIZER_NS . '\Assets' , 'templates' => self :: DEFAULT_INITIALIZER_NS . '\Templates' ) ; $ finalMapping = array_merge ( $ defaultMapping , $ mapping ) ; return new Configuration ( $ finalMapping ) ; } | Create the theme configuration . The object will be created and configuration files will be parsed . |
16,801 | public function apply ( ) { foreach ( $ this -> initializers as $ id => $ initializer ) { do_action ( 'baobab/configuration/before-initializer?id=' . $ id ) ; $ initializer -> run ( ) ; do_action ( 'baobab/configuration/after-initializer?id=' . $ id ) ; } } | Apply the configuration |
16,802 | public function getOrThrow ( $ section , $ key ) { if ( ! isset ( $ this -> initializers [ $ section ] ) ) { throw new UnknownSectionException ( $ section ) ; } return $ this -> initializers [ $ section ] -> getSettingOrThrow ( $ key ) ; } | Get the value of a setting in the configuration . If that setting is not found an exception will be thrown . |
16,803 | public function get ( $ section , $ key , $ defaultValue = null ) { if ( ! isset ( $ this -> initializers [ $ section ] ) ) { return $ defaultValue ; } return $ this -> initializers [ $ section ] -> getSetting ( $ key , $ defaultValue ) ; } | Get the value of a setting in the configuration . If that setting is not found return the provided default value . |
16,804 | public function render ( ) { $ renderedChildren = $ this -> renderChildren ( ) ; $ encoding = mb_detect_encoding ( $ renderedChildren ) ; return mb_strtoupper ( $ renderedChildren , $ encoding ) ; } | Converts the rendered children to uppercase . |
16,805 | public static function loadHelpers ( ) { $ helpers = array ( ) ; $ helperDir = Config :: getOption ( "sourceDir" ) . DIRECTORY_SEPARATOR . "_mustache-components/helpers" ; $ helperExt = Config :: getOption ( "mustacheHelperExt" ) ; $ helperExt = $ helperExt ? $ helperExt : "helper.php" ; if ( is_dir ( $ helperDir ) ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> name ( "*\." . $ helperExt ) -> in ( $ helperDir ) ; $ finder -> sortByName ( ) ; foreach ( $ finder as $ file ) { $ baseName = $ file -> getBasename ( ) ; if ( $ baseName [ 0 ] != "_" ) { include ( $ file -> getPathname ( ) ) ; if ( isset ( $ helper ) ) { if ( ! isset ( $ key ) ) { $ key = $ file -> getBasename ( "." . $ helperExt ) ; } $ helpers [ $ key ] = $ helper ; unset ( $ helper ) ; unset ( $ key ) ; } } } } return $ helpers ; } | Load helpers for the Mustache PatternEngine |
16,806 | public function setSubject ( $ subject ) { if ( $ subject === '' ) { throw new \ InvalidArgumentException ( '$subject must not be empty.' , 1331488802 ) ; } if ( ( strpos ( $ subject , CR ) !== false ) || ( strpos ( $ subject , LF ) !== false ) ) { throw new \ InvalidArgumentException ( '$subject must not contain any line breaks or carriage returns.' , 1331488817 ) ; } $ this -> setAsString ( 'subject' , $ subject ) ; } | Sets the subject of the e - mail . |
16,807 | public function setHTMLMessage ( $ message ) { if ( $ message === '' ) { throw new \ InvalidArgumentException ( '$message must not be empty.' , 1331488845 ) ; } if ( $ this -> hasCssFile ( ) ) { $ this -> loadEmogrifierClass ( ) ; $ emogrifier = new Emogrifier ( $ message , $ this -> getCssFile ( ) ) ; $ messageToStore = $ emogrifier -> emogrify ( ) ; } else { $ messageToStore = $ message ; } $ this -> setAsString ( 'html_message' , $ messageToStore ) ; } | Sets the HTML message of the e - mail . |
16,808 | public function setCssFile ( $ cssFile ) { if ( ! $ this -> cssFileIsCached ( $ cssFile ) ) { $ absoluteFileName = GeneralUtility :: getFileAbsFileName ( $ cssFile ) ; if ( ( $ cssFile !== '' ) && is_readable ( $ absoluteFileName ) ) { self :: $ cssFileCache [ $ cssFile ] = file_get_contents ( $ absoluteFileName ) ; } else { self :: $ cssFileCache [ $ cssFile ] = '' ; } } $ this -> setAsString ( 'cssFile' , self :: $ cssFileCache [ $ cssFile ] ) ; } | Sets the CSS file for sending an e - mail . |
16,809 | public function getGroupMembers ( $ groupUids ) { if ( $ groupUids === '' ) { throw new \ InvalidArgumentException ( '$groupUids must not be an empty string.' , 1331488505 ) ; } return $ this -> getListOfModels ( \ Tx_Oelib_Db :: selectMultiple ( '*' , $ this -> getTableName ( ) , $ this -> getUniversalWhereClause ( ) . ' AND ' . 'usergroup REGEXP \'(^|,)(' . implode ( '|' , GeneralUtility :: intExplode ( ',' , $ groupUids ) ) . ')($|,)\'' ) ) ; } | Returns the users which are in the groups with the given UIDs . |
16,810 | public function generateAppCredentials ( $ apiKey , $ apiSecret ) { $ apiKey = urlencode ( $ apiKey ) ; $ apiSecret = urlencode ( $ apiSecret ) ; $ credentials = base64_encode ( "{$apiKey}:{$apiSecret}" ) ; return $ credentials ; } | Generate app credentials |
16,811 | protected function insertMetadata ( $ content , $ entryIdentifier , array $ tags , $ lifetime ) { if ( ! is_string ( $ content ) ) { throw new InvalidDataTypeException ( 'Given data is of type "' . gettype ( $ content ) . '", but a string is expected for string cache.' , 1433155737 ) ; } $ metadata = array ( 'identifier' => $ entryIdentifier , 'tags' => $ tags , 'lifetime' => $ lifetime ) ; $ metadataJson = json_encode ( $ metadata ) ; $ this -> metadata [ $ entryIdentifier ] = $ metadata ; return $ metadataJson . self :: SEPARATOR . $ content ; } | Insert metadata into the content |
16,812 | protected function extractMetadata ( $ entryIdentifier , $ content ) { $ separatorIndex = strpos ( $ content , self :: SEPARATOR ) ; if ( $ separatorIndex === false ) { $ exception = new InvalidDataTypeException ( 'Could not find cache metadata in entry with identifier ' . $ entryIdentifier , 1433155925 ) ; if ( $ this -> environment -> getContext ( ) -> isProduction ( ) ) { $ this -> logger -> logException ( $ exception ) ; } else { throw $ exception ; } } $ metadataJson = substr ( $ content , 0 , $ separatorIndex ) ; $ metadata = json_decode ( $ metadataJson , true ) ; if ( $ metadata === null ) { $ exception = new InvalidDataTypeException ( 'Invalid cache metadata in entry with identifier ' . $ entryIdentifier , 1433155926 ) ; if ( $ this -> environment -> getContext ( ) -> isProduction ( ) ) { $ this -> logger -> logException ( $ exception ) ; } else { throw $ exception ; } } $ this -> metadata [ $ entryIdentifier ] = $ metadata ; return substr ( $ content , $ separatorIndex + 1 ) ; } | Extract metadata from the content and store it |
16,813 | public function setLang ( $ lang ) { if ( ! IntuitionUtil :: nonEmptyStr ( $ lang ) ) { return false ; } $ this -> currentLanguage = $ this -> normalizeLang ( $ lang ) ; return true ; } | Set the current language which will be used when requesting messages etc . |
16,814 | protected function getMessagesFunctions ( ) { if ( $ this -> messagesFunctions == null ) { $ this -> messagesFunctions = MessagesFunctions :: getInstance ( $ this -> localBaseDir , $ this ) ; } return $ this -> messagesFunctions ; } | Get an instance of MessagesFunctions . |
16,815 | public function msg ( $ key = 0 , $ options = [ ] , $ fail = null ) { if ( ! IntuitionUtil :: nonEmptyStr ( $ key ) ) { return $ this -> bracketMsg ( $ key , $ fail ) ; } $ defaultOptions = [ 'domain' => $ this -> getDomain ( ) , 'lang' => $ this -> getLang ( ) , 'variables' => [ ] , 'raw-variables' => false , 'escape' => 'plain' , 'parsemag' => true , 'externallinks' => false , 'wikilinks' => false , ] ; if ( IntuitionUtil :: nonEmptyStr ( $ options ) ) { $ options = [ 'domain' => $ options ] ; } if ( ! is_array ( $ options ) ) { $ options = $ defaultOptions ; } else { $ options = array_merge ( $ defaultOptions , $ options ) ; } $ key = lcfirst ( $ key ) ; $ msg = $ this -> rawMsg ( $ options [ 'domain' ] , $ options [ 'lang' ] , $ key ) ; if ( $ msg === null ) { $ this -> errTrigger ( "Message \"$key\" for lang \"{$options['lang']}\" in domain \"{$options['domain']}\" not found" , __METHOD__ , E_NOTICE ) ; return $ this -> bracketMsg ( $ key , $ fail ) ; } $ escapeDone = false ; if ( $ options [ 'raw-variables' ] === true ) { $ msg = IntuitionUtil :: strEscape ( $ msg , $ options [ 'escape' ] ) ; $ escapeDone = true ; } foreach ( $ options [ 'variables' ] as $ i => $ val ) { $ n = $ i + 1 ; $ msg = str_replace ( "\$$n" , $ val , $ msg ) ; } if ( $ options [ 'parsemag' ] === true ) { $ msg = $ this -> getMessagesFunctions ( ) -> parse ( $ msg , $ options [ 'lang' ] ) ; } if ( ! $ escapeDone ) { $ escapeDone = true ; $ msg = IntuitionUtil :: strEscape ( $ msg , $ options [ 'escape' ] ) ; } if ( is_string ( $ options [ 'wikilinks' ] ) ) { $ msg = IntuitionUtil :: parseWikiLinks ( $ msg , $ options [ 'wikilinks' ] ) ; } if ( $ options [ 'externallinks' ] ) { $ msg = IntuitionUtil :: parseExternalLinks ( $ msg ) ; } return $ msg ; } | Get a message from the message blob . |
16,816 | public function setMsg ( $ key , $ message , $ domain = null , $ lang = null ) { $ domain = IntuitionUtil :: nonEmptyStr ( $ domain ) ? $ this -> normalizeDomain ( $ domain ) : $ this -> getDomain ( ) ; $ lang = IntuitionUtil :: nonEmptyStr ( $ lang ) ? $ this -> normalizeLang ( $ lang ) : $ this -> getLang ( ) ; $ this -> messageBlob [ $ domain ] [ $ lang ] [ $ key ] = $ message ; } | Add or overwrites a message in the blob . |
16,817 | public function setMsgs ( $ messagesByKey , $ domain = null , $ lang = null ) { foreach ( $ messagesByKey as $ key => $ message ) { $ this -> setMsg ( $ key , $ message , $ domain , $ lang ) ; } } | Set multiple messages in the blob . |
16,818 | public function registerDomain ( $ domain , $ dir , $ info = [ ] ) { $ info [ 'dir' ] = $ dir ; $ this -> domainInfos [ $ this -> normalizeDomain ( $ domain ) ] = $ info ; } | Register a custom domain . |
16,819 | public function addDomainInfo ( $ domain , array $ info ) { $ domain = $ this -> normalizeDomain ( $ domain ) ; if ( isset ( $ this -> domainInfos [ $ domain ] ) ) { $ this -> domainInfos [ $ domain ] += $ info ; } } | Store information related to a domain . |
16,820 | public function listMsgs ( $ domain ) { $ domain = $ this -> normalizeDomain ( $ domain ) ; $ this -> ensureLoaded ( $ domain , 'en' ) ; if ( ! isset ( $ this -> messageBlob [ $ domain ] [ 'en' ] ) ) { return [ ] ; } return array_keys ( $ this -> messageBlob [ $ domain ] [ 'en' ] ) ; } | Get all known message keys for a domain . |
16,821 | public function getLangFallbacks ( $ lang ) { if ( self :: $ fallbackCache === null ) { self :: $ fallbackCache = $ this -> fetchLangFallbacks ( ) ; } $ lang = $ this -> normalizeLang ( $ lang ) ; return isset ( self :: $ fallbackCache [ $ lang ] ) ? self :: $ fallbackCache [ $ lang ] : [ 'en' ] ; } | Get fallback chain for a given language . |
16,822 | public function getLangName ( $ lang = false ) { $ lang = $ lang ? $ this -> normalizeLang ( $ lang ) : $ this -> getLang ( ) ; return $ this -> getLangNames ( ) [ $ lang ] ?? '' ; } | Return the language name in the native language . |
16,823 | public function getLangNames ( ) { if ( $ this -> langNames === null ) { $ path = $ this -> localBaseDir . '/language/mw-classes/Names.php' ; if ( ! is_readable ( $ path ) ) { $ this -> errTrigger ( 'Names.php is missing' , __METHOD__ , E_NOTICE ) ; $ this -> langNames = [ ] ; return [ ] ; } require_once $ path ; $ this -> langNames = \ MediaWiki \ Languages \ Data \ Names :: $ names ; } return $ this -> langNames ; } | Return all known languages . |
16,824 | public function addAvailableLang ( $ code , $ name ) { $ this -> getLangNames ( ) ; $ normalizedCode = $ this -> normalizeLang ( $ code ) ; $ this -> langNames [ $ normalizedCode ] = $ name ; $ this -> availableLanguages [ $ normalizedCode ] = $ name ; } | Add a language that isn t listed in Intuition s included language list . |
16,825 | protected function ensureLoaded ( $ domain , $ lang ) { if ( isset ( $ this -> loadedDomains [ $ domain ] [ $ lang ] ) ) { return $ this -> loadedDomains [ $ domain ] [ $ lang ] ; } if ( ! IntuitionUtil :: nonEmptyStrs ( $ domain , $ lang ) || strcspn ( $ domain , ":/\\\000" ) !== strlen ( $ domain ) || strcspn ( $ lang , ":/\\\000" ) !== strlen ( $ lang ) ) { $ this -> errTrigger ( 'Illegal domain or lang' , __METHOD__ , E_NOTICE ) ; return false ; } $ this -> loadedDomains [ $ domain ] [ $ lang ] = false ; if ( ! isset ( self :: $ messageCache [ $ domain ] [ $ lang ] ) ) { $ domainInfo = $ this -> getDomainInfo ( $ domain ) ; if ( ! $ domainInfo ) { return false ; } $ file = $ domainInfo [ 'dir' ] . "/$lang.json" ; $ this -> loadMessageFile ( $ domain , $ lang , $ file ) ; } else { $ this -> setMsgs ( self :: $ messageCache [ $ domain ] [ $ lang ] , $ domain , $ lang ) ; } $ this -> loadedDomains [ $ domain ] [ $ lang ] = true ; return true ; } | Ensure a domain s language is loaded . |
16,826 | protected function setExpiryTrackerCookie ( $ lifetime ) { $ val = time ( ) + $ lifetime ; $ this -> setCookie ( 'track-expire' , $ val , $ lifetime , TSINT_COOKIE_NOTRACK ) ; return true ; } | Browsers don t send the expiration date of cookies with the request In order to keep track of the expiration date we set an additional cookie . |
16,827 | public function renewCookies ( $ lifetime = 2592000 ) { foreach ( $ this -> getCookieNames ( ) as $ key => $ name ) { if ( $ key === 'track-expire' ) { continue ; } if ( isset ( $ _COOKIE [ $ name ] ) ) { $ this -> setCookie ( $ key , $ _COOKIE [ $ name ] , $ lifetime , TSINT_COOKIE_NOTRACK ) ; } } $ this -> setExpiryTrackerCookie ( $ lifetime ) ; return true ; } | Renew all cookies |
16,828 | public function wipeCookies ( ) { foreach ( $ this -> getCookieNames ( ) as $ key => $ name ) { $ this -> setCookie ( $ key , '' , - 3600 , TSINT_COOKIE_NOTRACK ) ; unset ( $ _COOKIE [ $ name ] ) ; } return true ; } | Delete all cookies . |
16,829 | public function getCookieExpiration ( ) { $ name = $ this -> getCookieName ( 'track-expire' ) ; return isset ( $ _COOKIE [ $ name ] ) ? intval ( $ _COOKIE [ $ name ] ) : 0 ; } | Get expiration timestamp . |
16,830 | public function getPromoBox ( $ imgSize = 28 , $ helpTranslateDomain = TSINT_HELP_CURRENT ) { if ( is_int ( $ imgSize ) && $ imgSize > 0 ) { $ src = '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Tool_labs_logo.svg/' . '/' . $ imgSize . 'px-Tool_labs_logo.svg.png' ; $ src_2x = '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Tool_labs_logo.svg/' . '/' . ( $ imgSize * 2 ) . 'px-Tool_labs_logo.svg.png' ; $ img = IntuitionUtil :: tag ( '' , 'img' , [ 'src' => $ src , 'srcset' => "$src 1x, $src_2x 2x" , 'width' => $ imgSize , 'height' => $ imgSize , 'alt' => '' , 'title' => '' , 'class' => 'int-logo' , ] ) ; } else { $ img = '' ; } $ promoMsgOpts = [ 'domain' => 'tsintuition' , 'escape' => 'html' , 'raw-variables' => true , 'variables' => [ '<a href="//translatewiki.net/">translatewiki.net</a>' , '<a href="' . $ this -> dashboardHome . '">Intuition</a>' ] , ] ; $ poweredHtml = $ this -> msg ( 'bl-promo' , $ promoMsgOpts ) ; $ translateGroup = null ; if ( $ helpTranslateDomain === TSINT_HELP_ALL ) { $ translateGroup = 'tsint-0-all' ; $ twLinkText = $ this -> msg ( 'help-translate-all' , 'tsintuition' ) ; } elseif ( $ helpTranslateDomain === TSINT_HELP_CURRENT ) { $ domain = $ this -> getDomain ( ) ; $ translateGroup = $ this -> isLocalDomain ( $ domain ) ? "tsint-{$domain}" : "int-{$domain}" ; $ twLinkText = $ this -> msg ( 'help-translate-tool' , 'tsintuition' ) ; } elseif ( $ helpTranslateDomain !== TSINT_HELP_NONE ) { $ domain = $ this -> normalizeDomain ( $ helpTranslateDomain ) ; $ translateGroup = $ this -> isLocalDomain ( $ domain ) ? "tsint-{$domain}" : "int-{$domain}" ; $ twLinkText = $ this -> msg ( 'help-translate-tool' , 'tsintuition' ) ; } $ helpTranslateLink = '' ; if ( $ translateGroup ) { $ twParams = [ 'title' => 'Special:Translate' , 'language' => $ this -> getLang ( ) , 'group' => $ translateGroup , ] ; $ twParams = http_build_query ( $ twParams ) ; $ helpTranslateLink = '<small>(' . IntuitionUtil :: tag ( $ twLinkText , 'a' , [ 'href' => "https://translatewiki.net/w/i.php?$twParams" , 'title' => $ this -> msg ( 'help-translate-tooltip' , 'tsintuition' ) ] ) . ')</small>' ; } return '<div class="int-promobox"><p><a href="' . htmlspecialchars ( $ this -> getDashboardReturnToUrl ( ) ) . "\">$img</a> " . "$poweredHtml {$this->dashboardBacklink()} $helpTranslateLink</p></div>" ; } | Show a promobox on the bottom of your tool . |
16,831 | public function getDashboardReturnToUrl ( ) { $ p = [ 'returnto' => $ _SERVER [ 'SCRIPT_NAME' ] , 'returntoquery' => http_build_query ( $ _GET ) , ] ; return rtrim ( $ this -> dashboardHome , '/' ) . '/?' . http_build_query ( $ p ) . '#tab-settingsform' ; } | Build a permalink to the dashboard with a returnto query to return to the current page . To be used in other tools . |
16,832 | public function redirectTo ( $ url = 0 , $ code = 302 ) { if ( $ url === null ) { $ this -> redirectTo = null ; return true ; } if ( ! is_string ( $ url ) || ! is_int ( $ code ) ) { return false ; } $ this -> redirectTo = [ $ url , $ code ] ; return true ; } | Redirect or refresh to url . Pass null to undo redirection . |
16,833 | public function dateFormatted ( $ first = null , $ second = null , $ lang = null ) { if ( $ second === null ) { if ( $ first === null ) { $ format = $ this -> msg ( 'dateformat' , 'general' ) ; $ timestamp = time ( ) ; } elseif ( is_int ( $ first ) ) { $ format = $ this -> msg ( 'dateformat' , 'general' ) ; $ timestamp = $ first ; } elseif ( strtotime ( $ first ) ) { $ format = $ this -> msg ( 'dateformat' , 'general' ) ; $ timestamp = strtotime ( $ first ) ; } else { $ format = $ first ; $ timestamp = time ( ) ; } } else { $ format = $ first ; $ timestamp = is_int ( $ second ) ? $ second : strtotime ( $ second ) ; } $ saved = setlocale ( LC_ALL , 0 ) ; setlocale ( LC_ALL , $ this -> getLocale ( $ lang ) ) ; $ return = strftime ( $ format , $ timestamp ) ; setlocale ( LC_ALL , $ saved ) ; return $ return ; } | Get a localized date . Pass a format time or both . Defaults to the current timestamp in the language s default date format . |
16,834 | protected function initLangSelect ( $ option = null ) { if ( $ option !== null && $ option !== false && $ option !== '' && $ this -> setLang ( $ option ) ) { return true ; } if ( $ this -> getUseRequestParam ( ) ) { $ key = $ this -> paramNames [ 'userlang' ] ; if ( isset ( $ _GET [ $ key ] ) && $ this -> setLang ( $ _GET [ $ key ] ) ) { return true ; } if ( isset ( $ _POST [ $ key ] ) && $ this -> setLang ( $ _POST [ $ key ] ) ) { return true ; } } if ( isset ( $ _COOKIE [ $ this -> cookieNames [ 'userlang' ] ] ) ) { $ set = $ this -> setLang ( $ _COOKIE [ $ this -> cookieNames [ 'userlang' ] ] ) ; if ( $ set ) { return true ; } } $ acceptableLanguages = IntuitionUtil :: getAcceptableLanguages ( ) ; foreach ( $ acceptableLanguages as $ acceptLang => $ qVal ) { if ( $ this -> getLangName ( $ acceptLang ) && $ this -> setLang ( $ acceptLang ) ) { return true ; } } foreach ( $ acceptableLanguages as $ acceptLang => $ qVal ) { if ( ! $ qVal ) { continue ; } while ( strpos ( $ acceptLang , '-' ) !== false ) { $ acceptLang = substr ( $ acceptLang , 0 , strrpos ( $ acceptLang , '-' ) ) ; if ( $ this -> getLangName ( $ acceptLang ) && $ this -> setLang ( $ acceptLang ) ) { return true ; } } } return ! ! $ this -> setLang ( 'en' ) ; } | Check language choice tree . |
16,835 | public function isRtl ( $ lang = null ) { static $ rtlLanguages = null ; $ lang = $ lang ? $ this -> normalizeLang ( $ lang ) : $ this -> getLang ( ) ; if ( $ rtlLanguages === null ) { $ file = $ this -> localBaseDir . '/language/rtl.json' ; $ rtlLanguages = json_decode ( file_get_contents ( $ file ) , true ) ; } return in_array ( $ lang , $ rtlLanguages ) ; } | Whether the language is right - to - left |
16,836 | public function delete ( ) { $ url = "entities" ; if ( $ this -> _id ) { $ url .= "/{$this->_id}" ; } if ( $ this -> _type ) { $ url .= "?type={$this->_type}" ; } return $ this -> _orion -> delete ( $ url ) ; } | Delete current Entity |
16,837 | public function getAttribute ( $ attr ) { $ url = "entities/{$this->_id}/attrs/$attr" ; if ( $ this -> _type ) { $ url .= "?type={$this->_type}" ; } return $ this -> _orion -> get ( $ url ) ; } | Get Attribute Data |
16,838 | public function getAttributeValue ( $ attr , & $ request = null ) { $ url = "entities/{$this->_id}/attrs/$attr/value" ; if ( $ this -> _type ) { $ url .= "?type={$this->_type}" ; } return $ this -> _orion -> get ( $ url , $ request , "text/plain" , "text/plain" ) ; } | Get Attribute Value |
16,839 | public function deleteAttribute ( $ attr ) { $ url = "entities/{$this->_id}/attrs/$attr" ; if ( $ this -> _type ) { $ url .= "?type={$this->_type}" ; } return $ this -> _orion -> delete ( $ url ) ; } | Remove a single attribute |
16,840 | public function replaceAttributes ( array $ attrs ) { $ url = "entities/{$this->_id}/attrs" ; if ( $ this -> _type ) { $ url .= "?type={$this->_type}" ; } $ updateEntity = new ContextFactory ( $ attrs ) ; return $ this -> _orion -> put ( $ url , $ updateEntity ) ; } | Replace all entity Attributes |
16,841 | public function appendAttribute ( $ attr , $ value , $ type , $ metadata = null , $ options = [ ] ) { $ attrs = [ $ attr => [ "value" => $ value , "type" => $ type ] ] ; if ( $ metadata != null ) { $ attrs [ 'metadata' ] = $ metadata ; } return $ this -> appendAttributes ( $ attrs , $ options ) ; } | Update or Append new attribute |
16,842 | public function appendAttributes ( array $ attrs , $ options = [ "option" => "append" ] ) { $ url = "entities/{$this->_id}/attrs" ; if ( $ this -> _type ) { $ url .= "?type={$this->_type}" ; } if ( count ( $ options ) > 0 ) { $ prefix = ( $ this -> _type ) ? "&" : "?" ; $ url .= $ prefix . urldecode ( http_build_query ( $ options ) ) ; } $ updateEntity = new ContextFactory ( $ attrs ) ; return $ this -> _orion -> create ( $ url , $ updateEntity ) ; } | Update or Append new attributes |
16,843 | private function coordsQueryString ( array $ coords ) { $ count = count ( $ coords ) ; if ( $ count == 2 ) { if ( is_numeric ( $ coords [ 0 ] ) && is_numeric ( $ coords [ 1 ] ) ) { return implode ( ',' , array_reverse ( $ coords ) ) ; } elseif ( is_array ( $ coords [ 0 ] ) && is_array ( $ coords [ 1 ] ) ) { foreach ( $ coords [ 0 ] as $ key => $ coord ) { $ coords [ 0 ] [ $ key ] = implode ( ',' , array_reverse ( $ coord ) ) ; } return implode ( ";" , $ coords [ 0 ] ) ; } } if ( $ count == 1 && is_array ( $ coords [ 0 ] ) && count ( $ coords [ 0 ] ) >= 3 ) { foreach ( $ coords [ 0 ] as $ key => $ coord ) { $ coords [ 0 ] [ $ key ] = implode ( ',' , array_reverse ( $ coord ) ) ; } return implode ( ";" , $ coords [ 0 ] ) ; } if ( $ count > 2 ) { $ first = $ coords [ 0 ] ; $ last = end ( $ coords ) ; reset ( $ coords ) ; if ( is_array ( $ first ) && is_array ( $ last ) ) { foreach ( $ coords as $ key => $ coord ) { $ coords [ $ key ] = implode ( ',' , $ coord ) ; } return implode ( ";" , $ coords ) ; } } throw new \ LogicException ( "You got me! :( Please report it to https://github.com/VM9/orion-explorer-php-frame-work/issues " ) ; } | Method thats allow to convert geoJson coordinate format into Orion coords query strinng format . |
16,844 | public function geoQuery ( $ georel , $ geoJson , array $ modifiers = [ ] , array $ options = [ ] , & $ request = null ) { if ( is_string ( $ geoJson ) ) { $ geoJson = json_decode ( $ geoJson ) ; } elseif ( is_array ( $ geoJson ) ) { $ geoJson = ( object ) $ geoJson ; } if ( $ geoJson == null ) { throw new \ Exception ( '$geoJson Param should be a valid GeoJson object or string' ) ; } array_unshift ( $ modifiers , $ georel ) ; $ options [ "georel" ] = implode ( ";" , $ modifiers ) ; $ options [ "geometry" ] = strtolower ( $ geoJson -> type ) ; $ options [ "coords" ] = $ this -> coordsQueryString ( $ geoJson -> coordinates ) ; return $ this -> getContext ( $ options , $ request ) ; } | Geo Spatial handler method |
16,845 | public function getCoveredBy ( $ geoJson , array $ modifiers = [ ] , array $ options = [ ] , & $ request = null ) { return $ this -> geoQuery ( "coveredBy" , $ geoJson , $ modifiers , $ options , $ request ) ; } | Denotes that matching entities are those that exist entirely within the reference geometry . When resolving a query of this type the border of the shape must be considered to be part of the shape |
16,846 | public function getIntersections ( $ geoJson , array $ modifiers = [ ] , array $ options = [ ] , & $ request = null ) { return $ this -> geoQuery ( "intersects" , $ geoJson , $ modifiers , $ options , $ request ) ; } | Denotes that matching entities are those intersecting with the reference geometry |
16,847 | public function getDisjoints ( $ geoJson , array $ modifiers = [ ] , array $ options = [ ] , & $ request = null ) { return $ this -> geoQuery ( "disjoint" , $ geoJson , $ modifiers , $ options , $ request ) ; } | Denotes that matching entities are those not intersecting with the reference geometry |
16,848 | public function getGeoEquals ( $ geoJson , array $ modifiers = [ ] , array $ options = [ ] , & $ request ) { return $ this -> geoQuery ( "equals" , $ geoJson , $ modifiers , $ options , $ request ) ; } | The geometry associated to the position of matching entities and the reference geometry must be exactly the same |
16,849 | public function init ( $ logFilePrefix ) { self :: $ logFileName = date ( 'Y-m-d_H-i-s' ) . '-' . ucfirst ( $ logFilePrefix ) . '-' . md5 ( time ( ) ) . '.log' ; $ ssl = null ; $ this -> writeLog ( sprintf ( $ this -> debugStrings [ 'start' ] , date ( 'Y-m-d H:i:s' ) ) ) ; if ( in_array ( 'curl' , get_loaded_extensions ( ) ) ) { $ curl_version = curl_version ( ) ; $ curl = $ curl_version [ 'version' ] ; $ ssl = $ curl_version [ 'ssl_version' ] ; } else { $ curl = 'no' ; } if ( ! $ ssl && in_array ( 'openssl' , get_loaded_extensions ( ) ) ) { $ ssl = 'yes' ; } if ( ! $ ssl ) { $ ssl = 'no' ; } $ this -> writeLog ( sprintf ( $ this -> debugStrings [ 'php-ini' ] , PHP_VERSION , $ curl , $ ssl ) ) ; } | Initialisation of the debug log stores information about the environment . |
16,850 | public function logParamsSet ( $ paramsArray ) { $ paramsString = '' ; foreach ( $ paramsArray as $ k => $ v ) { $ paramsString .= "$k=$v\r\n" ; } $ this -> writeLog ( sprintf ( $ this -> debugStrings [ 'params set' ] , date ( 'Y-m-d H:i:s' ) , $ paramsString ) ) ; } | Logs parameters which were set before sending . |
16,851 | public function logReplyParams ( $ params ) { $ paramsString = '' ; foreach ( $ params as $ k => $ v ) { $ paramsString .= "$k=" . print_r ( $ v , true ) . "\r\n" ; } $ this -> writeLog ( sprintf ( $ this -> debugStrings [ 'replyParams' ] , date ( 'Y-m-d H:i:s' ) , $ paramsString ) ) ; } | Logs processed reply params from json array |
16,852 | public function logNotificationInput ( $ paramsArray ) { $ this -> writeLog ( sprintf ( $ this -> debugStrings [ 'notifyInput' ] , date ( 'Y-m-d H:i:s' ) , print_r ( $ paramsArray , 1 ) ) ) ; } | Logs parameters which were used for Notification |
16,853 | public function logNotificationParams ( $ paramsArray ) { $ this -> writeLog ( sprintf ( $ this -> debugStrings [ 'notifyParams' ] , date ( 'Y-m-d H:i:s' ) , print_r ( $ paramsArray , 1 ) ) ) ; } | logs parameters which were used for Notification |
16,854 | public function writeLog ( $ string ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; $ path = str_replace ( '\\' , '/' , $ Config -> getConfig ( 'DEBUG_LOG_PATH' ) ) ; if ( ! is_dir ( $ path ) ) { if ( ! mkdir ( $ path ) ) { error_log ( 'Log directory does not exist. Please create directory: ' . $ path . '.' ) ; } $ htfp = fopen ( $ path . '/.htaccess' , 'w' ) ; fwrite ( $ htfp , "Order allow,deny\nDeny from all" ) ; fclose ( $ htfp ) ; } if ( ! self :: $ fp ) { self :: $ fp = fopen ( $ path . '/' . self :: $ logFileName , 'a' ) ; if ( ! self :: $ fp ) { error_log ( 'Log File (' . $ path . '/' . self :: $ logFileName . ') is not writeable.' ) ; } } fwrite ( self :: $ fp , $ string ) ; } | Writes log into log file |
16,855 | public function register ( $ compiler ) { $ this -> registerStartLoopQuery ( $ compiler ) ; $ this -> registerEmptyLoopBranch ( $ compiler ) ; $ this -> registerEndLoop ( $ compiler ) ; } | Register the extension in the compiler |
16,856 | public function setOrderSequence ( $ orderSequence ) { if ( false === in_array ( $ orderSequence , DataTablesEnumerator :: enumOrderSequences ( ) ) ) { $ orderSequence = null ; } $ this -> orderSequence = $ orderSequence ; return $ this ; } | Set the order sequence . |
16,857 | public function add ( $ object ) { if ( is_a ( $ object , 'Closure' ) ) { return $ this -> closures [ ] = $ object ; } $ this -> validateObject ( $ object ) ; $ data = $ object -> getSitemapData ( ) ; $ this -> addRaw ( $ data ) ; } | Add a SitemapAware object to the sitemap . |
16,858 | public function addAll ( $ objects ) { if ( is_a ( $ objects , 'Closure' ) ) { return $ this -> closures [ ] = $ objects ; } foreach ( $ objects as $ object ) { $ this -> add ( $ object ) ; } } | Add multiple SitemapAware objects to the sitemap . |
16,859 | public function addRaw ( $ data ) { $ this -> validateData ( $ data ) ; $ data [ 'location' ] = trim ( $ data [ 'location' ] , '/' ) ; $ this -> entries [ ] = $ this -> replaceAttributes ( $ data ) ; } | Add a raw entry to the sitemap . |
16,860 | public function contains ( $ url ) { $ url = trim ( $ url , '/' ) ; foreach ( $ this -> entries as $ entry ) { if ( $ entry [ 'loc' ] == $ url ) { return TRUE ; } } return FALSE ; } | Check if the sitemap contains an url . |
16,861 | public function generateIndex ( ) { $ this -> loadClosures ( ) ; $ xml = new XMLWriter ( ) ; $ xml -> openMemory ( ) ; $ xml -> writeRaw ( '<?xml version="1.0" encoding="UTF-8"?>' ) ; $ xml -> writeRaw ( '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' ) ; foreach ( $ this -> entries as $ data ) { $ xml -> startElement ( 'sitemap' ) ; foreach ( $ data as $ attribute => $ value ) { $ xml -> writeElement ( $ attribute , $ value ) ; } $ xml -> endElement ( ) ; } $ xml -> writeRaw ( '</sitemapindex>' ) ; return $ xml -> outputMemory ( ) ; } | Generate the xml for the sitemap . |
16,862 | protected function replaceAttributes ( $ data ) { foreach ( $ data as $ attribute => $ value ) { $ replacement = $ this -> replaceAttribute ( $ attribute ) ; unset ( $ data [ $ attribute ] ) ; $ data [ $ replacement ] = $ value ; } return $ data ; } | Replace the attribute names with their replacements . |
16,863 | protected function replaceAttribute ( $ attribute ) { if ( array_key_exists ( $ attribute , $ this -> replacements ) ) { return $ this -> replacements [ $ attribute ] ; } return $ attribute ; } | Replace an attribute with it s replacement if available . |
16,864 | protected function loadClosures ( ) { foreach ( $ this -> closures as $ closure ) { $ instance = $ closure ( ) ; if ( is_array ( $ instance ) || $ instance instanceof Traversable ) { $ this -> addAll ( $ instance ) ; } else { $ this -> add ( $ instance ) ; } } } | Load the lazy loaded elements . |
16,865 | protected function checkTemplateFile ( $ canUseFlexforms = false ) { if ( TYPO3_MODE === 'BE' ) { return ; } $ this -> checkForNonEmptyString ( 'templateFile' , $ canUseFlexforms , 's_template_special' , 'This value specifies the HTML template which is essential when ' . 'creating any output from this extension.' ) ; if ( ( $ this -> getFrontEndController ( ) !== null ) && $ this -> objectToCheck -> hasConfValueString ( 'templateFile' , 's_template_special' ) ) { $ rawFileName = $ this -> objectToCheck -> getConfValueString ( 'templateFile' , 's_template_special' , true ) ; if ( ! is_file ( $ this -> getFrontEndController ( ) -> tmpl -> getFileName ( $ rawFileName ) ) ) { $ message = 'The specified HTML template file <strong>' . htmlspecialchars ( $ rawFileName ) . '</strong> cannot be read. ' . 'The HTML template file is essential when creating any ' . 'output from this extension. ' . 'Please either create the file <strong>' . $ rawFileName . '</strong> or select an existing file using the TS setup ' . 'variable <strong>' . $ this -> getTSSetupPath ( ) . 'templateFile</strong>' ; if ( $ canUseFlexforms ) { $ message .= ' or via FlexForms' ; } $ message .= '.' ; $ this -> setErrorMessage ( $ message ) ; } } } | Checks whether the HTML template is provided and the file exists . |
16,866 | public function checkForNonEmptyString ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ value = $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) ; $ this -> checkForNonEmptyStringValue ( $ value , $ fieldName , $ canUseFlexforms , $ explanation ) ; } | Checks whether a configuration value contains a non - empty - string . |
16,867 | protected function checkIfSingleInSetNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , array $ allowedValues ) { $ this -> checkForNonEmptyString ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfSingleInSetOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ allowedValues ) ; } | Checks whether a configuration value is non - empty and lies within a set of allowed values . |
16,868 | protected function checkIfSingleInSetOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , array $ allowedValues ) { if ( $ this -> objectToCheck -> hasConfValueString ( $ fieldName , $ sheet ) ) { $ value = $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) ; $ this -> checkIfSingleInSetOrEmptyValue ( $ value , $ fieldName , $ canUseFlexforms , $ explanation , $ allowedValues ) ; } } | Checks whether a configuration value either is empty or lies within a set of allowed values . |
16,869 | protected function checkIfBoolean ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkIfSingleInSetNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , [ '0' , '1' ] ) ; } | Checks whether a configuration value has a boolean value . |
16,870 | protected function checkIfMultiInSetOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , array $ allowedValues ) { if ( $ this -> objectToCheck -> hasConfValueString ( $ fieldName , $ sheet ) ) { $ allValues = GeneralUtility :: trimExplode ( ',' , $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) , true ) ; $ overviewOfValues = '(' . implode ( ', ' , $ allowedValues ) . ')' ; foreach ( $ allValues as $ currentValue ) { if ( ! in_array ( $ currentValue , $ allowedValues , true ) ) { $ message = 'The TS setup variable <strong>' . $ this -> getTSSetupPath ( ) . $ fieldName . '</strong> contains the value <strong>' . htmlspecialchars ( $ currentValue ) . '</strong>, ' . 'but only the following values are allowed: ' . '<br /><strong>' . $ overviewOfValues . '</strong><br />' . $ explanation ; $ this -> setErrorMessageAndRequestCorrection ( $ fieldName , $ canUseFlexforms , $ message ) ; } } } } | Checks whether a configuration value either is empty or its comma - separated values lie within a set of allowed values . |
16,871 | public function checkIfSingleInTableNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ tableName ) { $ this -> checkIfSingleInSetNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ this -> getDbColumnNames ( $ tableName ) ) ; } | Checks whether a configuration value is non - empty and is one of the column names of a given DB table . |
16,872 | protected function checkIfSingleInTableOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ tableName ) { $ this -> checkIfSingleInSetOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ this -> getDbColumnNames ( $ tableName ) ) ; } | Checks whether a configuration value either is empty or is one of the column names of a given DB table . |
16,873 | protected function checkIfMultiInTableOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ tableName ) { $ this -> checkIfMultiInSetOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ this -> getDbColumnNames ( $ tableName ) ) ; } | Checks whether a configuration value either is empty or its comma - separated values is a column name of a given DB table . |
16,874 | protected function checkRegExp ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ regExp ) { $ value = $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) ; if ( ! preg_match ( $ regExp , $ value ) ) { $ message = 'The TS setup variable <strong>' . $ this -> getTSSetupPath ( ) . $ fieldName . '</strong> contains the value <strong>' . htmlspecialchars ( $ value ) . '</strong> which isn\'t valid. ' . $ explanation ; $ this -> setErrorMessageAndRequestCorrection ( $ fieldName , $ canUseFlexforms , $ message ) ; } } | Checks whether a configuration value matches a regular expression . |
16,875 | protected function checkRegExpNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ regExp ) { $ this -> checkForNonEmptyString ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkRegExp ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ regExp ) ; } | Checks whether a configuration value is non - empty and matches a regular expression . |
16,876 | protected function checkIfFePagesNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkForNonEmptyString ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfFePagesOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; } | Checks whether a configuration value is non - empty and contains a comma - separated list of front - end PIDs . |
16,877 | protected function checkIfSingleFePageNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkIfPositiveInteger ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfFePagesOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; } | Checks whether a configuration value is non - empty and contains a single front - end PID . |
16,878 | protected function checkIfSingleFePageOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkIfInteger ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfFePagesOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; } | Checks whether a configuration value either is empty or contains a single front - end PID . |
16,879 | protected function checkIfSysFoldersNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkForNonEmptyString ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfSysFoldersOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; } | Checks whether a configuration value is non - empty and contains a comma - separated list of system folder PIDs . |
16,880 | protected function checkIfSingleSysFolderNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkIfPositiveInteger ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfSysFoldersOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; } | Checks whether a configuration value is non - empty and contains a single system folder PID . |
16,881 | protected function checkIfSingleSysFolderOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ this -> checkIfInteger ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIfSysFoldersOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; } | Checks whether a configuration value either is empty or contains a single system folder PID . |
16,882 | protected function checkIfSysFoldersOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) { $ pids = $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) ; if ( ( $ pids === '' ) || ( strrpos ( $ pids , ',' ) !== false ) ) { $ message = 'All the selected pages need to be system folders so ' . 'that data records are tidily separated from front-end ' . 'content. ' . $ explanation ; } else { $ message = 'The selected page needs to be a system folder so that ' . 'data records are tidily separated from front-end content. ' . $ explanation ; } $ this -> checkPageTypeOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ message , '=254' ) ; } | Checks whether a configuration value either is empty or contains a comma - separated list of system folder PIDs . |
16,883 | protected function checkPageTypeOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation , $ typeCondition ) { $ this -> checkIfPidListOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; if ( $ this -> objectToCheck -> hasConfValueString ( $ fieldName , $ sheet ) ) { $ pids = $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) ; $ offendingPids = \ Tx_Oelib_Db :: selectColumnForMultiple ( 'uid' , 'pages' , 'uid IN (' . $ pids . ') AND NOT (doktype' . $ typeCondition . ')' . \ Tx_Oelib_Db :: enableFields ( 'pages' ) ) ; $ dbResultCount = count ( $ offendingPids ) ; if ( $ dbResultCount > 0 ) { $ pageIdPlural = ( $ dbResultCount > 1 ) ? 's' : '' ; $ bePlural = ( $ dbResultCount > 1 ) ? 'are' : 'is' ; $ message = 'The TS setup variable <strong>' . $ this -> getTSSetupPath ( ) . $ fieldName . '</strong> contains the page ID' . $ pageIdPlural . ' <strong>' . implode ( ',' , $ offendingPids ) . '</strong> ' . 'which ' . $ bePlural . ' of an incorrect page type. ' . $ explanation . '<br />' ; $ this -> setErrorMessageAndRequestCorrection ( $ fieldName , $ canUseFlexforms , $ message ) ; } } } | Checks whether a configuration value either is empty or contains a comma - separated list of PIDs that specify pages or a given type . |
16,884 | protected function checkListViewIfSingleInSetNotEmpty ( $ fieldName , $ explanation , array $ allowedValues ) { $ fieldSubPath = 'listView.' . $ fieldName ; $ value = $ this -> objectToCheck -> getListViewConfValueString ( $ fieldName ) ; $ this -> checkForNonEmptyStringValue ( $ value , $ fieldSubPath , false , $ explanation ) ; $ this -> checkIfSingleInSetOrEmptyValue ( $ value , $ fieldSubPath , false , $ explanation , $ allowedValues ) ; } | Checks whether a configuration value in listView . is non - empty and lies within a set of allowed values . |
16,885 | public function checkIsValidEmailOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ unused , $ explanation ) { $ value = $ this -> objectToCheck -> getConfValueString ( $ fieldName , $ sheet ) ; if ( $ value === '' ) { return ; } if ( ! GeneralUtility :: validEmail ( $ value ) ) { $ message = 'The e-mail address in <strong>' . $ this -> getTSSetupPath ( ) . $ fieldName . '</strong> is set to <strong>' . $ value . '</strong> ' . 'which is not valid. E-mails might not be received as long as ' . 'this address is invalid.<br />' ; $ this -> setErrorMessageAndRequestCorrection ( $ fieldName , $ canUseFlexforms , $ message . $ explanation ) ; } } | Checks that an e - mail address is valid or empty . |
16,886 | public function checkIsValidEmailNotEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ allowInternalAddresses , $ explanation ) { $ this -> checkForNonEmptyString ( $ fieldName , $ canUseFlexforms , $ sheet , $ explanation ) ; $ this -> checkIsValidEmailOrEmpty ( $ fieldName , $ canUseFlexforms , $ sheet , $ allowInternalAddresses , $ explanation ) ; } | Checks that an e - mail address is valid and non - empty . |
16,887 | private function setLanguageKeyFromConfiguration ( \ Tx_Oelib_Configuration $ configuration ) { if ( ! $ configuration -> hasString ( 'language' ) ) { return ; } $ this -> languageKey = $ configuration -> getAsString ( 'language' ) ; if ( $ configuration -> hasString ( 'language_alt' ) ) { $ this -> alternativeLanguageKey = $ configuration -> getAsString ( 'language_alt' ) ; } } | Reads the language key from a configuration and sets it as current language . Also sets the alternate language if one is configured . |
16,888 | private function initializeBackEnd ( ) { $ backEndUser = \ Tx_Oelib_BackEndLoginManager :: getInstance ( ) -> getLoggedInUser ( \ Tx_Oelib_Mapper_BackEndUser :: class ) ; $ this -> languageKey = $ backEndUser -> getLanguage ( ) ; } | Initializes the TranslatorRegistry for the back end . |
16,889 | private function getByExtensionName ( $ extensionName ) { if ( $ extensionName === '' ) { throw new \ InvalidArgumentException ( 'The parameter $extensionName must not be empty.' , 1331489578 ) ; } if ( ! ExtensionManagementUtility :: isLoaded ( $ extensionName ) ) { throw new \ BadMethodCallException ( 'The extension with the name "' . $ extensionName . '" is not loaded.' , 1331489598 ) ; } if ( ! isset ( $ this -> translators [ $ extensionName ] ) ) { $ localizedLabels = $ this -> getLocalizedLabelsFromFile ( $ extensionName ) ; if ( ( $ this -> getFrontEndController ( ) !== null ) && isset ( $ localizedLabels [ $ this -> languageKey ] ) && is_array ( $ localizedLabels [ $ this -> languageKey ] ) ) { $ labelsFromTyposcript = $ this -> getLocalizedLabelsFromTypoScript ( $ extensionName ) ; foreach ( $ labelsFromTyposcript as $ labelKey => $ labelFromTyposcript ) { $ localizedLabels [ $ this -> languageKey ] [ $ labelKey ] [ 0 ] [ 'target' ] = $ labelFromTyposcript ; } } $ translator = GeneralUtility :: makeInstance ( \ Tx_Oelib_Translator :: class , $ this -> languageKey , $ this -> alternativeLanguageKey , $ localizedLabels ) ; $ this -> translators [ $ extensionName ] = $ translator ; } return $ this -> translators [ $ extensionName ] ; } | Gets a Translator by its extension name . |
16,890 | private function getLocalizedLabelsFromFile ( $ extensionKey ) { if ( $ extensionKey === '' ) { throw new \ InvalidArgumentException ( '$extensionKey must not be empty.' , 1331489618 ) ; } $ languageFactory = GeneralUtility :: makeInstance ( LocalizationFactory :: class ) ; $ languageFile = 'EXT:' . $ extensionKey . '/' . self :: LANGUAGE_FILE_PATH ; $ localizedLabels = $ languageFactory -> getParsedData ( $ languageFile , $ this -> languageKey , 'utf-8' , 0 ) ; if ( $ this -> alternativeLanguageKey !== '' ) { $ alternativeLabels = $ languageFactory -> getParsedData ( $ languageFile , $ this -> languageKey , 'utf-8' , 0 ) ; $ localizedLabels = array_merge ( $ alternativeLabels , is_array ( $ localizedLabels ) ? $ localizedLabels : [ ] ) ; } return $ localizedLabels ; } | Returns the localized labels from an extension s language file . |
16,891 | private function getLocalizedLabelsFromTypoScript ( $ extensionName ) { if ( $ extensionName === '' ) { throw new \ InvalidArgumentException ( 'The parameter $extensionName must not be empty.' , 1331489630 ) ; } $ result = [ ] ; $ namespace = 'plugin.tx_' . $ extensionName . '._LOCAL_LANG.' . $ this -> languageKey ; $ configuration = \ Tx_Oelib_ConfigurationRegistry :: get ( $ namespace ) ; foreach ( $ configuration -> getArrayKeys ( ) as $ key ) { $ result [ $ key ] = $ configuration -> getAsString ( $ key ) ; } return $ result ; } | Returns the localized labels from an extension s TypoScript setup . |
16,892 | public function getCurrent ( ) { if ( is_null ( $ this -> current ) ) { $ siteView = $ this -> makeNewViewModel ( ) ; $ this -> current = $ siteView ; } return $ this -> current ; } | Returns the current site view instance creates if it is not created already |
16,893 | protected function collectVisitData ( ) { $ request = $ this -> request ; $ user = $ request -> user ( ) ; $ userId = $ user ? $ user -> getKey ( ) : null ; return [ 'user_id' => $ userId , 'http_referer' => $ request -> server ( 'HTTP_REFERER' ) , 'url' => $ request -> fullUrl ( ) , 'request_method' => $ request -> method ( ) , 'request_path' => $ request -> getPathInfo ( ) , 'http_user_agent' => $ request -> server ( 'HTTP_USER_AGENT' ) , 'http_accept_language' => $ request -> server ( 'HTTP_ACCEPT_LANGUAGE' ) , 'locale' => $ this -> app -> getLocale ( ) , 'request_time' => $ request -> server ( 'REQUEST_TIME' ) ] ; } | Collects the data for the site view model |
16,894 | public function saveCurrent ( ) { if ( $ this -> saveEnabled ( ) && $ this -> isViewValid ( ) && $ this -> isViewUnique ( ) ) { $ success = $ this -> saveCurrentModel ( ) ; if ( $ success ) { $ this -> storeCurrentHash ( ) ; $ this -> saveTrackables ( $ this -> getCurrent ( ) , $ success ) ; } return $ success ; } return false ; } | Persists the current site view to database |
16,895 | public function isViewUnique ( ) { $ hash = $ this -> getCurrentHash ( ) ; if ( in_array ( $ hash , $ this -> session -> get ( 'tracker.views' , [ ] ) ) ) { return false ; } return true ; } | Checks if the current request is unique |
16,896 | protected function getCurrentHash ( ) { if ( $ this -> currentHash === null ) { $ this -> currentHash = md5 ( $ this -> request -> fullUrl ( ) . $ this -> request -> method ( ) . $ this -> request -> getClientIp ( ) ) ; } return $ this -> currentHash ; } | Gets the view hash |
16,897 | protected function saveCurrentModel ( ) { $ current = $ this -> getCurrent ( ) ; $ current -> setAttribute ( 'app_time' , $ this -> getCurrentRuntime ( ) ) ; $ current -> setAttribute ( 'memory' , memory_get_peak_usage ( true ) ) ; return $ current -> save ( ) ; } | Saves the current model |
16,898 | protected function saveTrackables ( $ view , $ success ) { foreach ( $ this -> trackables as $ trackable ) { $ trackable -> attachTrackerView ( $ view ) ; } return $ success ; } | Saves the trackables |
16,899 | public function flushOlderThanOrBetween ( $ until = null , $ from = null ) { $ modelName = $ this -> getViewModelName ( ) ; return $ modelName :: olderThanOrBetween ( $ until , $ from ) -> delete ( ) ; } | Flush older than or between SiteViews |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.