idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
54,900
public function setCacheKey ( $ key ) { $ key = preg_replace ( '/[^\da-z]/i' , '' , $ key ) ; if ( ! empty ( $ key ) ) { $ this -> cacheKey = $ key ; } }
Manually set a name for the cached file instead of using the md5 of the template name .
54,901
public function cacheExists ( ) { $ cacheFile = $ this -> getCacheFile ( ) ; if ( file_exists ( $ cacheFile ) && filemtime ( $ cacheFile ) > ( time ( ) - $ this -> cachePeriod ) ) { return ( true ) ; } else { return ( false ) ; } }
Check whether a cache file exists and is not expired .
54,902
protected function setCache ( ) { if ( $ this -> cache ) { $ cacheFile = $ this -> getCacheFile ( ) ; file_put_contents ( $ cacheFile , $ this -> templateOutput ) ; } }
Cache the template if applicable .
54,903
private function getCacheFile ( ) { if ( is_null ( $ this -> cachePath ) || ! file_exists ( $ this -> cachePath ) ) { $ this -> error ( 'Invalid Cache Path. ' . $ this -> cachePath ) ; return false ; } $ cacheKey = is_null ( $ this -> cacheKey ) ? md5 ( $ this -> templateFile ) : $ this -> cacheKey ; return ( $ this ->...
Get the name of the file this template should be cached to . Using the supplied key or the md5 of the template name .
54,904
public function consume ( $ type = NULL ) { if ( ! $ this -> valid ( ) ) { throw new \ OutOfBoundsException ( 'No more tokens available' ) ; } $ token = $ this -> current ( ) ; if ( $ type !== NULL && ! $ token -> is ( $ type ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Expected token type %s, read "%s" (%d)...
Consume the next token and return it .
54,905
public function moveTo ( $ mark ) { if ( is_array ( $ mark ) || $ mark instanceof \ Countable ) { $ this -> index = count ( $ mark ) ; } else { $ this -> index = ( int ) $ mark ; } return $ this ; }
Moves the cursor to the given mark .
54,906
public function move ( $ steps ) { if ( is_array ( $ steps ) || $ steps instanceof \ Countable ) { $ this -> index += count ( $ steps ) ; } else { $ this -> index += ( int ) $ steps ; } return $ this ; }
Move the cursor by the given number of steps .
54,907
public function moveToNext ( $ type , callable $ callback = NULL ) { $ delim = ( array ) $ type ; while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ delim ) ) { return $ token ; } if ( $ callback !== NULL ) { $ callback ( $ token ) ; } $ this -> next ( ) ; } }
Move the cursor to the next occurance if the given token type .
54,908
public function readSequence ( array $ allowedTokenTypes ) { $ tokens = [ ] ; while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( ! $ token -> isOneOf ( $ allowedTokenTypes ) ) { break ; } $ tokens [ ] = $ token ; $ this -> next ( ) ; } return $ this -> createTokenSequence ( $ tokens ) ; }
Get a TokenSequence containing only the allowed token types starting from the current position of the cursor .
54,909
public function readSequenceToNext ( $ type , $ skipDelimiter = false ) { $ tokens = [ ] ; $ delim = ( array ) $ type ; while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ delim ) ) { if ( ! $ skipDelimiter ) { $ tokens [ ] = $ token ; } break ; } $ tokens [ ] = $ token ; $ thi...
Read tokens to the next occurance of the given token type and return a token sequence containing all found tokens .
54,910
public function readNextBlock ( $ openingDelimiter , $ closingDelimiter , $ skipDelimiters = true ) { $ od = ( array ) $ openingDelimiter ; $ cd = ( array ) $ closingDelimiter ; $ tokens = [ ] ; $ level = - 1 ; while ( $ this -> valid ( ) && $ level < 0 ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ ...
Reads the next code block enclosed in the given delimiters returns an empty token sequence when no tokens were matched .
54,911
protected function loadLocalization ( $ domain , $ path ) { if ( is_textdomain_loaded ( $ domain ) ) { return ; } $ locale = get_locale ( ) ; $ locale = apply_filters ( Localization :: LOCALE_FILTER , $ locale , $ domain ) ; $ mofile = apply_filters ( Localization :: MOFILE_FILTER , sprintf ( '%1$s/%2$s-%3$s.mo' , $ pa...
Load localized strings .
54,912
public function get ( $ key ) { $ file = $ this -> cacheDir . $ this -> getDir ( $ key ) . $ this -> getFile ( $ key ) ; if ( file_exists ( $ file ) && is_readable ( $ file ) ) { if ( filemtime ( $ file ) > time ( ) ) { return file_get_contents ( $ file ) ; } } return false ; }
Get a stored value by it s key
54,913
public function set ( $ key , $ value , $ expiration = 0 ) { $ file = $ this -> cacheDir . $ this -> getDir ( $ key ) . $ this -> getFile ( $ key ) ; if ( ! file_exists ( dirname ( $ file ) ) ) { mkdir ( dirname ( $ file ) , 0755 , true ) ; } $ return = file_put_contents ( $ file , $ value ) ; touch ( $ file , time ( )...
Stores a value in the cache
54,914
protected function getDir ( $ key ) { $ dir = sha1 ( $ key ) ; $ dir = substr ( $ dir , 0 , 3 ) . '/' . substr ( $ dir , 3 , 3 ) . '/' ; return $ dir ; }
Calculates the Directory based on a key
54,915
public function flushAllAction ( ) { try { $ this -> getWorker ( ) -> execute ( 'flushAll' ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Flush ALL executed successfully' ) ; } catch ( \ Exception $ e ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'error' , 'We have encountered an...
Call flush all command for the current instance
54,916
public function flushDbAction ( $ id ) { try { $ this -> getWorker ( ) -> flushDB ( $ id ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Flush DB on ' . $ id . ' executed successfully' ) ; } catch ( \ Exception $ e ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Une err...
Call flush DB command for the current instance and the current database
54,917
protected function setProtocol ( $ statuscode ) { if ( $ _SERVER [ 'SERVER_PROTOCOL' ] == 'HTTP/1.1' || $ statuscode == Response :: SC_CONTINUE || $ statuscode == Response :: SC_SWITCHING_PROTOCOLS || $ statuscode == Response :: SC_TEMPORARY_REDIRECT ) { header ( 'HTTP/1.1 ' . $ statuscode ) ; } elseif ( empty ( $ _SER...
setProtocol all response protocol decisions made here handle the exceptions to rules for protocol 1 . 1 vs 1 . 0 default to 1 . 0 when protocol not specified RFC
54,918
public function push ( $ handler ) { if ( ! $ handler ) { return $ this ; } if ( $ this -> next ) { return $ this -> next -> push ( $ handler ) ; } if ( ! $ handler instanceof MiddlewareInterface ) { $ handler = new Middleware ( $ handler ) ; } $ this -> next = $ handler ; return $ this -> next ; }
stack up the middleware . converts normal Application into middleware .
54,919
public function getClassifiedImageAddForm ( ) { if ( null === $ this -> classifiedImageAddForm ) { $ this -> classifiedImageAddForm = $ this -> getServiceLocator ( ) -> get ( 'document.form.classifiedimageadd' ) ; } return $ this -> classifiedImageAddForm ; }
Get useradd form
54,920
public function create ( array $ parameters , $ className , PropertyMapper $ propertyMapper ) { list ( $ objectStructure , $ propertyPaths ) = $ this -> getNestedStructureForDottedNotation ( $ parameters ) ; $ propertyMappingConfiguration = $ this -> getPropertyMappingConfigurationForPropertyPaths ( $ propertyPaths , $...
Creates a new object based in input parameters and a class name .
54,921
public function getPropertyMappingConfigurationForPropertyPaths ( array $ propertyPaths , $ className = '' ) { $ propertyMappingConfiguration = new PropertyMappingConfiguration ( ) ; $ propertyMappingConfiguration -> allowAllProperties ( ) ; $ propertyMappingConfiguration -> setTypeConverterOption ( PersistentObjectCon...
Creates a allow all property mapping configuration for all properties even recursively .
54,922
public function getNestedStructureForDottedNotation ( array $ row ) { $ propertyPaths = [ ] ; $ objectStructure = [ ] ; foreach ( $ row as $ key => $ value ) { self :: applyValueProcessors ( $ key , $ value ) ; self :: traverseObjectStructure ( $ objectStructure , $ propertyPaths , $ key , $ value ) ; } return [ $ obje...
The input structure needs to be a key = > value map . Every key should be a dot notation property path every value the corresponding value .
54,923
public function rememberLastObjectAs ( $ identifier ) { if ( array_key_exists ( $ identifier , $ this -> rememberedObjects ) ) { throw new \ Exception ( sprintf ( 'The identifier "%s" is already taken' , $ identifier ) , 1480605866 ) ; } if ( ! $ this -> startObjectTracking ) { throw new \ Exception ( 'Object tracking ...
The most recent object created gets remembered by a specific identifier as long as the current scenario runs .
54,924
public static function config ( Smarty_Internal_Config $ _config ) { static $ _incompatible_resources = array ( 'eval' => true , 'string' => true , 'extends' => true , 'php' => true ) ; $ config_resource = $ _config -> config_resource ; $ smarty = $ _config -> smarty ; self :: parseResourceName ( $ config_resource , $ ...
initialize Config Source Object for given resource
54,925
private function parseComposerLoader ( ) : void { $ map = $ this -> loader -> getPrefixes ( ) ; if ( Any :: isArray ( $ map ) ) { if ( array_key_exists ( 'Apps\\' , $ map ) ) { foreach ( $ map [ 'Apps\\' ] as $ appPath ) { $ this -> appRoots [ ] = $ appPath ; } } if ( array_key_exists ( 'Widgets\\' , $ map ) ) { foreac...
Find app s and widgets root directories over composer psr loader
54,926
public function compileBootableClasses ( ) : void { foreach ( $ this -> appRoots as $ app ) { $ app .= '/Apps/Controller/' . env_name ; $ files = File :: listFiles ( $ app , [ '.php' ] , true ) ; foreach ( $ files as $ file ) { $ class = 'Apps\Controller\\' . env_name . '\\' . Str :: cleanExtension ( $ file ) ; if ( cl...
Find all bootatble instances and set it to object map
54,927
public function run ( ) : bool { $ this -> startMeasure ( __METHOD__ ) ; if ( ! Any :: isArray ( $ this -> objects ) ) { return false ; } foreach ( $ this -> objects as $ class ) { forward_static_call ( [ $ class , 'boot' ] ) ; } $ this -> stopMeasure ( __METHOD__ ) ; return true ; }
Call bootable methods in apps and widgets
54,928
public function generateTable ( BeanInterface $ bean , $ findCondition = "" , $ returnString = false ) { $ this -> loadConfig ( ) ; if ( ( is_array ( $ findCondition ) && ! isset ( $ findCondition [ 'limit' ] ) ) || empty ( $ findCondition ) ) { $ recordLimitOnOnePage = $ this -> getConfigForElement ( $ this -> _table_...
This function generates the table with the Bean and findCondition is passed .
54,929
protected function Area ( ) { if ( ! $ this -> area ) { $ this -> area = new Area ( Request :: GetData ( 'area' ) ) ; } return $ this -> area ; }
The area from request
54,930
protected function Container ( ) { if ( ! $ this -> container ) { $ this -> container = new Container ( Request :: GetData ( 'container' ) ) ; } return $ this -> container ; }
The container from request
54,931
protected function Page ( ) { if ( ! $ this -> page ) { $ this -> page = new Page ( Request :: GetData ( 'page' ) ) ; } return $ this -> page ; }
The page from request
54,932
private function ParentItem ( ) { $ this -> parent = $ this -> GetTreeItem ( 'parent' ) ; return $ this -> parent -> Exists ( ) ? $ this -> parent : null ; }
Gets the parent tree item
54,933
private function PreviousItem ( ) { $ this -> previous = $ this -> GetTreeItem ( 'previous' ) ; return $ this -> previous -> Exists ( ) ? $ this -> previous : null ; }
The previous item
54,934
protected function Location ( ) { if ( $ this -> Container ( ) -> Exists ( ) ) { return Enums \ ContentLocation :: Container ( ) ; } else if ( $ this -> Area ( ) -> Exists ( ) ) { if ( $ this -> Page ( ) -> Exists ( ) ) { return Enums \ ContentLocation :: Page ( ) ; } return Enums \ ContentLocation :: Layout ( ) ; } re...
Gets the content location
54,935
private function InitContentRights ( ) { $ beContentRights = null ; if ( $ this -> Content ( ) -> Exists ( ) ) { $ beContentRights = $ this -> Content ( ) -> GetUserGroupRights ( ) ; } $ this -> contentRights = new ContentRights ( $ this -> FindParentRights ( ) , $ beContentRights ) ; }
Initialize the content rights snippet
54,936
private function FindParentRights ( ) { $ parentRights = null ; $ parentContent = $ this -> Content ( ) -> Exists ( ) ? ContentTreeUtil :: ParentOf ( $ this -> Content ( ) ) : null ; if ( $ parentContent ) { $ parentRights = RightsFinder :: FindContentRights ( $ parentContent ) ; } if ( ! $ parentRights ) { switch ( $ ...
Finds the parent rights
54,937
protected function RenderGroupRights ( ) { if ( ! $ this -> CanAssignGroup ( ) ) { return '' ; } $ result = $ this -> RenderElement ( 'UserGroup' ) ; return $ result . '<div id="group-rights">' . $ this -> contentRights -> Render ( ) . '</div>' ; }
Renders the group rights
54,938
private function AddGuestsOnlyField ( ) { $ field = new Checkbox ( 'GuestsOnly' , '1' , ( bool ) $ this -> Content ( ) -> GetGuestsOnly ( ) ) ; $ this -> AddField ( $ field , false , Trans ( 'Core.ContentForm.GuestsOnly' ) ) ; }
Adds the checkbox for guests only visibility of a content
54,939
protected function LoadElement ( ) { if ( $ this -> Content ( ) -> Exists ( ) ) { return $ this -> ElementSchema ( ) -> ByContent ( $ this -> Content ( ) ) ; } return $ this -> ElementSchema ( ) -> CreateInstance ( ) ; }
Helper function to retrieve the content element from database
54,940
private function SaveContent ( ) { $ this -> Content ( ) -> SetType ( $ this -> FrontendModule ( ) -> MyType ( ) ) ; $ this -> Content ( ) -> SetCssClass ( $ this -> Value ( 'CssClass' ) ) ; $ this -> Content ( ) -> SetCssID ( $ this -> Value ( 'CssID' ) ) ; $ this -> Content ( ) -> SetTemplate ( $ this -> Value ( 'Tem...
Saves content base properties
54,941
private function PublishDate ( $ baseName ) { if ( ! $ this -> Content ( ) -> GetPublish ( ) ) { return null ; } $ strDate = $ this -> Value ( $ baseName . 'Date' ) ; if ( ! $ strDate ) { return null ; } $ date = \ DateTime :: createFromFormat ( $ this -> dateFormat , $ strDate ) ; $ date -> setTime ( ( int ) $ this ->...
Gets a publishing date
54,942
private function SaveRights ( ) { $ userGroup = Usergroup :: Schema ( ) -> ByID ( $ this -> Value ( 'UserGroup' ) ) ; $ this -> Content ( ) -> SetUserGroup ( $ userGroup ) ; if ( ! $ userGroup ) { $ oldRights = $ this -> Content ( ) -> GetUserGroupRights ( ) ; if ( $ oldRights ) { $ oldRights -> Delete ( ) ; } $ this -...
Saves the content rights and user group
54,943
private function AttachContent ( $ isNew ) { switch ( $ this -> Location ( ) ) { case Enums \ ContentLocation :: Layout ( ) : $ this -> AttachLayoutContent ( $ isNew ) ; break ; case Enums \ ContentLocation :: Page ( ) : $ this -> AttachPageContent ( $ isNew ) ; break ; case Enums \ ContentLocation :: Container ( ) : $...
Attaches content to tree item
54,944
private function AttachContainerContent ( $ isNew ) { $ provider = new ContainerContentTreeProvider ( $ this -> Container ( ) ) ; $ tree = new TreeBuilder ( $ provider ) ; $ containerContent = $ this -> Content ( ) -> GetContainerContent ( ) ; if ( ! $ containerContent ) { $ containerContent = new ContainerContent ( ) ...
Attaches the content to the container
54,945
protected final function AddCssIDField ( ) { $ name = 'CssID' ; $ this -> AddField ( Input :: Text ( $ name , $ this -> Content ( ) -> GetCssID ( ) ) , false , Trans ( "Core.ContentForm.$name" ) ) ; }
Adds the css id form field
54,946
protected function AddCacheLifetimeField ( ) { $ name = 'CacheLifetime' ; $ label = "Core.ContentForm.$name" ; $ field = Input :: Text ( $ name , ( string ) ( int ) $ this -> Content ( ) -> GetCacheLifetime ( ) ) ; $ this -> AddField ( $ field , false , Trans ( $ label ) ) ; $ this -> AddValidator ( $ name , Integer ::...
Adds the lifetime field
54,947
protected final function AddTemplateField ( ) { $ name = 'Template' ; $ field = new Select ( $ name , ( string ) $ this -> Content ( ) -> GetTemplate ( ) ) ; $ field -> AddOption ( '' , Trans ( "Core.ContentForm.$name.Default" ) ) ; $ folder = PathUtil :: ModuleCustomTemplatesFolder ( $ this -> FrontendModule ( ) ) ; i...
Adds the template select field
54,948
protected function BackLink ( ) { $ selected = $ this -> SelectedTreeID ( ) ; switch ( $ this -> Location ( ) ) { case Enums \ ContentLocation :: Page ( ) : return $ this -> PageBackLink ( $ selected ) ; case Enums \ ContentLocation :: Layout ( ) : return $ this -> LayoutBackLink ( $ selected ) ; case Enums \ ContentLo...
The back link url
54,949
private function AddWordingFields ( ) { foreach ( $ this -> Wordings ( ) as $ name ) { $ wording = $ this -> FindWording ( $ name ) ; $ fieldName = $ this -> WordingFieldName ( $ name ) ; $ field = Input :: Text ( $ fieldName , $ wording ? $ wording -> GetText ( ) : '' ) ; $ field -> SetHtmlAttribute ( 'placeholder' , ...
Adds the wording fields
54,950
private function FindWording ( $ name ) { if ( ! $ this -> Content ( ) -> Exists ( ) ) { return null ; } $ sql = Access :: SqlBuilder ( ) ; $ tblWording = ContentWording :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblWording -> Field ( 'Content' ) , $ sql -> Value ( $ this -> Content ( ) -> GetID ( ) ) )...
Finds the wording with the given placeholder name
54,951
private static function loopThroughBodyAndCalculatePixels ( BitmapBodyModel $ bitmapBodyModel ) { for ( $ i = 0 ; $ i < $ bitmapBodyModel -> bodySize ; $ i += 3 ) { if ( $ bitmapBodyModel -> x >= $ bitmapBodyModel -> width ) { if ( $ bitmapBodyModel -> usePadding ) { $ i += $ bitmapBodyModel -> width % 4 ; } $ bitmapBo...
Loop through the data in the body of the bitmap file and calculate each individual pixel based on the bytes
54,952
public static function imageCreateFromBmp ( $ pathToBitmapFile ) { $ bitmapFileData = self :: getBitmapFileData ( $ pathToBitmapFile ) ; $ temp = unpack ( 'H*' , $ bitmapFileData ) ; $ hex = $ temp [ 1 ] ; $ header = substr ( $ hex , 0 , 108 ) ; list ( $ width , $ height ) = self :: calculateWidthAndHeight ( $ header )...
Create Image resource from Bitmap
54,953
public function run ( $ args ) { $ this -> command = $ this -> getCommand ( $ args ) ; if ( NULL == $ this -> command ) { throw new CommandException ( 'Command: ' . $ args [ 1 ] . ' not found' ) ; } $ this -> processArgs ( $ this -> command , $ args ) ; return $ this -> command -> execute ( ) ; }
Runs the requested command .
54,954
public function getCommand ( $ args ) { $ class = strtoupper ( substr ( $ args [ 1 ] , 0 , 1 ) ) . substr ( $ args [ 1 ] , 1 ) ; $ class .= 'Command' ; $ command = NULL ; if ( class_exists ( $ class ) ) { $ command = new $ class ( ) ; } if ( NULL === $ command && ! empty ( $ this -> namespaces ) ) { foreach ( $ this ->...
Get the requested command .
54,955
public function processArgs ( ICommand & $ command , $ args ) { $ i = 0 ; $ ops = array_slice ( $ args , 2 ) ; while ( $ i < count ( $ ops ) ) { $ o = $ ops [ $ i ] ; if ( Option :: isShortCode ( $ o ) || Option :: isLongCode ( $ o ) ) { $ option = Command :: getOption ( $ command , $ o ) ; if ( $ option -> isRequired ...
Processes the command line arguments and sets the option values for the command .
54,956
public function withCellValuesAsField ( IField $ field ) : TableFieldBuilder { return new TableFieldBuilder ( $ this -> fieldBuilder -> type ( new TableType ( $ this -> cellClassName , $ this -> columnField , $ this -> rowField , $ field ) ) ) ; }
Defines the cell values as the supplied field .
54,957
public function setTwigGenerator ( TwigGenerator $ twigGenerator ) { $ this -> twigGenerator = $ twigGenerator ; $ this -> twigGenerator -> setTemplateDirs ( array ( __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' ) ) ; $ this -> twigGenerator -> setMustOverwriteIfExists ( true ) ; }
Define the twig generator instance
54,958
public function load ( $ resources , $ extension = '' ) { $ finder = new Finder ( ) ; $ collection = array ( ) ; if ( is_array ( $ resources ) ) { foreach ( $ resources as $ resource ) { $ subcollection = array ( ) ; $ subcollection = $ this -> load ( $ resource ) ; $ collection = array_merge ( $ collection , $ subcoll...
Return a collection of files
54,959
private function getSaleOrderData ( $ saleId ) { $ entity = $ this -> daoGeneric -> getEntityByPk ( Cfg :: ENTITY_MAGE_SALES_ORDER , [ Cfg :: E_COMMON_A_ENTITY_ID => $ saleId ] , [ Cfg :: E_SALE_ORDER_A_CUSTOMER_ID , Cfg :: E_SALE_ORDER_A_INCREMENT_ID ] ) ; $ custId = $ entity [ Cfg :: E_SALE_ORDER_A_CUSTOMER_ID ] ; $ ...
Get significant attributes of the sale order .
54,960
private function getFieldType ( array $ formFieldConfiguration , array $ fieldConfiguration ) { if ( isset ( $ formFieldConfiguration [ 'fieldtype' ] ) ) { return $ formFieldConfiguration [ 'fieldtype' ] ; } $ fieldType = null ; switch ( $ fieldConfiguration [ 'datatype' ] ) { case 'BOOLEAN' : $ fieldType = CheckboxTyp...
Returns the field type for a field .
54,961
protected function getFieldOptions ( array $ formFieldConfiguration , array $ fieldConfiguration ) { $ options = array ( 'label' => '' , 'required' => false , 'constraints' => array ( ) , ) ; if ( empty ( $ fieldConfiguration ) ) { $ options [ 'mapped' ] = false ; } if ( isset ( $ fieldConfiguration [ 'label' ] ) ) { $...
Returns the field options for a field .
54,962
public function addFieldPlaceholder ( array & $ options , array $ formFieldConfiguration , array $ fieldConfiguration ) { $ fieldType = $ this -> getFieldType ( $ formFieldConfiguration , $ fieldConfiguration ) ; if ( isset ( $ formFieldConfiguration [ 'notices' ] [ 'placeholder' ] ) ) { if ( in_array ( $ fieldType , a...
Adds the placeholder for a field based on the type .
54,963
private function addFieldChoiceOptions ( array & $ options , array $ formFieldConfiguration , array $ fieldConfiguration ) { if ( isset ( $ formFieldConfiguration [ 'options' ] ) ) { $ fieldConfiguration [ 'options' ] = $ formFieldConfiguration [ 'options' ] ; } if ( isset ( $ fieldConfiguration [ 'options' ] ) ) { $ o...
Adds the choices option to the field options .
54,964
private function addFieldConstraintOptions ( array & $ options , array $ formFieldConfiguration ) { if ( $ options [ 'required' ] === true ) { $ options [ 'constraints' ] [ ] = new NotBlank ( ) ; } if ( isset ( $ formFieldConfiguration [ 'validators' ] ) ) { $ options [ 'constraints' ] = array ( ) ; foreach ( $ formFie...
Adds the constraints option to the field options .
54,965
public function setRows ( array $ rows ) { $ this -> rows = $ rows ; $ this -> setKeys ( array_keys ( $ this -> rows [ 0 ] ) ) ; return $ this ; }
Sets the array to be printed
54,966
protected function calculateDimensions ( ) { foreach ( $ this -> getRows ( ) as $ x => $ row ) { foreach ( $ row as $ y => $ value ) { $ this -> calculateDimensionsForCell ( $ x , $ y , $ value ) ; } } return $ this ; }
Calculates the dimensions of the table
54,967
public function print ( $ row_key ) { $ this -> calculateDimensions ( ) ; $ result = '' ; if ( $ this -> getPrintHeader ( ) ) { $ result .= $ this -> printHeader ( ) ; } else { $ result .= $ this -> printRowLine ( ) ; } if ( ! is_null ( $ row_key ) ) { $ result .= $ this -> printRow ( $ row_key , $ this -> getRows ( ) ...
Prints the data to a text table
54,968
static function path_to_url ( $ path ) { $ path = str_replace ( DIRECTORY_SEPARATOR , '/' , $ path ) ; $ abspath = str_replace ( DIRECTORY_SEPARATOR , '/' , ABSPATH ) ; $ url = str_replace ( $ abspath , '' , $ path ) ; return esc_url_raw ( site_url ( $ url ) ) ; }
Convert the given path to a URL .
54,969
private function queryToAndExpression ( LuceneQuery $ query ) { $ span = new SpanExpression ( 'AND' ) ; if ( ! $ query -> hasTrivialMainQuery ( ) ) $ span -> addExpression ( $ query -> getMainQuery ( ) ) ; $ span -> addExpressions ( $ query -> getFilterQueries ( ) ) ; return $ span ; }
Convert a query to an AND expression
54,970
public function filter ( ) { $ count = 0 ; $ tags = $ this -> getParameter ( 'Tags' ) ; if ( $ tags === null ) $ tags = $ this -> getLocal ( 'LinkTags' ) ; $ maxRows = $ this -> getParameter ( 'MaxRows' ) ; $ partial = $ this -> getParameter ( 'Partial' ) ; $ partials = array ( ) ; if ( ! empty ( $ partial ) ) { $ part...
Returns a subset of tags filtered according to the params passed .
54,971
protected function _replaceReferences ( $ input , ContainerInterface $ container , $ default = null , $ startDelimiter = '${' , $ endDelimiter = '}' ) { $ regexpDelimiter = '/' ; $ input = $ this -> _normalizeString ( $ input ) ; $ defaultValue = $ default === null ? '' : $ this -> _normalizeString ( $ default ) ; $ st...
Replaces all tokens wrapped with some delimiters in a string with corresponding values retrieved from a container .
54,972
public function data ( ) : string { $ code = $ this -> response -> getStatusCode ( ) ; if ( $ code >= 400 && $ code < 600 ) { throw new ErrorResponseException ( $ this -> response -> getReasonPhrase ( ) , $ code ) ; } return $ this -> payload ( ) ; }
parsed data with status checking
54,973
public function only ( $ keys ) { $ keys = is_array ( $ keys ) ? $ keys : func_get_args ( ) ; return array_only ( $ this -> parameters , $ keys ) ; }
Get only certain attributes .
54,974
public static function parseRgbString ( string $ string ) : array { if ( ! preg_match ( self :: REGEX_RGB , $ string , $ matches ) ) { throw InvalidArgumentException :: format ( 'Invalid rgb string passed to %s: expecting format "rgb(0-255, 0-255, 0-255)", "%s" given' , __METHOD__ , $ string ) ; } return [ ( int ) $ ma...
Parses the supplied rgb string into an array of channels .
54,975
public static function parseHexString ( string $ string ) : array { if ( ! preg_match ( self :: REGEX_HEX , $ string , $ matches ) ) { throw InvalidArgumentException :: format ( 'Invalid rgba string passed to %s: expecting format "#...", "%s" given' , __METHOD__ , $ string ) ; } $ string = str_replace ( '#' , '' , $ st...
Parses the supplied hex string into an array of channels .
54,976
public static function parseRgbaString ( string $ string ) : array { if ( ! preg_match ( self :: REGEX_RGBA , $ string , $ matches ) ) { throw InvalidArgumentException :: format ( 'Invalid rgba string passed to %s: expecting format "rgb(0-255, 0-255, 0-255, 0-1)", "%s" given' , __METHOD__ , $ string ) ; } return [ ( in...
Parses the supplied rgba string into an array of channels .
54,977
private function loadModules ( ) { $ repo = $ this -> getContainer ( ) -> get ( 'module_repository' ) ; foreach ( $ repo -> getAll ( ) as $ module ) { $ moduleClass = $ module -> getClass ( ) ; new $ moduleClass ( $ this ) ; } }
add modules to App
54,978
private function configureDI ( ) { $ container = $ this -> getContainer ( ) ; $ this -> add ( new NotificationMiddleware ( $ container ) ) ; $ this -> add ( new OldInputDataMiddleware ( $ container ) ) ; $ container -> set ( Generator :: class , function ( ) { $ randomNumberGeneratorFactory = new RandomNumberGeneratorF...
Configure the dependency injection container
54,979
public function renderLayoutSegments ( MvcEvent $ e ) { $ viewModel = $ e -> getViewModel ( ) ; if ( 'Zend\View\Model\ViewModel' != get_class ( $ viewModel ) ) { return ; } $ resolver = $ e -> getApplication ( ) -> getServiceManager ( ) -> get ( 'ViewResolver' ) ; foreach ( $ this -> layoutSegments as $ segment ) { if ...
Listen to the render event and render additional layout segments
54,980
public function coverAction ( $ id , Request $ request ) { $ body = $ this -> getAnime ( $ id ) ; $ response = $ this -> get ( 'cache_time_keeper' ) -> getResponse ( [ ] , self :: CACHE_LIFETIME ) -> setEtag ( sha1 ( $ body -> html ( ) ) ) ; $ response -> headers -> set ( 'Content-Type' , 'image/jpeg' ) ; if ( $ respon...
Get cover from anidb . net item id .
54,981
public function TopMost ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tblArea = Area :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblArea -> Field ( 'Layout' ) , $ sql -> Value ( $ this -> layout -> GetID ( ) ) ) -> And_ ( $ sql -> IsNull ( $ tblArea -> Field ( 'Previous' ) ) ) ; return Area :: Schema ( ) ->...
Returns the top most area
54,982
public function set ( $ key , $ val ) { parent :: set ( func_get_args ( ) , null ) ; $ this -> values [ '_changed' ] = true ; return $ this ; }
Set a value in the cache
54,983
public function clear ( ) { $ expiry = $ this -> values [ '_expiry' ] ?? null ; parent :: clear ( ) ; $ this -> set ( '_changed' , true ) ; $ this -> set ( '_timestamp' , time ( ) ) ; if ( $ expiry ) $ this -> setExpiry ( $ expiry ) ; return $ this ; }
Remove all contents from the cache
54,984
public function toSQL ( Parameters $ params , bool $ inner_clause ) { return "OFFSET " . $ params -> getDriver ( ) -> toSQL ( $ params , $ this -> getOffset ( ) ) ; }
Write a OFFSET clause to SQL query syntax
54,985
public static function getInstance ( $ configFile = null , $ mode = self :: APP_MODE_PROD ) { $ c = get_called_class ( ) ; if ( ! isset ( self :: $ _instances [ $ c ] ) ) { self :: $ _instances [ $ c ] = new $ c ( $ configFile , $ mode ) ; self :: $ _instances [ $ c ] -> setup ( ) ; } return self :: $ _instances [ $ c ...
Initialize and return App uniq instance
54,986
public function run ( ) { $ session = $ this -> get ( 'session' ) ; $ session -> start ( ) ; $ uri = '' ; if ( strcmp ( $ this -> mode , self :: APP_MODE_DEV ) == 0 ) { $ uri = $ _SERVER [ 'REQUEST_URI' ] ; } else { $ uri = $ _GET [ 'url' ] ; } if ( ! empty ( $ this -> baseUri ) && substr ( $ uri , 0 , strlen ( $ this ...
Run Bandama application
54,987
public function addService ( $ key , $ callable ) { $ instance = Container :: newInstance ( $ callable ) ; $ this -> container -> set ( $ key , function ( ) use ( $ instance ) { return $ instance ; } ) ; }
Add an instance of class in container with custom key
54,988
protected function registerConfig ( ) { $ config = new Configuration ( $ this -> configFile ) ; $ this -> container -> set ( 'config' , function ( ) use ( $ config ) { return $ config ; } ) ; }
Create and add config in container
54,989
protected function registerFlash ( ) { $ container = $ this -> container ; $ this -> container -> set ( 'flash' , function ( ) use ( $ container ) { return new Flash ( $ container -> get ( 'session' ) ) ; } ) ; }
Create and add session flash object to container
54,990
private function setCounts ( ) { foreach ( $ this -> routes as $ module ) { $ this -> counts [ 'module' ] ++ ; foreach ( $ module [ 'routes' ] as $ route ) { $ this -> counts [ 'route' ] ++ ; } } }
set module part route counts
54,991
protected function getMyModules ( ) { $ all = array_keys ( app ( ) -> getLoadedProviders ( ) ) ; $ modules = [ ] ; foreach ( $ all as $ provider ) { $ parts = explode ( '\\' , $ provider ) ; if ( $ parts [ 0 ] === 'ErenMustafaOzdal' && array_search ( $ parts [ 1 ] , $ modules ) === false ) { array_push ( $ modules , sn...
get ErenMustafaOzdal namespace provider
54,992
protected function loadFunctions ( ) : void { $ this -> extendForTranslator ( ) ; $ this -> extendForWidget ( ) ; $ this -> extendForSiteUrl ( ) ; $ this -> extendForGetUrl ( ) ; $ this -> extendForQueryParams ( ) ; $ this -> extendForPagination ( ) ; $ this -> extendForVarDump ( ) ; }
Load functions that will be used in the templates
54,993
public static function update ( Cacheable $ object ) { return wp_cache_set ( $ object -> get_pk ( ) , $ object -> get_data_to_cache ( ) , $ object :: get_cache_group ( ) ) ; }
Update an item in the cache .
54,994
public function logRequest ( $ request , $ extra = [ ] , $ includeHeader = true ) { $ extra = count ( $ extra ) ? ' ' . json_encode ( $ extra ) : '' ; $ trace = debug_backtrace ( false , 2 ) ; if ( isset ( $ trace [ 1 ] ) ) { $ caller = substr ( strrchr ( $ trace [ 1 ] [ 'class' ] , '\\' ) , 1 ) . '::' . $ trace [ 1 ] ...
Log server request
54,995
public static function create ( int $ amount , int $ avance , string $ b2bGroupId , CurrencyInterface $ currency , int $ specialOfferPrice , int $ unitPrice ) : PriceInterface { $ specialOfferPrice = new Money ( $ specialOfferPrice , new \ Money \ Currency ( $ currency -> getIsoCodeAlpha ( ) ) ) ; $ unitPrice = new Mon...
Creates a valid Price .
54,996
function composite ( $ label ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; $ composite = \ ran \ CompositeField :: instance ( $ this -> confs ) ; $ composite -> fieldlabel_is ( $ label ) ; if ( count ( $ args ) >= 1 ) { if ( is_array ( $ args [ 0 ] ) ) { $ array_shorthand = array_shift ( $ args ) ; foreach ...
Any additonal parameters are interpreted as Fields that are part of the composite . If an array is passed as second parameter the fields will be interpreted as text Field .
54,997
function autocomplete_array ( array & $ hints = null ) { if ( $ this -> autocomplete === null ) { $ this -> autocomplete = & $ hints ; } else if ( $ hints !== null ) { foreach ( $ hints as $ key => $ hint ) { $ this -> autocomplete [ $ key ] = $ hint ; } } return $ this ; }
The given values will be used to autofill the form . They may be however ignored depending on context .
54,998
function autovalue ( $ fieldname , $ default = null ) { if ( $ this -> autocomplete !== null ) { $ fieldname = rtrim ( $ fieldname , '[]' ) ; if ( isset ( $ this -> autocomplete [ $ fieldname ] ) ) { return $ this -> autocomplete [ $ fieldname ] ; } } return $ default ; }
Retrieve autocomplete value for given field or null .
54,999
function signature ( $ id = null ) { if ( ! $ this -> unsigned ) { if ( $ this -> get ( 'id' , null ) === null ) { $ formsignature = 'freiaform' . $ this -> formindex ; } else { $ formsignature = $ this -> get ( 'id' ) ; } if ( $ id !== null ) { return "{$formsignature}_field$id" ; } else { return $ formsignature ; } }...
Returns the form signature or creates signature using given id and form signature .