idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
7,400 | public function getMatches ( VerbalExpression $ verbalExpression , $ test ) { $ matches = array ( ) ; preg_match ( $ verbalExpression , $ test , $ matches ) ; return $ matches ; } | Get all matches for the expression |
7,401 | protected function render ( ) { $ this -> context -> getAssetsService ( ) -> beginAssetsContext ( $ this -> props -> prepend ) ; $ this -> runChildren ( ) ; $ this -> context -> getAssetsService ( ) -> endAssetsContext ( ) ; } | Groups Script components under the same assets context . |
7,402 | protected function getEditorValues ( $ set , array $ setData , $ device , $ groupLabel ) { $ groupLabel = $ groupLabel ? $ groupLabel : $ device ; $ editorValues = [ ] ; $ cssSuffixes = $ this -> settings [ static :: $ SETTINGS_SECTION ] [ $ set ] [ 'cssClassSuffixes' ] ; foreach ( $ cssSuffixes as $ cssSuffix ) { $ cs... | Generates SelectBoxEditor options |
7,403 | public function href ( $ routeName = 'tag.single' , $ customAttributes = [ ] ) { $ params = [ 'tagSlug' => $ this -> slug ] ; if ( $ customAttributes ) { $ params = array_merge ( $ customAttributes , $ params ) ; } return route ( $ routeName , $ params ) ; } | Generate a custom URL to a tag . |
7,404 | public function setTable ( $ table ) { $ this -> table = 'post_' . cleanPostTypeSlug ( $ table ) ; self :: $ _tmptable = $ this -> table ; return $ this ; } | Set the table associated with the model . |
7,405 | public static function with ( $ relations ) { $ model = ( new static ( ) ) ; $ class = new \ ReflectionClass ( $ model ) ; $ method = $ class -> getProperty ( "table" ) ; $ class = explode ( "\\" , $ method -> class ) ; if ( $ class [ count ( $ class ) - 1 ] != class_basename ( $ model ) ) { if ( self :: $ _tmptable ) ... | Begin querying a model with eager loading . The default with method initializes a model with pre - defined table new . The table name of a post type is saved in a static variable which is than appended to the model . |
7,406 | protected static function menuLinkPanel ( ) { $ panels = [ ] ; foreach ( PostType :: all ( ) as $ postType ) { $ panels [ ] = [ 'label' => $ postType -> name , 'belongsTo' => $ postType -> slug , 'controller' => ( $ postType -> hasCustomController ( ) ? $ postType -> getCustomController ( ) : 'PostController' ) , 'sear... | Define menu panel . |
7,407 | public static function setMostReadCache ( ) { if ( Cache :: has ( "most_read_articles_ids" ) ) { $ currentDate = new DateTime ( ) ; $ mostReadIDs = [ ] ; $ postByCount = [ ] ; $ currentMostReadIDs = Cache :: get ( "most_read_articles_ids" ) ; foreach ( $ currentMostReadIDs as $ key => $ post ) { $ diff = ( int ) $ curr... | Sets up the cache for the most read articles |
7,408 | public static function getMostReadCache ( ) { $ mostRead = Cache :: get ( "most_read_articles" ) ; if ( ! $ mostRead || $ mostRead == null || $ mostRead -> isEmpty ( ) ) { return [ ] ; } return $ mostRead ; } | Get most read posts from cache |
7,409 | public function getDefaultRelations ( $ postType ) { $ relations = [ ] ; if ( count ( $ this -> autoCacheRelations ) ) { return $ this -> autoCacheRelations ; } if ( $ postType -> hasTags ) { $ relations [ ] = 'tags' ; } if ( $ postType -> hasCategories ) { $ relations [ ] = 'categories' ; } $ relations [ ] = 'featured... | Get cache relations . |
7,410 | public function scopeDate ( $ query , $ year = '' , $ month = '' , $ day = '' ) { if ( $ year ) { $ query -> whereMonth ( $ this -> getTable ( ) . '.created_at' , $ year ) ; } if ( $ month ) { $ query -> whereYear ( $ this -> getTable ( ) . '.created_at' , $ month ) ; } if ( $ day ) { $ query -> whereDay ( $ this -> ge... | Scope a query to include posts by a specific date . |
7,411 | public static function setHomepage ( ) { if ( ! self :: $ homepage ) { $ findHomePage = null ; if ( settings ( 'homepageID' ) ) { $ findHomePage = ( new Post ( ) ) -> setTable ( "post_pages" ) -> where ( 'postID' , settings ( 'homepageID' ) ) -> first ( ) ; } if ( ! $ findHomePage ) { $ findHomePage = ( new Post ( ) ) ... | Get Home Page s data . Home is supposed to be served form post_pages post type . |
7,412 | public static function getHomepage ( $ columnName = '' ) { if ( $ columnName ) { if ( isset ( self :: $ homepage -> $ columnName ) ) { return self :: $ homepage -> $ columnName ; } return null ; } return self :: $ homepage ; } | Get the data of Homepage . |
7,413 | public function mediaField ( $ field ) { if ( count ( $ this -> media ) ) { $ results = $ this -> media -> where ( 'field' , $ field ) ; if ( count ( $ results ) ) { return $ results ; } } return null ; } | Get media of a specific field . |
7,414 | public function media ( ) { $ query = $ this -> customHasManyThrough ( 'App\Models\Media' , 'App\Models\MediaRelation' , 'postID' , 'mediaID' , 'postID' , 'mediaID' , $ this -> getTable ( ) . "_media" ) ; if ( $ this -> mediaField ) { $ query -> where ( $ this -> getTable ( ) . '_media.field' , $ this -> mediaField ) ;... | Media that belong to a Post . |
7,415 | public function getCategoriesAttribute ( ) { $ getPostType = getPostType ( $ this -> getTable ( ) ) ; if ( $ getPostType -> hasCategories ) { return $ this -> getRelationValue ( 'categories' ) ; } return null ; } | Cached categories that belong to a post . |
7,416 | public function getUserAttribute ( ) { if ( $ this -> createdByUserID ) { $ user = User :: where ( 'userID' , $ this -> createdByUserID ) -> first ( ) ; if ( ! $ user ) { $ user = $ this -> getRelationValue ( 'user' ) ; } return $ user ; } return null ; } | Get user that belongs to a post . |
7,417 | public function categories ( ) { $ findPostType = PostType :: findBySlug ( $ this -> getTable ( ) ) ; if ( ! $ findPostType ) { throw new \ Exception ( "Categories relations could not be made because the post type of the post #" . $ this -> postID . " could ont be found!" ) ; } return $ this -> customHasManyThrough ( ... | Categories that belong to a Post . |
7,418 | public function AddComment ( string $ text , int $ itemType = GnCommentItemType :: Community , string $ itemKey = NULL ) { $ result = $ this -> ExecuteCall ( "AddComment" , ( object ) [ "itemType" => $ itemType , "itemKey" => $ itemKey , "text" => $ text ] , GnResponseType :: Json , FALSE , PHP_INT_MAX ) ; $ this -> Cl... | Adds a new comment . |
7,419 | public function copyLocalization ( Localization $ source , LocaleInterface $ targetLocale ) { $ deepCopy = new DeepCopy ( ) ; $ entityManager = $ this -> container -> getDoctrine ( ) -> getManagerForClass ( get_class ( $ source ) ) ; $ deepCopy -> addFilter ( new KeepFilter ( ) , new PropertyMatcher ( get_class ( $ sou... | Makes deep copy with persisting . |
7,420 | public function attachFile ( $ file , $ options = [ ] ) { $ attachment = \ Swift_Attachment :: fromPath ( $ file ) ; if ( isset ( $ options [ 'filename' ] ) ) $ attachment -> setFilename ( $ options [ 'filename' ] ) ; if ( isset ( $ options [ 'mime' ] ) ) $ attachment -> setContentType ( $ options [ 'mime' ] ) ; return... | Attach a file to the email . |
7,421 | public function attachData ( $ data , $ options = [ ] ) { $ attachment = \ Swift_Attachment :: newInstance ( $ data ) ; if ( isset ( $ options [ 'filename' ] ) ) $ attachment -> setFilename ( $ options [ 'filename' ] ) ; if ( isset ( $ options [ 'mime' ] ) ) $ attachment -> setContentType ( $ options [ 'mime' ] ) ; ret... | Attach data as a file to the email . |
7,422 | public function embedFile ( $ file , $ options = [ ] ) { $ image = \ Swift_Image :: fromPath ( $ file ) ; if ( isset ( $ options [ 'filename' ] ) ) $ image -> setFilename ( $ options [ 'filename' ] ) ; if ( isset ( $ options [ 'mime' ] ) ) $ image -> setContentType ( $ options [ 'mime' ] ) ; return $ this -> embed ( $ ... | Embed a file in the email . |
7,423 | public function embedData ( $ data , $ options = [ ] ) { $ image = \ Swift_Image :: newInstance ( $ data ) ; if ( isset ( $ options [ 'filename' ] ) ) $ image -> setFilename ( $ options [ 'filename' ] ) ; if ( isset ( $ options [ 'mime' ] ) ) $ image -> setContentType ( $ options [ 'mime' ] ) ; return $ this -> embed (... | Embed data as a file in the email . |
7,424 | public function process ( $ filePath ) { if ( ! is_string ( $ filePath ) && ! file_exists ( $ filePath ) && ! is_readable ( $ filePath ) ) { $ this -> error = 'Failed to get image path' ; return ; } $ imageInfo = getimagesize ( $ filePath ) ; if ( $ imageInfo === false ) { $ this -> error = 'Failed to get image informa... | Builds info from image full path |
7,425 | public function toArray ( ) { return array ( 'width' => $ this -> width , 'height' => $ this -> height , 'type' => $ this -> type , 'bits' => $ this -> bits , 'channels' => $ this -> channels , 'mime' => $ this -> mime , 'path' => $ this -> path , 'size' => $ this -> size , 'name' => $ this -> name , 'directory' => $ t... | Returns image info in array |
7,426 | public function addBlock ( Block $ block ) { if ( $ this -> lock ( 'block' ) ) { $ this -> matchDiscriminator ( $ block ) ; if ( $ this -> addUnique ( $ this -> blocks , $ block ) ) { $ block -> setPlaceHolder ( $ this ) ; } $ this -> unlock ( 'block' ) ; } } | Adds a block |
7,427 | public function removeBlock ( Block $ block ) { if ( ! $ this -> equals ( $ block -> getPlaceHolder ( ) ) || ! $ this -> blocks -> contains ( $ block ) ) { throw new \ InvalidArgumentException ( 'Block does not belongs to this placeholder.' ) ; } $ position = $ block -> getPosition ( ) ; $ this -> blocks -> removeEleme... | Removes block from collection and recalculates other blocks position indexes . |
7,428 | public function setMaster ( Localization $ localization ) { $ this -> matchDiscriminator ( $ localization ) ; if ( $ this -> writeOnce ( $ this -> localization , $ localization ) ) { $ this -> localization -> addPlaceHolder ( $ this ) ; } } | Set master localization |
7,429 | public static function factory ( Localization $ localization , $ name , PlaceHolder $ source = null ) { $ placeHolder = null ; switch ( $ localization :: DISCRIMINATOR ) { case self :: TEMPLATE_DISCR : $ placeHolder = new TemplatePlaceHolder ( $ name ) ; break ; case self :: PAGE_DISCR : case self :: APPLICATION_DISCR ... | Creates new instance based on the discriminator of source entity . |
7,430 | public static function get ( array $ data , string $ key , $ defaultValue = null ) { $ data = self :: dataByPath ( $ data , $ key ) ; if ( $ data === null ) { $ data = $ defaultValue ; } return $ data ; } | Get value from data . |
7,431 | public static function set ( array & $ array , string $ key , $ value , bool $ create = false ) : void { $ keyLast = Str :: last ( $ key , '.' ) ; $ key = Str :: removeLast ( $ key , '.' ) ; $ pathArray = null ; if ( $ key !== '' && $ key !== null ) { $ array = & self :: dataByPath ( $ array , $ key , $ create ) ; } if... | Set value in data . |
7,432 | public static function first ( array $ data , ? string $ key = null ) { if ( count ( $ data ) === 0 ) { return null ; } reset ( $ data ) ; $ element = current ( $ data ) ; if ( $ key !== null && is_array ( $ element ) && isset ( $ element [ $ key ] ) ) { return $ element [ $ key ] ; } return $ element ; } | Get first element of array . |
7,433 | public static function last ( array $ data , ? string $ key = null ) { if ( count ( $ data ) === 0 ) { return null ; } $ element = end ( $ data ) ; if ( $ key !== null && is_array ( $ element ) && isset ( $ element [ $ key ] ) ) { return $ element [ $ key ] ; } return $ element ; } | Get last element of array . |
7,434 | public static function isStringInList ( array $ list , ? string $ key = null ) : bool { $ stringInList = false ; if ( count ( $ list ) === 0 ) { return $ stringInList ; } foreach ( $ list as $ item ) { if ( $ key !== null && isset ( $ item [ $ key ] ) ) { $ value = $ item [ $ key ] ; } else { $ value = $ item ; } if ( ... | Is string in list . |
7,435 | public static function keysExist ( array $ data , array $ keys ) : bool { if ( count ( $ keys ) > 0 ) { foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ data ) ) { return false ; } } } return true ; } | Check if all keys exist in array . |
7,436 | public static function lineMatch ( array $ lines , string $ prefix , string $ suffix , bool $ doTrim , bool $ removePrefixSuffix = false ) : array { $ result = [ ] ; foreach ( $ lines as $ line ) { $ isHit = true ; if ( $ prefix !== '' && $ prefix !== null && Str :: startsWith ( trim ( $ line ) , $ prefix ) ) { if ( $ ... | Get line match . |
7,437 | public static function toJson ( array $ array , bool $ prettyPrint = true , bool $ unescapedSlashes = true ) : string { $ options = 0 ; if ( $ unescapedSlashes ) { $ options += JSON_UNESCAPED_SLASHES ; } if ( $ prettyPrint ) { $ options += JSON_PRETTY_PRINT ; } return json_encode ( $ array , $ options ) ; } | To json . |
7,438 | private static function & dataByPath ( array & $ data , string $ key , bool $ create = false , $ defaultValue = null ) { if ( $ key === '' ) { return $ data ; } $ pathSegments = explode ( '.' , $ key ) ; foreach ( $ pathSegments as $ pathSegment ) { if ( ! is_array ( $ data ) ) { $ data = [ ] ; } if ( ! array_key_exist... | Get data by path . |
7,439 | private function addSeoSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'seo' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> booleanNode ( 'no_follow' ) -> defaultFalse ( ) -> end ( ) -> booleanNode ( 'no_index' ) -> defaultFalse ( ) -> end ( ) -> scalarNode ( 'title_append' ) -> defaultV... | Adds seo section . |
7,440 | private function addMenuSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'menu' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'roots' ) -> defaultValue ( [ 'main' => [ 'title' => 'Navigation principale' , 'description' => 'Barre de navigation principale' , ] ] ) -> useAttribu... | Adds menu section . |
7,441 | private function addSlideShowSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'slide_show' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'static' ) -> defaultValue ( [ ] ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'scalar' ) -> end ( ) -> end ( ) -> arrayNode ( 'themes' ... | Adds slide show section . |
7,442 | private function addSchemaOrgSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'schema_org' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'provider' ) -> defaultValue ( [ ] ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'scalar' ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) ... | Adds schema . org section . |
7,443 | protected function isValidDomainName ( $ domain_name ) { return ( preg_match ( '/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i' , $ domain_name ) && preg_match ( '/^.{1,253}$/' , $ domain_name ) && preg_match ( '/^[^\.]{1,63}(\.[^\.]{1,63})*$/' , $ domain_name ) ) && count ( explode ( '.' , $ domain_name ) ) > 1 ... | Checks if the given string looks like a valid domain name |
7,444 | protected function getHtmlAttributes ( $ attributes ) { $ list = array ( ) ; foreach ( $ attributes as $ name => $ value ) { if ( ! empty ( $ value ) ) { if ( is_scalar ( $ value ) ) { $ list [ ] = "$name='" . htmlentities ( $ value , ENT_QUOTES , "UTF-8" ) . "'" ; } elseif ( is_array ( $ value ) ) { $ list [ ] = $ thi... | Turns a list of attributes provided as an associative array into an equivalent string of HTML attributes that can be inserted into a HTML tag . Skips any attributes that are considered empty . |
7,445 | private function getMedia ( $ timetable , $ externalStopPointId = false ) { $ seasonCategory = $ this -> getSeasonCategory ( $ timetable -> getLineConfig ( ) -> getSeason ( ) -> getPerimeter ( ) -> getExternalNetworkId ( ) , $ timetable -> getExternalRouteId ( ) , $ timetable -> getLineConfig ( ) -> getSeason ( ) -> ge... | prepare media regarding Mtt policy |
7,446 | public function log ( $ message ) : void { $ defaults = [ 'SEVERITY' => 'INFO' , 'AUDIT_TYPE_ID' => $ this -> auditTypeId , 'ITEM_ID' => $ this -> itemId ? : '' , ] ; $ message = $ this -> logMessToArray ( $ message ) ; CEventLog :: Add ( array_merge ( $ defaults , $ message , [ 'MODULE_ID' => $ this -> moduleId ] ) ) ... | Add message to event log |
7,447 | public function debug ( $ message ) : void { $ message = $ this -> logMessToArray ( $ message ) ; $ this -> log ( array_merge ( [ 'SEVERITY' => 'DEBUG' ] , $ message ) ) ; } | Add message to log with DEBUG severity |
7,448 | public function warning ( $ message ) : void { $ message = $ this -> logMessToArray ( $ message ) ; $ this -> log ( array_merge ( [ 'SEVERITY' => 'WARNING' ] , $ message ) ) ; } | Add message to log with WARNING severity |
7,449 | public function error ( $ message ) : void { $ message = $ this -> logMessToArray ( $ message ) ; $ this -> log ( array_merge ( [ 'SEVERITY' => 'ERROR' ] , $ message ) ) ; } | Add message to log with ERROR severity |
7,450 | public function security ( $ message ) : void { $ message = $ this -> logMessToArray ( $ message ) ; $ this -> log ( array_merge ( [ 'SEVERITY' => 'SECURITY' ] , $ message ) ) ; } | Add message to log with SECURITY severity |
7,451 | public function buildPDO ( array $ config = null ) { if ( ! $ config ) $ config = $ this -> config ; $ driver = $ config [ 'driver' ] ; $ user = isset ( $ config [ 'user' ] ) ? $ config [ 'user' ] : 'root' ; $ password = isset ( $ config [ 'password' ] ) ? $ config [ 'password' ] : '' ; $ database = isset ( $ config [ ... | Build the PDO instance . |
7,452 | public function callSilent ( $ command , array $ arguments = [ ] ) { $ instance = $ this -> getApplication ( ) -> find ( $ command ) ; $ arguments [ 'command' ] = $ command ; return $ instance -> run ( new ArrayInput ( $ arguments ) , new NullOutput ) ; } | Call another command silently . |
7,453 | public function confirm ( $ questionStr ) { $ helper = $ this -> getHelperSet ( ) -> get ( 'question' ) ; $ question = new ConfirmationQuestion ( $ questionStr . ' (yes/no)' , false ) ; return $ helper -> ask ( $ this -> input , $ this -> output , $ question ) ; } | Prompt user for confirmation . |
7,454 | private function fillBuffer ( $ length ) { $ fill = intval ( max ( [ $ length , 8192 ] ) ) ; while ( $ this -> buffer -> getSize ( ) < $ length ) { $ read = $ this -> stream -> read ( $ fill ) ; if ( $ read === false || $ read === '' ) { break ; } $ this -> buffer -> write ( preg_replace ( $ this -> pattern , $ this ->... | Fills the BufferStream with at least 8192 characters of input for future read operations . |
7,455 | protected function syntaxHighlighterConfig ( SyntaxHighlighterConfig $ config ) { $ template = [ ] ; $ template [ ] = "SyntaxHighlighter.config.bloggerMode = " . StringHelper :: parseBoolean ( $ config -> getBloggerMode ( ) ) . ";" ; $ template [ ] = "SyntaxHighlighter.config.stripBrs = " . StringHelper :: parseBoolean... | Displays a SyntaxHighlighter config . |
7,456 | protected function syntaxHighlighterDefaults ( SyntaxHighlighterDefaults $ defaults ) { $ template = [ ] ; $ template [ ] = "SyntaxHighlighter.defaults['auto-links'] = " . StringHelper :: parseBoolean ( $ defaults -> getAutoLinks ( ) ) . ";" ; $ template [ ] = "SyntaxHighlighter.defaults['class-name'] = \"" . $ default... | Displays a SyntaxHighlighter defaults . |
7,457 | protected function syntaxHighlighterStrings ( SyntaxHighlighterStrings $ strings ) { $ template = [ ] ; $ template [ ] = "SyntaxHighlighter.config.strings.alert = \"" . $ strings -> getAlert ( ) . "\";" ; $ template [ ] = "SyntaxHighlighter.config.strings.brushNotHtmlScript = \"" . $ strings -> getBrushNotHtmlScript ( ... | Displays a SyntaxHighlighter strings . |
7,458 | private function getChunkedString ( $ string ) { $ firstLine = '' ; if ( $ this -> tell ( ) !== 0 ) { $ next = $ this -> lineLength - ( $ this -> position % ( $ this -> lineLength + $ this -> lineEndingLength ) ) ; if ( strlen ( $ string ) > $ next ) { $ firstLine = substr ( $ string , 0 , $ next ) . $ this -> lineEndi... | Inserts the line ending character after each line length characters in the passed string making sure previously written bytes are taken into account . |
7,459 | public function write ( $ string ) { $ chunked = $ this -> getChunkedString ( $ string ) ; $ this -> position += strlen ( $ chunked ) ; return $ this -> stream -> write ( $ chunked ) ; } | Writes the passed string to the underlying stream ensuring line endings are inserted every line length characters in the string . |
7,460 | public function formatPresenterClass ( string $ presenter ) : string { if ( isset ( $ this -> presenterMapping [ $ presenter ] ) ) { return $ this -> presenterMapping [ $ presenter ] ; } $ parts = explode ( ':' , $ presenter ) ; $ presenterName = ( string ) array_pop ( $ parts ) ; $ modules = [ ] ; while ( ! isset ( $ ... | Formats presenter class name from its name . |
7,461 | public function unformatPresenterClass ( string $ class ) : ? string { $ presenter = array_search ( $ class , $ this -> presenterMapping , true ) ; if ( $ presenter !== false ) { return ( string ) $ presenter ; } foreach ( $ this -> moduleMapping as $ module => $ mapping ) { $ mapping = str_replace ( [ '\\' , '*' ] , [... | Formats presenter name from class name . |
7,462 | public function pagesListAction ( Request $ request ) { $ repository = $ this -> get ( 'ekyna_cms.page.repository' ) ; $ lastModifiedAt = $ repository -> getLastUpdatedAt ( ) ; $ response = new Response ( ) ; $ response -> headers -> set ( 'Content-Type' , 'application/json' ) ; $ response -> setLastModified ( $ lastMo... | Pages list action . |
7,463 | private function buildConfig ( Request $ request ) { $ editor = $ this -> getEditor ( ) ; $ config = $ editor -> getConfig ( ) ; unset ( $ config [ 'layout' ] ) ; $ locales = [ ] ; foreach ( $ config [ 'locales' ] as $ locale ) { $ locales [ ] = [ 'name' => $ locale , 'value' => $ locale , 'title' => ucfirst ( Intl :: ... | Builds the editor configuration . |
7,464 | private function registerSocialSubjectEventSubscriber ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Ekyna\Bundle\CmsBundle\EventListener\SocialSubjectEventListener' ) ; $ definition -> addArgument ( new Reference ( 'ekyna_cms.helper.page' ) ) ; $ definition -> addArgument ( new Reference ( 'router... | Registers the social subject event subscriber . |
7,465 | private function configureSlideShow ( ContainerBuilder $ container , $ config ) { $ registry = $ container -> getDefinition ( 'ekyna_cms.slide_show.registry' ) ; $ container -> setParameter ( 'ekyna_cms.slide_show.static' , $ config [ 'static' ] ) ; $ container -> setParameter ( 'ekyna_cms.slide_show.themes' , $ config... | Configures slide show . |
7,466 | private function registerImageFilters ( ContainerBuilder $ container ) { $ medias = [ 'lg' => 1140 , 'md' => 940 , 'sm' => 720 , 'xs' => 480 , ] ; $ filterSets = [ ] ; foreach ( $ medias as $ size => $ width ) { for ( $ column = 1 ; $ column <= 12 ; $ column ++ ) { $ number = 12 / $ column ; $ filterSets [ sprintf ( 'c... | Registers the image filters for the cms editor . |
7,467 | private function appendCommandOptions ( array $ commandParts ) { foreach ( $ this -> options as $ optionKey ) { if ( $ optionKey == 'tab-width' ) { continue ; } $ optionValue = $ this -> option ( $ optionKey ) ; if ( ! empty ( $ optionValue ) ) { $ commandParts [ ] = sprintf ( '--%s=%s' , $ optionKey , $ optionValue ) ... | Append options to CLI command . |
7,468 | public function createAction ( ) { $ this -> checkAuth ( ) ; $ addressCreate = $ this -> createForm ( FrontForm :: ADDRESS_CREATE ) ; try { $ customer = $ this -> getSecurityContext ( ) -> getCustomerUser ( ) ; $ form = $ this -> validateForm ( $ addressCreate , "post" ) ; $ event = $ this -> createAddressEvent ( $ for... | Create controller . Check if customer is logged in |
7,469 | public function loadFile ( $ filename , $ expose = [ ] ) { $ anaxInstallPath = ANAX_INSTALL_PATH . "/config/$filename" ; $ anaxAppPath = ANAX_APP_PATH . "/config/$filename" ; extract ( $ expose ) ; if ( is_readable ( $ anaxAppPath ) ) { return require $ anaxAppPath ; } elseif ( is_readable ( $ anaxInstallPath ) ) { ret... | Load config file from ANAX_APP_PATH or ANAX_INSTALL_PATH . |
7,470 | public function addOptions ( array $ options ) : void { foreach ( $ options as $ key => $ option ) { $ this -> addOption ( $ key , $ option ) ; } } | Add multiple options at once |
7,471 | public function addTab ( string $ id , array $ tab ) : void { $ this -> optionTabs [ ] = array_merge ( $ tab , [ 'DIV' => $ id ] ) ; } | Add options tab |
7,472 | public function addTabs ( array $ tabs ) : void { foreach ( $ tabs as $ key => $ tab ) { $ this -> addTab ( $ key , $ tab ) ; } } | Add multiple tabs at once |
7,473 | private function loadOptionValues ( ) : void { $ this -> optionValues = array_merge ( Option :: getDefaults ( $ this -> moduleId ) , Option :: getForModule ( $ this -> moduleId ) ) ; } | Load module options values fallback to defaults |
7,474 | public function get ( string $ name ) { if ( empty ( $ this -> optionValues ) ) { $ this -> loadOptionValues ( ) ; } return $ this -> optionValues [ $ name ] ; } | Get module option value |
7,475 | private function upgrade ( ContainerInterface $ container ) { $ data = array_replace ( self :: DEFAULT_DATA , $ container -> getData ( ) ) ; if ( isset ( $ data [ 'media_id' ] ) ) { $ data [ 'image' ] [ 'media' ] = $ data [ 'media_id' ] ; unset ( $ data [ 'media_id' ] ) ; } if ( isset ( $ data [ 'video_id' ] ) ) { $ da... | Changes the container data to follow the 2019 - 03 - 11 changes . |
7,476 | public function getPlaces ( $ layoutSrc ) { $ places = array ( ) ; $ cdataCallback = function ( $ cdata ) { } ; $ macroCallback = function ( $ func , array $ args ) use ( & $ places , $ layoutSrc ) { if ( $ func == HtmlProcessor :: PLACE_HOLDER ) { if ( ! array_key_exists ( 0 , $ args ) || $ args [ 0 ] == '' ) { throw ... | Return list of place names inside the layout |
7,477 | protected function getFileName ( $ layoutSrc ) { $ filename = $ this -> getLayoutDir ( ) . \ DIRECTORY_SEPARATOR . $ layoutSrc ; if ( ! is_file ( $ filename ) ) { throw new LayoutNotFound ( "File '$layoutSrc' was not found" ) ; } if ( ! is_readable ( $ filename ) ) { throw new \ RuntimeException ( "File '$layoutSrc' is... | Generates absolute filename |
7,478 | private function orderToc ( $ baseRoute , $ meta ) { $ defaults = [ "orderby" => "section" , "orderorder" => "asc" , ] ; $ options = array_merge ( $ defaults , $ meta ) ; $ orderby = $ options [ "orderby" ] ; $ order = $ options [ "orderorder" ] ; $ toc = $ this -> meta [ $ baseRoute ] [ "__toc__" ] ; uksort ( $ toc , ... | Order toc items . |
7,479 | private function limitToc ( & $ toc , & $ meta , $ baseRoute = null ) { $ defaults = [ "items" => 7 , "offset" => 0 , ] ; $ options = array_merge ( $ defaults , $ meta ) ; if ( $ this -> currentPage ) { $ options [ "offset" ] = ( $ this -> currentPage - 1 ) * $ options [ "items" ] ; } $ meta [ "totalItems" ] = count ( ... | Limit and paginate toc items . |
7,480 | public function load ( $ class ) { $ class = ltrim ( $ class , '\\' ) ; if ( strncasecmp ( $ class , 'Plop\\' , 4 ) ) { return false ; } if ( strpos ( $ class , '://' ) !== false ) { throw new \ Exception ( 'Possible exploitation attempt detected' ) ; } $ class = str_replace ( array ( '_' , '\\' ) , DIRECTORY_SEPARATOR... | Attempt to load the given class . |
7,481 | public function toString ( ) { $ result = '' ; if ( ! empty ( $ this -> scheme ) ) { $ result .= $ this -> scheme . ':' ; } if ( ! empty ( $ this -> authority ) ) { $ result .= '//' . $ this -> authority ; } $ result .= $ this -> path ; if ( ! empty ( $ this -> query ) ) { $ result .= '?' . $ this -> query ; } if ( ! e... | Returns the string representation of the URI |
7,482 | protected function parse ( $ uri ) { $ uri = ( string ) $ uri ; $ matches = array ( ) ; preg_match ( '!' . self :: getPattern ( ) . '!' , $ uri , $ matches ) ; $ scheme = isset ( $ matches [ 2 ] ) ? $ matches [ 2 ] : null ; $ authority = isset ( $ matches [ 4 ] ) ? $ matches [ 4 ] : null ; $ path = isset ( $ matches [ ... | Parses the given URI into the components |
7,483 | public function convert ( AbstractPaginationQuery $ filter , ArrayAccess $ response ) { $ entities = [ ] ; $ ids = [ ] ; $ return = [ ] ; if ( ! isset ( $ response [ 'response' ] ) || ! isset ( $ response [ 'response' ] [ 'docs' ] ) || ! is_array ( $ response [ 'response' ] [ 'docs' ] ) ) { throw new InvalidArgumentExc... | Convert result into entities |
7,484 | public function get ( $ service ) { if ( isset ( $ this -> active [ $ service ] ) ) { if ( $ this -> loaded [ $ service ] [ 'singleton' ] ) { return $ this -> active [ $ service ] ; } else { return $ this -> load ( $ service ) ; } } elseif ( isset ( $ this -> loaded [ $ service ] ) ) { return $ this -> load ( $ service... | Get an instance of the service object managing singletons . |
7,485 | protected function load ( $ service ) { $ sol = isset ( $ this -> loaded [ $ service ] [ 'loader' ] ) ? $ this -> loaded [ $ service ] [ 'loader' ] : null ; if ( is_callable ( $ sol ) ) { try { $ this -> active [ $ service ] = $ sol ( ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "CDI could not load service... | Lazy load a service object and create an instance of it . |
7,486 | protected function parseMessages ( $ lines ) { $ messages = array ( ) ; $ message = array ( ) ; foreach ( $ lines as $ line ) { if ( empty ( $ line ) & ! empty ( $ message ) ) { $ messages [ ] = $ message ; $ message = array ( ) ; continue ; } $ message [ ] = $ line ; } return $ messages ; } | Parse output into separate messages . |
7,487 | protected function parseLineNumber ( $ lines ) { $ number = 0 ; foreach ( $ lines as $ k => $ line ) { if ( strpos ( $ line , '----' ) === 0 ) { $ string = trim ( $ lines [ $ k - 1 ] ) ; $ string = explode ( '|' , $ string ) ; $ number = trim ( $ string [ 0 ] ) ; break ; } } return ( int ) $ number ; } | Parse line number . |
7,488 | public function checkSchema ( Repository $ inRepository ) { try { $ repos = get_class ( $ inRepository ) ; if ( stripos ( $ repos , "MySql" ) === false ) { return ; } $ existingSchema = MySqlComparisonSchema :: fromTable ( $ this -> schemaName ) ; $ testSchema = MySqlComparisonSchema :: fromMySqlSchema ( $ this ) ; $ a... | Check to see if the back end schema is up to date - if not update it . |
7,489 | private function createTable ( ) { $ sql = "CREATE TABLE `" . $ this -> schemaName . "` (" ; $ definitions = [ ] ; foreach ( $ this -> columns as $ columnName => $ column ) { $ storageColumns = $ column -> createStorageColumns ( ) ; foreach ( $ storageColumns as $ storageColumn ) { $ storageColumn = $ storageColumn -> ... | Creates the table in the back end data store . |
7,490 | public function getNetworks ( $ user = null ) { if ( $ user == null ) { $ user = $ this -> container -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; } if ( $ user === 'anon.' ) { return ( array ( ) ) ; } $ perimeters = $ user -> getCustomer ( ) -> getPerimeters ( ) ; if ( count ( $ perimeters ) == 0 ) { ... | Retrieve current user networks |
7,491 | private function setDefaultOption ( string $ app , int $ value ) { $ this -> defaultsOptions [ $ app ] = $ value ; return $ this ; } | Set total dummy nr per app |
7,492 | public function getDefaultOption ( string $ app ) { if ( $ this -> option ( $ app ) ) { return $ this -> option ( $ app ) ; } if ( ! isset ( $ this -> defaultsOptions [ $ app ] ) ) { throw new \ Exception ( 'Option ' . $ app . ' is not configured' ) ; } return $ this -> defaultsOptions [ $ app ] ; } | Get Total Dummy Per App |
7,493 | private function createPostTypes ( ) { if ( ! $ this -> option ( 'posts' ) && ( $ this -> option ( 'post_types' ) || $ this -> option ( 'all' ) ) ) { $ this -> comment ( 'Creating dummy Post Types...' ) ; $ output = ( new \ PostTypeSeeder ( ) ) -> setCommand ( $ this ) -> run ( $ this -> getDefaultOption ( 'post_types'... | Create post types |
7,494 | public function display ( $ defaults = array ( ) , $ displayTitle = false ) { $ metaAttributes = array_replace_recursive ( $ defaults , $ this -> attributes ) ; $ results = array ( ) ; foreach ( $ metaAttributes as $ name => $ content ) { if ( $ name === 'keywords' ) { $ keywords = $ this -> prepareKeywords ( $ content... | Display the meta tags with the set attributes |
7,495 | private function prepareKeywords ( $ keywords ) { if ( $ keywords === null ) return null ; if ( is_array ( $ keywords ) ) $ keywords = implode ( ', ' , $ keywords ) ; return strtolower ( strip_tags ( $ keywords ) ) ; } | Prepares keywords and converts the array to a comma separated string if required . |
7,496 | private function processNestedAttributes ( $ property , $ content ) { $ results = array ( ) ; if ( $ this -> isAssociativeArray ( $ content ) ) { foreach ( $ content as $ key => $ value ) { $ results = array_merge ( $ results , $ this -> processNestedAttributes ( "{$property}:{$key}" , $ value ) ) ; } } else { foreach ... | Process nested attributes recursively . |
7,497 | final public function prepare ( PageRequest $ request ) { $ this -> request = $ request ; $ this -> response = $ this -> createBlockResponse ( $ request ) ; $ this -> properties = $ request -> getBlockPropertySet ( ) -> getBlockPropertySet ( $ this -> block ) ; try { $ this -> doPrepare ( ) ; } catch ( \ Exception $ e ... | Prepares controller for execution . |
7,498 | public function getPropertyViewValue ( $ name , array $ options = array ( ) ) { $ property = $ this -> getProperty ( $ name ) ; $ propertyConfig = $ this -> config -> getProperty ( $ name ) ; if ( $ propertyConfig instanceof Config \ PropertyCollectionConfig ) { return new BlockPropertyCollectionValue ( $ property , $ ... | Get property value uses default if not found throws exception if property not declared |
7,499 | public function index ( $ lang = "" , $ view = "" ) { $ classNameArr = explode ( "\\" , get_class ( $ this ) ) ; $ className = str_replace ( "Controller" , "" , $ classNameArr [ 4 ] ) ; $ key = ( $ view == 'list' || $ view == '' ) ? 'read' : $ view ; if ( ! User :: hasAccess ( $ className , $ key ) ) { return view ( 'e... | Returns view with no ID param like create etc . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.