idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
4,500 | public function getAdapterAlias ( ) { if ( '__undefined__' == $ this -> adapterAlias ) { $ this -> adapterAlias = null ; $ annotations = $ this -> inspector -> getClassAnnotations ( ) ; if ( $ annotations -> hasAnnotation ( '@adapter' ) ) { $ this -> adapterAlias = $ annotations -> getAnnotation ( '@adapter' ) -> getVa... | Returns the adapter alias name to use with this entity |
4,501 | private function processNode ( \ SimpleXMLElement $ node ) : array { $ config = [ ] ; foreach ( $ node as $ name => $ value ) { if ( \ preg_match ( '/^num__([0-9]+)$/' , $ name , $ matches ) ) { $ name = $ matches [ 1 ] ; } if ( $ value -> count ( ) > 0 ) { $ config [ $ name ] = $ this -> processNode ( $ value -> child... | Processes XML node |
4,502 | private function renderCell ( array $ row , $ column , $ cellFormat ) { $ cell = isset ( $ row [ $ column ] ) ? $ row [ $ column ] : '' ; $ width = $ this -> effectiveColumnWidths [ $ column ] ; if ( $ cell instanceof TableCell && $ cell -> getColspan ( ) > 1 ) { foreach ( range ( $ column + 1 , $ column + $ cell -> ge... | Renders table cell with padding . |
4,503 | private function getRowColumns ( $ row ) { $ columns = range ( 0 , $ this -> numberOfColumns - 1 ) ; foreach ( $ row as $ cellKey => $ cell ) { if ( $ cell instanceof TableCell && $ cell -> getColspan ( ) > 1 ) { $ columns = array_diff ( $ columns , range ( $ cellKey + 1 , $ cellKey + $ cell -> getColspan ( ) - 1 ) ) ;... | Gets list of columns for the given row . |
4,504 | private function calculateColumnsWidth ( $ rows ) { for ( $ column = 0 ; $ column < $ this -> numberOfColumns ; ++ $ column ) { $ lengths = array ( ) ; foreach ( $ rows as $ row ) { if ( $ row instanceof TableSeparator ) { continue ; } foreach ( $ row as $ i => $ cell ) { if ( $ cell instanceof TableCell ) { $ textCont... | Calculates columns widths . |
4,505 | public function indexAction ( $ page , $ sort , $ direction ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module-actions' , 'INDEX' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs ... | Lists all ModuleActions entities . |
4,506 | public function searchAction ( Request $ request ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module-actions' , 'INDEX' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ this -> get ( 'session' ) -> remove ( 'moduleactions_search_session' ) ; if ( $ request ->... | Search filter ModuleActions entities . |
4,507 | public function newAction ( Request $ request ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module-actions' , 'NEW' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ entityName = $ this -> getParameter ( 'bacon_acl.entities.module_actions' ) ; $ formTypeName = ... | Displays a form to create a new ModuleActions entity . |
4,508 | public function editAction ( Request $ request , $ id ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module-actions' , 'EDIT' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ formTypeName = $ this -> getParameter ( 'bacon_acl.forms.module_actions_form_type_clas... | Displays a form to edit an existing ModuleActions entity . |
4,509 | public function showAction ( $ id ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module-actions' , 'SHOW' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ entity = $ this -> getRepository ( ) -> find ( $ id ) ; if ( ! $ entity ) { return $ this -> createNotFoun... | Finds and displays a ModuleActions entity . |
4,510 | public function deleteAction ( $ id ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'module-actions' , 'DELETE' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ formHandlerName = $ this -> getParameter ( 'bacon_acl.forms.module_actions_form_handler_class' ) ; $ e... | Deletes a ModuleActions entity . |
4,511 | public function registerServices ( DiInterface $ di ) { $ config = $ di -> get ( 'config' ) ; $ view = $ di -> get ( 'view' ) ; $ view -> setViewsDir ( __DIR__ . '/views/' ) ; $ view -> setMainView ( 'main' ) ; $ view -> setLayoutsDir ( $ config -> application -> layoutsDir ) ; $ view -> setPartialsDir ( $ config -> ap... | Register specific services for the module |
4,512 | private function collectEventsFromDocument ( LifecycleEventArgs $ event ) { $ entity = $ event -> getEntity ( ) ; if ( $ entity instanceof UserAggregateRoot ) { foreach ( $ entity -> events ( ) as $ event ) { $ this -> collectedEvents [ ] = $ event ; } $ entity -> eraseEvents ( ) ; } } | Gets the domain events from the aggregate root and loads inside collected events collection removing from the document . |
4,513 | public function pdoQuery ( PDOStatement $ pStmt , $ pReturnResults = true ) { $ returnValue = null ; try { $ returnValue = $ pStmt -> execute ( ) ; if ( $ returnValue && $ pReturnResults ) { $ rows = $ pStmt -> fetchAll ( PDO :: FETCH_ASSOC ) ; if ( $ this -> isArray ( $ rows ) ) { $ returnValue = $ rows ; } } $ pStmt ... | Run a query statement as a prepared PDO statement . Optionally returns the result . |
4,514 | public function pdoQueryBind ( $ pSqlQuery , array $ pBindings = null , $ pReturnResults = true ) { $ returnValue = null ; try { $ stmt = $ this -> pdo -> prepare ( $ pSqlQuery ) ; if ( $ this -> isArray ( $ pBindings ) ) { foreach ( $ pBindings as $ parameterName => $ data ) { $ stmt -> bindValue ( $ parameterName , $... | Run a prepared SQL statement with an arbitrary number of values . |
4,515 | public function select ( $ pSelectStatement ) { $ returnValue = null ; try { $ stmt = $ this -> pdo -> prepare ( $ pSelectStatement ) ; $ stmt -> execute ( ) ; $ rows = $ stmt -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; if ( $ this -> isArray ( $ rows ) ) { $ returnValue = $ rows ; } $ stmt -> closeCursor ( ) ; } catch ( Ex... | Perform a simple SELECT that does NOT have any parameters . |
4,516 | private function releaseWhenLockIsPresentAndTimeDeltaAllows ( ) { $ fileInfo = $ this -> getFileInfo ( ) ; $ lockIsPresent = $ fileInfo -> isFile ( ) ; if ( $ lockIsPresent ) { $ this -> releaseWhenTimeDeltaAllows ( ) ; } } | Releases the present lock if the datetime delta allows |
4,517 | private function writeAutoReleaseMoment ( ) { $ fileObject = $ this -> getFileInfo ( ) -> openFile ( 'w' ) ; $ fileObject -> fwrite ( $ this -> autoReleaseMoment -> format ( 'c' ) ) ; $ fileObject -> fflush ( ) ; $ fileObject = null ; } | Writes the datetime when to release into the lock file |
4,518 | private function readAutoReleaseMoment ( ) { $ lockFile = $ this -> getFileInfo ( ) -> openFile ( 'r' ) ; $ lockEndTimeAsString = $ lockFile -> getCurrentLine ( ) ; $ lockFile = null ; $ lockEndTime = new \ DateTime ( $ lockEndTimeAsString ) ; return $ lockEndTime ; } | Reads the datetime when to release from the lock file |
4,519 | protected function render ( ) { $ presenter = $ this -> createPresenter ( $ this -> getRequiredTemplateVariable ( 'Presenter' ) ) ; try { $ arguments = $ this -> getArguments ( $ presenter ) ; $ result = call_user_func_array ( $ presenter , $ arguments ) ; } catch ( \ Exception $ e ) { if ( $ this -> throwRenderExcepti... | Loads a presenter calls its method and sets the resulting string into the PRESENTER_RESULT template variable . |
4,520 | protected function getArguments ( $ presenter ) { if ( is_array ( $ presenter ) ) { $ r = new \ ReflectionMethod ( $ presenter [ 0 ] , $ presenter [ 1 ] ) ; } elseif ( is_object ( $ presenter ) && ! $ presenter instanceof \ Closure ) { $ r = new \ ReflectionObject ( $ presenter ) ; $ r = $ r -> getMethod ( '__invoke' )... | Returns the arguments to pass to the presenter . |
4,521 | public function mergeWithConfig ( array & $ target , $ config_key , $ default = [ ] , $ recursive = true ) { if ( $ recursive ) { $ target = array_merge_recursive ( $ target , $ this -> config ( $ config_key , $ default ) ) ; } else { $ target = array_merge ( $ target , $ this -> config ( $ config_key , $ default ) ) ;... | Merge target array with values from configuration file |
4,522 | public function passes ( ) { foreach ( $ this -> userRules as $ inputName => $ userRule ) { $ rules = $ this -> parser -> setCommand ( $ userRule ) -> parse ( ) ; $ this -> validateInput ( $ inputName , $ rules ) ; } return $ this -> isValid ; } | Check if the given input is valid under the specified rules |
4,523 | public function validateInput ( $ inputName , $ rules ) { foreach ( $ rules as $ rule ) { $ this -> validateRule ( $ rule , $ inputName ) ; } } | Validates the input for a specific group of rules |
4,524 | public function getDataSource ( ) { if ( empty ( $ this -> dataSource ) ) { $ this -> dataSource = $ this -> getDefaultDataSource ( ) ; if ( empty ( $ this -> dataSource ) ) { throw new Exception ( 'No datasource has been defined.' ) ; } } return $ this -> dataSource ; } | Returns the data source this factory is fed from . |
4,525 | public function findEntity ( $ id ) { Logger :: get ( ) -> debug ( sprintf ( 'Finding entity %s...' , $ id ) ) ; $ entity = $ this -> getEntity ( $ id ) ; if ( empty ( $ entity ) ) { Logger :: get ( ) -> debug ( sprintf ( 'Entity %s is not cached. Retrieving...' , $ id ) ) ; $ className = static :: getEntitiesClassName... | Returns the entity identified by the ID retrieving it from the persistence layer if need be . |
4,526 | public function registerEntity ( Entity $ entity ) { Logger :: get ( ) -> debug ( 'Registering entity ' . get_class ( $ entity ) . ":{$entity->id}..." ) ; self :: $ entities [ get_called_class ( ) ] [ $ entity -> id ] = $ entity ; Logger :: get ( ) -> debug ( 'Registered.' ) ; } | Keeps the selected entity in memory for quick access . |
4,527 | public function getAll ( $ filter = null ) { $ className = self :: getEntitiesClassName ( ) ; $ results = $ this -> getDataSource ( ) -> retrieveAll ( $ filter ) ; $ entities = array ( ) ; foreach ( $ results as $ data ) { $ id = @ $ data [ 'id' ] ; $ entity = $ this -> getEntity ( $ id ) ; if ( empty ( $ entity ) ) { ... | Returns all entities in the collection . |
4,528 | public function parse ( $ value ) { if ( is_array ( $ value ) ) { return $ this -> parseSet ( $ value ) ; } else { return $ this -> parseValue ( $ value ) ; } } | Parse a string or array into a set or variable . |
4,529 | public static function autorun ( ) { $ classes = array_reverse ( get_declared_classes ( ) ) ; foreach ( $ classes as $ class ) { $ type = new \ ReflectionClass ( $ class ) ; $ abstract = $ type -> isAbstract ( ) ; if ( is_subclass_of ( $ class , MViewController :: class ) === true && $ abstract === false ) { $ controll... | This function run the UI process of the web application . |
4,530 | private function addParamValueToList ( \ ReflectionMethod $ reflectedMethod , AssignedParamValue $ paramValue , & $ orderedParamList ) { $ methodParams = $ reflectedMethod -> getParameters ( ) ; $ nothingSet = true ; for ( $ paramIndex = 0 ; $ paramIndex < count ( $ methodParams ) ; $ paramIndex ++ ) { $ reflectedParam... | Puts resolved param value at proper position in the list . |
4,531 | private function resolve ( ValueSource $ valSrc ) { try { return $ this -> resolver -> resolveValueFrom ( $ valSrc ) ; } catch ( ImpossibleToResolveValue $ e ) { throw new UnableToBuild ( "impossible to resolve a value" ) ; } } | Resolves some value . |
4,532 | public function validateSequentialArray ( array $ data , $ prettyName = 'This value' ) { if ( ! empty ( $ data ) && array_keys ( $ data ) !== range ( 0 , count ( $ data ) - 1 ) ) { throw new DataValidationException ( sprintf ( '%s is an array but it is not sequential' , $ prettyName ) ) ; } } | Validate that array is sequential |
4,533 | private function parseConfig ( array $ config = [ ] ) { $ this -> apiConfig = $ this -> extractGuzzleConfig ( $ config ) ; if ( ConfigUtils :: configurationExists ( $ this -> apiConfig , 'apiDescription' ) ) { $ this -> apiDescription = $ this -> apiConfig [ 'apiDescription' ] ; } if ( ConfigUtils :: configurationExist... | Parses the input array for the API client and sets various properties . Returns the raw config |
4,534 | private function extractGuzzleConfig ( $ config ) { foreach ( ConfigUtils :: $ GUZZLE_CONFIG_KEYS as $ guzzleOption ) { if ( array_key_exists ( $ guzzleOption , $ config ) ) { $ this -> guzzleConfig [ $ guzzleOption ] = $ config [ $ guzzleOption ] ; unset ( $ config [ $ guzzleOption ] ) ; } } return $ config ; } | Extracts the Guzzle - specific configuration options from the input configuration array . Returns a stripped - down configuration array with the Guzzle options removed . |
4,535 | private function initializeClient ( ) { $ this -> client = new Client ( $ this -> guzzleConfig ) ; if ( $ this -> isInDebugMode ( ) ) { $ this -> setDebugger ( ) ; } if ( $ this -> needsAuthentication ( ) ) { $ this -> authenticate ( ) ; } return $ this -> client ; } | Initializes the API client . |
4,536 | private function setDebugger ( ) { $ this -> client -> getEmitter ( ) -> attach ( new LogSubscriber ( $ this -> debugLogger , Formatter :: DEBUG ) ) ; } | Attaches a debugger to the API client . |
4,537 | private function authenticate ( ) { self :: assertValidAuthType ( ) ; $ this -> client -> getEmitter ( ) -> attach ( new $ this -> authenticators [ $ this -> authType ] ( $ this ) ) ; } | Authenticates the API client by attaching an authenticator that signs requests . |
4,538 | private function assertValidAuthType ( ) { if ( ! array_key_exists ( $ this -> authType , $ this -> authenticators ) || ! class_exists ( $ this -> authenticators [ $ this -> authType ] ) || ! is_subclass_of ( $ this -> authenticators [ $ this -> authType ] , AbstractAuthenticator :: class ) ) { throw new UnregisteredAu... | Asserts that the API client s authentication type is registered . |
4,539 | private function resolveApiDescription ( ) { $ resolveByClassNameAttempted = false ; while ( ! $ this -> apiDescription instanceof AbstractApiDescription ) { if ( $ resolveByClassNameAttempted ) { $ error = ( is_null ( $ this -> apiDescription ) ) ? 'No API service description found' : 'Malformed API service descriptio... | Resolves the API service description for usage . |
4,540 | public function getTotalBetweenDates ( $ dates ) { $ date1 = new \ DateTime ( $ dates [ 'date1' ] ) ; $ date2 = new \ DateTime ( $ dates [ 'date2' ] ) ; $ qb = $ this -> getQueryBuilder ( ) -> select ( 'SUM(i.totalPrice)' ) -> innerJoin ( 't.items' , 'i' ) -> where ( 't.status = :status' ) -> andWhere ( 't.created BETW... | Get month income between two dates |
4,541 | public function getAll ( ) { $ qb = $ this -> getQueryBuilder ( ) -> select ( 'SUM(i.totalPrice)' ) -> innerJoin ( 't.items' , 'i' ) -> where ( 't.status = :status' ) -> setParameter ( 'status' , Transaction :: STATUS_PAID ) ; return $ qb -> getQuery ( ) -> getSingleScalarResult ( ) ; } | Get all income |
4,542 | public function removeItems ( Transaction $ transaction ) { $ qb = $ this -> getItemQueryBuilder ( ) -> delete ( ) -> where ( 'i.transaction = :transaction' ) -> setParameter ( 'transaction' , $ transaction ) ; $ qb -> getQuery ( ) -> execute ( ) ; } | Remove all product purchase items |
4,543 | public function getStrategy ( $ name ) { $ name = ( string ) $ name ; if ( ! isset ( $ this -> strategies [ $ name ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Unknown escaper strategy "%s".' , $ name ) ) ; } return $ this -> strategies [ $ name ] ; } | Gets the strategy . |
4,544 | public function escapeHtml ( $ string , $ flags = null , $ encoding = null ) { if ( null === $ flags ) { $ flags = ENT_QUOTES | ENT_HTML5 ; } $ flags |= ENT_SUBSTITUTE ; if ( null === $ encoding ) { $ encoding = $ this -> encoding ; } return htmlspecialchars ( ( string ) $ string , $ flags , $ encoding ) ; } | Converts special characters to HTML entities . |
4,545 | function captureBuffer ( $ buff ) { ( ! empty ( $ this -> _view_data ) ) ? $ data = $ this -> _view_data : $ data = "" ; ob_start ( ) ; echo $ buff ; $ contents = ob_get_contents ( ) ; ob_end_clean ( ) ; return trim ( $ contents ) ; } | does not seem to do anything useful |
4,546 | protected function dbConnect ( ) { try { $ pdo = new PDO ( 'mysql:host=' . conf :: $ db [ 'host' ] . ';dbname=' . conf :: $ db [ 'name' ] , conf :: $ db [ 'user' ] , conf :: $ db [ 'pass' ] ) ; $ pdo -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; return $ pdo ; } catch ( PDOException $ e ) { retur... | Standard DB connection function . |
4,547 | protected function query ( $ sql ) { $ vars = func_get_args ( ) ; $ cleaner = "/[\s,].+|[^a-zA-Z]/" ; $ illegal = "/[\\\\'\"\%]/" ; try { $ pdo = $ this -> dbConnect ( ) ; $ stmt = $ pdo -> prepare ( $ sql ) ; $ binds = explode ( ':' , $ sql ) ; foreach ( $ binds as $ n => $ b ) { if ( $ n != 0 && substr ( $ b , 1 ) !=... | false in the event of an error . |
4,548 | public function changePassword ( $ id = null ) { $ user = $ this -> Users -> get ( $ id , [ 'contain' => [ ] ] ) ; $ user -> set ( 'password' , null ) ; if ( $ this -> request -> is ( [ 'patch' , 'post' , 'put' ] ) ) { $ user = $ this -> Users -> patchEntity ( $ user , $ this -> request -> getData ( ) ) ; if ( $ result... | Change user password action . |
4,549 | public function init ( $ themePath ) { $ this -> themePath = $ themePath ; $ this -> themeURL = get_bloginfo ( 'url' ) ; add_action ( 'after_setup_theme' , array ( $ this , 'afterSetupTheme' ) ) ; add_action ( 'template_include' , array ( $ this , 'templateInclude' ) ) ; } | For the given theme path it sets up the theme |
4,550 | protected function _parseExtendsMain ( ) { $ content = file_get_contents ( $ this -> _parent -> getFile ( ) ) ; $ this -> _content = preg_replace ( '`' . $ this -> _openTag . $ this -> _name . preg_quote ( $ this -> markup [ 'extends' ] [ 3 ] ) . $ this -> _space . '/' . $ this -> _closeTag . '`isU' , $ this -> _conten... | if there is a parent template we parse it |
4,551 | protected function _parseExtend ( ) { foreach ( Template :: $ _extends as $ extend ) { $ this -> _content = $ extend [ 'class' ] :: $ extend [ 'method' ] ( $ this -> _content ) ; } foreach ( Config :: instance ( ) -> config [ 'user' ] [ 'template' ] as $ extend ) { $ this -> _content = $ extend [ 'class' ] :: $ extend ... | call functions which extend the template engine |
4,552 | public function parseNoTemplate ( $ content ) { $ this -> _content = $ content ; $ this -> _parseDebugStart ( ) ; $ this -> _parseExtend ( ) ; $ this -> _parseInclude ( ) ; $ this -> _parsePath ( ) ; $ this -> _parseGravatar ( ) ; $ this -> _parseAsset ( ) ; $ this -> _parseUrl ( ) ; $ this -> _parsePhp ( ) ; $ this ->... | parsing without block and template |
4,553 | public function parseLang ( $ content ) { $ this -> _content = $ content ; $ this -> _parseDebugStart ( ) ; $ this -> _parsePath ( ) ; $ this -> _parseGravatar ( ) ; $ this -> _parseUrl ( ) ; $ this -> _parsePhp ( ) ; $ this -> _parseLang ( ) ; $ this -> _parseForeach ( ) ; $ this -> _parseFor ( ) ; $ this -> _parseVar... | parsing for langs |
4,554 | protected function _parseIncludeCallback ( $ m ) { $ file = $ this -> resolve ( RESOLVE_TEMPLATE , $ m [ 1 ] ) . '.tpl' ; $ content = "" ; if ( $ this -> _template -> getFile ( ) != $ file ) { if ( file_exists ( $ file ) ) { if ( isset ( $ m [ 4 ] ) ) { $ t = new Template ( $ m [ 1 ] , 'tplInclude_' . $ this -> _templa... | parse include callback |
4,555 | protected function _parseIncludeCompileCallback ( $ m ) { $ data = '<?php ' ; if ( ! preg_match ( '#^\$#' , $ m [ 1 ] ) ) { $ m [ 1 ] = '"' . $ m [ 1 ] . '"' ; } if ( isset ( $ m [ 4 ] ) ) { $ data .= '$t = self::Template(' . $ m [ 1 ] . ', "tplInclude_' . $ m [ 4 ] . '_' . $ this -> _includeI . '_", "' . $ m [ 4 ] . '... | parse include no compiled callback |
4,556 | protected function _parseExtendsCallback ( $ m ) { $ m [ 1 ] = $ this -> _parseVariableInParameters ( $ m [ 1 ] ) ; $ file = $ this -> resolve ( RESOLVE_TEMPLATE , $ m [ 1 ] ) . '.tpl' ; if ( $ this -> _template -> getFile ( ) != $ file ) { if ( file_exists ( $ file ) ) { if ( isset ( $ m [ 4 ] ) ) { $ this -> _parent ... | parse extends callback |
4,557 | protected function _parseGravatarCallback ( $ m ) { if ( preg_match ( '#^\$#' , $ m [ 1 ] ) ) { foreach ( $ this -> _template -> vars as $ key => $ val ) { if ( substr ( $ m [ 1 ] , 1 , strlen ( $ m [ 1 ] ) ) == $ key ) { $ m [ 1 ] = preg_replace ( '`' . $ key . '`' , $ val , $ m [ 1 ] ) ; $ m [ 1 ] = substr ( $ m [ 1 ... | parse gravatar callback |
4,558 | protected function _parseUrlCallback ( $ m ) { if ( $ m [ 1 ] == ':' ) { $ type = '' ; } else { if ( Config :: config ( ) [ 'user' ] [ 'output' ] [ 'https' ] ) $ type = '"https://' . $ _SERVER [ 'HTTP_HOST' ] . '".' ; else $ type = '"http://' . $ _SERVER [ 'HTTP_HOST' ] . '".' ; } $ data = $ this -> _parseUrlCallbackNo... | parse url classic |
4,559 | protected function _parseUrlCallbackNormal ( $ m ) { if ( isset ( $ m [ 3 ] ) ) { $ vars = explode ( ',' , $ m [ 3 ] ) ; } else { $ vars = [ ] ; } $ array = 'array(' ; foreach ( $ vars as $ val ) { $ array .= '' . $ val . ',' ; } $ array = trim ( $ array , ',' ) . ')' ; return [ $ m [ 2 ] , $ array ] ; } | parse url for both url functions |
4,560 | protected function _parseLangCallBack ( $ m ) { $ a = explode ( ':' , $ m [ 2 ] ) ; if ( $ m [ 1 ] == ':' ) { $ type = '' ; } else { $ type = ', \Gcs\Framework\Core\Lang\Lang::USE_TPL' ; } if ( isset ( $ a [ 1 ] ) ) { if ( ! preg_match ( '#\$#' , $ a [ 0 ] ) ) { return '<?php echo $this->useLang(\'' . trim ( $ a [ 0 ] ... | parse lang classic |
4,561 | protected function _parseLangCallBackNoEcho ( $ m ) { $ a = explode ( ':' , $ m [ 2 ] ) ; if ( $ m [ 1 ] == ':' ) { $ type = '' ; } else { $ type = ', \Gcs\Framework\Core\Lang\Lang::USE_TPL' ; } if ( isset ( $ a [ 1 ] ) ) { if ( ! preg_match ( '#\$#' , $ a [ 0 ] ) ) { return '$this->useLang(\'' . trim ( $ a [ 0 ] ) . '... | parse lang classic no echo |
4,562 | protected function _parseBlockCallback ( $ m ) { if ( ! class_exists ( 'block' . $ m [ 1 ] ) ) { $ blockFunction = '<?php class block' . $ m [ 1 ] . ' extends \Gcs\Framework\Core\Gcs\Framework\Core\Template\Template { public static function ' . $ m [ 1 ] . '(){ ?> ' ; $ blockFunction .= $ m [ 2 ] ; $ blockFunction .= '... | parse block callback |
4,563 | protected function _parseTemplateCallback ( $ m ) { if ( ! class_exists ( 'block' . $ m [ 1 ] ) ) { $ vars = explode ( ',' , $ m [ 2 ] ) ; $ varList = '' ; foreach ( $ vars as $ value ) { if ( $ value == '*' ) { foreach ( $ this -> _template -> vars as $ key => $ value2 ) { if ( ! in_array ( '$' . $ key , $ vars ) ) { ... | parse template callback |
4,564 | protected function _parseCallTemplateCallback ( $ m ) { $ vars = explode ( ',' , $ m [ 2 ] ) ; $ varList = '' ; foreach ( $ vars as $ value ) { if ( $ value == '*' ) { foreach ( $ this -> _template -> vars as $ key => $ value2 ) { if ( ! in_array ( '$' . $ key , $ vars ) ) { $ varList .= '$' . $ key . ',' ; } else { $ ... | parse call block callback |
4,565 | protected function _parseAssetCallback ( $ m ) { if ( Config :: config ( ) [ 'user' ] [ 'output' ] [ 'asset' ] [ 'enabled' ] ) { $ data = [ 'type' => $ m [ 1 ] , 'cache' => $ m [ 3 ] , 'files' => explode ( ',' , $ m [ 2 ] ) ] ; $ asset = new Asset ( $ data ) ; if ( $ m [ 1 ] == 'css' ) { return '<link href="{{url:.Gcs.... | parse asset callback |
4,566 | protected function _parseMinifyCallback ( $ m ) { if ( Config :: config ( ) [ 'user' ] [ 'output' ] [ 'minify' ] ) { $ m [ 1 ] = preg_replace ( '!/\*[^*]*\*+([^/][^*]*\*+)*/!' , '' , $ m [ 1 ] ) ; $ m [ 1 ] = str_replace ( [ "\t" , ' ' , ' ' , ' ' ] , '' , $ m [ 1 ] ) ; } return $ m [ 1 ] ; } | parse minify callback |
4,567 | protected function getContent ( ) : string { if ( $ this -> parent ) { return $ this -> execute ( ) -> parent -> getContent ( ) ; } else { return $ this -> execute ( ) -> content ; } } | Getting the result of document executing . |
4,568 | protected function getLine ( ) : Line { do { $ line = $ this -> buffer -> getLine ( ) ; } while ( $ line -> isEmpty ( ) && $ line -> hasMore ( ) ) ; return $ line ; } | Getting the next line . |
4,569 | public function getConfig ( string ... $ keys ) { return $ this -> htsl -> getConfig ( array_shift ( $ keys ) , $ this -> docType , ... $ keys ) ; } | Getting the config of type of this document . |
4,570 | protected function parseFirstLine ( ) : self { $ line = $ this -> getLine ( ) ; if ( '@' === $ line -> getChar ( 0 ) ) { return $ this -> setExtending ( $ line ) ; } $ this -> docType = $ line -> content ; $ docTypeContent = $ this -> getConfig ( 'doc_types' ) or $ this -> throw ( "DocType $this->docType is not support... | Parsing the first line . |
4,571 | protected function setExtending ( Line $ firstLine ) : self { switch ( $ name = $ firstLine -> pregGet ( '/(?<=^@)[\w-:]+/' ) ) { default : { $ this -> throw ( "The @$name is not supported." ) ; } break ; case 'extend' : { $ this -> extend ( $ firstLine -> pregGet ( '/(?<=\( ).*(?= \))/' ) ) ; } break ; case 'show' : c... | Setting that this document extends another document . |
4,572 | protected function lineByLine ( ) : self { while ( ( $ line = $ this -> getLine ( ) ) -> hasMore ( ) ) { $ this -> lineNumber += 1 ; if ( $ this -> embedment ) { $ this -> embeddingParse ( $ line ) ; } else { $ this -> parseLine ( $ line ) ; } } $ this -> embedment and $ this -> breakEmbedding ( ) ; $ this -> closeNode... | Parsing this document line by line . |
4,573 | protected function embeddingParse ( Line $ line ) : self { if ( $ line -> content === '<}' ) { $ this -> breakEmbedding ( ) ; } else { $ this -> embedment -> parseLine ( $ line -> getSubIndentLine ( ) ) ; } return $ this ; } | Parsing embedded line . |
4,574 | protected function startEmbedding ( string $ embedType ) : self { $ embedmentClass = '\\Htsl\\Embedment\\' . ucfirst ( $ embedType ) . 'Embedment' ; class_exists ( $ embedmentClass ) or $ this -> throw ( "Embed type $embedType not exists." ) ; $ this -> embedment = new $ embedmentClass ( $ this ) ; return $ this ; } | Starting the embedding . |
4,575 | public function breakEmbedding ( ) : self { $ this -> append ( $ this -> embedment -> getContent ( ) ) ; $ this -> embedment = null ; return $ this ; } | Ending the embedding . |
4,576 | protected function getLineType ( Line $ line ) : string { $ possibleType = self :: POSSIBLE_LINE_TYPES ; for ( $ i = 0 ; is_array ( $ possibleType ) ; ++ $ i ) { $ possibleType = $ possibleType [ $ line -> getChar ( $ i ) ] ?? $ possibleType [ ' ' ] ; } return $ possibleType ; } | Getting line type by analyzing first or first two characters of line . |
4,577 | protected function parseHtmlLine ( Line $ line ) : self { return $ this -> openNode ( new StringNode ( $ this , $ line ) ) -> appendLine ( $ line -> slice ( 1 ) ) ; } | Parsing line as HTML content . |
4,578 | protected function parseStringLine ( Line $ line ) : self { return $ this -> openNode ( new StringNode ( $ this , $ line ) ) -> appendLine ( $ this -> htmlEntities ( trim ( $ line -> getContent ( ) ) ) ) ; } | Parsing line as string content . |
4,579 | protected function parseExpressionLine ( Line $ line ) : self { $ content = $ line -> slice ( 1 ) ; $ ent_flag = var_export ( $ this -> htsl -> getConfig ( 'ENT_flags' , $ this -> docType ) , true ) ; $ charset = var_export ( $ this -> htsl -> getConfig ( 'charset' ) , true ) ; return $ this -> openNode ( new StringNod... | Parsing line as PHP expression . |
4,580 | protected function parseExpressionHtmlLine ( Line $ line ) : self { $ content = $ line -> slice ( 1 ) ; return $ this -> openNode ( new StringNode ( $ this , $ line ) ) -> appendLine ( "<?$content?>" ) ; } | Parsing line as PHP expression with HTML result . |
4,581 | protected function parseCommentLine ( Line $ line ) : self { $ node = new CommentNode ( $ this , $ line ) ; return $ this -> openNode ( $ node ) -> appendLine ( $ node -> open ( ) ) ; } | Parsing line as comment . |
4,582 | protected function parseTagLine ( Line $ line ) : self { $ node = new TagNode ( $ this , $ line ) ; $ this -> appendLine ( $ node -> open ( ) ) ; $ node -> embed and $ this -> startEmbedding ( $ node -> embed ) ; return $ this -> openNode ( $ node ) ; } | Parsing line as HTSL tag . |
4,583 | protected function parseControlLine ( Line $ line ) : self { $ node = new ControlNode ( $ this , $ line ) ; return $ this -> appendLine ( $ node -> open ( ) ) -> openNode ( $ node ) ; } | Parsing line as control node of Htsl . php . |
4,584 | protected function parseDocControlLine ( Line $ line ) : self { switch ( $ name = $ line -> pregGet ( '/(?<=^@)[\w-:]+/' ) ) { default : { $ this -> throw ( "The @$name is not supported." ) ; } break ; case 'extend' : { $ this -> throw ( 'The @extend can only be used on first line.' ) ; } break ; case 'include' : { $ t... | Parsing line as document control node of Htsl . php . |
4,585 | protected function extend ( string $ fileName ) : self { $ this -> parent = new static ( $ this -> htsl , $ this -> buffer -> goSide ( $ fileName ) ) ; $ this -> docType = $ this -> parent -> docType ; $ this -> indentation = $ this -> parent -> indentation ; return $ this ; } | Parsing extending defination . |
4,586 | protected function insertIndentations ( string $ input ) : string { return preg_replace ( '/(?<=^|\\n)(?!$)/' , str_repeat ( $ this -> indentation , $ this -> level - $ this -> sectionLevel ) , $ input ) ; } | Insert indentations into given paragraph . |
4,587 | protected function include ( Line $ line ) : self { $ inclued = ( new static ( $ this -> htsl , $ this -> buffer -> goSide ( $ line -> pregGet ( '/(?<=\( ).*(?= \))/' ) ) , $ this ) ) -> execute ( ) -> content ?? null ; false === $ this -> indentation or $ inclued = $ this -> insertIndentations ( $ inclued ) ; return $... | Include another document . |
4,588 | protected function defineSection ( Line $ line ) : self { $ node = new SectionNode ( $ this , $ line ) ; $ node -> open ( ) ; return $ this -> openNode ( $ node ) ; } | Starting to define a section . |
4,589 | protected function showSection ( Line $ line ) : self { $ sectionName = $ line -> pregGet ( '/(?<=\( ).*(?= \))/' ) ; if ( ! isset ( $ this -> sections [ $ sectionName ] ) ) { return $ this -> openNode ( new StringNode ( $ this , $ line ) ) ; } $ content = $ this -> sections [ $ sectionName ] -> content ; false === $ t... | Showing a section . |
4,590 | public function setSection ( Section $ section = null ) : self { if ( ! $ section ) { $ this -> sectionLevel = 0 ; $ this -> currentSection = null ; return $ this ; } if ( $ this -> currentSection ) { $ this -> throw ( 'Nesting definition of section is forbidden.' ) ; } if ( isset ( $ this -> parent -> sections [ $ sec... | Setting document as section definer . |
4,591 | protected function bubbleSections ( ) : self { if ( $ this -> parent ) { foreach ( $ this -> sections as $ name => $ section ) { if ( ! isset ( $ this -> parent -> sections [ $ name ] ) ) { $ this -> parent -> sections [ $ name ] = $ section ; } ; } } return $ this ; } | Bubble the sections to parent document . |
4,592 | public function htmlEntities ( string $ input ) : string { return htmlentities ( $ input , $ this -> htsl -> getConfig ( 'ENT_flags' , $ this -> docType ) , $ this -> htsl -> getConfig ( 'charset' ) , false ) ; } | Escaping characters to HTML entities . |
4,593 | protected function setLevel ( int $ level ) : self { $ level -= $ this -> level ; if ( $ level <= 0 ) { $ this -> closeNodes ( - $ level ) ; } elseif ( $ level == 1 ) { $ this -> level += 1 ; } else { $ this -> throw ( 'Indent error.' ) ; } return $ this ; } | Setting indent level of this document . |
4,594 | protected function openNode ( Node $ node ) : self { array_push ( $ this -> openedNodes , $ node ) ; $ node -> scope and $ this -> setScope ( $ node ) ; return $ this ; } | Opening a node . |
4,595 | protected function closeNodes ( int $ level = 0 ) : self { if ( empty ( $ this -> openedNodes ) ) return $ this ; while ( $ level -- >= 0 ) { $ node = array_pop ( $ this -> openedNodes ) ; $ node -> scope and $ this -> removeScope ( $ node ) ; $ closer = $ node -> close ( $ this -> currentLine ) and $ this -> appendLin... | Closing open node or nodes . |
4,596 | protected function removeScope ( Node $ scope ) : self { if ( $ scope !== array_shift ( $ this -> scopes ) ) { $ this -> throw ( 'Scope nesting error' ) ; } ; return $ this ; } | Pop a scope from stack . |
4,597 | protected function appendLine ( string $ content ) : self { false === $ this -> indentation or $ content = str_repeat ( $ this -> indentation , $ this -> level - $ this -> sectionLevel ) . $ content . "\n" ; return $ this -> append ( $ content ) ; } | Appending a line of content to parsing result . |
4,598 | protected function append ( string $ content ) : self { if ( $ this -> currentSection ) { $ this -> currentSection -> append ( $ content ) ; } else { $ this -> content .= $ content ; } return $ this ; } | Appending some content to parsing result . |
4,599 | public function UserModel_BeforeDeleteUser_Handler ( $ Sender ) { $ UserID = GetValue ( 'UserID' , $ Sender -> EventArguments ) ; $ Options = GetValue ( 'Options' , $ Sender -> EventArguments , array ( ) ) ; $ Options = is_array ( $ Options ) ? $ Options : array ( ) ; $ DeleteMethod = GetValue ( 'DeleteMethod' , $ Opti... | Remove data when deleting a user . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.