idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
46,300
public function addRaw ( $ aAttr ) { if ( ! empty ( $ aAttr ) ) { $ sHash = md5 ( json_encode ( $ aAttr ) ) ; $ this -> aEntries [ $ sHash ] = $ aAttr ; } return $ this ; }
Adds a meta tag setting all the element keys as tag attributes .
46,301
public function removeRaw ( $ aAttr ) { if ( ! empty ( $ aAttr ) ) { $ sHash = md5 ( json_encode ( $ aAttr ) ) ; unset ( $ this -> aEntries [ $ sHash ] ) ; } return $ this ; }
Adds a meta tag
46,302
public function add ( $ sName , $ sContent , $ sTag = '' ) { $ aMeta = [ 'name' => $ sName , 'content' => $ sContent , 'tag' => $ sTag , ] ; return $ this -> addRaw ( $ aMeta ) ; }
Adds a basic meta tag setting the name and the content attributes
46,303
public function remove ( $ sName , $ sContent , $ sTag = '' ) { $ aMeta = [ 'name' => $ sName , 'content' => $ sContent , 'tag' => $ sTag , ] ; return $ this -> removeRaw ( $ aMeta ) ; }
Removes a basic meta tag
46,304
public function removeByPropertyPattern ( $ aProperties ) { foreach ( $ this -> aEntries as $ sHash => $ aEntry ) { foreach ( $ aProperties as $ aPatterns ) { foreach ( $ aPatterns as $ sProperty => $ sPattern ) { if ( ! array_key_exists ( $ sProperty , $ aEntry ) ) { continue 2 ; } elseif ( ! preg_match ( '/^' . $ sPa...
Removes items whose propeerties match a defined pattern
46,305
public function outputAr ( ) { $ aOut = [ ] ; foreach ( $ this -> aEntries as $ aEntry ) { $ sTemp = ! empty ( $ aEntry [ 'tag' ] ) ? '<' . $ aEntry [ 'tag' ] . ' ' : '<meta ' ; unset ( $ aEntry [ 'tag' ] ) ; foreach ( $ aEntry as $ sKey => $ sValue ) { $ sTemp .= $ sKey . '="' . $ sValue . '" ' ; } $ sTemp = trim ( $ ...
Compiles the elements into an array of strings
46,306
public function getAllNested ( array $ aData = [ ] , $ bIncludeDeleted = false , $ sProperty = 'children' ) { $ aAll = parent :: getAll ( null , null , $ aData , $ bIncludeDeleted ) ; return $ this -> nestItems ( $ aAll , $ sProperty ) ; }
Similar to getAll but returns the items in a nested array
46,307
public function getAllNestedFlat ( array $ aData = [ ] , $ sSeparator = ' &rsaquo; ' , $ bIncludeDeleted = false ) { $ aAllNested = $ this -> getAllNested ( $ aData , $ bIncludeDeleted , 'children' ) ; $ aFlattened = $ this -> flattenItems ( $ aAllNested ) ; foreach ( $ aFlattened as & $ aLabels ) { $ aLabels = implode...
Returns nested items but as a flat array . The item s parent s labels will be prepended to the string
46,308
private function loadStateIdentifiers ( ) : array { if ( $ this -> stateIdentifiers === null ) { $ this -> stateIdentifiers = $ this -> repository -> sudo ( static function ( Repository $ repository ) : array { $ stateIdentifiers = [ ] ; $ stateGroups = $ repository -> getObjectStateService ( ) -> loadObjectStateGroups...
Returns the list of object state identifiers separated by group .
46,309
private function buildObjectStateFilterParameters ( ParameterBuilderInterface $ builder , array $ groups = [ ] ) : void { $ builder -> add ( 'filter_by_object_state' , ParameterType \ Compound \ BooleanType :: class , [ 'groups' => $ groups , ] ) ; $ builder -> get ( 'filter_by_object_state' ) -> add ( 'object_states' ...
Builds the parameters for filtering by object states .
46,310
private function getObjectStateFilterCriteria ( ParameterCollectionInterface $ parameterCollection ) : ? Criterion { if ( $ parameterCollection -> getParameter ( 'filter_by_object_state' ) -> getValue ( ) !== true ) { return null ; } $ objectStates = $ parameterCollection -> getParameter ( 'object_states' ) -> getValue...
Returns the criteria used to filter content by object state .
46,311
private function getObjectStateIds ( array $ stateIdentifiers ) : array { $ idList = [ ] ; foreach ( $ stateIdentifiers as $ identifier ) { $ identifier = explode ( '|' , $ identifier ) ; if ( count ( $ identifier ) !== 2 ) { continue ; } try { $ stateGroup = $ this -> objectStateHandler -> loadGroupByIdentifier ( $ id...
Returns object state IDs for all provided object state identifiers .
46,312
private function loadLanguages ( ) : iterable { if ( method_exists ( $ this -> languageService , 'loadLanguageListByCode' ) ) { return $ this -> languageService -> loadLanguageListByCode ( $ this -> languageCodes ) ; } $ languages = [ ] ; foreach ( $ this -> languageCodes as $ languageCode ) { try { $ language = $ this...
Loads the list of eZ Platform languages from language codes available in the object .
46,313
private function getPosixLocale ( Language $ language ) : ? array { if ( ! $ language -> enabled ) { return null ; } $ posixLocale = $ this -> localeConverter -> convertToPOSIX ( $ language -> languageCode ) ; if ( $ posixLocale === null ) { return null ; } if ( ! Locales :: exists ( $ posixLocale ) ) { return null ; }...
Returns the array with POSIX locale code and name for provided eZ Platform language .
46,314
public static function init ( ) { if ( static :: $ bIsReady ) { return ; } $ aErrorHandlers = Components :: drivers ( 'nails/common' , 'ErrorHandler' ) ; $ oDefaultDriver = null ; $ aCustomDrivers = [ ] ; foreach ( $ aErrorHandlers as $ oErrorHandler ) { if ( $ oErrorHandler -> slug == static :: DEFAULT_ERROR_HANDLER )...
Sets up the appropriate error handling driver
46,315
public function getDefaultDriverClass ( ) { $ oDriver = $ this -> getDefaultDriver ( ) ; $ sDriverNamespace = ArrayHelper :: getFromArray ( 'namespace' , ( array ) $ oDriver -> data ) ; $ sDriverClass = ArrayHelper :: getFromArray ( 'class' , ( array ) $ oDriver -> data ) ; return '\\' . $ sDriverNamespace . $ sDriverC...
Returns the default error driver class name
46,316
public function triggerError ( $ iErrorNumber = 0 , $ sErrorString = '' , $ sErrorFile = '' , $ iErrorLine = 0 ) { $ sDriverClass = static :: $ sDriverClass ; $ sDriverClass :: error ( $ iErrorNumber , $ sErrorString , $ sErrorFile , $ iErrorLine ) ; }
Manually trigger an error
46,317
public function showFatalErrorScreen ( $ sSubject = '' , $ sMessage = '' , $ oDetails = null ) { if ( is_array ( $ sMessage ) ) { $ sMessage = implode ( "\n" , $ sMessage ) ; } if ( is_null ( $ oDetails ) ) { $ oDetails = ( object ) [ 'type' => null , 'code' => null , 'msg' => null , 'file' => null , 'line' => null , '...
Shows the fatal error screen . A diagnostic screen is shown on non - production environments
46,318
public function show401 ( $ bLogError = true ) { if ( function_exists ( 'isLoggedIn' ) && isLoggedIn ( ) ) { if ( $ bLogError ) { $ sPage = ArrayHelper :: getFromArray ( 'REQUEST_URI' , $ _SERVER ) ; log_message ( 'error' , '401 Unauthorised . $ sPage ) ; } $ sMessage = 'The page you are trying to view is restricted. ...
Renders the 401 page and halts script execution
46,319
public static function renderErrorView ( $ sView , $ aData = [ ] , $ bFlushBuffer = true ) { if ( $ bFlushBuffer ) { $ sObContents = ob_get_contents ( ) ; if ( ! empty ( $ sObContents ) ) { ob_clean ( ) ; } } $ oInput = Factory :: service ( 'Input' ) ; $ sType = $ oInput :: isCli ( ) ? 'cli' : 'html' ; $ aPaths = [ ] ;...
Renders the error view appropriate for the environment
46,320
public static function halt ( $ sError , $ sSubject = '' , int $ iCode = HttpCodes :: STATUS_INTERNAL_SERVER_ERROR ) { if ( php_sapi_name ( ) === 'cli' || defined ( 'STDIN' ) ) { $ sSubject = trim ( strip_tags ( $ sSubject ) ) ; $ sError = trim ( strip_tags ( $ sError ) ) ; echo "\n" ; echo $ sSubject ? 'ERROR: ' . $ s...
A very low - level error function used before the main error handling stack kicks in
46,321
public function unique_if_diff ( $ new , $ params ) { list ( $ table , $ column , $ old ) = explode ( "." , $ params , 3 ) ; if ( $ new == $ old ) { return true ; } if ( ! array_key_exists ( 'unique_if_diff' , $ this -> _error_messages ) ) { $ this -> set_message ( 'unique_if_diff' , lang ( 'fv_unique_if_diff_field' ) ...
Checks if a certain value is unique in a specified table if different from current value .
46,322
public function valid_postcode ( $ str ) { if ( ! array_key_exists ( 'valid_postcode' , $ this -> _error_messages ) ) { $ this -> set_message ( 'valid_postcode' , lang ( 'fv_valid_postcode' ) ) ; } $ pattern = '/^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])...
Checks if a string is in a valid UK post code format .
46,323
public function item_count ( array $ aArray , $ sParam ) { $ aParams = preg_replace ( '/[^0-9]/' , '' , explode ( ',' , $ sParam ) ) ; $ mFloor = ArrayHelper :: getFromArray ( 0 , $ aParams , 0 ) ; $ mCeiling = ArrayHelper :: getFromArray ( 1 , $ aParams , INF ) ; if ( substr ( $ sParam , 0 , 1 ) === '(' && substr ( $ ...
Checks if an array satisfies specified count restrictions .
46,324
public function valid_date ( $ sDate , $ sFormat ) { if ( empty ( $ sDate ) ) { return true ; } if ( empty ( $ sFormat ) ) { $ sFormat = 'Y-m-d' ; } if ( ! array_key_exists ( 'valid_date' , $ this -> _error_messages ) ) { $ this -> set_message ( 'valid_date' , lang ( 'fv_valid_date_field' ) ) ; } try { $ oDate = \ Date...
Check if a date is valid
46,325
public function date_future ( $ sDate , $ sFormat ) { if ( empty ( $ sDate ) ) { return true ; } if ( empty ( $ sFormat ) ) { $ sFormat = 'Y-m-d' ; } if ( ! array_key_exists ( 'date_future' , $ this -> _error_messages ) ) { $ this -> set_message ( 'date_future' , lang ( 'fv_valid_date_future_field' ) ) ; } try { $ oNow...
Checks if a date is in the future
46,326
public function date_before ( $ sDate , $ sParams ) { if ( empty ( $ sDate ) ) { return true ; } if ( empty ( $ sParams ) ) { return false ; } $ aParams = explode ( '.' , $ sParams ) ; $ sField = ! empty ( $ aParams [ 0 ] ) ? $ aParams [ 0 ] : null ; $ sFormat = ! empty ( $ aParams [ 1 ] ) ? $ aParams [ 1 ] : 'Y-m-d' ;...
Checks if a date is before another date field
46,327
public function valid_datetime ( $ sDateTime , $ sFormat ) { if ( empty ( $ sDateTime ) ) { return true ; } if ( empty ( $ sFormat ) ) { $ sFormat = 'Y-m-d H:i:s' ; } if ( ! array_key_exists ( 'valid_datetime' , $ this -> _error_messages ) ) { $ this -> set_message ( 'valid_datetime' , lang ( 'fv_valid_datetime_field' ...
Checks if a datetime string is valid
46,328
public function datetime_future ( $ sDateTime , $ sFormat ) { if ( empty ( $ sDateTime ) ) { return true ; } if ( empty ( $ sFormat ) ) { $ sFormat = 'Y-m-d H:i:s' ; } if ( ! array_key_exists ( 'datetime_future' , $ this -> _error_messages ) ) { $ this -> set_message ( 'datetime_future' , lang ( 'fv_valid_datetime_futu...
Checks if a datetime string is in the future
46,329
public function valid_time ( $ sTime , $ sFormat ) { if ( empty ( $ sTime ) ) { return true ; } if ( empty ( $ sFormat ) ) { $ sFormat = 'H:i:s' ; } if ( ! array_key_exists ( 'valid_time' , $ this -> _error_messages ) ) { $ this -> set_message ( 'valid_time' , lang ( 'fv_valid_time_field' ) ) ; } try { $ oDate = \ Date...
Checks if a time string is valid
46,330
public function valid_email ( $ str ) { if ( function_exists ( 'filter_var' ) ) { return ( bool ) filter_var ( $ str , FILTER_VALIDATE_EMAIL ) ; } else { return parent :: valid_email ( $ str ) ; } }
Valid Email using filter_var if possible falling back to CI s regex
46,331
public function cdnObjectPickerMultiObjectRequired ( $ aValues ) { $ this -> set_message ( 'cdnObjectPickerMultiObjectRequired' , 'All items must have a file set.' ) ; foreach ( $ aValues as $ aValue ) { if ( empty ( $ aValue [ 'object_id' ] ) ) { return false ; } } return true ; }
Validates that all items within a CDN Object Multi Picker have a label set
46,332
public function is_unique ( $ sString , $ sParameters ) { $ aParameters = explode ( '.' , $ sParameters ) ; $ sTable = ArrayHelper :: getFromArray ( 0 , $ aParameters ) ; $ sColumn = ArrayHelper :: getFromArray ( 1 , $ aParameters ) ; $ sIgnoreId = ArrayHelper :: getFromArray ( 2 , $ aParameters ) ; $ sIgnoreColumn = A...
Checks a value is uniqe in a given table
46,333
public function is_bool ( $ bValue ) { $ this -> set_message ( 'is_bool' , lang ( 'fv_is_bool_field' ) ) ; return is_bool ( $ bValue ) || $ bValue === '1' || $ bValue === '0' || $ bValue === 1 || $ bValue === 0 ; }
Checks whether a value is a boolean value
46,334
public function supportedLocale ( $ sValue ) { $ oLocale = Factory :: service ( 'Locale' ) ; $ aSupportedLocales = $ oLocale -> getSupportedLocales ( ) ; if ( ! in_array ( $ sValue , $ aSupportedLocales ) ) { $ this -> set_message ( 'supportedLocale' , 'This is not a supported locale' ) ; return false ; } return true ;...
Determines whether the vlaue is a supported locale
46,335
public function is ( $ sValue , $ sExpected ) { if ( $ sValue !== $ sExpected ) { $ this -> set_message ( 'is' , 'This field must be exactly "' . $ sExpected . '"' ) ; return false ; } return true ; }
Determines whether a value is specifically something
46,336
public static function filter ( $ sType ) : array { if ( ! isset ( static :: $ aCache [ $ sType ] ) ) { $ aComponents = static :: available ( ) ; static :: $ aCache [ $ sType ] = [ ] ; foreach ( $ aComponents as $ oComponent ) { if ( $ oComponent -> type === $ sType ) { static :: $ aCache [ $ sType ] [ ] = $ oComponent...
Returns a filtered array of components
46,337
public static function getBySlug ( $ sSlug ) : ? Component { $ aComponents = static :: available ( ) ; foreach ( $ aComponents as $ oComponent ) { if ( $ oComponent -> slug === $ sSlug ) { return $ oComponent ; } } return null ; }
Returns a component by its slug
46,338
public static function getApp ( $ bUseCache = true ) : Component { if ( $ bUseCache && isset ( static :: $ aCache [ 'APP' ] ) ) { return static :: $ aCache [ 'APP' ] ; } $ sComposer = @ file_get_contents ( NAILS_APP_PATH . 'composer.json' ) ; if ( empty ( $ sComposer ) ) { ErrorHandler :: halt ( 'Failed to get app conf...
Returns an instance of the app as a component
46,339
public static function exists ( $ sSlug ) : bool { $ aModules = static :: modules ( ) ; foreach ( $ aModules as $ oModule ) { if ( $ sSlug === $ oModule -> slug ) { return true ; } } return false ; }
Test whether a component is installed
46,340
public static function skins ( $ sModule , $ sSubType = '' ) : array { $ aSkins = static :: filter ( 'skin' ) ; $ aOut = [ ] ; foreach ( $ aSkins as $ oSkin ) { if ( Functions :: isPageSecure ( ) ) { $ oSkin -> url = SECURE_BASE_URL . $ oSkin -> relativePath ; } else { $ oSkin -> url = BASE_URL . $ oSkin -> relativePat...
Returns registered skins optionally filtered
46,341
public static function drivers ( $ sModule , $ sSubType = '' ) : array { $ aDrivers = static :: filter ( 'driver' ) ; $ aOut = [ ] ; foreach ( $ aDrivers as $ oDriver ) { if ( $ oDriver -> forModule == $ sModule ) { if ( ! empty ( $ sSubType ) && $ sSubType == $ oDriver -> subType ) { $ aOut [ ] = $ oDriver ; } elseif ...
Returns registered drivers optionally filtered
46,342
public static function getDriverInstance ( $ oDriver ) : Base { if ( is_string ( $ oDriver ) ) { $ oDriver = \ Nails \ Components :: getBySlug ( $ oDriver ) ; } if ( isset ( static :: $ aCache [ 'DRIVER_INSTANCE' ] [ $ oDriver -> slug ] ) ) { return static :: $ aCache [ 'DRIVER_INSTANCE' ] [ $ oDriver -> slug ] ; } if ...
Returns an instance of a single driver
46,343
public static function detectClassComponent ( $ mClass ) : ? Component { $ oReflect = new \ ReflectionClass ( $ mClass ) ; $ sPath = $ oReflect -> getFileName ( ) ; $ bIsVendor = ( bool ) preg_match ( '/^' . preg_quote ( NAILS_APP_PATH . 'vendor' , '/' ) . '/' , $ sPath ) ; if ( ! $ bIsVendor ) { return static :: getAp...
Attempt to detect which component a class belongs to
46,344
public static function setNailsConstants ( ) { Functions :: define ( 'NAILS_PACKAGE_NAME' , 'Nails' ) ; Functions :: define ( 'NAILS_PACKAGE_URL' , 'http://nailsapp.co.uk/' ) ; Functions :: define ( 'NAILS_BRANDING' , true ) ; Functions :: define ( 'NAILS_PATH' , static :: $ sBaseDirectory . 'vendor/nails/' ) ; Functio...
Set Nails constants
46,345
private static function setupModules ( ) { $ aModuleLocations = [ ] ; $ aModules = Components :: modules ( ) ; $ aAbsolutePaths = [ [ rtrim ( APPPATH , DIRECTORY_SEPARATOR ) , 'modules' ] , [ rtrim ( FCPATH , DIRECTORY_SEPARATOR ) , 'vendor' , 'nails' , 'common' ] , ] ; $ aRelativePaths = [ [ '..' , 'modules' ] , [ '.....
Looks for modules and configures CI
46,346
protected function setDefinitions ( ) { $ aDefinitionLocations = [ ] ; $ aDefinitionLocations [ ] = NAILS_COMMON_PATH . 'config/app_notifications.php' ; foreach ( Components :: modules ( ) as $ oModule ) { $ aDefinitionLocations [ ] = $ oModule -> path . $ oModule -> moduleName . '/config/app_notifications.php' ; } $ a...
Defines the notifications
46,347
public function getDefinitions ( $ grouping = null ) { if ( is_null ( $ grouping ) ) { return $ this -> notifications ; } elseif ( isset ( $ this -> notifications [ $ grouping ] ) ) { return $ this -> notifications [ $ grouping ] ; } else { return [ ] ; } }
Returns the notification defnintions optionally limited per group
46,348
public static function possessive ( $ sString ) { $ sLastChar = substr ( $ sString , - 1 ) ; $ bIsLowerCase = strtolower ( $ sLastChar ) === $ sLastChar ; $ sPossessionChar = $ bIsLowerCase ? 's' : 'S' ; return substr ( $ sString , - 1 ) == $ sPossessionChar ? $ sString . '\'' : $ sString . '\'' . $ sPossessionChar ; }
Correctly adds a possessive apostrophe to a word
46,349
public static function pluralise ( $ iValue , $ sSingular , $ sSpecified = null ) { $ sSingular = trim ( $ sSingular ) ; if ( $ iValue == 1 ) { return $ sSingular ; } else { return $ sSpecified ? : plural ( $ sSingular ) ; } }
Pluralises english words if a value is greater than 1
46,350
public function detectFromFile ( string $ sFile ) : string { if ( ! file_exists ( $ sFile ) ) { return '' ; } $ rHandle = finfo_open ( FILEINFO_MIME_TYPE ) ; $ sMime = finfo_file ( $ rHandle , $ sFile ) ; if ( $ sMime === 'application/octet-stream' || empty ( $ sMime ) ) { $ sMime = $ this -> oDetector -> getType ( $ s...
Detect a file s mimetype first using the system followed by the detector
46,351
public function addMime ( string $ sMime , array $ aExtensions ) : self { $ this -> updateMap ( static :: $ aMapMimeToExtensions , $ sMime , $ aExtensions ) ; foreach ( $ aExtensions as $ sExtension ) { $ this -> updateMap ( static :: $ aMapExtensionToMimes , $ sExtension , [ $ sMime ] ) ; } return $ this ; }
Adds a new mime type to the map and its associated extensions
46,352
public function addExtension ( string $ sExtension , array $ aMimes ) : self { $ this -> updateMap ( static :: $ aMapExtensionToMimes , $ sExtension , $ aMimes ) ; foreach ( $ aMimes as $ sMime ) { $ this -> updateMap ( static :: $ aMapMimeToExtensions , $ sMime , [ $ sExtension ] ) ; } return $ this ; }
Adds a new extension to the map and its associated mime types
46,353
protected function updateMap ( array & $ aMap , string $ sKey , array $ aValues ) : self { if ( ! array_key_exists ( $ sKey , $ aMap ) ) { $ aMap [ $ sKey ] = [ ] ; } $ aMap [ $ sKey ] = array_values ( array_unique ( array_merge ( $ aMap [ $ sKey ] , $ aValues ) ) ) ; return $ this ; }
Updates a map array
46,354
public function getDefault ( ) { $ sDefault = $ this -> oCi -> config -> item ( 'languages_default' ) ; $ oLanguage = $ this -> getByCode ( $ sDefault ) ; return ! empty ( $ oLanguage ) ? $ oLanguage : false ; }
Retursn the default language object
46,355
public function getDefaultCode ( ) { $ oDefault = $ this -> getDefault ( ) ; return empty ( $ oDefault -> code ) ? false : $ oDefault -> code ; }
Returns the default language s code
46,356
public function getDefaultLabel ( ) { $ oDefault = $ this -> getDefault ( ) ; return empty ( $ oDefault -> label ) ? false : $ oDefault -> label ; }
Returns the default language s label
46,357
public function getAllFlat ( ) { $ aOut = [ ] ; $ aLanguages = $ this -> getAll ( ) ; foreach ( $ aLanguages as $ oLanguage ) { $ aOut [ $ oLanguage -> code ] = $ oLanguage -> label ; } return $ aOut ; }
Returns all defined languages as a flat array
46,358
public function getAllEnabled ( ) { $ aEnabled = $ this -> oCi -> config -> item ( 'languages_enabled' ) ; $ aOut = [ ] ; foreach ( $ aEnabled as $ sCode ) { $ aOut [ ] = $ this -> getByCode ( $ sCode ) ; } return array_filter ( $ aOut ) ; }
Returns all the enabled languages
46,359
public function getAllEnabledFlat ( ) { $ aOut = [ ] ; $ aLanguages = $ this -> getAllEnabled ( ) ; foreach ( $ aLanguages as $ oLanguage ) { $ aOut [ $ oLanguage -> code ] = $ oLanguage -> label ; } return $ aOut ; }
Returns all the enabled languages as a flat array
46,360
public function getByCode ( $ sCode ) { $ aLanguages = $ this -> getAll ( ) ; return ! empty ( $ aLanguages [ $ sCode ] ) ? $ aLanguages [ $ sCode ] : false ; }
Returns a language by it s code
46,361
public function site_url ( $ sUrl = '' , $ bForceSecure = false ) { if ( preg_match ( '/^(http|https|ftp|mailto)\:/' , $ sUrl ) ) { return $ sUrl ; } $ sUrl = parent :: site_url ( $ sUrl ) ; if ( preg_match ( '/^\//' , $ sUrl ) && ! empty ( $ _SERVER [ 'HTTP_HOST' ] ) ) { $ sProtocol = ! empty ( $ _SERVER [ 'REQUEST_SC...
Returns the site s URL secured if necessary
46,362
public function delete ( $ mKey , $ sGrouping ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> trans_begin ( ) ; if ( is_array ( $ mKey ) ) { foreach ( $ mKey as $ sKey ) { $ this -> doDelete ( $ sKey , $ sGrouping ) ; } } else { $ this -> doDelete ( $ mKey , $ sGrouping ) ; } if ( $ oDb -> trans_status ( ) ===...
Deletes a key for a particular group
46,363
protected function doDelete ( $ sKey , $ sGrouping ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> where ( 'key' , $ sKey ) ; $ oDb -> where ( 'grouping' , $ sGrouping ) ; return $ oDb -> delete ( $ this -> sTable ) ; }
Actually performs the deletion of the row .
46,364
public function deleteGroup ( $ sGrouping ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> where ( 'grouping' , $ sGrouping ) ; return $ oDb -> delete ( $ this -> sTable ) ; }
Deletes all keys for a particular group .
46,365
private function getContentTypes ( Options $ options ) : array { $ allContentTypes = [ ] ; $ groups = $ this -> contentTypeService -> loadContentTypeGroups ( ) ; $ configuredGroups = $ options [ 'types' ] ; foreach ( $ groups as $ group ) { $ configuredGroups += [ $ group -> identifier => true ] ; if ( $ configuredGrou...
Returns the allowed content types from eZ Platform .
46,366
protected function _validate_request ( $ segments ) { if ( count ( $ segments ) == 0 ) { return $ segments ; } if ( $ located = $ this -> locate ( $ segments ) ) { return $ located ; } if ( isset ( $ this -> routes [ '404_override' ] ) && $ this -> routes [ '404_override' ] ) { $ segments = explode ( '/' , $ this -> ro...
Extending method purely to change the 404 behaviour and PSR - 2 things a little .
46,367
public function load ( $ mAssets , $ sAssetLocation = 'APP' , $ sForceType = null ) : self { $ aAssets = ( array ) $ mAssets ; $ sAssetLocation = $ sAssetLocation === true ? 'NAILS' : $ sAssetLocation ; switch ( strtoupper ( $ sAssetLocation ) ) { case 'NAILS-BOWER' : $ sAssetLocationMethod = 'loadNailsBower' ; break ;...
Loads an asset
46,368
protected function loadUrl ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : $ this -> aCss [ 'URL-' . $ sAsset ] = $ sAsset ; break ; case 'JS' : $ this -> aJs [ 'URL-' . $ sAsset ] = $ sAsset ; break ; } }
Loads an asset supplied as a URL
46,369
protected function loadNails ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : $ this -> aCss [ 'NAILS-' . $ sAsset ] = NAILS_ASSETS_URL . $ this -> sCssDir . $ sAsset ; break ; case 'JS' : $ this -> aJs [ 'NAILS-' . $ sAsset ] = NAILS_ASSETS...
Loads an asset from the Nails asset module
46,370
protected function loadNailsBower ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : $ this -> aCss [ 'NAILS-BOWER-' . $ sAsset ] = NAILS_ASSETS_URL . $ this -> sBowerDir . $ sAsset ; break ; case 'JS' : $ this -> aJs [ 'NAILS-BOWER-' . $ sAss...
Loads a Bower asset from the NAils asset module s bower_components directory
46,371
protected function loadAppBower ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : $ this -> aCss [ 'APP-BOWER-' . $ sAsset ] = $ this -> sBaseUrl . $ this -> sBowerDir . $ sAsset ; break ; case 'JS' : $ this -> aJs [ 'APP-BOWER-' . $ sAsset ]...
Loads a Bower asset from the app s bower_components directory
46,372
protected function loadApp ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : $ this -> aCss [ 'APP-' . $ sAsset ] = $ this -> sBaseUrl . $ this -> sCssDir . $ sAsset ; break ; case 'JS' : $ this -> aJs [ 'APP-' . $ sAsset ] = $ this -> sBaseU...
Loads an asset from the app s asset directory
46,373
protected function loadModule ( $ sAsset , $ sForceType , $ mModule ) { if ( is_array ( $ mModule ) ) { $ sModule = ! empty ( $ mModule [ 0 ] ) ? $ mModule [ 0 ] : null ; $ sLocation = ! empty ( $ mModule [ 1 ] ) ? $ mModule [ 1 ] : null ; } else { $ sModule = $ mModule ; $ sLocation = null ; } $ sType = $ this -> dete...
Loads an asset from a module s asset directory
46,374
public function unload ( $ mAssets , $ sAssetLocation = 'APP' , $ sForceType = null ) { $ aAssets = ( array ) $ mAssets ; $ sAssetLocation = $ sAssetLocation === true ? 'NAILS' : $ sAssetLocation ; switch ( strtoupper ( $ sAssetLocation ) ) { case 'NAILS-BOWER' : $ sAssetLocationMethod = 'unloadNailsBower' ; break ; ca...
Unloads an asset
46,375
protected function unloadUrl ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : unset ( $ this -> aCss [ 'URL-' . $ sAsset ] ) ; break ; case 'JS' : unset ( $ this -> aJs [ 'URL-' . $ sAsset ] ) ; break ; } }
Unloads an asset supplied as a URL
46,376
protected function unloadAbsolute ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : unset ( $ this -> aCss [ 'ABSOLUTE-' . $ sAsset ] ) ; break ; case 'JS' : unset ( $ this -> aJs [ 'ABSOLUTE-' . $ sAsset ] ) ; break ; } }
Unloads an asset supplied as an absolute URL
46,377
protected function unloadNails ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : unset ( $ this -> aCss [ 'NAILS-' . $ sAsset ] ) ; break ; case 'JS' : unset ( $ this -> aJs [ 'NAILS-' . $ sAsset ] ) ; break ; } }
Unloads an asset from the Nails asset module
46,378
protected function unloadNailsBower ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : unset ( $ this -> aCss [ 'NAILS-BOWER-' . $ sAsset ] ) ; break ; case 'JS' : unset ( $ this -> aJs [ 'NAILS-BOWER-' . $ sAsset ] ) ; break ; } }
Loads a Bower asset from the Nails asset module s bower_components directory
46,379
protected function unloadAppBower ( $ sAsset , $ sForceType ) { $ sType = $ this -> determineType ( $ sAsset , $ sForceType ) ; switch ( $ sType ) { case 'CSS' : unset ( $ this -> aCss [ 'APP-BOWER-' . $ sAsset ] ) ; break ; case 'JS' : unset ( $ this -> aJs [ 'APP-BOWER-' . $ sAsset ] ) ; break ; } }
Unloads a Bower asset from the app s bower_components directory
46,380
public function inline ( $ sScript = null , $ sForceType = null , $ sJsLocation = 'FOOTER' ) { if ( ! empty ( $ sScript ) ) { $ sJsLocation = strtoupper ( $ sJsLocation ) ; if ( $ sJsLocation != 'FOOTER' && $ sJsLocation != 'HEADER' ) { throw new AssetException ( '"' . $ sJsLocation . '" is not a valid inline JS locati...
Loads an inline asset
46,381
public function library ( $ sLibrary ) { switch ( strtoupper ( $ sLibrary ) ) { case 'CKEDITOR' : $ this -> load ( [ 'ckeditor/ckeditor.js' , 'ckeditor/adapters/jquery.js' , ] , 'NAILS-BOWER' ) ; break ; case 'JQUERYUI' : $ this -> load ( [ 'jquery-ui/jquery-ui.min.js' , 'jquery-ui/themes/smoothness/jquery-ui.min.css' ...
Loads a set of assets
46,382
public function clear ( ) { $ this -> aCss = [ ] ; $ this -> aCssInline = [ ] ; $ this -> aJs = [ ] ; $ this -> aJsInlineHeader = [ ] ; $ this -> aJsInlineFooter = [ ] ; return $ this ; }
Clears all loaded assets
46,383
public function getLoaded ( ) { $ oLoaded = new \ stdClass ( ) ; $ oLoaded -> css = $ this -> aCss ; $ oLoaded -> cssInline = $ this -> aCssInline ; $ oLoaded -> js = $ this -> aJs ; $ oLoaded -> jsInlineHeader = $ this -> aJsInlineHeader ; $ oLoaded -> jsInlineFooter = $ this -> aJsInlineFooter ; return $ oLoaded ; }
Returns an object containing all loaded assets useful for debugging .
46,384
public function output ( $ sType = 'ALL' , $ bOutput = true ) { $ aOut = [ ] ; $ sType = strtoupper ( $ sType ) ; if ( ! empty ( $ this -> aCss ) && ( $ sType == 'CSS' || $ sType == 'ALL' ) ) { foreach ( $ this -> aCss as $ sAsset ) { $ sAsset = $ this -> addCacheBuster ( $ sAsset ) ; $ aOut [ ] = link_tag ( $ sAsset )...
Output the assets for HTML
46,385
protected function addCacheBuster ( $ sAsset ) { if ( $ this -> sCacheBuster ) { $ aParsedUrl = parse_url ( $ sAsset ) ; if ( empty ( $ aParsedUrl [ 'query' ] ) ) { $ sAsset .= '?' ; } else { $ sAsset .= '&' ; } $ sAsset .= 'revision=' . $ this -> sCacheBuster ; } return $ sAsset ; }
Appends the cacheBuster string to the asset name accounts for existing query strings
46,386
protected function determineType ( $ sAsset , $ sForceType = null ) { if ( ! empty ( $ sForceType ) ) { return $ sForceType ; } if ( preg_match ( '/^<style.*?>.*?<\/style>$/si' , $ sAsset ) ) { return 'CSS-INLINE' ; } if ( preg_match ( '/^<script.*?>.*?<\/script>$/si' , $ sAsset ) ) { return 'JS-INLINE' ; } if ( substr...
Determines the type of asset being loaded
46,387
protected function resetProperties ( $ aProperties ) { foreach ( $ aProperties as $ aProperty ) { if ( property_exists ( $ this -> oDb , $ aProperty [ 0 ] ) ) { $ this -> oDb -> { $ aProperty [ 0 ] } = $ aProperty [ 1 ] ; } } return $ this ; }
Safely resets properties
46,388
protected function compile ( array & $ aClientConfig , array & $ aRequestOptions ) { parent :: compile ( $ aClientConfig , $ aRequestOptions ) ; $ aRequestOptions [ 'form_params' ] = $ this -> aFormParams ; }
Compile the request
46,389
private function buildMainLocationParameters ( ParameterBuilderInterface $ builder , array $ groups = [ ] ) : void { $ builder -> add ( 'only_main_locations' , ParameterType \ BooleanType :: class , [ 'default_value' => true , 'groups' => $ groups , ] ) ; }
Builds the parameters for filtering content with main location only .
46,390
private function getMainLocationFilterCriteria ( ParameterCollectionInterface $ parameterCollection ) : ? Criterion { if ( $ parameterCollection -> getParameter ( 'only_main_locations' ) -> getValue ( ) !== true ) { return null ; } return new Criterion \ Location \ IsMainLocation ( Criterion \ Location \ IsMainLocation...
Returns the criteria used to filter content with main location only .
46,391
private function loadLocation ( ) : ? Location { if ( ! $ this -> context -> has ( 'ez_location_id' ) ) { return null ; } return $ this -> locationService -> loadLocation ( ( int ) $ this -> context -> get ( 'ez_location_id' ) ) ; }
Loads the location from the eZ Platform API by using the location ID stored in the context .
46,392
private function buildQueryTypeParameters ( ParameterBuilderInterface $ builder , array $ groups = [ ] ) : void { $ builder -> add ( 'query_type' , ParameterType \ ChoiceType :: class , [ 'required' => true , 'options' => [ 'List' => 'list' , 'Tree' => 'tree' , ] , 'groups' => $ groups , ] ) ; }
Builds the parameters for selecting a query type .
46,393
private function getQueryTypeFilterCriteria ( ParameterCollectionInterface $ parameterCollection , Location $ parentLocation ) : ? Criterion { if ( $ parameterCollection -> getParameter ( 'query_type' ) -> getValue ( ) !== 'list' ) { return null ; } return new Criterion \ Location \ Depth ( Criterion \ Operator :: EQ ,...
Returns the criteria used to filter content with one of the supported query types .
46,394
public static function convert ( string $ uuid ) { $ bin = hex2bin ( str_replace ( [ '{' , '-' , '}' ] , '' , $ uuid ) ) ; $ xor = self :: xor ( ... str_split ( $ bin , 8 ) ) ; return unpack ( 'q' , $ xor ) [ 1 ] ; }
Convert a uuid to a 64 - bit signed integer .
46,395
public static function isPageSecure ( ) { if ( isset ( $ _SERVER [ 'HTTPS' ] ) && strtolower ( $ _SERVER [ 'HTTPS' ] ) === 'on' ) { return true ; } elseif ( isset ( $ _SERVER [ 'SERVER_NAME' ] ) && isset ( $ _SERVER [ 'REQUEST_URI' ] ) && SECURE_BASE_URL != BASE_URL ) { $ sUrl = 'http://' . $ _SERVER [ 'SERVER_NAME' ] ...
Detects whether the current page is secure or not
46,396
public function getAsString ( ) : string { return implode ( '_' , array_filter ( [ ( string ) $ this -> getLanguage ( ) , ( string ) $ this -> getRegion ( ) , ( string ) $ this -> getScript ( ) , ] ) ) ; }
Compute the string representation of the locale
46,397
public function write ( $ mData , string $ sKey = null ) : Item { if ( is_null ( $ sKey ) ) { $ sKey = md5 ( microtime ( true ) ) ; } $ sPath = $ this -> prepKey ( $ sKey ) ; file_put_contents ( $ sPath , $ mData ) ; return $ this -> newItem ( $ sKey ) ; }
Writes to the cache
46,398
public function read ( string $ sKey ) : ? Item { return $ this -> exists ( $ sKey ) ? $ this -> newItem ( $ sKey ) : null ; }
Reads a file from the cache
46,399
public function delete ( string $ sKey ) : bool { if ( $ this -> exists ( $ sKey ) ) { return @ unlink ( $ this -> prepKey ( $ sKey ) ) ; } else { return false ; } }
Delete a cache item