idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
227,600 | public function getLinks ( int $ limit = 0 ) : array { if ( $ this -> links === null ) { $ links = $ this -> attrs [ 'links' ] ?? [ ] ; $ this -> links = $ this -> removeInvalidOrHiddenLinks ( $ links ) ; } return $ limit > 0 ? array_slice ( $ this -> links , 0 , $ limit ) : $ this -> links ; } | Returns an array of links in the linkset . |
227,601 | public function input ( $ filename , $ content ) { $ this -> _filename = $ filename ; $ content = preg_replace_callback ( $ this -> _backgroundPattern , array ( $ this , '_replace' ) , $ content ) ; $ content = preg_replace_callback ( $ this -> _backgroundImagePattern , array ( $ this , '_replace' ) , $ content ) ; ret... | Input filter . Locates CSS background images relative to the filename and gets the filemtime for the images . |
227,602 | protected function _replace ( $ matches ) { $ webroot = null ; if ( defined ( 'WWW_ROOT' ) ) { $ webroot = WWW_ROOT ; } if ( ! empty ( $ this -> _settings [ 'webroot' ] ) ) { $ webroot = $ this -> _settings [ 'webroot' ] ; } $ path = $ matches [ 'path' ] ; if ( $ path [ 0 ] === '/' ) { $ imagePath = $ webroot . rtrim (... | Do replacements . |
227,603 | protected function _timestamp ( $ filepath , $ path ) { if ( strpos ( $ path , '?' ) === false ) { $ path .= '?t=' . filemtime ( $ filepath ) ; } return $ path ; } | Add timestamps to the given path . Will not change paths with querystrings as they could have anything in them or be customized already . |
227,604 | protected function oneOf ( array $ keys , $ default = null ) { $ metadata = $ this -> getMetadata ( ) ; foreach ( $ keys as $ key ) { if ( isset ( $ metadata [ $ key ] ) ) { return $ metadata [ $ key ] ; } } return $ default ; } | Loop through an array of metadata keys and return the first one that exists . |
227,605 | public function WriteXY ( $ x , $ y , $ line , $ txt , $ link = '' ) { $ this -> SetXY ( $ x , $ y ) ; $ this -> Write ( $ line , $ txt , $ link ) ; } | Write to position |
227,606 | public function arc ( $ x1 , $ y1 , $ x2 , $ y2 , $ x3 , $ y3 ) { $ h = $ this -> h ; $ this -> out ( sprintf ( '%.2F %.2F %.2F %.2F %.2F %.2F c ' , $ x1 * $ this -> k , ( $ h - $ y1 ) * $ this -> k , $ x2 * $ this -> k , ( $ h - $ y2 ) * $ this -> k , $ x3 * $ this -> k , ( $ h - $ y3 ) * $ this -> k ) ) ; } | Create an Arc . |
227,607 | public function circle ( $ x , $ y , $ r , $ style = 'D' ) { $ this -> Ellipse ( $ x , $ y , $ r , $ r , $ style ) ; } | create a circle . |
227,608 | public function getCode128CheckNum ( $ val ) { $ sum = 103 ; for ( $ i = 0 ; $ i < strlen ( $ val ) ; $ i ++ ) { $ sum += ( $ i + 1 ) * $ this -> ChrToC128 ( ord ( substr ( $ val , $ i , 1 ) ) ) ; } $ ch_num = $ sum % 103 ; return $ ch_num ; } | helper method get Code 128 . |
227,609 | public function compare ( PageVersion $ new , PageVersion $ old ) { if ( $ new -> getRestoredVersionId ( ) ) { return new Diff \ RestoredVersion ( $ new , $ old ) ; } if ( $ new -> isContentChange ( ) ) { return new Diff \ ChunkChange ( $ new , $ old ) ; } if ( $ new -> getTemplateId ( ) !== $ old -> getTemplateId ( ) ... | Compare two versions . |
227,610 | public function allowedToEdit ( Page $ page = null ) { if ( $ page === null ) { return true ; } return Editor :: isEnabled ( ) && $ this -> gate -> allows ( 'edit' , $ page ) ; } | Returns whether the logged in user is allowed to edit a page . |
227,611 | public function edit ( $ type , $ slotname , $ page = null ) { $ className = $ this -> getClassName ( $ type ) ; if ( $ page === null ) { $ page = Router :: getActivePage ( ) ; } $ model = $ this -> find ( $ type , $ slotname , $ page -> getCurrentVersion ( ) ) ; $ attrs = $ model ? $ model -> toArray ( ) : [ ] ; $ chu... | Returns a chunk object of the required type . |
227,612 | public function find ( $ type , $ slotname , PageVersion $ version ) { $ cached = $ this -> getFromCache ( $ type , $ slotname , $ version ) ; if ( $ cached !== false ) { return $ cached ; } $ class = $ this -> getModelName ( $ type ) ; $ chunk = $ version -> getId ( ) ? $ class :: getSingleChunk ( $ version , $ slotna... | Find a chunk by page version type and slotname . |
227,613 | public function findById ( $ type , $ chunkId ) { $ model = $ this -> getModelName ( $ type ) ; return $ model :: find ( $ chunkId ) ; } | Find a chunk by it s ID . |
227,614 | public function getFromCache ( $ type , $ slotname , PageVersion $ version ) { $ key = $ this -> getCacheKey ( $ type , $ slotname , $ version ) ; return $ this -> cache -> get ( $ key , false ) ; } | Get a chunk from the cache . |
227,615 | public function insert ( $ type , $ slotname , $ page = null ) { if ( $ page === null || $ page === Router :: getActivePage ( ) ) { return $ this -> edit ( $ type , $ slotname , $ page ) ; } return $ this -> get ( $ type , $ slotname , $ page ) ; } | Insert a chunk into a page . |
227,616 | public function saveToCache ( $ type , $ slotname , $ version , ChunkModel $ chunk = null ) { $ key = $ this -> getCacheKey ( $ type , $ slotname , $ version ) ; $ this -> cache -> forever ( $ key , $ chunk ) ; } | Save a chunk to the cache . |
227,617 | public function since ( PageVersion $ version ) { $ chunks = [ ] ; foreach ( $ this -> types as $ type ) { $ className = $ this -> getModelName ( $ type ) ; $ chunks [ $ type ] = $ className :: getSince ( $ version ) -> get ( ) ; } return $ chunks ; } | Returns an array of chunks which have changed since a version . |
227,618 | public function input ( $ filename , $ input ) { if ( substr ( $ filename , strlen ( $ this -> _settings [ 'ext' ] ) * - 1 ) !== $ this -> _settings [ 'ext' ] ) { return $ input ; } $ tmpFile = tempnam ( TMP , 'TYPESCRIPT' ) ; $ cmd = $ this -> _settings [ 'typescript' ] . " " . escapeshellarg ( $ filename ) . " --out ... | Runs tsc against files that match the configured extension . |
227,619 | public function output ( $ filename , $ input ) { $ cmdSep = $ this -> _settings [ 'version' ] <= 1 ? ' - ' : '' ; $ cmd = $ this -> _settings [ 'node' ] . ' ' . $ this -> _settings [ 'uglify' ] . $ cmdSep . $ this -> _settings [ 'options' ] ; $ env = array ( 'NODE_PATH' => $ this -> _settings [ 'node_path' ] ) ; retur... | Run uglifyjs against the output and compress it . |
227,620 | protected function _findFile ( $ file ) { foreach ( $ this -> _settings [ 'paths' ] as $ path ) { $ path = rtrim ( $ path , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; if ( file_exists ( $ path . $ file ) ) { return $ path . $ file ; } } return $ file ; } | Attempt to locate a file in the configured paths . |
227,621 | protected function _prependPrefixToFilename ( $ name ) { $ ds = DIRECTORY_SEPARATOR ; $ parts = explode ( $ ds , $ name ) ; $ filename = end ( $ parts ) ; if ( $ name === $ filename || $ filename [ 0 ] === $ this -> optionalDependencyPrefix ) { return $ this -> optionalDependencyPrefix . $ name ; } return str_replace (... | Prepends filenames with defined prefix if not already defined . |
227,622 | public function setSlidesAttribute ( $ slides ) { foreach ( $ slides as & $ slide ) { if ( ! $ slide instanceof Slideshow \ Slide ) { $ slide [ 'url' ] = ( isset ( $ slide [ 'page' ] ) && $ slide [ 'page' ] > 0 ) ? $ slide [ 'page' ] : isset ( $ slide [ 'url' ] ) ? $ slide [ 'url' ] : null ; unset ( $ slide [ 'page' ] ... | Persists slide data to the database . |
227,623 | public function index ( Page $ page ) { $ this -> auth ( $ page ) ; return view ( 'boomcms::editor.page.settings.acl' , [ 'page' => $ page , 'allGroups' => GroupFacade :: findAll ( ) , 'groupIds' => $ page -> getAclGroupIds ( ) , ] ) ; } | View the page ACL settings . |
227,624 | protected function loadConfig ( ) : void { $ configClass = $ this -> getConfigClass ( ) ; $ configDefinitionClass = $ this -> getConfigDefinitionClass ( ) ; try { $ this -> config = new $ configClass ( $ this -> getRawConfig ( ) , new $ configDefinitionClass ( ) ) ; } catch ( InvalidConfigurationException $ e ) { throw... | Automatically loads configuration from datadir instantiates specified config class and validates it with specified confing definition class |
227,625 | public static function controller ( AssetModel $ asset ) { $ namespace = 'BoomCMS\Http\Controllers\ViewAsset\\' ; if ( ! $ asset -> getExtension ( ) ) { return ; } $ byExtension = $ namespace . ucfirst ( $ asset -> getExtension ( ) ) ; if ( class_exists ( $ byExtension ) ) { return $ byExtension ; } $ byType = $ namesp... | Return the controller to be used to display an asset . |
227,626 | protected function _addConstants ( $ constants ) { foreach ( $ constants as $ key => $ value ) { if ( is_resource ( $ value ) === false ) { if ( is_array ( $ value ) || strpos ( $ value , DIRECTORY_SEPARATOR ) === false ) { continue ; } if ( $ value !== DIRECTORY_SEPARATOR && ! @ file_exists ( $ value ) ) { continue ; ... | Add path based constants to the mapped constants . |
227,627 | public function load ( $ path , $ prefix = '' ) { $ config = $ this -> readConfig ( $ path ) ; foreach ( $ config as $ section => $ values ) { if ( in_array ( $ section , self :: $ _extensionTypes ) ) { $ defaults = $ this -> get ( $ section ) ; if ( $ defaults ) { $ values = array_merge ( $ defaults , $ values ) ; } $... | Load a config file into the current instance . |
227,628 | protected function readConfig ( $ filename ) { if ( empty ( $ filename ) || ! is_string ( $ filename ) || ! file_exists ( $ filename ) ) { throw new RuntimeException ( sprintf ( 'Configuration file "%s" was not found.' , $ filename ) ) ; } $ this -> _modifiedTime = max ( $ this -> _modifiedTime , filemtime ( $ filename... | Read the configuration file from disk |
227,629 | protected function resolveExtends ( ) { $ extend = [ ] ; foreach ( $ this -> _targets as $ name => $ target ) { if ( empty ( $ target [ 'extend' ] ) ) { continue ; } $ parent = $ target [ 'extend' ] ; if ( empty ( $ this -> _targets [ $ parent ] ) ) { throw new RuntimeException ( "Invalid extend in '$name'. There is no... | Once all targets have been built resolve extend options . |
227,630 | protected function _parseExtensionDef ( $ target ) { $ paths = array ( ) ; if ( ! empty ( $ target [ 'paths' ] ) ) { $ paths = array_map ( array ( $ this , '_replacePathConstants' ) , ( array ) $ target [ 'paths' ] ) ; } $ target [ 'paths' ] = $ paths ; if ( ! empty ( $ target [ 'cachePath' ] ) ) { $ path = $ this -> _... | Parses paths in an extension definition |
227,631 | public function set ( $ path , $ value ) { $ parts = explode ( '.' , $ path ) ; switch ( count ( $ parts ) ) { case 2 : $ this -> _data [ $ parts [ 0 ] ] [ $ parts [ 1 ] ] = $ value ; break ; case 1 : $ this -> _data [ $ parts [ 0 ] ] = $ value ; break ; case 0 : throw new RuntimeException ( 'Path was empty.' ) ; defau... | Set values into the config object You can t modify targets or filters with this . Use the appropriate methods for those settings . |
227,632 | public function get ( $ path ) { $ parts = explode ( '.' , $ path ) ; switch ( count ( $ parts ) ) { case 2 : if ( isset ( $ this -> _data [ $ parts [ 0 ] ] [ $ parts [ 1 ] ] ) ) { return $ this -> _data [ $ parts [ 0 ] ] [ $ parts [ 1 ] ] ; } break ; case 1 : if ( isset ( $ this -> _data [ $ parts [ 0 ] ] ) ) { return... | Get values from the config data . |
227,633 | public function targetFilters ( $ name ) { $ ext = $ this -> getExt ( $ name ) ; $ filters = [ ] ; if ( isset ( $ this -> _data [ $ ext ] [ self :: FILTERS ] ) ) { $ filters = $ this -> _data [ $ ext ] [ self :: FILTERS ] ; } if ( ! empty ( $ this -> _targets [ $ name ] [ self :: FILTERS ] ) ) { $ buildFilters = $ this... | Get the filters for a build target . |
227,634 | public function allFilters ( ) { $ filters = [ ] ; foreach ( $ this -> extensions ( ) as $ ext ) { if ( empty ( $ this -> _data [ $ ext ] [ self :: FILTERS ] ) ) { continue ; } $ filters = array_merge ( $ filters , $ this -> _data [ $ ext ] [ self :: FILTERS ] ) ; } foreach ( $ this -> _targets as $ target ) { if ( emp... | Get configuration for all filters . |
227,635 | public function cachePath ( $ ext , $ path = null ) { if ( $ path === null ) { if ( isset ( $ this -> _data [ $ ext ] [ 'cachePath' ] ) ) { return $ this -> _data [ $ ext ] [ 'cachePath' ] ; } return '' ; } $ path = $ this -> _replacePathConstants ( $ path ) ; $ this -> _data [ $ ext ] [ 'cachePath' ] = rtrim ( $ path ... | Accessor for getting the cachePath for a given extension . |
227,636 | public function addTarget ( $ target , array $ config ) { $ ext = $ this -> getExt ( $ target ) ; $ config += [ 'files' => [ ] , 'filters' => [ ] , 'theme' => false , 'extend' => false , 'require' => [ ] , ] ; if ( ! empty ( $ config [ 'paths' ] ) ) { $ config [ 'paths' ] = array_map ( array ( $ this , '_replacePathCon... | Create a new build target . |
227,637 | public function theme ( $ theme = null ) { if ( $ theme === null ) { return isset ( $ this -> _data [ 'theme' ] ) ? $ this -> _data [ 'theme' ] : '' ; } $ this -> _data [ 'theme' ] = $ theme ; } | Set the active theme for building assets . |
227,638 | public function write ( AssetTarget $ build , $ content ) { $ ext = $ build -> ext ( ) ; $ path = $ build -> outputDir ( ) ; if ( ! is_writable ( $ path ) ) { throw new RuntimeException ( 'Cannot write cache file. Unable to write to ' . $ path ) ; } $ filename = $ this -> buildFileName ( $ build ) ; $ success = file_pu... | Writes content into a file |
227,639 | public function invalidate ( AssetTarget $ build ) { $ ext = $ build -> ext ( ) ; if ( empty ( $ this -> timestamp [ $ ext ] ) ) { return false ; } $ this -> _invalidated = $ build -> name ( ) ; $ this -> setTimestamp ( $ build , 0 ) ; } | Invalidate a build before re - generating the file . |
227,640 | public function finalize ( AssetTarget $ build ) { $ ext = $ build -> ext ( ) ; if ( empty ( $ this -> timestamp [ $ ext ] ) ) { return ; } $ data = $ this -> _readTimestamp ( ) ; $ name = $ this -> buildCacheName ( $ build ) ; if ( ! isset ( $ data [ $ name ] ) ) { return ; } $ time = $ data [ $ name ] ; unset ( $ dat... | Finalize a build after written to filesystem . |
227,641 | public function setTimestamp ( AssetTarget $ build , $ time ) { $ ext = $ build -> ext ( ) ; if ( empty ( $ this -> timestamp [ $ ext ] ) ) { return ; } $ data = $ this -> _readTimestamp ( ) ; $ name = $ this -> buildCacheName ( $ build ) ; $ data [ $ name ] = $ time ; $ this -> _writeTimestamp ( $ data ) ; } | Set the timestamp for a build file . |
227,642 | protected function _readTimestamp ( ) { $ data = array ( ) ; if ( empty ( $ data ) && file_exists ( $ this -> path . static :: BUILD_TIME_FILE ) ) { $ data = file_get_contents ( $ this -> path . static :: BUILD_TIME_FILE ) ; if ( $ data ) { $ data = unserialize ( $ data ) ; } } return $ data ; } | Read timestamps from either the fast cache or the serialized file . |
227,643 | protected function _writeTimestamp ( $ data ) { $ data = serialize ( $ data ) ; file_put_contents ( $ this -> path . static :: BUILD_TIME_FILE , $ data ) ; chmod ( $ this -> path . static :: BUILD_TIME_FILE , 0644 ) ; } | Write timestamps to either the fast cache or the serialized file . |
227,644 | public function buildFileName ( AssetTarget $ target , $ timestamp = true ) { $ file = $ target -> name ( ) ; if ( $ target -> isThemed ( ) && $ this -> theme ) { $ file = $ this -> theme . '-' . $ file ; } if ( $ timestamp ) { $ time = $ this -> getTimestamp ( $ target ) ; $ file = $ this -> _timestampFile ( $ file , ... | Get the final filename for a build . Resolves theme prefixes and timestamps . |
227,645 | public function buildCacheName ( $ build ) { $ name = $ this -> buildFileName ( $ build , false ) ; if ( $ build -> name ( ) == $ this -> _invalidated ) { return '~' . $ name ; } return $ name ; } | Get the cache name a build . |
227,646 | public function clearTimestamps ( ) { $ path = $ this -> path . static :: BUILD_TIME_FILE ; if ( file_exists ( $ path ) ) { unlink ( $ this -> path . static :: BUILD_TIME_FILE ) ; } } | Clear timestamps for assets . |
227,647 | protected function _timestampFile ( $ file , $ time ) { if ( ! $ time ) { return $ file ; } $ pos = strrpos ( $ file , '.' ) ; $ name = substr ( $ file , 0 , $ pos ) ; $ ext = substr ( $ file , $ pos ) ; return $ name . '.v' . $ time . $ ext ; } | Modify a file name and append in the timestamp |
227,648 | protected function _generateTree ( $ path ) { $ paths = glob ( $ path , GLOB_ONLYDIR ) ; if ( ! $ paths ) { $ paths = array ( ) ; } array_unshift ( $ paths , dirname ( $ path ) ) ; return $ paths ; } | Discover all the sub directories for a given path . |
227,649 | public function find ( $ file ) { $ found = false ; $ expanded = $ this -> _expandPrefix ( $ file ) ; if ( file_exists ( $ expanded ) ) { return $ expanded ; } foreach ( $ this -> _paths as $ path ) { $ file = $ this -> _normalizePath ( $ file , DIRECTORY_SEPARATOR ) ; $ fullPath = $ path . $ file ; if ( file_exists ( ... | Find a file in the connected paths and check for its existance . |
227,650 | public function getDelete ( Page $ page ) { $ this -> authorize ( 'delete' , $ page ) ; return view ( $ this -> viewPrefix . '.delete' , [ 'children' => $ page -> countChildren ( ) , 'page' => $ page , ] ) ; } | Show the delete page confirmation . |
227,651 | public function getHistory ( Page $ page ) { $ this -> authorize ( 'edit' , $ page ) ; return view ( "$this->viewPrefix.history" , [ 'versions' => PageVersionFacade :: history ( $ page ) , 'page' => $ page , 'diff' => new Diff ( ) , ] ) ; } | Show the page version history . |
227,652 | public function postAdmin ( Request $ request , Page $ page ) { $ this -> authorize ( 'editAdmin' , $ page ) ; $ page -> setInternalName ( $ request -> input ( 'internal_name' ) ) -> setAddPageBehaviour ( $ request -> input ( 'add_behaviour' ) ) -> setChildAddPageBehaviour ( $ request -> input ( 'child_add_behaviour' )... | Save the page admin settings . |
227,653 | public function postChildren ( Request $ request , Page $ page ) { $ this -> authorize ( 'editChildrenBasic' , $ page ) ; $ post = $ request -> input ( ) ; $ page -> setChildTemplateId ( $ request -> input ( 'children_template_id' ) ) ; if ( Gate :: allows ( 'editChildrenAdvanced' , $ page ) ) { $ page -> setChildrenUr... | Save the child page settings . |
227,654 | public function postFeature ( Request $ request , Page $ page ) { $ this -> authorize ( 'editFeature' , $ page ) ; $ page -> setFeatureImageId ( $ request -> input ( 'feature_image_id' ) ) ; PageFacade :: save ( $ page ) ; } | Save the page feature image . |
227,655 | public function postNavigation ( Request $ request , Page $ page ) { $ this -> authorize ( 'editNavBasic' , $ page ) ; if ( Gate :: allows ( 'editNavAdvanced' , $ page ) ) { $ parent = Page :: find ( $ request -> input ( 'parent_id' ) ) ; if ( $ parent ) { $ page -> setParent ( $ parent ) ; } } $ page -> setVisibleInNa... | Save the page navigation settings . |
227,656 | public function postSortChildren ( Request $ request , Page $ page ) { $ this -> authorize ( 'editChildrenBasic' , $ page ) ; Bus :: dispatch ( new ReorderChildPages ( $ page , $ request -> input ( 'sequences' ) ) ) ; } | Save the order of child pages . |
227,657 | public function postVisibility ( Request $ request , Page $ page ) { $ this -> authorize ( 'publish' , $ page ) ; $ wasVisible = $ page -> isVisible ( ) ; $ page -> setVisibleAtAnyTime ( $ request -> input ( 'visible' ) ) ; if ( $ page -> isVisibleAtAnyTime ( ) ) { if ( $ request -> has ( 'visible_from' ) ) { $ page ->... | Save the page visibility settings . |
227,658 | protected function _replace ( $ matches ) { $ file = $ this -> _currentFile ; if ( $ matches [ 1 ] === '"' ) { $ file = $ this -> _findFile ( $ matches [ 2 ] , dirname ( $ file ) . DIRECTORY_SEPARATOR ) ; } else { $ file = $ this -> _findFile ( $ matches [ 2 ] ) ; } if ( isset ( $ this -> _loaded [ $ file ] ) ) { retur... | Performs the replacements and inlines dependencies . |
227,659 | public function addVersion ( array $ attrs = [ ] ) : PageVersionInterface { if ( $ oldVersion = $ this -> getCurrentVersion ( ) ) { $ attrs += $ oldVersion -> toArray ( ) ; } unset ( $ attrs [ PageVersion :: ATTR_CHUNK_TYPE ] ) ; unset ( $ attrs [ PageVersion :: ATTR_CHUNK_ID ] ) ; unset ( $ attrs [ PageVersion :: ATTR... | Adds a new version to the page . |
227,660 | public function getDefaultChildTemplateId ( ) : int { if ( ! empty ( $ this -> { self :: ATTR_CHILD_TEMPLATE } ) ) { return ( int ) $ this -> { self :: ATTR_CHILD_TEMPLATE } ; } $ parent = $ this -> getParent ( ) ; return ( $ parent && ! empty ( $ parent -> getGrandchildTemplateId ( ) ) ) ? $ parent -> getGrandchildTem... | Returns the default template ID that child pages should use . |
227,661 | public function getDefaultGrandchildTemplateId ( ) : int { $ grandchildTemplateId = $ this -> getGrandchildTemplateId ( ) ; return empty ( $ grandchildTemplateId ) ? $ this -> getTemplateId ( ) : ( int ) $ grandchildTemplateId ; } | If a default grandchild template ID is set then that is returned . |
227,662 | public function getVisibleTo ( ) { return empty ( $ this -> { self :: ATTR_VISIBLE_TO } ) ? null : new DateTime ( '@' . $ this -> { self :: ATTR_VISIBLE_TO } ) ; } | Returns the visible to date or null if none is set . |
227,663 | public function setEmbargoTime ( DateTime $ time ) : PageInterface { $ this -> addVersion ( [ PageVersion :: ATTR_PENDING_APPROVAL => false , PageVersion :: ATTR_EMBARGOED_UNTIL => $ time -> getTimestamp ( ) , ] ) ; return $ this ; } | Set an embargo time for any unpublished changes . |
227,664 | public function url ( ) { if ( $ this -> { self :: ATTR_PRIMARY_URI } === null ) { return ; } if ( $ this -> primaryUrl === null ) { $ this -> primaryUrl = new URL ( [ 'page' => $ this , 'location' => $ this -> { self :: ATTR_PRIMARY_URI } , 'is_primary' => true , ] ) ; } return $ this -> primaryUrl ; } | Returns the URL object for the page s primary URI . |
227,665 | public function scopeCurrentVersion ( Builder $ query ) { $ subquery = $ this -> getCurrentVersionQuery ( ) ; return $ query -> select ( 'version.*' ) -> addSelect ( 'version.id as version:id' ) -> addSelect ( 'version.created_at as version:created_at' ) -> addSelect ( 'version.created_by as version:created_by' ) -> ad... | Scope for getting pages with the current version . |
227,666 | public static function fromTitle ( $ base , $ title ) { $ url = static :: sanitise ( $ title ) ; if ( $ base && substr ( $ base , - 1 ) != '/' ) { $ base = $ base . '/' ; } $ url = ( $ base == '/' ) ? $ url : $ base . $ url ; return static :: makeUnique ( $ url ) ; } | Generate a unique URL from a page title . |
227,667 | public static function getInternalPath ( $ url ) { $ path = parse_url ( $ url , PHP_URL_PATH ) ; return ( $ path === '/' ) ? $ path : ltrim ( $ path , '/' ) ; } | Returns a path which can be used to query the database of internal URLs . |
227,668 | public static function isInternal ( $ url ) { $ relative = static :: makeRelative ( $ url ) ; if ( substr ( $ relative , 0 , 1 ) !== '/' ) { return false ; } $ path = static :: getInternalPath ( $ relative ) ; return ! URLFacade :: isAvailable ( $ path ) ; } | Determine whether a path is valid internal path . |
227,669 | public static function sanitise ( $ url ) { $ url = trim ( $ url ) ; $ url = strtolower ( $ url ) ; $ url = parse_url ( $ url , PHP_URL_PATH ) ; $ url = preg_replace ( '|/+|' , '/' , $ url ) ; if ( $ url !== '/' ) { $ url = trim ( $ url , '/' ) ; } $ url = preg_replace ( '|[^' . preg_quote ( '-' ) . '\/\pL\pN\s]+|u' , ... | Remove invalid characters from a URL . |
227,670 | protected function getDefaultParameters ( ) : array { $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) ; $ last = end ( $ trace ) ; $ debugMode = static :: detectDebugMode ( ) ; return [ 'appDir' => isset ( $ trace [ 2 ] [ 'file' ] ) ? dirname ( $ trace [ 2 ] [ 'file' ] ) : null , 'wwwDir' => isset ( $ last [ ... | Collect default parameters |
227,671 | protected function _replace ( $ matches ) { $ required = empty ( $ matches [ 2 ] ) ? $ matches [ 4 ] : $ matches [ 2 ] ; $ filename = $ this -> scanner ( ) -> find ( $ required ) ; if ( ! $ filename ) { throw new RuntimeException ( sprintf ( 'Could not find dependency "%s"' , $ required ) ) ; } if ( empty ( $ this -> _... | Does file replacements . |
227,672 | public function attributes ( ) { return [ $ this -> attributePrefix . 'address' => ( int ) $ this -> address , $ this -> attributePrefix . 'title' => ( int ) $ this -> title , ] ; } | Returns the array of chunk attributes . |
227,673 | public function show ( ) { return View :: make ( $ this -> viewPrefix . "location.$this->template" , [ 'lat' => $ this -> getLat ( ) , 'lng' => $ this -> getLng ( ) , 'address' => $ this -> getAddress ( ) , 'title' => $ this -> getTitle ( ) , 'postcode' => $ this -> getPostcode ( ) , 'location' => $ this -> getLocation... | Show a chunk where the target is set . |
227,674 | public function editSuperuser ( Person $ user , Person $ editing ) { return $ user -> isSuperUser ( ) && ! $ user -> is ( $ editing ) ; } | Whether a user can edit the superuser status of another . |
227,675 | public function run ( $ input = null ) { $ descriptorSpec = array ( 0 => array ( 'pipe' , 'r' ) , 1 => array ( 'pipe' , 'w' ) , 2 => array ( 'pipe' , 'w' ) ) ; $ process = proc_open ( $ this -> _command , $ descriptorSpec , $ pipes , null , $ this -> _env ) ; if ( is_resource ( $ process ) ) { fwrite ( $ pipes [ 0 ] , ... | Run the command and capture the output as the return . |
227,676 | protected function _generateScript ( $ file , $ filename , $ input ) { $ id = str_replace ( $ this -> _settings [ 'ext' ] , '' , basename ( $ filename ) ) ; $ filepath = str_replace ( $ this -> _settings [ 'ext' ] , '' , $ filename ) ; foreach ( $ this -> _settings [ 'paths' ] as $ path ) { $ path = rtrim ( $ path , '/... | Generates the javascript passed into node to precompile the the mustache template . |
227,677 | public function getThumbnail ( ) : Imagick { $ image = new Imagick ( $ this -> file -> getPathname ( ) . '[0]' ) ; $ image -> setImageFormat ( 'png' ) ; return $ image ; } | Generates a thumbnail for the PDF from the first page of the document . |
227,678 | public function readMetadata ( ) : array { try { $ parser = new Parser ( ) ; $ pdf = $ parser -> parseFile ( $ this -> file -> getPathname ( ) ) ; return $ pdf -> getDetails ( ) ; } catch ( Exception $ e ) { return [ ] ; } } | Extracts metadata from a PDF . |
227,679 | protected function getRootDefinition ( TreeBuilder $ treeBuilder ) : ArrayNodeDefinition { $ rootNode = $ treeBuilder -> root ( 'root' ) ; $ rootNode -> ignoreExtraKeys ( false ) ; $ rootNode -> children ( ) -> append ( $ this -> getParametersDefinition ( ) ) ; return $ rootNode ; } | Root definition to be overridden in special cases |
227,680 | public function input ( $ file , $ content ) { foreach ( $ this -> filters as $ filter ) { $ content = $ filter -> input ( $ file , $ content ) ; } return $ content ; } | Apply all the input filters in sequence to the file and content . |
227,681 | public function output ( $ target , $ content ) { foreach ( $ this -> filters as $ filter ) { $ content = $ filter -> output ( $ target , $ content ) ; } return $ content ; } | Apply all the output filters in sequence to the file and content . |
227,682 | public function getAsset ( ) { if ( $ this -> asset === null ) { $ this -> asset = AssetFacade :: find ( $ this -> getAssetId ( ) ) ; } return $ this -> asset ; } | Returns the associated asset . |
227,683 | public function getLink ( ) { if ( $ this -> link === null && isset ( $ this -> attrs [ 'url' ] ) ) { $ this -> link = LinkObject :: factory ( $ this -> attrs [ 'url' ] ) ; } return $ this -> link ; } | Returns a LinkObject for the associated link . |
227,684 | public function config ( ) { if ( ! $ this -> config ) { $ config = new AssetConfig ( ) ; $ config -> load ( $ this -> cli -> arguments -> get ( 'config' ) ) ; $ this -> config = $ config ; } return $ this -> config ; } | Get the injected config or build a config object from the CLI option . |
227,685 | public function main ( $ argv ) { $ this -> addArguments ( ) ; try { $ this -> cli -> arguments -> parse ( $ argv ) ; } catch ( \ Exception $ e ) { $ this -> cli -> usage ( ) ; return 0 ; } if ( $ this -> cli -> arguments -> get ( 'help' ) ) { $ this -> cli -> usage ( ) ; return 0 ; } return $ this -> execute ( ) ; } | Execute the task given a set of CLI arguments . |
227,686 | public function verbose ( $ text , $ short = '' ) { if ( ! $ this -> cli -> arguments -> defined ( 'verbose' ) ) { if ( strlen ( $ short ) ) { $ this -> cli -> inline ( $ short ) ; } return ; } $ this -> cli -> out ( $ text ) ; } | Output verbose information . |
227,687 | protected function bootstrapApp ( ) { $ files = explode ( ',' , $ this -> cli -> arguments -> get ( 'bootstrap' ) ) ; foreach ( $ files as $ file ) { require_once $ file ; } } | Include any additional bootstrap files an application might need to create its environment of constants . |
227,688 | public function readMetadata ( ) : array { try { $ ffprobe = FFProbe :: create ( ) ; return $ ffprobe -> format ( $ this -> file -> getPathname ( ) ) -> all ( ) ; } catch ( ExecutableNotFoundException $ e ) { return [ ] ; } } | Extracts metadata via FFProbe . |
227,689 | public static function parseParameters ( array $ variables , string $ prefix ) : array { $ map = function ( & $ array , array $ keys , $ value ) use ( & $ map ) { if ( count ( $ keys ) <= 0 ) return $ value ; $ key = array_shift ( $ keys ) ; if ( ! is_array ( $ array ) ) { throw new InvalidStateException ( sprintf ( 'I... | Parse given parameters with custom prefix |
227,690 | public static function parseAllEnvironmentParameters ( ) : array { $ parameters = [ ] ; foreach ( $ _SERVER as $ key => $ value ) { $ value = getenv ( $ key ) ; if ( $ value !== false ) { $ parameters [ $ key ] = $ value ; } } return $ parameters ; } | Parse all environment variables |
227,691 | public function append ( AssetTarget $ target ) { $ name = $ target -> name ( ) ; $ this -> indexed [ $ name ] = $ target ; $ this -> items [ ] = $ name ; } | Append an asset to the collection . |
227,692 | public function get ( $ name ) { if ( ! isset ( $ this -> indexed [ $ name ] ) ) { return null ; } if ( empty ( $ this -> indexed [ $ name ] ) ) { $ this -> indexed [ $ name ] = $ this -> factory -> target ( $ name ) ; } return $ this -> indexed [ $ name ] ; } | Get an asset from the collection |
227,693 | public function remove ( $ name ) { if ( ! isset ( $ this -> indexed [ $ name ] ) ) { return ; } unset ( $ this -> indexed [ $ name ] ) ; foreach ( $ this -> items as $ i => $ v ) { if ( $ v === $ name ) { unset ( $ this -> items [ $ i ] ) ; } } } | Remove an asset from the collection |
227,694 | public function create ( File $ file ) : FileInfoDriver { $ driver = $ this -> getDriver ( $ file -> getMimeType ( ) ) ; $ className = __NAMESPACE__ . '\Drivers\\' . $ driver ; return new $ className ( $ file ) ; } | Factory method for retrieving a FileInfo object . |
227,695 | public function getDriver ( string $ mimetype ) { foreach ( $ this -> byMimetype as $ match => $ driver ) { if ( $ mimetype === $ match ) { return $ driver ; } } foreach ( $ this -> byMimeStart as $ match => $ driver ) { if ( strpos ( $ mimetype , $ match ) === 0 ) { return $ driver ; } } return 'DefaultDriver' ; } | Determines which driver to use for a given mimetype . |
227,696 | public function view ( Person $ person , Page $ page ) { if ( ! $ page -> aclEnabled ( ) ) { return true ; } if ( $ page -> wasCreatedBy ( $ person ) || $ this -> managesPages ( ) ) { return true ; } $ aclGroupIds = $ page -> getAclGroupIds ( ) ; if ( count ( $ aclGroupIds ) === 0 ) { return true ; } $ groups = $ perso... | Whether the page can be viewed . |
227,697 | public function collection ( AssetTarget $ target ) { $ filters = [ ] ; foreach ( $ target -> filterNames ( ) as $ name ) { $ filter = $ this -> get ( $ name ) ; if ( $ filter === null ) { throw new RuntimeException ( "Filter '$name' was not loaded/configured." ) ; } $ copy = clone $ filter ; $ copy -> settings ( [ 'ta... | Get a filter collection for a specific target . |
227,698 | public function fire ( ) { $ themes = $ this -> manager -> findAndInstallThemes ( ) ; foreach ( $ themes as $ theme ) { $ directories = [ $ theme -> getPublicDirectory ( ) => public_path ( 'vendor/boomcms/themes/' . $ theme -> getName ( ) ) , $ theme -> getMigrationsDirectory ( ) => base_path ( 'migrations/boomcms' ) ,... | Publishes migrations and public files for all themes to their respective directories . |
227,699 | public function input ( $ filename , $ input ) { if ( substr ( $ filename , strlen ( $ this -> _settings [ 'ext' ] ) * - 1 ) !== $ this -> _settings [ 'ext' ] ) { return $ input ; } if ( ! class_exists ( 'Leafo\\ScssPhp\\Compiler' ) ) { throw new \ Exception ( sprintf ( 'Cannot not load filter class "%s".' , 'Leafo\\Sc... | Runs scssc against any files that match the configured extension . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.