idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
46,600
protected function getRiskParamsStructure ( ) { return [ 'ssn' => $ this -> risk_ssn , 'mac_address' => $ this -> risk_mac_address , 'session_id' => $ this -> risk_session_id , 'user_id' => $ this -> risk_user_id , 'user_level' => $ this -> risk_user_level , 'email' => $ this -> risk_email , 'phone' => $ this -> risk_p...
Builds an array list with all Risk Params
46,601
public function populateNodes ( $ structure ) { try { $ this -> output = json_encode ( $ structure ) ; } catch ( \ Exception $ e ) { throw new \ Genesis \ Exceptions \ InvalidArgument ( 'Invalid data/tree' ) ; } }
Convert multi - dimensional array to JSON object
46,602
public function toArray ( ) { return [ 'order_tax_amount' => CurrencyUtils :: amountToExponent ( $ this -> getOrderTaxAmount ( ) , $ this -> currency ) , 'items' => array_map ( function ( $ item ) { return [ 'item' => $ item -> toArray ( ) ] ; } , $ this -> items ) ] ; }
Return items request attributes
46,603
protected static function _tableExists ( $ sTable ) { $ oConfig = Registry :: getConfig ( ) ; $ sDbName = $ oConfig -> getConfigParam ( 'dbName' ) ; $ sQuery = " SELECT 1 FROM information_schema.tables WHERE table_schema = ? AND table_name = ? " ; return ( bool ) Datab...
Table exists in database?
46,604
protected static function _columnExists ( $ sTable , $ sColumn ) { $ oConfig = Registry :: getConfig ( ) ; $ sDbName = $ oConfig -> getConfigParam ( 'dbName' ) ; $ sSql = 'SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND ...
Column exists in specific table?
46,605
public static function getPHPVersion ( ) { if ( ! defined ( 'PHP_VERSION_ID' ) ) { list ( $ major , $ minor , $ release ) = explode ( '.' , PHP_VERSION ) ; define ( 'PHP_VERSION_ID' , ( ( $ major * 10000 ) + ( $ minor * 100 ) + $ release ) ) ; } return ( int ) PHP_VERSION_ID ; }
Helper to get the current PHP version
46,606
public static function pascalToSnakeCase ( $ input ) { preg_match_all ( '!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!' , $ input , $ matches ) ; foreach ( $ matches [ 0 ] as & $ match ) { $ match = ( $ match == strtoupper ( $ match ) ) ? strtolower ( $ match ) : lcfirst ( $ match ) ; } return implode ( '_' ,...
Convert PascalCase string to a SnakeCase useful for argument parsing
46,607
public static function isArrayKeyExists ( $ key , $ arr ) { if ( ! self :: isValidArray ( $ arr ) ) { return false ; } return array_key_exists ( $ key , $ arr ) ; }
Check if the passed key exists in the supplied array
46,608
public static function getSortedArrayByValue ( $ arr ) { $ duplicate = self :: copyArray ( $ arr ) ; if ( $ duplicate === null ) { return null ; } asort ( $ duplicate ) ; return $ duplicate ; }
Sorts an array by value and returns a new instance
46,609
public static function appendItemsToArrayObj ( & $ arrObj , $ key , $ values ) { if ( ! $ arrObj instanceof \ ArrayObject ) { return null ; } $ arr = $ arrObj -> getArrayCopy ( ) ; $ commonArrKeyValues = Common :: isArrayKeyExists ( $ key , $ arr ) ? $ arr [ $ key ] : [ ] ; $ arr [ $ key ] = array_merge ( $ commonArrKe...
Appends items to an ArrayObject by key
46,610
public static function isValidXMLName ( $ tag ) { if ( ! is_array ( $ tag ) ) { return preg_match ( '/^[a-z_]+[a-z0-9\:\-\.\_]*[^:]*$/i' , $ tag , $ matches ) && reset ( $ matches ) == $ tag ; } return false ; }
Check if the passed argument is a valid XML tag name
46,611
public static function stringToBoolean ( $ string ) { $ flag = filter_var ( $ string , FILTER_VALIDATE_BOOLEAN , FILTER_NULL_ON_FAILURE ) ; if ( $ flag ) { return true ; } elseif ( is_null ( $ flag ) ) { return $ string ; } return false ; }
Evaluate a boolean expression from String or return the string itself
46,612
public static function isBase64Encoded ( $ input ) { if ( $ input && @ base64_encode ( @ base64_decode ( $ input , true ) ) === $ input ) { return true ; } return false ; }
Check if a string is base64 Encoded
46,613
public static function arrayContainsArrayItems ( $ arr ) { if ( ! self :: isValidArray ( $ arr ) ) { return false ; } foreach ( $ arr as $ item ) { if ( self :: isValidArray ( $ item ) ) { return true ; } } return false ; }
Check if an array has array items
46,614
public static function isClassAbstract ( $ className ) { if ( ! class_exists ( $ className ) ) { return false ; } $ reflectionClass = new \ ReflectionClass ( $ className ) ; return $ reflectionClass -> isAbstract ( ) ; }
Determines if the given class is Instantiable or not Helps to prevent from creating an instance of an abstract class
46,615
public static function verify ( ) { self :: checkSystemVersion ( ) ; self :: isFunctionExists ( 'bcmul' , self :: getErrorMessage ( 'bcmath' ) ) ; self :: isFunctionExists ( 'bcdiv' , self :: getErrorMessage ( 'bcmath' ) ) ; self :: isFunctionExists ( 'filter_var' , self :: getErrorMessage ( 'filter' ) ) ; self :: isFu...
Check if the current system fulfils the project s dependencies
46,616
public static function checkSystemVersion ( ) { if ( \ Genesis \ Utils \ Common :: compareVersions ( self :: $ minPHPVersion , '<' ) ) { throw new \ Exception ( self :: getErrorMessage ( 'system' ) ) ; } }
Check the PHP interpreter version we re currently running
46,617
public static function getErrorMessage ( $ name ) { $ messages = [ 'system' => 'Unsupported PHP version, please upgrade!' . PHP_EOL . 'This library requires PHP version ' . self :: $ minPHPVersion . ' or newer.' , 'bcmath' => 'BCMath extension is required!' . PHP_EOL . 'Please install the extension or rebuild with "--e...
Get error message for certain type
46,618
public function populateNodes ( $ data ) { if ( ! \ Genesis \ Utils \ Common :: isValidArray ( $ data ) ) { throw new \ Genesis \ Exceptions \ InvalidArgument ( 'Invalid data structure' ) ; } reset ( $ data ) ; $ this -> iterateArray ( key ( $ data ) , reset ( $ data ) ) ; $ this -> context -> endDocument ( ) ; }
Insert tree - structured array as nodes in XMLWriter and end the current Document .
46,619
public function iterateArray ( $ name , $ data ) { if ( \ Genesis \ Utils \ Common :: isValidXMLName ( $ name ) ) { $ this -> context -> startElement ( $ name ) ; } foreach ( $ data as $ key => $ value ) { if ( is_null ( $ value ) ) { continue ; } if ( $ key === '@attributes' ) { $ this -> writeAttribute ( $ value ) ; ...
Recursive iteration over array
46,620
public function writeAttribute ( $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ attrName => $ attrValue ) { $ this -> context -> writeAttribute ( $ attrName , $ attrValue ) ; } } }
Write Element s Attribute
46,621
public function writeCData ( $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ attrValue ) { $ this -> context -> writeCData ( $ attrValue ) ; } } else { $ this -> context -> writeCData ( $ value ) ; } }
Write Element s CData
46,622
public function writeText ( $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ attrValue ) { $ this -> context -> text ( $ attrValue ) ; } } else { $ this -> context -> text ( $ value ) ; } }
Write Element s Text
46,623
public function writeElement ( $ key , $ value ) { if ( is_array ( $ value ) ) { $ this -> iterateArray ( $ key , $ value ) ; } else { $ value = \ Genesis \ Utils \ Common :: booleanToString ( $ value ) ; $ this -> context -> writeElement ( $ key , $ value ) ; } }
Write XML Element
46,624
public static function range ( $ start , $ count ) { if ( $ count < 0 ) { throw new OutOfRangeException ( '$count must be not be negative.' ) ; } return new Linq ( range ( $ start , $ start + $ count - 1 ) ) ; }
Generates a sequence of integral numbers within a specified range .
46,625
public function skip ( $ count ) { $ innerIterator = $ this -> iterator ; if ( $ innerIterator instanceof \ ArrayIterator ) { if ( $ count >= $ innerIterator -> count ( ) ) { return new Linq ( [ ] ) ; } } if ( ! ( $ innerIterator instanceof \ Iterator ) ) { $ innerIterator = new \ IteratorIterator ( $ innerIterator ) ;...
Bypasses a specified number of elements and then returns the remaining elements .
46,626
public function take ( $ count ) { if ( $ count == 0 ) { return new Linq ( [ ] ) ; } $ innerIterator = $ this -> iterator ; if ( ! ( $ innerIterator instanceof \ Iterator ) ) { $ innerIterator = new \ IteratorIterator ( $ innerIterator ) ; } return new Linq ( new \ LimitIterator ( $ innerIterator , 0 , $ count ) ) ; }
Returns a specified number of contiguous elements from the start of a sequence
46,627
public function all ( callable $ func ) { foreach ( $ this -> iterator as $ current ) { $ match = LinqHelper :: getBoolOrThrowException ( $ func ( $ current ) ) ; if ( ! $ match ) { return false ; } } return true ; }
Determines whether all elements satisfy a condition .
46,628
public function count ( ) { if ( $ this -> iterator instanceof Countable ) { return $ this -> iterator -> count ( ) ; } return iterator_count ( $ this -> iterator ) ; }
Counts the elements of this Linq sequence .
46,629
public function sum ( callable $ func = null ) { $ sum = 0 ; $ iterator = $ this -> getSelectIteratorOrInnerIterator ( $ func ) ; foreach ( $ iterator as $ value ) { if ( ! is_numeric ( $ value ) ) { throw new UnexpectedValueException ( "sum() only works on numeric values." ) ; } $ sum += $ value ; } return $ sum ; }
Gets the sum of all items or by invoking a transform function on each item to get a numeric value .
46,630
public function min ( callable $ func = null ) { $ min = null ; $ iterator = $ this -> getSelectIteratorOrInnerIterator ( $ func ) ; foreach ( $ iterator as $ value ) { if ( ! is_numeric ( $ value ) && ! is_string ( $ value ) && ! ( $ value instanceof \ DateTime ) ) { throw new UnexpectedValueException ( "min() only wo...
Gets the minimum item value of all items or by invoking a transform function on each item to get a numeric value .
46,631
public function concat ( $ second ) { LinqHelper :: assertArgumentIsIterable ( $ second , "second" ) ; $ allItems = new \ ArrayIterator ( [ $ this -> iterator , $ second ] ) ; return new Linq ( new SelectManyIterator ( $ allItems ) ) ; }
Concatenates this Linq object with the given sequence .
46,632
public function intersect ( $ second ) { LinqHelper :: assertArgumentIsIterable ( $ second , "second" ) ; return new Linq ( new IntersectIterator ( $ this -> iterator , LinqHelper :: getIteratorOrThrow ( $ second ) ) ) ; }
Intersects the Linq sequence with second Iterable sequence .
46,633
public function except ( $ second ) { LinqHelper :: assertArgumentIsIterable ( $ second , "second" ) ; return new Linq ( new ExceptIterator ( $ this -> iterator , LinqHelper :: getIteratorOrThrow ( $ second ) ) ) ; }
Returns all elements except the ones of the given sequence .
46,634
protected function filterExtensionsByModuleId ( $ modules , $ moduleId ) { $ modulePaths = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aModulePaths' ) ; $ path = '' ; if ( isset ( $ modulePaths [ $ moduleId ] ) ) { $ path = $ modulePaths [ $ moduleId ] . '/' ; } if ( ! $ path ) { $ path...
Returns extensions list by module id .
46,635
protected function validate ( ) { if ( ! CommonUtils :: isRegexExpr ( $ this -> pattern ) ) { return false ; } return ( bool ) preg_match ( $ this -> pattern , $ this -> getRequestValue ( ) ) ; }
Execute field name validation
46,636
public function metas ( ) { $ model = new \ Kodeine \ Metable \ MetaData ( ) ; $ model -> setTable ( $ this -> getMetaTable ( ) ) ; return new HasMany ( $ model -> newQuery ( ) , $ this , $ this -> getMetaKeyName ( ) , $ this -> getKeyName ( ) ) ; }
Relationship for meta tables
46,637
public function setValueAttribute ( $ value ) { $ type = gettype ( $ value ) ; if ( is_array ( $ value ) ) { $ this -> type = 'array' ; $ this -> attributes [ 'value' ] = json_encode ( $ value ) ; } elseif ( $ value instanceof DateTime ) { $ this -> type = 'datetime' ; $ this -> attributes [ 'value' ] = $ this -> fromD...
Set the value and type .
46,638
public function getThumbnail ( ) { try { $ ffmpeg = FFMpeg :: create ( ) ; $ video = $ ffmpeg -> open ( $ this -> file -> getPathname ( ) ) ; $ frame = $ video -> frame ( TimeCode :: fromSeconds ( 0 ) ) ; $ base64 = $ frame -> save ( tempnam ( sys_get_temp_dir ( ) , $ this -> file -> getBasename ( ) ) , true , true ) ;...
Generates a thumbnail for the video from the first frame .
46,639
public function deleting ( Model $ model ) { $ model -> deleted_by = $ this -> guard -> check ( ) ? $ this -> guard -> user ( ) -> getId ( ) : null ; }
Set deleted_by on the model prior to deletion .
46,640
public function getParam ( $ key ) { return isset ( $ this -> params [ $ key ] ) ? $ this -> params [ $ key ] : null ; }
Returns a search parameter by key .
46,641
public function hasFilters ( ) { $ params = array_except ( $ this -> params , [ 'order' , 'limit' ] ) ; return ! empty ( $ params ) && ! empty ( array_values ( $ params ) ) ; }
Returns whether the parameters array contains any filters .
46,642
public function files ( ) { $ files = [ ] ; foreach ( call_user_func ( $ this -> callable ) as $ file ) { $ path = $ this -> scanner -> find ( $ file ) ; if ( $ path === false ) { throw new RuntimeException ( "Could not locate {$file} for {$this->callable} in any configured path." ) ; } $ files [ ] = new Local ( $ path...
Get the list of files from the callback .
46,643
public function input ( $ filename , $ input ) { if ( substr ( $ filename , strlen ( $ this -> _settings [ 'ext' ] ) * - 1 ) !== $ this -> _settings [ 'ext' ] ) { return $ input ; } $ filename = preg_replace ( '/ /' , '\\ ' , $ filename ) ; $ bin = $ this -> _settings [ 'sass' ] . ' ' . $ filename ; $ return = $ this -...
Runs SCSS compiler against any files that match the configured extension .
46,644
public function input ( $ filename , $ input ) { if ( substr ( $ filename , strlen ( $ this -> _settings [ 'ext' ] ) * - 1 ) !== $ this -> _settings [ 'ext' ] ) { return $ input ; } $ cmd = $ this -> _settings [ 'node' ] . ' ' . $ this -> _settings [ 'coffee' ] . ' -c -p -s ' ; $ env = array ( 'NODE_PATH' => $ this -> ...
Runs coffee against files that match the configured extension .
46,645
public function getParameter ( $ key ) { $ query = $ this -> getQuery ( ) ; return isset ( $ query [ $ key ] ) ? $ query [ $ key ] : null ; }
Returns a query string parameter for a given key .
46,646
public function getQuery ( ) { if ( $ this -> query === null ) { $ string = parse_url ( $ this -> link , PHP_URL_QUERY ) ; parse_str ( $ string , $ this -> query ) ; } return $ this -> query ; }
Returns an array of query string parameters in the URL .
46,647
public static function assetURL ( array $ params ) { if ( isset ( $ params [ 'asset' ] ) && is_object ( $ params [ 'asset' ] ) ) { $ asset = $ params [ 'asset' ] ; $ params [ 'asset' ] = $ params [ 'asset' ] -> getId ( ) ; } if ( ! isset ( $ params [ 'action' ] ) ) { $ params [ 'action' ] = 'view' ; } if ( isset ( $ pa...
Generate a URL to link to an asset .
46,648
public static function chunk ( $ type , $ slotname , $ page = null ) { return ChunkFacade :: insert ( $ type , $ slotname , $ page ) ; }
Interest a chunk into a page .
46,649
public static function description ( PageInterface $ page = null ) { $ page = $ page ? : Router :: getActivePage ( ) ; $ description = $ page -> getDescription ( ) ? : ChunkFacade :: get ( 'text' , 'standfirst' , $ page ) -> text ( ) ; return strip_tags ( $ description ) ; }
Reutrn the meta description for a page .
46,650
public static function getTags ( ) { $ finder = new Tag \ Finder \ Finder ( ) ; foreach ( func_get_args ( ) as $ arg ) { if ( is_string ( $ arg ) ) { $ finder -> addFilter ( new Tag \ Finder \ Group ( $ arg ) ) ; } elseif ( $ arg instanceof PageInterface ) { $ finder -> addFilter ( new Tag \ Finder \ AppliedToPage ( $ ...
Get tags matching given parameters . Accepts a page group name or tag as arguments in any order to search by .
46,651
public static function getTagsInSection ( PageInterface $ page = null , $ group = null ) { $ page = $ page ? : Router :: getActivePage ( ) ; $ finder = new Tag \ Finder \ Finder ( ) ; $ finder -> addFilter ( new Tag \ Finder \ AppliedToPageDescendants ( $ page ) ) ; $ finder -> addFilter ( new Tag \ Finder \ Group ( $ ...
Get the pages applied to the children of a page .
46,652
public static function pub ( $ file , $ theme = null ) { $ theme = $ theme ? : static :: activeThemeName ( ) ; return "/vendor/boomcms/themes/$theme/" . ltrim ( trim ( $ file ) , '/' ) ; }
Get a relative path to a file in a theme s public directory .
46,653
public function getValue ( array $ keys , $ default = null ) { $ config = $ this -> config ; $ pointer = & $ config ; foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ pointer ) ) { if ( $ default === null ) { throw new InvalidArgumentException ( sprintf ( 'Key "%s" does not exist' , implode ( '.' , $ k...
Returns value by key . You can supply default value for when the key is missing . Without default value exception is thrown for nonexistent keys .
46,654
public function hasLink ( ) { return isset ( $ this -> attrs [ 'url' ] ) && trim ( $ this -> attrs [ 'url' ] ) && $ this -> attrs [ 'url' ] !== '#' && $ this -> attrs [ 'url' ] !== 'http://' ; }
Whether the current slide has a link associated with it .
46,655
public function isFresh ( AssetTarget $ target ) { $ buildName = $ this -> buildFileName ( $ target ) ; $ buildFile = $ this -> outputDir ( $ target ) . DIRECTORY_SEPARATOR . $ buildName ; if ( ! file_exists ( $ buildFile ) ) { return false ; } $ buildTime = filemtime ( $ buildFile ) ; if ( $ this -> configTime && $ th...
Check to see if a cached build file is fresh . Fresh cached files have timestamps newer than all of the component files .
46,656
public function buildFileName ( AssetTarget $ target ) { $ file = $ target -> name ( ) ; if ( $ target -> isThemed ( ) && $ this -> theme ) { $ file = $ this -> theme . '-' . $ file ; } return $ file ; }
Get the final build file name for a target .
46,657
public function read ( AssetTarget $ target ) { $ buildName = $ this -> buildFileName ( $ target ) ; return file_get_contents ( $ this -> path . $ buildName ) ; }
Get the cached result for a build target .
46,658
public function settings ( array $ settings = null ) { if ( $ settings ) { $ this -> _settings = array_merge ( $ this -> _settings , $ settings ) ; } return $ this -> _settings ; }
Gets settings for this filter . Will always include paths key which points at paths available for the type of asset being generated .
46,659
protected function _runCmd ( $ cmd , $ content , $ environment = null ) { $ Process = new AssetProcess ( ) ; $ Process -> environment ( $ environment ) ; $ Process -> command ( $ cmd ) -> run ( $ content ) ; if ( $ Process -> error ( ) ) { throw new RuntimeException ( $ Process -> error ( ) ) ; } return $ Process -> ou...
Run the compressor command and get the output
46,660
protected function _query ( $ content , $ args = array ( ) ) { if ( ! extension_loaded ( 'curl' ) ) { throw new \ Exception ( 'Missing the `curl` extension.' ) ; } $ args = array_merge ( $ this -> _defaults , $ args ) ; if ( ! empty ( $ this -> _settings [ 'level' ] ) ) { $ args [ 'compilation_level' ] = $ this -> _set...
Query the Closure compiler API .
46,661
public function writer ( $ tmpPath = '' ) { $ tmpPath = $ tmpPath ? : $ this -> config -> get ( 'general.timestampPath' ) ; if ( ! $ tmpPath ) { $ tmpPath = sys_get_temp_dir ( ) . DIRECTORY_SEPARATOR ; } $ timestamp = [ 'js' => $ this -> config -> get ( 'js.timestamp' ) , 'css' => $ this -> config -> get ( 'css.timesta...
Create an AssetWriter
46,662
public function cacher ( $ path = '' ) { if ( ! $ path ) { $ path = sys_get_temp_dir ( ) . DIRECTORY_SEPARATOR ; } $ cache = new AssetCacher ( $ path , $ this -> config -> theme ( ) ) ; $ cache -> configTimestamp ( $ this -> config -> modifiedTime ( ) ) ; $ cache -> filterRegistry ( $ this -> filterRegistry ( ) ) ; ret...
Create an AssetCacher
46,663
public function target ( $ name ) { if ( ! $ this -> config -> hasTarget ( $ name ) ) { throw new RuntimeException ( "The target named '$name' does not exist." ) ; } $ ext = $ this -> config -> getExt ( $ name ) ; $ themed = $ this -> config -> isThemed ( $ name ) ; $ filters = $ this -> config -> targetFilters ( $ nam...
Create a single build target
46,664
public function filterRegistry ( ) { $ filters = [ ] ; foreach ( $ this -> config -> allFilters ( ) as $ name ) { $ filters [ $ name ] = $ this -> buildFilter ( $ name , $ this -> config -> filterConfig ( $ name ) ) ; } return new FilterRegistry ( $ filters ) ; }
Create a filter registry containing all the configured filters .
46,665
public function getNext ( ) { return $ this -> where ( self :: ATTR_PAGE , $ this -> getPageId ( ) ) -> where ( self :: ATTR_CREATED_AT , '>' , $ this -> getEditedTime ( ) -> getTimestamp ( ) ) -> orderBy ( self :: ATTR_CREATED_AT , 'asc' ) -> first ( ) ; }
Returns the next version .
46,666
public function isPublished ( DateTime $ time = null ) { $ timestamp = $ time ? $ time -> getTimestamp ( ) : time ( ) ; return $ this -> { self :: ATTR_EMBARGOED_UNTIL } && $ this -> { self :: ATTR_EMBARGOED_UNTIL } <= $ timestamp ; }
Whether the version is published .
46,667
public function status ( DateTime $ time = null ) { if ( $ this -> isPendingApproval ( ) ) { return 'pending approval' ; } elseif ( $ this -> isDraft ( ) ) { return 'draft' ; } elseif ( $ this -> isPublished ( $ time ) ) { return 'published' ; } elseif ( $ this -> isEmbargoed ( $ time ) ) { return 'embargoed' ; } }
Returns the status of the current page version .
46,668
public function addRole ( $ roleId , $ allowed , $ pageId = 0 ) { if ( ! $ this -> hasRole ( $ roleId , $ pageId ) ) { $ this -> roles ( ) -> attach ( $ roleId , [ self :: PIVOT_ATTR_ALLOWED => $ allowed , self :: PIVOT_ATTR_PAGE_ID => $ pageId , ] ) ; } return $ this ; }
Adds a role to the current group .
46,669
public function removeRole ( $ roleId , $ pageId = 0 ) { $ this -> roles ( ) -> wherePivot ( self :: PIVOT_ATTR_ROLE_ID , '=' , $ roleId ) -> wherePivot ( self :: PIVOT_ATTR_PAGE_ID , '=' , $ pageId ) -> detach ( ) ; return $ this ; }
Remove a role from a group .
46,670
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 .
46,671
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 .
46,672
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 .
46,673
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 .
46,674
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 .
46,675
public function WriteXY ( $ x , $ y , $ line , $ txt , $ link = '' ) { $ this -> SetXY ( $ x , $ y ) ; $ this -> Write ( $ line , $ txt , $ link ) ; }
Write to position
46,676
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 .
46,677
public function circle ( $ x , $ y , $ r , $ style = 'D' ) { $ this -> Ellipse ( $ x , $ y , $ r , $ r , $ style ) ; }
create a circle .
46,678
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 .
46,679
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 .
46,680
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 .
46,681
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 .
46,682
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 .
46,683
public function findById ( $ type , $ chunkId ) { $ model = $ this -> getModelName ( $ type ) ; return $ model :: find ( $ chunkId ) ; }
Find a chunk by it s ID .
46,684
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 .
46,685
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 .
46,686
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 .
46,687
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 .
46,688
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 .
46,689
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 .
46,690
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 .
46,691
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 .
46,692
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 .
46,693
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 .
46,694
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
46,695
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 .
46,696
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 .
46,697
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 .
46,698
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
46,699
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 .