idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
47,800
public function get ( $ meta ) { return isset ( $ this -> parsed [ $ meta ] ) ? $ this -> parsed [ $ meta ] : null ; }
Gets the meta value by name null returned if not found
47,801
public function addRule ( $ pattern , $ replacement = null ) { if ( is_object ( $ pattern ) && method_exists ( $ pattern , 'toArray' ) ) $ pattern = $ pattern -> toArray ( ) ; if ( is_object ( $ replacement ) && method_exists ( $ replacement , 'toArray' ) ) $ replacement = $ replacement -> toArray ( ) ; if ( ! ( is_arr...
Add a rule to the set of rules in this BBCode instance
47,802
public function apply ( $ txt ) { if ( ! is_string ( $ txt ) ) throw new \ RuntimeException ( "Argument should be a string" ) ; foreach ( $ this -> rules as $ pattern => $ replacement ) { if ( is_callable ( $ replacement ) ) $ txt = preg_replace_callback ( $ pattern , $ replacement , $ txt ) ; else $ txt = preg_replace...
Apply all the configured rules to the provided text and return the result
47,803
protected function renderPage ( $ page , $ options = array ( ) ) { $ this -> render ( __DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $ page . '.php' , $ options ) ; }
Render a selected view .
47,804
protected function flatReference ( array $ reference ) { reset ( $ reference ) ; foreach ( $ reference as $ key => $ value ) { if ( is_object ( $ value ) ) { $ reference [ $ key ] = get_class ( $ value ) ; } elseif ( is_array ( $ value ) ) { $ reference [ $ key ] = $ this -> flatReference ( $ value ) ; } } ksort ( $ re...
flat the reference array to make it easy for serialize
47,805
protected function setContent ( $ content ) { $ this -> content = ( string ) $ content ; if ( empty ( $ this -> content ) ) { throw new \ Exception ( 'Header content is empty !' ) ; } return $ this ; }
Set header content
47,806
protected function setHttpCode ( $ httpCode = null ) { if ( $ httpCode !== null ) { $ this -> httpCode = ( int ) $ httpCode ; if ( ! HttpCode :: exists ( $ this -> httpCode ) ) { throw new \ DomainException ( 'Http Code does not exist! (code: ' . $ this -> httpCode . ')' ) ; } } return $ this ; }
Set http code for the header
47,807
protected function determineInputFiles ( ) { if ( empty ( $ this -> route -> getParameters ( ) -> files ) ) { $ this -> setNotReady ( "No input files found." , null , 404 ) ; return ; } if ( is_array ( $ this -> route -> getParameters ( ) -> files ) ) { foreach ( $ this -> route -> getParameters ( ) -> files as $ file ...
Determine input files from the route parameters
47,808
private function addFileObject ( $ file ) { $ file = $ this -> getActualFilename ( $ file ) ; try { $ this -> concatenator -> addObject ( $ file , [ ] ) ; } catch ( \ Exception $ e ) { $ this -> system -> log ( ) -> error ( "Failed to add concatenator object: " . $ file ) ; } }
Add a file object
47,809
public function cmdGetAddress ( ) { $ result = $ this -> getListAddress ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableAddress ( $ result ) ; $ this -> output ( ) ; }
Callback for address - get command
47,810
public function cmdUpdateAddress ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ...
Callback for address - update command
47,811
protected function addAddress ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> address -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } }
Add a new address
47,812
protected function updateAddress ( $ address_id ) { if ( ! $ this -> isError ( ) && ! $ this -> address -> update ( $ address_id , $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Updates an address
47,813
protected function submitAddAddress ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedJson ( 'data' ) ; $ this -> validateComponent ( 'address' ) ; $ this -> addAddress ( ) ; }
Add a new address at once
47,814
protected function wizardAddAddress ( ) { $ types = $ this -> address -> getTypes ( ) ; $ this -> validateMenu ( 'type' , $ this -> text ( 'Address type' ) , 'address' , array_combine ( $ types , $ types ) , 'shipping' ) ; $ this -> validatePrompt ( 'user_id' , $ this -> text ( 'User ID' ) , 'address' ) ; $ this -> val...
Add a new address step by step
47,815
public function remove ( $ key ) { return ( $ this -> memcache ) ? $ this -> memcache -> remove ( $ this -> prefix . '_' . $ key ) : false ; }
Remove Memcache key
47,816
protected function checkRootNode ( ) { $ id = ( int ) Application :: getRequest ( ) -> get ( 'id' ) ; $ repository = $ this -> getEntityManager ( ) -> getRepository ( $ this -> entityName ) ; if ( $ node = $ repository -> find ( $ id ) ) { return $ node -> getLevel ( ) > 1 ; } return false ; }
If node not root then method return true
47,817
static function array2Parameters ( $ params , $ stringdelim ) { $ s = "" ; foreach ( $ params as $ p ) { if ( is_int ( $ p ) ) $ s .= "$p, " ; else $ s .= $ stringdelim . $ p . $ stringdelim . ", " ; } if ( $ s ) $ s = substr ( $ s , 0 , - 2 ) ; return $ s ; }
Convert an array to a commas separated string of parameters
47,818
static function is_associative_array ( $ a , $ ifEmptyAssociativeArray = false ) { if ( ! is_array ( $ a ) ) return false ; if ( count ( $ a ) == 0 ) return $ ifEmptyAssociativeArray ; $ keys = array_keys ( $ a ) ; foreach ( $ keys as $ k ) if ( ! is_int ( $ k ) ) return true ; return max ( $ keys ) + 1 != count ( $ a ...
Test if a given array is associative or has only numeric keys
47,819
static function matchAll ( $ pattern , $ buffer , $ vars , & $ matches ) { $ tmp = array ( ) ; if ( preg_match_all ( $ pattern , $ buffer , $ tmp , PREG_SET_ORDER ) === FALSE ) return false ; else { for ( $ m = 0 ; $ m < count ( $ tmp ) ; $ m ++ ) { $ res = array ( ) ; for ( $ v = 0 ; $ v < count ( $ vars ) ; $ v ++ ) ...
Convenient function to extract data from a string through a regular expression .
47,820
static function string2associativeArray ( $ str , $ sep , $ sepval , $ valIfEmpty = NULL ) { $ str = explode ( $ sep , $ str ) ; $ ret = array ( ) ; foreach ( $ str as $ s ) { $ s = explode ( $ sepval , $ s ) ; if ( count ( $ s ) == 2 ) $ ret [ $ s [ 0 ] ] = ( $ s [ 1 ] != '' ) ? $ s [ 1 ] : $ valIfEmpty ; } return $ r...
Decode a string to an associative array
47,821
static function explodeAssociativeArray ( $ str , $ sep = ';' , $ sepval = '=' , $ valIfEmpty = NULL ) { return self :: string2associativeArray ( $ str , $ sep , $ sepval , $ valIfEmpty ) ; }
Synonymous for string2associativeArray with default values for separators
47,822
private function getPoolsSection ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'pools' ) ; $ node -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'helper' ) -> isRequired ( ) -> addDefaultsIfNotSet ( ) -> children ( ) -> variableNode ( 'templates' ) -> defaultValue ( [ '_form.html' => '...
Returns the pools configuration definition .
47,823
public function getTree ( ObjectCollection $ objectCollection , int $ left = 0 , int $ right = NULL ) : array { $ items = [ ] ; foreach ( $ objectCollection as $ item ) { $ items [ ] = $ item ; } $ tree = $ this -> generateTree ( $ items , $ left , $ right ) ; return $ tree ; }
Metoda pro transformaci nested tree do multilevel pole
47,824
public function getFlatCollection ( array $ tree ) : ObjectCollection { $ data = [ ] ; array_walk_recursive ( $ tree , function ( $ item ) use ( & $ data ) { if ( $ item !== NULL ) { $ data [ ] = $ item ; } } ) ; return new ObjectCollection ( $ data ) ; }
Metoda pro transformaci multilevel pole do flat ObjectCollection
47,825
public function date ( string $ format = Date :: DISPLAY_FORMAT ) : DateFieldBuilder { return new DateFieldBuilder ( $ this -> field -> type ( new DateType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a Date instance .
47,826
public function dateTime ( string $ format = DateTime :: DISPLAY_FORMAT ) : DateTimeFieldBuilder { return new DateTimeFieldBuilder ( $ this -> field -> type ( new DateTimeType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a DateTime instance .
47,827
public function time ( string $ format = TimeOfDay :: DEFAULT_FORMAT ) : TimeOfDayFieldBuilder { return new TimeOfDayFieldBuilder ( $ this -> field -> type ( new TimeOfDayType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a TimeOfDay instance .
47,828
public function dateTimeWithTimezone ( string $ format = TimezonedDateTime :: DISPLAY_FORMAT ) : TimezonedDateTimeFieldBuilder { return new TimezonedDateTimeFieldBuilder ( $ this -> field -> type ( new TimezonedDateTimeType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a TimezonedDateTime instance .
47,829
public function dateRange ( string $ format = Date :: DISPLAY_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new DateRangeType ( $ format ) ) ; }
Validates the input as a date range and converts it to an instance of DateRange .
47,830
public function dateTimeRange ( string $ format = DateTime :: DISPLAY_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new DateTimeRangeType ( $ format ) ) ; }
Validates the input with the supplied format and converts the input to a DateTimeRange instance .
47,831
public function timeRange ( string $ format = TimeOfDay :: DEFAULT_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new TimeRangeType ( $ format ) ) ; }
Validates the input with the supplied format and converts the input to a TimeRange instance .
47,832
public function dateTimeWithTimezoneRange ( string $ format = TimezonedDateTime :: DISPLAY_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new TimezonedDateTimeRangeType ( $ format ) ) ; }
Validates the input with the supplied format and converts the input to a TimezonedDateTimeRange instance .
47,833
public function multipleFrom ( array $ valueLabelMap ) : ArrayOfFieldBuilder { return $ this -> arrayOf ( Field :: element ( ) -> string ( ) -> oneOf ( $ valueLabelMap ) -> required ( ) ) -> containsNoDuplicates ( ) ; }
Validates the input as an an array only containing elements which are in the supplied value map
47,834
public function nsPush ( ) { $ nsName = self :: DELIMITER . ( self :: $ _pushID ++ ) ; $ this -> _data [ $ nsName ] = array ( ) ; $ this -> _current = & $ this -> _data [ $ nsName ] ; $ this -> _names [ ] = & $ this -> _current ; $ this -> _pushedData [ ] = $ nsName ; }
Pushes namespace .
47,835
public function nsPop ( ) { array_pop ( $ this -> _names ) ; $ this -> _current = & $ this -> _names [ sizeof ( $ this -> _names ) - 1 ] ; unset ( $ this -> _data [ array_pop ( $ this -> _pushedData ) ] ) ; }
Pops namespace .
47,836
private function _shiftTmp ( $ path ) { if ( $ path ) { $ names = explode ( self :: DELIMITER , $ path ) ; foreach ( $ names as $ name ) { if ( ! is_array ( $ this -> _tmp ) ) { $ this -> _tmp = array ( ) ; } if ( ! isset ( $ this -> _tmp [ $ name ] ) ) { $ this -> _tmp [ $ name ] = null ; } $ this -> _tmp = & $ this -...
It shifts .
47,837
public function joinOnMatch ( $ nickname , UserEventInterface $ event , EventQueueInterface $ queue ) { if ( $ nickname == $ event -> getConnection ( ) -> getNickname ( ) && ( $ index = array_search ( $ event -> getSource ( ) , $ this -> channels ) ) !== false ) { $ queue -> ircJoin ( $ this -> channels [ $ index ] , $...
Joins a channel if nickname and channel matches the own nickname and a channel in channels configuration respectively .
47,838
public function onPartChannels ( UserEventInterface $ event , EventQueueInterface $ queue ) { $ this -> joinOnMatch ( $ event -> getNick ( ) , $ event , $ queue ) ; }
Listen for part channel events .
47,839
public function onKickChannels ( UserEventInterface $ event , EventQueueInterface $ queue ) { $ this -> joinOnMatch ( $ event -> getParams ( ) [ 'user' ] , $ event , $ queue ) ; }
Listen for kick channel events .
47,840
public function query ( $ queryString , $ suggestedClass = NULL ) { if ( ! empty ( $ this -> log ) ) { $ this -> log -> debug ( "Performing SQL: " . $ queryString . '...' , 'DATABASE' ) ; } $ result = $ this -> mysqli -> query ( $ queryString ) ; if ( ! empty ( $ this -> mysqli -> error ) ) { throw new \ Slab \ Databas...
Perform a standard query
47,841
public function buildInsertQuery ( $ table , $ data ) { $ sql = "INSERT INTO " . $ this -> quoteSpecialName ( $ table ) . " " ; if ( ! empty ( $ data [ 'ON DUPLICATE' ] ) ) { $ onDuplicate = $ data [ 'ON DUPLICATE' ] ; unset ( $ data [ 'ON DUPLICATE' ] ) ; } $ keys = $ values = '' ; foreach ( $ data as $ key => $ value...
Perform an insert query
47,842
protected function quoteSpecialName ( $ name ) { if ( $ name [ 0 ] == '`' && $ name [ mb_strlen ( $ name ) - 1 ] == '`' ) return $ name ; $ name = '`' . $ name . '`' ; $ name = str_replace ( '.' , '`.`' , $ name ) ; return $ name ; }
MySQL style special naming backticks quotes
47,843
public function buildUpdateQuery ( $ table , $ data , $ where , $ limit ) { $ sql = "UPDATE " . $ this -> quoteSpecialName ( $ table ) . " SET " ; $ values = '' ; foreach ( $ data as $ key => $ value ) { if ( ! empty ( $ values ) ) $ values .= ', ' ; $ values .= $ this -> quoteSpecialName ( $ key ) . ' = ' . $ this -> ...
Update a table
47,844
public function wheel ( $ table , $ column , $ value , $ separator = '_' , $ maxTries = 10 ) { $ tempValue = $ value ; for ( $ i = 2 ; $ i <= $ maxTries ; ++ $ i ) { $ result = $ this -> query ( "select count(*) as cnt from " . $ this -> quoteSpecialName ( $ table ) . " where " . $ this -> quoteSpecialName ( $ column )...
Wheel a string value in the database
47,845
private function CreateSettings ( ) { $ this -> settings = new Settings ( ) ; $ this -> settings -> SetLogLifetime ( 90 ) ; $ this -> settings -> SetChangeRequestLifetime ( 30 ) ; $ this -> settings -> SetSmtpSecurity ( ( string ) Enums \ SmtpSecurity :: None ( ) ) ; $ admin = $ this -> FirstAdmin ( ) ; if ( $ admin ) ...
Creates the settings initally
47,846
private function FirstAdmin ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tblUser = User :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblUser -> Field ( 'IsAdmin' ) , $ sql -> Value ( true ) ) ; $ orderBy = $ sql -> OrderList ( $ sql -> OrderAsc ( $ tblUser -> Field ( 'ID' ) ) ) ; return User :: Schema ( ) -...
Gets the first user that is an admin
47,847
public static function onChange ( PathInterface $ cache , Loader $ load = null ) : self { $ self = new self ( $ cache , $ load ) ; $ self -> debug = true ; return $ self ; }
The cached container will be recompiled if the definition file has changed since the last compilation
47,848
public function boot ( ) { session_start ( ) ; $ this -> registerWhoops ( ) ; $ route = ( empty ( $ _REQUEST [ '_' ] ) ? '/' : htmlspecialchars ( $ _REQUEST [ '_' ] ) ) ; require_once ( PATH . '/app/routes.php' ) ; return Route :: execute ( $ route ) ; }
Boot Sectorr application .
47,849
protected function registerWhoops ( ) { $ whoops = new \ Whoops \ Run ; $ whoops -> pushHandler ( new \ Whoops \ Handler \ PrettyPageHandler ) ; $ whoops -> register ( ) ; }
Register Whoops error handler .
47,850
protected function childbearing ( \ DOMNode $ node ) { if ( $ node -> hasChildNodes ( ) ) { foreach ( $ node -> childNodes as $ child ) { if ( $ child -> nodeType === XML_ELEMENT_NODE ) { return true ; } } } return false ; }
Checks if a specified node has children .
47,851
protected function minify ( $ html ) { $ html = str_replace ( '<?xml encoding="UTF-8">' , '' , $ html ) ; $ html = trim ( preg_replace ( '/\s+/' , ' ' , $ html ) ) ; $ html = str_replace ( '> <' , '><' , $ html ) ; return str_replace ( array ( ' />' , '/>' ) , '>' , $ html ) ; }
Minifies the specified HTML .
47,852
protected function remove ( \ DOMNodeList $ elements ) { $ encoded = array ( 'textarea' , 'code' ) ; foreach ( $ elements as $ element ) { if ( $ this -> childbearing ( $ element ) ) { continue ; } $ output = ( string ) $ element -> nodeValue ; if ( in_array ( $ element -> nodeName , $ encoded ) ) { $ output = htmlenti...
Removes the content of single elements .
47,853
protected function restore ( $ html ) { foreach ( $ this -> data as $ index => $ item ) { $ key = ( string ) '$' . $ index . '$' ; $ html = str_replace ( $ key , $ item , $ html ) ; } return ( string ) $ html ; }
Restores the data into the minified HTML .
47,854
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ rootDir = $ this -> getRootDir ( ) ; $ stagingName = $ input -> getOption ( 'staging-name' ) ; $ stagingPath = $ this -> getCapistranoDir ( ) . '/deploy/' ; $ staging = sprintf ( '%s%s.rb' , $ stagingPath , $ stagingName ) ; $ output -...
Deploys application .
47,855
public function actionIndex ( ) { $ cards = $ this -> loadDashboardCards ( ) ; $ cardData = array ( ) ; foreach ( $ cards -> value as $ id => $ url ) { $ metadata = $ this -> loadCardDetailsModel ( $ id ) ; $ cardData [ $ id ] = $ metadata -> value ; } return array ( 'cards' => $ cards -> value , 'cardData' => $ cardDa...
Retrieves all the dashboard cards for the current user
47,856
public function actionIndexPost ( ) { $ cards = $ this -> loadDashboardCards ( ) ; $ id = Cii :: get ( $ _POST , 'id' , false ) ; $ url = Cii :: get ( $ _POST , 'url' , false ) ; $ data = Cii :: get ( $ _POST , 'details' , false ) ; if ( $ id === false || $ url === false || $ data == false ) throw new CHttpException ( ...
Installs a new card to the dashboard cards and adds the appropriate settings to the database
47,857
public function actionIndexDelete ( $ id = NULL ) { $ cards = $ this -> loadDashboardCards ( ) ; $ value = $ cards -> value ; if ( array_key_exists ( $ id , $ value ) ) unset ( $ value [ $ id ] ) ; $ cards -> value = CJSON :: encode ( $ value ) ; if ( $ cards -> save ( ) ) { $ newCard = $ this -> loadCardDetailsModel (...
Deletes a card from the dashboard
47,858
private function loadDashboardCards ( ) { $ model = UserMetadata :: model ( ) -> getPrototype ( 'UserMetadata' , array ( 'user_id' => $ this -> user -> id , 'key' => 'dashboard_cards' ) , array ( 'value' => '{}' ) ) ; $ model -> value = CJSON :: decode ( $ model -> value ) ; return $ model ; }
Loads all the dashboard cards in order for this particular user
47,859
private function loadCardDetailsModel ( $ id = NULL ) { if ( $ id == NULL ) throw new CHttpException ( 400 , Yii :: t ( 'Api.card' , 'Missing card ID' ) ) ; $ model = UserMetadata :: model ( ) -> getPrototype ( 'UserMetadata' , array ( 'user_id' => $ this -> user -> id , 'key' => $ id . '_card_settings' ) , array ( 'va...
Returns a UserMetadata Object for a given card containing the properties and settings for that card .
47,860
final public function setView ( View $ view ) { $ this -> view = $ view ; $ this -> publicAssetsPath = ROOT . 'public' . DIRECTORY_SEPARATOR . '.assets' . DIRECTORY_SEPARATOR ; return $ this ; }
Sets the view to render
47,861
protected function module ( $ check = null ) { $ module = Util :: camelToHyphen ( $ this -> view -> getModule ( ) ) ; return $ check ? ( $ check == $ module ) : $ module ; }
Fetches the current module
47,862
protected function controller ( $ check = null ) { $ controller = Util :: camelToHyphen ( $ this -> view -> getController ( ) -> getClassName ( ) ) ; return $ check ? ( $ check == $ controller ) : $ controller ; }
Fetches the current controller
47,863
protected function params ( $ check = null ) { $ params = $ this -> view -> getParams ( ) ; if ( $ check ) { if ( is_array ( $ check ) ) { $ inter = array_intersect ( $ check , $ params ) ; return ( count ( $ inter ) === count ( $ check ) ) ; } else { return in_array ( $ check , $ params ) ; } } return $ params ; }
Fetches the parameters set to the current action
47,864
final public function loadLayout ( $ layoutName , array $ variables = array ( ) , $ fromTheme = false ) { $ dsLayout = $ this -> getLayoutPath ( $ layoutName , $ fromTheme ) ; if ( ! $ dsLayout ) return '' ; foreach ( $ variables as $ var => $ value ) { $ $ var = $ value ; } include $ dsLayout ; }
Loads a layout
47,865
private function getLayoutPath ( $ layout = null , $ fromTheme = false ) { $ layout = ( $ layout === null ) ? $ this -> view -> getController ( ) -> getLayout ( ) : $ layout ; if ( ! $ layout ) return false ; if ( ! $ fromTheme && is_readable ( MODULES . $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . 'View' . ...
Fetches the layout path
47,866
final public function render ( $ content = null ) { if ( $ content === null ) { foreach ( $ this -> view -> getVariables ( ) as $ var => $ val ) { $ $ var = $ val ; } $ viewFile = $ this -> view -> getViewFile ( ) ; if ( ! is_readable ( MODULES . $ viewFile [ 0 ] . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . '...
Renders the action content to the browser
47,867
private function updateAssets ( $ file ) { $ modulesAssets = MODULES . $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR ; $ themeAssets = THEMES . engineGet ( 'config' , 'defaults' , 'theme' ) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR ; i...
updates the cached asset files
47,868
private function getFile ( $ file , $ fromTheme ) { $ this -> updateAssets ( $ file ) ; if ( ! $ fromTheme && is_readable ( $ this -> publicAssetsPath . $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . $ file ) ) { return $ this -> parseFile ( $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . $ file ) ; } ...
Fetches the path to file
47,869
final protected function loadCss ( $ css , $ fromTheme = false , $ once = false ) { if ( $ once && ! $ this -> canLoadAsset ( $ css , 'css' ) ) return null ; return '<link rel="stylesheet" type="text/css" href="' . $ this -> getFile ( $ css . '.css' , $ fromTheme ) . '" />' . "\n" ; }
Loads a style sheet file
47,870
final protected function loadJs ( $ src , $ fromTheme = false , $ once = false ) { if ( $ once && ! $ this -> canLoadAsset ( $ src , 'js' ) ) return null ; return '<script type="text/javascript" src="' . $ this -> getFile ( $ src . '.js' , $ fromTheme ) . '"></script>' . "\n" ; }
Loads a javascript file
47,871
final protected function loadIcon ( $ src , $ fromTheme = false , $ once = true ) { if ( $ once && ! $ this -> canLoadAsset ( $ src , 'icon' ) ) return null ; return '<link rel="shortcut icon" href="' . $ this -> getFile ( $ src , $ fromTheme ) . '"/>' . "\n" ; }
Loads the icon for the page
47,872
final protected function canLoadAsset ( $ file , $ type ) { $ filename = basename ( $ file ) ; if ( in_array ( $ filename , $ this -> loadedAssets [ $ type ] ) ) return false ; $ this -> loadedAssets [ $ type ] [ ] = $ filename ; return true ; }
Checks if the asset has not been loaded before
47,873
final public function url ( $ module , $ controller = null , $ action = null , array $ params = array ( ) , $ hash = null ) { return $ this -> view -> url ( $ module , $ controller , $ action , $ params , $ hash ) ; }
Fetches the url path the a resource
47,874
public function getId ( ) { return base64_encode ( $ this -> path . implode ( '' , $ this -> parameters ) . implode ( '' , $ this -> body ) . $ this -> method ) ; }
Return an id unique for this request with identical parameters
47,875
public function returnWebServiceSerialisableData ( ) { $ serialisableMap = $ this -> __getSerialisablePropertyMap ( ) ; unset ( $ serialisableMap [ "trace" ] ) ; unset ( $ serialisableMap [ "file" ] ) ; unset ( $ serialisableMap [ "line" ] ) ; unset ( $ serialisableMap [ "traceAsString" ] ) ; unset ( $ serialisableMap ...
Return web service serialisable data
47,876
protected function redirectToLanguage ( $ language ) { $ result = parent :: parseRequest ( $ this -> _request ) ; if ( $ result === false ) { throw new NotFoundHttpException ( Yii :: t ( 'yii' , 'Page not found.' ) ) ; } list ( $ route , $ params ) = $ result ; if ( $ language ) { $ params [ $ this -> languageParam ] =...
Redirect to the current URL with given language code applied
47,877
public function getSubRoles ( Role $ role ) { $ parentName = $ role -> getRoleName ( ) ; $ subRoles = [ ] ; if ( array_key_exists ( $ role -> getRoleName ( ) , $ this -> mappedRoleNames ) ) { foreach ( $ this -> mappedRoleNames [ $ parentName ] as $ subRoleName ) { $ subRoles [ ] = new Role ( $ subRoleName ) ; } } retu...
get all possible sub roles of a role
47,878
private function buildRoleMap ( ) { $ this -> mappedRoleNames = [ ] ; foreach ( $ this -> hierarchy as $ parent => $ roles ) { $ roles = array_map ( 'strtolower' , $ roles ) ; $ this -> mappedRoleNames [ $ parent ] = $ roles ; $ additionalRoles = $ roles ; $ foundParent = [ ] ; while ( $ role = array_shift ( $ addition...
build the map which maps all sub - roles on any level to any of their parent roles
47,879
protected function _reset ( ) { $ tracker = $ this -> _getTracker ( ) ; $ this -> _resetTracker ( $ tracker ) ; $ iteration = $ this -> _createIterationFromTracker ( $ tracker ) ; return $ iteration ; }
Resets the loop and calculates the first iteration .
47,880
protected function _loop ( ) { $ tracker = $ this -> _getTracker ( ) ; $ this -> _advanceTracker ( $ tracker ) ; $ iteration = $ this -> _createIterationFromTracker ( $ tracker ) ; return $ iteration ; }
Advances the loop and calculates the next iteration .
47,881
final protected static function _readHeaders ( ) { if ( empty ( static :: $ _request_headers ) ) { $ headers = function_exists ( 'getallheaders' ) ? getallheaders ( ) : [ ] ; $ keys = array_keys ( $ headers ) ; array_walk ( $ keys , [ __CLASS__ , '_cleanHeader' ] ) ; static :: $ _request_headers = array_combine ( $ key...
Protected method to get the headers array cleaned for usage with magic methods
47,882
protected function doMapping ( $ source , $ targetType , PropertyMappingConfigurationInterface $ configuration , & $ currentPropertyPath ) { if ( $ source === null ) { return null ; } $ typeConverter = $ this -> getTypeConverter ( $ source , $ targetType , $ configuration ) ; $ targetType = ltrim ( $ typeConverter -> g...
Will recursively fill all the properties of the configuration object .
47,883
protected function convertChildProperties ( array $ source , $ targetType , TypeConverterInterface $ typeConverter , PropertyMappingConfigurationInterface $ configuration , array & $ currentPropertyPath ) { $ convertedChildProperties = [ ] ; $ properties = $ source ; if ( Core :: get ( ) -> classExists ( $ targetType )...
Will convert all the properties of the given source depending on the target type .
47,884
protected function handleDataPreProcessor ( $ source , $ targetType , $ currentPropertyPath ) { if ( $ this -> serviceFactory -> has ( ServiceInterface :: SERVICE_DATA_PRE_PROCESSOR ) ) { $ dataProcessorService = $ this -> serviceFactory -> get ( ServiceInterface :: SERVICE_DATA_PRE_PROCESSOR ) ; $ processor = $ dataPr...
Will check if the target type is a class then call functions which will check the interfaces of the class .
47,885
protected function getTypeConverter ( $ source , $ targetType , $ configuration ) { $ compositeType = $ this -> parseCompositeType ( $ targetType ) ; if ( in_array ( $ compositeType , [ '\\ArrayObject' , 'array' ] ) ) { $ typeConverter = $ this -> objectManager -> get ( ArrayConverter :: class ) ; } else { $ typeConver...
This function will fetch the type converter which will convert the source to the requested target type .
47,886
protected function getProperties ( $ targetType ) { $ properties = ReflectionService :: get ( ) -> getClassReflection ( $ targetType ) -> getProperties ( ) ; $ propertiesKeys = array_map ( function ( PropertyReflection $ propertyReflection ) { return $ propertyReflection -> getName ( ) ; } , $ properties ) ; return arr...
Internal function that fetches the properties of a class .
47,887
public function register ( $ entityClass , $ repositoryClass ) { $ entityName = \ Bond \ get_unqualified_class ( $ entityClass ) ; if ( isset ( $ this -> names [ $ entityName ] ) ) { throw new EntityAlreadyRegisteredException ( $ entityClass , $ repositoryClass , $ this ) ; } $ this -> names [ $ entityName ] = $ entity...
Register a entity .
47,888
function MkdirForFile ( $ filename , & $ error = null , & $ error_str = null ) { $ directory = preg_replace ( '/[^\/]+$/' , '' , $ filename ) ; if ( ! strlen ( $ directory ) ) { $ error = true ; $ error_str = "can't determine directory name" ; return ; } return self :: Mkdir ( $ directory , $ error , $ error_str ) ; }
Created a directory for the given filename .
47,889
static function CopyFile ( $ from_file , $ to_file , & $ error = null , & $ error_str = null ) { $ bytes = 0 ; $ error = false ; $ error_str = "" ; settype ( $ from_file , "string" ) ; settype ( $ to_file , "string" ) ; $ in = fopen ( $ from_file , "r" ) ; if ( ! $ in ) { $ error = true ; $ error_str = "can't open inpu...
Creates a copy of a file .
47,890
static function AppendToFile ( $ file , $ content , & $ error = null , & $ error_str = null ) { return Files :: WriteToFile ( $ file , $ content , $ error , $ error_str , array ( "file_open_mode" => "a" ) ) ; }
Appends content to the given file .
47,891
static function IsUploadedFile ( $ filename ) { settype ( $ filename , "string" ) ; if ( ! file_exists ( $ filename ) ) { return false ; } if ( is_dir ( $ filename ) ) { return false ; } if ( ! is_uploaded_file ( $ filename ) ) { return false ; } if ( fileowner ( $ filename ) != posix_getuid ( ) && ! fileowner ( $ file...
Checks if a file was uploaded via HTTP POST request .
47,892
static function MoveFile ( $ from_file , $ to_file , & $ error = null , & $ error_str = null ) { $ error = false ; $ error_str = "" ; settype ( $ from_file , "string" ) ; settype ( $ to_file , "string" ) ; if ( is_dir ( $ to_file ) && file_exists ( $ from_file ) && ! is_dir ( $ from_file ) ) { preg_match ( '/([^\/]+)$/...
Moves a file or a directory
47,893
static function Unlink ( $ file , & $ error = null , & $ error_str = null ) { $ error = false ; $ error_str = "" ; if ( ! file_exists ( $ file ) ) { return 0 ; } $ stat = unlink ( $ file ) ; if ( ! $ stat ) { $ error = true ; $ error_str = "cannot unlink $file" ; return 0 ; } return 1 ; }
Removes a file from filesystem .
47,894
static function _RecursiveUnlinkDir ( $ dir , & $ error , & $ error_str ) { settype ( $ dir , "string" ) ; $ out = 0 ; if ( $ error ) { return $ out ; } if ( $ dir == "" ) { return ; } if ( $ dir [ strlen ( $ dir ) - 1 ] == "/" ) { $ dir = preg_replace ( '/\/$/' , '' , $ dir ) ; } if ( $ dir == "" ) { return ; } if ( !...
Internal method making main part of RecursiveUnlinkDir call
47,895
static function GetFileContent ( $ filename , & $ error = null , & $ error_str = null ) { $ error = false ; $ error_str = "" ; $ out = "" ; settype ( $ filename , "string" ) ; if ( ! is_file ( $ filename ) ) { $ error = true ; $ error_str = "$filename is not a file" ; return null ; } $ filesize = filesize ( $ filename ...
Reads content of a file .
47,896
static function IsReadableAndWritable ( $ filename , & $ error = null , & $ error_str = null ) { $ error = false ; $ error_str = "" ; settype ( $ filename , "string" ) ; if ( ! file_exists ( $ filename ) ) { $ error = true ; $ error_str = "file does't exist" ; return 0 ; } $ _UID_ = posix_getuid ( ) ; $ _FILE_OWNER = f...
Checks if a file is both readable and writable .
47,897
static function GetImageSize ( $ image_content , & $ error = null , & $ error_str = null ) { $ temp = defined ( "TEMP" ) ? TEMP : "/tmp" ; $ filename = $ temp . "/get_image_filename_" . posix_getpid ( ) ; if ( ! Files :: WriteToFile ( $ filename , $ image_content , $ error , $ error_str ) ) { return null ; } $ out = ge...
Determines width and height of an image in parameter .
47,898
static function WriteToTemp ( $ content , & $ error = null , & $ error_str = null ) { $ temp_filename = Files :: GetTempFilename ( ) ; $ out = Files :: WriteToFile ( $ temp_filename , $ content , $ error , $ error_str ) ; if ( ! $ error ) { return $ temp_filename ; } }
Write a content to a temporary file .
47,899
static function GetTempDir ( ) { $ temp_dir = ( defined ( "TEMP" ) && strlen ( "TEMP" ) ) ? ( string ) TEMP : sys_get_temp_dir ( ) ; if ( ! strlen ( $ temp_dir ) ) { $ temp_dir = "/tmp" ; } return $ temp_dir ; }
Returns the temporary directory