idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
7,300 | public function inspect ( ? string $ id , bool $ size = false ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/json?' . http_build_query ( compact ( 'size' ) ) ; return self :: $ curl -> get ( $ url ) ; } | Inspect a container . |
7,301 | public function top ( ? string $ id , string $ ps_args = '-ef' ) { $ url = self :: $ base_url . '/' . $ id ?? $ this -> container_id . '/' . __FUNCTION__ . '?' . http_build_query ( [ 'ps_args' => $ ps_args ] ) ; return self :: $ curl -> get ( $ url ) ; } | List processes running inside a container . |
7,302 | public function logs ( string $ id , bool $ follow = false , bool $ stdout = true , bool $ stderr = false , int $ since = 0 , int $ until = 0 , bool $ timestamps = false , string $ tail = 'all' ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/' . __FUNCTION__ . '?' . http_build_query ( comp... | Get container logs . |
7,303 | public function stats ( ? string $ id , bool $ stream = false ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/stats?' . http_build_query ( [ 'stream' => $ stream ] ) ; return self :: $ curl -> get ( $ url ) ; } | Get container stats based on resource usage . |
7,304 | public function resize ( ? string $ id , int $ height , int $ width ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/resize?' . http_build_query ( compact ( 'height' , 'width' ) ) ; return self :: $ curl -> post ( $ url ) ; } | Resize a container TTY . |
7,305 | public function attachViaWebSocket ( ? string $ id , string $ detachKeys = null , bool $ logs = false , bool $ stream = false , bool $ stdin = false , bool $ stdout = false , bool $ stderr = false ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/attach/ws?' . http_build_query ( compact ( 'd... | Attach to a container via a websocket . |
7,306 | public function wait ( ? string $ id , string $ condition = 'not - running' ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/wait?' . http_build_query ( compact ( 'condition' ) ) ; return self :: $ curl -> post ( $ url ) ; } | Wait for a container . |
7,307 | public function getFileInfo ( ? string $ id , string $ path ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/archive?' . http_build_query ( [ 'path' => $ path , ] ) ; self :: $ curl -> get ( $ url ) ; return self :: $ curl -> getResponseHeaders ( ) ; } | Get information about files in a container . |
7,308 | public function archive ( ? string $ id , string $ path ) { $ url = self :: $ base_url . '/' . ( $ id ?? $ this -> container_id ) . '/archive?' . http_build_query ( [ 'path' => $ path ] ) ; return self :: $ curl -> get ( $ url ) ; } | Get an archive of a filesystem resource in a container . |
7,309 | public function extract ( ? string $ id , string $ path , bool $ noOverwriteDirNonDir , string $ request ) { $ id = $ id ?? $ this -> container_id ; $ url = self :: $ base_url . '/' . $ id . '/archive?' . http_build_query ( compact ( 'path' , 'noOverwriteDirNonDir' ) ) ; $ output = self :: $ curl -> put ( $ url , $ req... | Extract an archive of files or folders to a directory in a container . |
7,310 | function apply ( Component $ component ) { if ( $ component -> supportsProperties ( ) ) { if ( $ this -> props ) $ component -> props -> applyDefaults ( $ this -> props ) ; if ( $ this -> unset ) foreach ( $ this -> unset as $ prop ) unset ( $ component -> props -> $ prop ) ; } if ( $ this -> content ) { $ component ->... | Apply the preset to the given component . |
7,311 | function ifMatchesApply ( Component $ component ) { if ( $ this -> matches ( $ component ) ) { $ this -> apply ( $ component ) ; return true ; } return false ; } | If the given component matches the preset s selector it applies the preset to it . |
7,312 | function matches ( Component $ component ) { if ( $ this -> matchTag && $ this -> matchTag !== $ component -> getTagName ( ) ) return false ; if ( $ this -> matchClass && ( ! $ component instanceof HtmlComponent || ! preg_match ( $ this -> matchClass , $ component -> props -> class ) ) ) return false ; if ( $ component... | Checks if the given component matches the preset s selector . |
7,313 | public static function parse ( string $ address ) { static $ regex = null ; if ( null === $ regex ) { $ grammar = Grammar :: getInstance ( ) ; $ addrSpec = $ grammar -> getDefinition ( 'addr-spec' ) ; $ cfws = $ grammar -> getDefinition ( 'CFWS' ) ; $ phrase = $ grammar -> getDefinition ( 'phrase' ) ; $ regex = '/(?<ad... | Parse a RFC 2822 compliant address and return its address and personal parts . Returns null if address is invalid . |
7,314 | public function link ( $ link , $ text = null , $ title = null , $ popup = false , $ class = null ) { if ( is_null ( $ text ) ) { $ text = $ link ; } $ link = $ this -> getLink ( $ link ) ; $ attributes = $ this -> getHtmlAttributes ( array ( 'title' => $ title , 'target' => $ this -> isTrue ( $ popup ) ? "blank" : nul... | Implements the link snippet |
7,315 | public function email ( $ address , $ text = null , $ title = null , $ class = null ) { if ( is_null ( $ text ) ) { $ text = $ address ; } $ attributes = $ this -> getHtmlAttributes ( array ( 'title' => $ title , 'class' => $ class ) ) ; return "<a href='mailto:$address'$attributes>$text</a>" ; } | Implements the email snippet |
7,316 | public function tel ( $ nr , $ text = null , $ class = null ) { if ( is_null ( $ text ) ) { $ text = $ nr ; } $ attributes = $ this -> getHtmlAttributes ( array ( 'class' => $ class ) ) ; return "<a href='tel:$nr'$attributes>$text</a>" ; } | Implements the tel snippet |
7,317 | public function image ( $ image , $ width = null , $ height = null , $ alt = null , $ class = null , $ link = null , $ caption = null , $ srcset = null ) { $ image = $ this -> getLink ( $ image ) ; $ attributes = $ this -> getHtmlAttributes ( array ( 'width' => $ width , 'height' => $ height , 'alt' => $ alt , 'caption... | Implements the image snippet |
7,318 | public function file ( $ file , $ text = null , $ download = null , $ class = null ) { if ( is_null ( $ text ) ) { $ text = $ file ; } $ file = $ this -> getLink ( $ file ) ; $ attributes = $ this -> getHtmlAttributes ( array ( 'class' => $ class ) ) ; if ( $ this -> isTrue ( $ download ) ) { $ attributes .= " download... | Implements the file snippet |
7,319 | public function youtube ( $ link , $ width = 480 , $ height = 360 ) { $ url = parse_url ( $ link ) ; if ( ! array_key_exists ( 'query' , $ url ) ) { return "" ; } parse_str ( $ url [ 'query' ] , $ query ) ; $ is_playlist = array_key_exists ( 'list' , $ query ) ; if ( $ is_playlist ) { $ playlist_id = $ query [ 'list' ]... | Implements the youtube snippet |
7,320 | public function vimeo ( $ link , $ width = 480 , $ height = 360 , $ portrait = true , $ title = true , $ byline = true ) { $ matches = array ( ) ; $ regexp = '/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*(?\'video_id\'[0-9]{6,11})[?]?.*/' ; if ( preg_match_all ( $ regexp , $ link , $ matches ) ) { if ( arra... | Implements the vimeo snippet |
7,321 | public function twitter ( $ what , $ text = null , $ class = null ) { if ( is_null ( $ text ) ) { $ text = $ what ; } $ attributes = $ this -> getHtmlAttributes ( array ( 'class' => $ class ) ) ; if ( substr ( $ what , 0 , 1 ) == '@' ) { $ link = "https://www.twitter.com/" . ltrim ( $ what , '@' ) ; } elseif ( substr (... | Implements the twitter snippet |
7,322 | public function gist ( $ link , $ file = null ) { $ matches = array ( ) ; if ( preg_match ( '/[0-9]+/' , $ link , $ matches ) > 0 ) { $ gist_id = $ matches [ 0 ] ; $ link = "https://gist.github.com/$gist_id.js" ; if ( ! is_null ( $ file ) ) { $ link .= "?file=" . urlencode ( $ file ) ; } } return "<script src='$link'><... | Implements the gist snippet |
7,323 | public function onResponse ( Connection $ conn , $ bytes ) { $ this -> onPublishResponse ( $ conn , $ bytes ) ; if ( $ bytes === "CLOSE_WAIT" ) { $ conn -> tryClose ( ) ; } } | OnResponse is called when the connection receives a FrameTypeResponse from nsqd |
7,324 | public function onClose ( Connection $ conn ) { $ this -> onPublishResponse ( $ conn , "CONN_CLOSED" , new NsqException ( "connection close, maybe disposable connection timeout" ) ) ; if ( ! $ conn -> isDisposable ( ) ) { $ this -> lookup -> removeConnection ( $ conn ) ; $ remainConnNum = count ( $ this -> getNsqdConns... | OnClose is called when the connection closes after all cleanup |
7,325 | public function postage ( $ params , $ content , $ template , & $ repeat ) { if ( ! $ repeat ) { return ( null !== $ this -> countryId ) ? $ content : "" ; } $ customer = $ this -> getCurrentRequest ( ) -> getSession ( ) -> getCustomerUser ( ) ; list ( $ address , $ country , $ state ) = $ this -> getDeliveryInformatio... | Get postage amount for cart |
7,326 | protected function getDeliveryInformation ( Customer $ customer = null ) { $ address = null ; if ( null !== $ addressId = $ this -> getCurrentRequest ( ) -> getSession ( ) -> getOrder ( ) -> getChoosenDeliveryAddress ( ) ) { if ( null !== $ address = AddressQuery :: create ( ) -> findPk ( $ addressId ) ) { $ this -> is... | Retrieve the delivery country for a customer |
7,327 | protected function getCheapestDelivery ( Address $ address = null , Country $ country = null ) { $ cart = $ this -> getCurrentRequest ( ) -> getSession ( ) -> getSessionCart ( ) ; $ deliveryModules = ModuleQuery :: create ( ) -> filterByActivate ( 1 ) -> filterByType ( BaseModule :: DELIVERY_MODULE_TYPE , Criteria :: E... | Retrieve the cheapest delivery for country |
7,328 | public static function createVirtualColumns ( string $ tableName , string $ column , array $ virtualColumns , bool $ isJson = true ) { if ( Schema :: hasTable ( $ tableName ) ) { Schema :: table ( $ tableName , function ( $ table ) use ( $ tableName , $ column , $ virtualColumns , $ isJson ) { foreach ( $ virtualColumn... | Create virtual columns for selected table an column . |
7,329 | public static function deleteColumn ( string $ tableName , string $ column ) { if ( Schema :: hasTable ( $ tableName ) ) { Schema :: table ( $ tableName , function ( $ table ) use ( $ tableName , $ column ) { if ( Schema :: hasColumn ( $ tableName , $ column ) ) { $ table -> dropColumn ( $ column ) ; } } ) ; } } | Delete column from the database |
7,330 | public function onConnect ( Connection $ conn ) { $ conn -> setDelegate ( $ this ) ; $ conn -> writeCmd ( Command :: subscribe ( $ this -> topic , $ this -> channel ) ) ; $ this -> maybeUpdateRDY ( $ conn ) ; } | onConnected is called when nsqd connects |
7,331 | public function onMessage ( Connection $ conn , Message $ msg ) { $ this -> totalRdyCount -- ; $ this -> stats [ "messagesReceived" ] ++ ; yield $ this -> handleMessage ( $ msg ) ; } | OnMessage is called when the connection receives a FrameTypeMessage from nsqd |
7,332 | private function resolveRouteOptions ( Route $ route , $ routeName ) { if ( null === $ cmsOptions = $ route -> getOption ( '_cms' ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Route "%s" does not have "_cms" defaults attributes.' , $ routeName ) ) ; } $ path = $ route -> getPath ( ) ; $ dynamic = false ; if (... | Resolve route options . |
7,333 | private function gatherRoutesDefinitions ( ) { $ route = $ this -> findRouteByName ( $ this -> homeRouteName ) ; $ this -> homeDefinition = new RouteDefinition ( $ this -> homeRouteName , $ this -> resolveRouteOptions ( $ route , $ this -> homeRouteName ) ) ; foreach ( $ this -> routes as $ name => $ route ) { if ( $ t... | Creates a tree of RouteDefinition |
7,334 | private function createRouteDefinition ( $ routeName , Route $ route ) { if ( null === $ definition = $ this -> findRouteDefinitionByRouteName ( $ routeName ) ) { $ definition = new RouteDefinition ( $ routeName , $ this -> resolveRouteOptions ( $ route , $ routeName ) ) ; if ( null === $ parentRouteName = $ definition... | Creates a route definition |
7,335 | private function findRouteByName ( $ name ) { if ( null === $ route = $ this -> routes -> get ( $ name ) ) { throw new \ RuntimeException ( sprintf ( 'Route "%s" not found.' , $ name ) ) ; } return $ route ; } | Finds a route by name |
7,336 | private function findRouteDefinitionByRouteName ( $ routeName ) { if ( $ routeName === $ this -> homeRouteName ) { return $ this -> homeDefinition ; } return $ this -> homeDefinition -> findChildByRouteName ( $ routeName ) ; } | Finds a RouteDefinition by route name |
7,337 | private function createMenus ( PageInterface $ page , array $ menus ) { if ( ! empty ( $ menus ) ) { foreach ( $ menus as $ parentName => $ config ) { if ( null === $ parent = $ this -> menuRepository -> findOneByName ( $ parentName ) ) { $ this -> output -> writeln ( sprintf ( '<error>Parent menu "%s" not found for ro... | Creates the menus entries . |
7,338 | private function removeNonMappedPages ( ) { $ staticPages = $ this -> pageRepository -> findBy ( [ 'static' => true ] , [ 'left' => 'DESC' ] ) ; foreach ( $ staticPages as $ page ) { if ( null === $ this -> findRouteDefinitionByRouteName ( $ page -> getRoute ( ) ) ) { $ this -> outputPageAction ( $ page -> getName ( ) ... | Removes static pages which are no longer mapped to the routing . |
7,339 | private function validate ( $ element ) { $ violationList = $ this -> validator -> validate ( $ element , null , [ 'Generator' ] ) ; if ( 0 < $ violationList -> count ( ) ) { $ this -> output -> writeln ( '<error>Invalid element</error>' ) ; foreach ( $ violationList as $ violation ) { $ this -> output -> writeln ( spr... | Validates the element . |
7,340 | private function outputPageAction ( $ name , $ action ) { $ this -> output -> writeln ( sprintf ( '- <comment>%s</comment> %s %s.' , $ name , str_pad ( '.' , 44 - mb_strlen ( $ name ) , '.' , STR_PAD_LEFT ) , $ action ) ) ; } | Outputs the page action . |
7,341 | protected function fetch ( ) { if ( $ this -> fetched ) return ; if ( $ this -> container [ 'session' ] -> has ( 'messages' ) ) $ this -> messages = $ this -> container [ 'session' ] [ 'messages' ] ; $ this -> fetched = true ; return $ this ; } | Fetch messages . |
7,342 | public function getRouteCollectionForRequest ( Request $ request ) { $ collection = new RouteCollection ( ) ; $ qb = $ this -> pageRepository -> createQueryBuilder ( 'p' ) ; $ qb -> select ( 'p.id' ) -> join ( 'p.translations' , 't' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'p.static' , 0 ) ) -> andWhere ( $ qb -> expr ... | Finds Routes that match the given request . |
7,343 | public function getRoutesByNames ( $ names , $ parameters = [ ] ) { $ qb = $ this -> pageRepository -> createQueryBuilder ( 'p' ) ; $ qb -> select ( 'p.route, p.controller, t.path, t.locale' ) -> join ( 'p.translations' , 't' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'p.static' , 0 ) ) ; if ( is_array ( $ names ) && ! e... | Find Routes by name . |
7,344 | public function getRouteByName ( $ name , $ parameters = [ ] ) { $ qb = $ this -> pageRepository -> createQueryBuilder ( 'p' ) ; $ results = $ qb -> select ( 'p.route, p.controller, t.path, t.locale' ) -> join ( 'p.translations' , 't' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'p.static' , 0 ) ) -> andWhere ( $ qb -> exp... | Finds a Route by name . |
7,345 | protected function transformResultsToRoutes ( array $ results ) { $ routes = [ ] ; foreach ( $ results as $ result ) { $ name = $ result [ 'route' ] ; if ( array_key_exists ( $ name , $ routes ) ) { $ route = $ routes [ $ name ] ; $ paths = $ route -> getOption ( 'i18n_paths' ) ; $ paths [ $ result [ 'locale' ] ] = $ r... | Transforms the array results into routes . |
7,346 | function setProps ( array $ props = null ) { if ( $ this -> propsClass ) { if ( ! class_exists ( $ this -> propsClass , false ) ) { $ this -> context -> getMacrosService ( ) -> setupMacroProperties ( $ this -> propsClass , $ this -> templateUrl , function ( ) { $ this -> createView ( ) ; return $ this -> getShadowDOM (... | Creates the properties object from the class generated for this macro type and copies the property values to it . |
7,347 | protected function databind ( ) { $ bp = "$this->propsClass::bindings" ; if ( defined ( $ bp ) ) foreach ( constant ( $ bp ) as $ k => $ v ) { if ( ! exists ( $ this -> getComputedPropValue ( $ k ) ) ) $ this -> bindings [ $ k ] = unserialize ( $ v ) ; } parent :: databind ( ) ; } | Extend the default binding procedure by also incorporating bindings for computed default property values . |
7,348 | public function newCollection ( array $ models = [ ] , string $ eloquent = null , string $ table = null ) { return ( new AccioCollection ( $ models ) ) -> setModel ( $ eloquent , $ table ) ; } | Create a custom Eloquent Collection instance . |
7,349 | private function getIndex ( $ searchedHour , $ hours ) { foreach ( $ hours as $ index => $ hour ) { if ( $ hour == $ searchedHour ) { return $ index ; } } } | returns index of the given value in array |
7,350 | public function isWithinFrequency ( $ hour , $ frequencies , $ hours ) { $ hourIndex = $ this -> getIndex ( $ hour , $ hours ) ; foreach ( $ frequencies as $ frequency ) { $ startIndex = $ this -> getIndex ( date ( 'G' , $ frequency -> getStartTime ( ) -> getTimestamp ( ) ) , $ hours ) ; $ endIndex = $ this -> getIndex... | Check if an hour is under a frequency frame and should not be displayed . |
7,351 | public function hourIndex ( $ datetime , $ hours ) { $ searchedHour = date ( 'G' , $ datetime -> getTimestamp ( ) ) ; return $ this -> getIndex ( $ searchedHour , $ hours ) ; } | Returns the index values array for a given Datetime |
7,352 | public function toWeekDays ( $ pattern ) { $ weekDays = $ this -> getWeekDays ( ) ; $ formatedDays = [ ] ; foreach ( str_split ( $ pattern ) as $ key => $ day ) { if ( array_key_exists ( $ day , $ weekDays ) && intval ( $ day ) === 1 ) { $ formatedDays [ ] = $ weekDays [ $ key ] ; } } return join ( ', ' , $ formatedDay... | Converts weekly pattern to week days string |
7,353 | private function getWeekDays ( ) { if ( empty ( self :: $ weekDays ) && ( $ this -> translator instanceof TranslatorInterface ) ) { self :: $ weekDays = [ $ this -> translator -> trans ( 'calendar.weekdays.monday' , [ ] , 'default' ) , $ this -> translator -> trans ( 'calendar.weekdays.tuesday' , [ ] , 'default' ) , $ ... | Singleton method to avoid multiple translate call |
7,354 | public function mkdirr ( $ pathname , $ mode = null ) { if ( is_dir ( $ pathname ) || empty ( $ pathname ) ) { return true ; } if ( is_file ( $ pathname ) ) { return false ; } $ nextPathname = substr ( $ pathname , 0 , strrpos ( $ pathname , "/" ) ) ; if ( $ this -> mkdirr ( $ nextPathname , $ mode ) ) { if ( ! file_ex... | Create a directory and all subdirectories needed . |
7,355 | public function rmdirr ( $ dir ) { if ( $ handle = opendir ( "$dir" ) ) { while ( $ item = readdir ( $ handle ) ) { if ( ( $ item != "." ) && ( $ item != ".." ) ) { if ( is_dir ( "$dir/$item" ) ) { $ this -> rmdirr ( "$dir/$item" ) ; } else { unlink ( "$dir/$item" ) ; } } } closedir ( $ handle ) ; rmdir ( $ dir ) ; } } | remove recursively directory |
7,356 | public function readfileChunked ( $ filename , $ retbytes = false ) { $ chunksize = 1 * ( 1024 * 1024 ) ; $ buffer = '' ; $ cnt = 0 ; $ handle = fopen ( $ filename , 'rb' ) ; if ( $ handle === false ) { return false ; } while ( ! feof ( $ handle ) ) { $ buffer = fread ( $ handle , $ chunksize ) ; echo $ buffer ; ob_flu... | send the content of a file to the output by chuncks in order to limite the memory consumption . |
7,357 | public function prepareName ( $ name ) { $ name = empty ( $ name ) ? 'index' : $ name ; $ name = strtolower ( $ name ) ; $ name = str_replace ( [ '-' , '_' ] , ' ' , $ name ) ; $ name = ucwords ( $ name ) ; $ name = str_replace ( ' ' , '' , $ name ) ; return $ name ; } | Prepare the name . |
7,358 | public function setControllerName ( $ name = 'index' ) { $ name = $ this -> prepareName ( $ name ) . 'Controller' ; $ this -> controllerName = $ name ; $ this -> controller = $ this -> di -> has ( $ name ) ? $ this -> di -> get ( $ name ) : null ; } | Set the name of the controller . |
7,359 | public function forward ( $ forward = [ ] ) { $ controller = isset ( $ forward [ 'controller' ] ) ? $ forward [ 'controller' ] : null ; $ action = isset ( $ forward [ 'action' ] ) ? $ forward [ 'action' ] : null ; $ params = isset ( $ forward [ 'params' ] ) ? $ forward [ 'params' ] : [ ] ; $ this -> setControllerName (... | Forward to a controller action with parameters . |
7,360 | private function getBreadcrumbTitle ( $ file ) { $ frontmatter = $ this -> getFrontmatter ( $ file ) ; $ title = $ frontmatter [ "title" ] ; if ( isset ( $ frontmatter [ "titleBreadcrumb" ] ) ) { $ title = $ frontmatter [ "titleBreadcrumb" ] ; } return $ title ; } | Get the title of a document to use for breadcrumb . |
7,361 | public function handleRequest ( ) : void { global $ save , $ restore ; $ request = $ this -> getRequest ( ) ; if ( ( ! empty ( $ save ) || ! empty ( $ restore ) ) && $ request -> isPost ( ) && check_bitrix_sessid ( ) ) { if ( ! empty ( $ restore ) ) { Option :: delete ( ADMIN_MODULE_NAME ) ; CAdminMessage :: showMessag... | Handle options save request |
7,362 | public function GetStorageItem ( string $ storage , string $ key , string $ ownerUserName = NULL ) { $ result = $ this -> ExecuteCall ( "GetStorageItem" , ( object ) [ "storage" => $ storage , "key" => $ key , "ownerUserName" => $ ownerUserName ] , GnResponseType :: GnMashupStorageItem ) ; return $ result ; } | Gets a storage - item from a specific storage for an user by a given key . Use this call to retrieve the internal value possible with json inside . It s useful when needing the UpdatedTicks value for example . |
7,363 | protected function clearCaches ( ) { $ this -> callSilent ( 'clear-compiled' ) ; $ this -> callSilent ( 'cache:clear' ) ; $ this -> callSilent ( 'route:clear' ) ; $ this -> callSilent ( 'config:clear' ) ; $ this -> callSilent ( 'view:clear' ) ; Cache :: flush ( ) ; } | Clears all Laravel caches . |
7,364 | protected function compileTags ( Compiler $ compiler ) : void { $ tagClass = $ this -> getAttribute ( 'tagClass' ) ; $ assets = $ this -> getAttribute ( 'assets' ) ; $ attributes = $ this -> getAttribute ( 'attributes' ) ; $ position = $ this -> getAttribute ( 'position' ) ; foreach ( $ assets as $ asset ) { $ compiler... | Compile the tags . |
7,365 | public function getSettings ( ) { $ settings = Settings :: all ( ) -> keyBy ( 'settingsKey' ) ; $ settings [ 'defaultLanguage' ] = ( object ) array ( 'value' => Language :: getDefault ( ) -> languageID ) ; if ( isset ( $ settings [ 'logo' ] ) ) { $ media = Media :: where ( 'mediaID' , $ settings [ 'logo' ] -> value ) -... | Get list of all settings and corresponding data languages for language images etc . |
7,366 | public function store ( Request $ request ) { $ settings = Settings :: all ( ) -> keyBy ( 'settingsKey' ) -> toArray ( ) ; foreach ( $ request -> form as $ key => $ value ) { if ( ! isset ( $ settings [ $ key ] ) ) { $ settings [ $ key ] = [ "settingsKey" => $ key , "value" => $ value ] ; } $ settings [ $ key ] [ 'valu... | Store all settings in the database . |
7,367 | public function storePermalinks ( Request $ request ) { $ data = $ request -> all ( ) ; $ tmp = [ ] ; foreach ( $ data as $ permalinks ) { $ tmp = array_merge ( $ tmp , $ permalinks ) ; } if ( Permalink :: truncate ( ) ) { if ( Permalink :: insert ( $ tmp ) ) { return $ this -> response ( 'Permalinks are saved' , 200 )... | Store permalinks in database . |
7,368 | public function LengthAwarePaginator ( $ items , $ resultsPerPage = 4 ) { $ currentPage = LengthAwarePaginator :: resolveCurrentPage ( ) ; $ collection = new Collection ( $ items ) ; $ currentPageSearchResults = $ collection -> slice ( ( $ currentPage - 1 ) * $ resultsPerPage , $ resultsPerPage ) -> all ( ) ; return ne... | Initializes a LengthAwarePaginator instance |
7,369 | public function setGlobals ( $ globals = [ ] ) { $ this -> server = isset ( $ globals [ 'server' ] ) ? array_merge ( $ _SERVER , $ globals [ 'server' ] ) : $ _SERVER ; $ this -> get = isset ( $ globals [ 'get' ] ) ? array_merge ( $ _GET , $ globals [ 'get' ] ) : $ _GET ; $ this -> post = isset ( $ globals [ 'post' ] ) ... | Read info from the globals . |
7,370 | public function init ( ) { $ this -> requestUri = $ this -> getServer ( 'REQUEST_URI' ) ; $ scriptName = $ this -> getServer ( 'SCRIPT_NAME' ) ; $ this -> path = rtrim ( dirname ( $ scriptName ) , '/' ) ; $ this -> scriptName = basename ( $ scriptName ) ; $ this -> extractRoute ( ) ; $ this -> currentUrl = $ this -> ge... | Init the request class by reading information from the request . |
7,371 | public function extractRoute ( ) { $ requestUri = $ this -> getServer ( 'REQUEST_URI' ) ; $ scriptName = $ this -> getServer ( 'SCRIPT_NAME' ) ; $ scriptPath = dirname ( $ scriptName ) ; $ scriptFile = basename ( $ scriptName ) ; $ requestUri = urldecode ( $ requestUri ) ; $ i = 0 ; $ len = min ( strlen ( $ requestUri ... | Extract the part containing the route . |
7,372 | public function getCurrentUrl ( $ queryString = true ) { $ rs = $ this -> getServer ( 'REQUEST_SCHEME' ) ; $ https = $ this -> getServer ( 'HTTPS' ) == 'on' ? true : false ; $ sn = $ this -> getServer ( 'SERVER_NAME' ) ; $ port = $ this -> getServer ( 'SERVER_PORT' ) ; $ port = ( $ port == '80' ) ? '' : ( ( $ port == 4... | Get the current url . |
7,373 | public function getServer ( $ key , $ default = null ) { return isset ( $ this -> server [ $ key ] ) ? $ this -> server [ $ key ] : $ default ; } | Get a value from the _SERVER array and use default if it is not set . |
7,374 | public function setServer ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { $ this -> server = array_merge ( $ this -> server , $ key ) ; } else { $ this -> server [ $ key ] = $ value ; } } | Set variable in the server array . |
7,375 | public function setGet ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { $ this -> get = array_merge ( $ this -> get , $ key ) ; } else { $ this -> get [ $ key ] = $ value ; } } | Set variable in the get array . |
7,376 | public function getAll ( $ lang = "" ) { $ result = [ ] ; $ postType = PostType :: all ( ) -> orderBy ( 'postTypeID' ) ; foreach ( $ postType as $ postType ) { $ postType -> categories = Category :: where ( "postTypeID" , $ postType -> postTypeID ) -> get ( ) ; $ result [ ] = $ postType ; } return [ 'data' => $ result ... | Gets post type with his category . |
7,377 | public function menuPanelItems ( $ lang = "" ) { if ( ! User :: hasAccess ( 'PostType' , 'read' ) ) { return $ this -> noPermission ( ) ; } if ( Input :: input ( 'keyword' ) ) { $ postTypes = PostType :: where ( 'name' , 'like' , '%test%' ) -> paginate ( PostType :: $ rowsPerPage ) ; } else { $ postTypes = PostType :: ... | Get all post types for menu panel . |
7,378 | public function delete ( $ lang , $ id ) { if ( ! User :: hasAccess ( 'PostType' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ res = $ this -> deletePostType ( $ id ) ; if ( $ res && is_bool ( $ res ) ) { return $ this -> response ( 'Post Type is successfully deleted' ) ; } if ( $ res && ! is_bool ( $ res ) ... | Delete a Post Type by using it s ID . |
7,379 | public function bulkDelete ( Request $ request ) { if ( ! User :: hasAccess ( 'PostType' , 'delete' ) ) { return $ this -> noPermission ( ) ; } if ( count ( $ request -> all ( ) ) <= 0 ) { return $ this -> response ( 'Please select items to be deleted' , 500 ) ; } foreach ( $ request -> all ( ) as $ id ) { $ res = $ th... | Bulk Delete post type . Delete many post type in the same time . |
7,380 | private function deletePostType ( $ id ) { $ postType = PostType :: find ( $ id ) ; if ( ! $ postType ) { return false ; } if ( PostType :: hasPosts ( $ postType -> slug ) || PostType :: isInMenuLinks ( $ id ) ) { return $ this -> response ( "You can't delete this Post Type. There could be posts associated with it or i... | Delete post type by using ID . Used in bulkDelete and delete functions . |
7,381 | public function deleteRelatedTagsAndCategory ( $ postType ) { $ categories = Category :: where ( "postTypeID" , $ postType -> postTypeID ) ; $ categoryIDs = $ categories -> pluck ( 'categoryID' ) -> toArray ( ) ; $ categoriesRelations = ( new CategoryRelation ) -> setTable ( $ postType -> slug . "_categories" ) -> wher... | Delete categories and tags with the relations for a post type . |
7,382 | public function deleteField ( string $ postTypeSlug , string $ fieldSlug ) { if ( Schema :: hasColumn ( $ postTypeSlug , $ fieldSlug ) ) { Schema :: table ( $ postTypeSlug , function ( $ table ) use ( $ fieldSlug ) { $ table -> dropColumn ( $ fieldSlug ) ; } ) ; } return true ; } | Delete column from DB . |
7,383 | public function getTables ( ) { $ tables = [ 0 => [ 'group' => 'Post Type' , 'options' => [ ] ] , 1 => [ 'group' => 'Others' , 'options' => [ [ 'label' => 'Users' , 'name' => 'users' , 'belongsTo' => 'User' ] , ] ] ] ; foreach ( PostType :: all ( ) as $ postType ) { $ tables [ 0 ] [ 'options' ] [ ] = [ 'label' => $ pos... | Generates a list of tables that can be used as data for custom field drop down . |
7,384 | public function checkForRelationshipIntersections ( Collection $ collection , $ createIntersectionCallback ) { if ( $ this -> intersectionCreated ) { return ; } $ collection -> joinWith ( $ this -> collection , $ this -> columnName , $ this -> columnName , [ $ this -> columnName => $ this -> collection -> getUniqueRefe... | An opportunity for implementors to create intersections on the collection . |
7,385 | public function addColumn ( Column $ column ) { $ columns = func_get_args ( ) ; foreach ( $ columns as $ column ) { $ this -> columns [ $ column -> columnName ] = $ column ; if ( $ column instanceof AutoIncrementColumn ) { $ this -> uniqueIdentifierColumnName = $ column -> columnName ; } } } | Adds a column to the column collection . |
7,386 | public function getIndex ( $ indexName ) { if ( isset ( $ this -> indexes [ $ indexName ] ) ) { return $ this -> indexes [ $ indexName ] ; } return null ; } | Returns a index contained in the schema matching the specified name . |
7,387 | public static function createPrimaryMenu ( ) { $ check = Menu :: where ( 'slug' , 'primary' ) -> get ( ) -> first ( ) ; if ( ! $ check ) { $ create = factory ( Menu :: class ) -> create ( [ 'title' => 'Primary' , 'slug' => 'primary' , 'isPrimary' => true , ] ) ; if ( $ create ) { return true ; } } return false ; } | Create primary menu ( if it doesn t exist . |
7,388 | public static function tag ( $ tag , array $ attrs , $ inner = null ) { $ str = '' ; foreach ( $ attrs as $ k => $ v ) { if ( is_numeric ( $ k ) ) $ str .= $ v . ' ' ; else $ str .= $ k . '="' . $ v . '" ' ; } $ str = '<' . $ tag . ' ' . trim ( $ str ) . '>' ; if ( $ inner === null ) return $ str ; $ str .= $ inner ; r... | Create HTML tag . |
7,389 | public function create ( $ containerOrName , array $ data = [ ] ) { if ( ! ( $ containerOrName instanceof Model \ ContainerInterface || ( is_string ( $ containerOrName ) && 0 < strlen ( $ containerOrName ) ) ) ) { throw new InvalidOperationException ( "Excepted instance of ContainerInterface or string." ) ; } $ row = $... | Creates a new row . |
7,390 | public function delete ( Model \ RowInterface $ row , $ force = false ) { $ container = $ row -> getContainer ( ) ; if ( ! $ force ) { if ( $ row -> isAlone ( ) || $ row -> isNamed ( ) ) { throw new InvalidOperationException ( "The row can't be removed because it is named or the parent container does not have enough ch... | Deletes the row . |
7,391 | public function moveUp ( Model \ RowInterface $ row ) { $ sibling = $ this -> editor -> getRepository ( ) -> findSiblingRow ( $ row , false ) ; if ( null === $ sibling ) { throw new InvalidOperationException ( "The row can't be moved up as no sibling row has been found." ) ; } $ row -> setPosition ( $ row -> getPositio... | Moves the row up . |
7,392 | public function moveDown ( Model \ RowInterface $ row ) { $ sibling = $ this -> editor -> getRepository ( ) -> findSiblingRow ( $ row , true ) ; if ( null === $ sibling ) { throw new InvalidOperationException ( "The row can't be moved down as no sibling row has been found." ) ; } $ row -> setPosition ( $ row -> getPosi... | Moves the row down . |
7,393 | public function fixBlocksPositions ( Model \ RowInterface $ row ) { $ this -> sortChildrenByPosition ( $ row , 'blocks' ) ; $ blocks = $ row -> getBlocks ( ) ; $ position = 0 ; foreach ( $ blocks as $ block ) { $ block -> setPosition ( $ position ) ; $ position ++ ; } return $ this ; } | Fix the blocks positions . |
7,394 | public function applyToQueryBuilder ( QueryBuilder $ qb , & $ parameterOffset = 0 ) { $ expr = $ qb -> expr ( ) ; $ conditions = $ this -> conditions ; foreach ( $ conditions as $ condition ) { $ field = $ condition [ self :: FIELD_POS ] ; switch ( $ field ) { case self :: LEFT_FIELD : case self :: RIGHT_FIELD : case s... | Adds search filter to the query builder passed . NB! The alias of the main table must be e . |
7,395 | public function processFile ( $ src , $ dst , $ vars ) { if ( ! $ this -> overrideFiles && file_exists ( $ dst ) ) return ; $ container = $ this -> container ; $ _src = $ src ; $ _dst = $ dst ; extract ( $ vars ) ; ob_start ( ) ; include $ _src ; $ content = ob_get_contents ( ) ; ob_end_clean ( ) ; $ content = str_repl... | Process a template file . |
7,396 | public function outputPHP ( $ v , $ tabs = 0 , $ line = false ) { $ r = '' ; if ( $ line ) $ r .= "\n" . str_repeat ( "\t" , $ tabs ) ; if ( is_array ( $ v ) ) { $ r .= '[' ; if ( $ v === array_values ( $ v ) ) { foreach ( $ v as $ _v ) $ r .= $ this -> outputPHP ( $ _v , $ tabs + 1 , true ) . "," ; } else { foreach ( ... | Format PHP variables to string . |
7,397 | public static function get ( array $ array , $ key = null , $ default = null ) { if ( is_null ( $ key ) ) { return ; } if ( isset ( $ array [ $ key ] ) ) { return $ array [ $ key ] ; } foreach ( explode ( '.' , $ key ) as $ token ) { if ( ! is_array ( $ array ) or ! array_key_exists ( $ token , $ array ) ) { return $ d... | Get an item from an array with dot notation support . |
7,398 | public static function transmute ( $ items ) { if ( is_array ( $ items ) ) { return $ items ; } elseif ( $ items instanceof Collection ) { return $ items -> all ( ) ; } return ( array ) $ items ; } | Transmute passed items as an array . |
7,399 | public function unserialize ( $ data ) { $ data = unserialize ( $ data ) ; $ this -> dict = $ data [ 0 ] ; $ this -> setInterpolator ( $ data [ 1 ] ) ; } | Reconstruct a log record from its serialized representation . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.