idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
229,800
public static function setHeaders ( array $ data , array $ attributes = array ( ) ) { foreach ( $ data as $ header ) { self :: addHeader ( $ header , $ attributes ) ; } }
Sets header data
229,801
public static function setFooters ( array $ data , array $ attributes = array ( ) ) { foreach ( $ data as $ footer ) { self :: addFooter ( $ footer , $ attributes ) ; } }
Sets footer data
229,802
public static function newRow ( array $ attrs = array ( ) ) { if ( ! empty ( self :: $ row_data ) ) self :: $ rows [ count ( self :: $ rows ) - 1 ] [ ] = self :: $ row_data ; self :: $ row_data = array ( ) ; self :: $ rows [ ] [ ] = $ attrs ; return count ( self :: $ rows ) ; }
Signals beginning of a new row
229,803
public static function render ( ) { self :: newRow ( ) ; ob_start ( ) ; ?> <table <?php echo ( ! empty ( self :: $ table_attributes ) ) ? self :: parseAttributes ( self :: $ table_attributes ) : "" ; ?> > <?php if ( ! empty ( self :: $ headers ) ) { ?> <thead> <tr> ...
Renders the HTML Table
229,804
public function getTransformer ( string $ target_class ) { if ( isset ( $ this -> transformers [ $ target_class ] ) ) return $ this -> transformers [ $ target_class ] ; foreach ( $ this -> transformers as $ class => $ transformer ) { $ inherit_mode = $ transformer -> getInheritMode ( ) ; if ( ( $ inherit_mode === Trans...
Get a transformer that converts to the target class . If a direct version is available that is returned . Otherwise a transformer registered to transform to a superclass of the target may be returned instead .
229,805
public function flush ( ) { if ( $ this -> stream === NULL ) { throw new \ RuntimeException ( sprintf ( 'Cannot flush detached stream' ) ) ; } if ( strlen ( $ this -> buffer ) ) { $ this -> stream -> write ( sprintf ( "%X\r\n%s\r\n" , strlen ( $ this -> buffer ) , $ this -> buffer ) ) ; $ this -> buffer = '' ; } }
Flush the current write buffer to the underlying output stream .
229,806
public function AddSchema ( $ schema ) { if ( is_null ( $ schema ) ) throw new \ lyquidity \ xml \ exceptions \ ArgumentNullException ( ) ; if ( ! $ schema instanceof XmlSchema ) throw new XmlSchemaException ( "The parameter is not a valid XmlSchema instance" ) ; $ this -> schemas [ $ schema -> getTargetNamespace ( ) ]...
Adds the given XmlSchema to the XmlSchemaSet .
229,807
public function set ( $ key , $ value ) { if ( ! is_null ( $ key ) && is_scalar ( $ key ) ) { return $ this -> _items [ $ key ] = $ value ; } else { throw new EnumeratorException ( 'Element could not be added to list. Index is not valid.' , E_NOTICE ) ; } }
add or replace a value with a specified key
229,808
public function getAssociations ( $ post_id = null ) { $ oConfig = Factory :: service ( 'Config' ) ; $ oDb = Factory :: service ( 'Database' ) ; $ _associations = $ oConfig -> item ( 'blog_post_associations' ) ; if ( ! $ _associations ) { return array ( ) ; } foreach ( $ _associations as & $ assoc ) { if ( $ post_id ) ...
Fetch all the associations for a particular post
229,809
public function getBlogUrl ( $ blogId ) { if ( isset ( $ this -> blogUrl [ $ blogId ] ) ) { return $ this -> blogUrl [ $ blogId ] ; } else { $ url = appSetting ( 'url' , 'blog-' . $ blogId ) ; $ url = $ url ? $ url : 'blog/' ; $ url = site_url ( $ url ) ; $ this -> blogUrl [ $ blogId ] = $ url ; return $ this -> blogUr...
Get the URL of a blog
229,810
public function compare ( Table $ oldTable , Table $ newTable ) { $ createdColumns = $ this -> getCreatedColumns ( $ oldTable , $ newTable ) ; $ alteredColumns = $ this -> getAlteredColumns ( $ oldTable , $ newTable ) ; $ droppedColumns = $ this -> getDroppedColumns ( $ oldTable , $ newTable ) ; $ this -> detectRenamed...
Compares two tables .
229,811
public function comparePrimaryKeys ( PrimaryKey $ oldPrimaryKey , PrimaryKey $ newPrimaryKey ) { return ( $ oldPrimaryKey -> getName ( ) !== $ newPrimaryKey -> getName ( ) ) || ( $ oldPrimaryKey -> getColumnNames ( ) !== $ newPrimaryKey -> getColumnNames ( ) ) ; }
Compares two primary keys .
229,812
public function compareForeignKeys ( ForeignKey $ oldForeignKey , ForeignKey $ newForeignKey ) { return ( $ oldForeignKey -> getName ( ) !== $ newForeignKey -> getName ( ) ) || ( $ oldForeignKey -> getLocalColumnNames ( ) !== $ newForeignKey -> getLocalColumnNames ( ) ) || ( $ oldForeignKey -> getForeignTableName ( ) !...
Compares two foreign keys .
229,813
public function compareIndexes ( Index $ oldIndex , Index $ newIndex ) { return ( $ oldIndex -> getName ( ) !== $ newIndex -> getName ( ) ) || ( $ oldIndex -> getColumnNames ( ) !== $ newIndex -> getColumnNames ( ) ) || ( $ oldIndex -> isUnique ( ) !== $ newIndex -> isUnique ( ) ) ; }
Compares two indexes .
229,814
public function compareChecks ( Check $ oldCheck , Check $ newCheck ) { return ( $ oldCheck -> getName ( ) !== $ newCheck -> getName ( ) ) || ( $ oldCheck -> getDefinition ( ) !== $ newCheck -> getDefinition ( ) ) ; }
Compares two checks .
229,815
private function detectRenamedColumns ( array & $ createdColumns , array & $ droppedColumns , array & $ alteredColumns ) { foreach ( $ createdColumns as $ createdIndex => $ createdColumn ) { foreach ( $ droppedColumns as $ droppedIndex => $ droppedColumn ) { $ columnDiff = $ this -> columnComparator -> compare ( $ drop...
Detects and rewrites renamed columns .
229,816
protected function parse ( ) { $ query = preg_replace ( '/OR\s+REPLACE/' , '' , $ this -> value ) ; if ( preg_match ( '/(CREATE|UPDATE|DELETE|ALTER|INSERT|DROP|SELECT|GRANT)\s+(SEQUENCE|INDEX|SYNONYM|TABLE|INTO|FROM|VIEW|)\s*([a-zA-Z-_]*)\s*/im' , $ query , $ matches ) ) { $ this -> type = trim ( strtolower ( $ matches...
Parse query Extract type & extra data
229,817
public function getMaxFileSize ( ) : int { if ( $ this -> maxFileSize === null ) { $ value = ini_get ( "upload_max_filesize" ) ; $ units = "BKMGT" ; $ unit = preg_replace ( "/[^$units]/i" , "" , $ value ) ; $ value = floatval ( $ value ) ; if ( $ unit ) { $ value *= pow ( 1024 , stripos ( $ units , $ unit [ 0 ] ) ) ; }...
Retrieve the upload_max_filesize ini setting
229,818
public function init ( $ config = NULL ) { $ option = new Option ( ) ; $ option -> shortCode = 'h' ; $ option -> longCode = 'help' ; $ option -> isOptional = TRUE ; $ option -> type = Type :: BOOLEAN ; $ option -> shortDescription = 'Show the help menu' ; $ this -> options [ ] = $ option ; $ option = new Option ( ) ; $...
This method adds the help and verbose options to the command .
229,819
public function removeOption ( $ longCode ) { $ retVal = FALSE ; $ i = 0 ; foreach ( $ this -> options as $ option ) { if ( $ longCode === $ option -> longCode ) { break ; } $ i ++ ; } if ( $ i !== count ( $ this -> options ) ) { unset ( $ this -> options [ $ i ] ) ; $ retVal = TRUE ; } return $ retVal ; }
Removes an option by its long code .
229,820
public static function getOption ( Command $ command , $ longCode ) { foreach ( $ command -> options as $ op ) { if ( '--' === substr ( $ longCode , 0 , 2 ) ) { $ longCode = substr ( $ longCode , 2 ) ; } elseif ( '-' === substr ( $ longCode , 0 , 1 ) ) { $ longCode = substr ( $ longCode , 1 ) ; } if ( $ op -> shortCode...
Gets an option either by short or long code .
229,821
public function getParentTemplateFilename ( ) { if ( empty ( $ this -> parentTemplateFilename ) ) { if ( preg_match ( $ this -> extendRex , $ this -> bufferInstance -> __rawContents , $ matches ) ) { $ this -> parentTemplateFilename = $ matches [ 1 ] ; } } return $ this -> parentTemplateFilename ; }
get filename of parent template
229,822
public function assign ( $ var , $ value = null ) { $ invalidProperties = [ '__rawContents' ] ; if ( is_array ( $ var ) ) { foreach ( $ var as $ k => $ v ) { if ( in_array ( $ k , $ invalidProperties ) ) { throw new SimpleTemplateException ( "Tried to assign invalid property '%s'" , $ k ) ; } $ this -> bufferInstance -...
assign value to variable which is then available within template
229,823
public function blockFilter ( $ filterId ) { if ( ! in_array ( $ filterId , $ this -> blockedFilters ) ) { $ this -> blockedFilters [ ] = $ filterId ; } return $ this ; }
block a pre - configured filter
229,824
public function display ( $ defaultFilters = null ) { $ this -> extend ( ) ; $ this -> fillBuffer ( ) ; if ( is_null ( $ defaultFilters ) ) { $ this -> defaultFilters = [ new AnchorHref ( ) , new ImageCache ( ) , ] ; if ( ! $ this -> ignoreLocales ) { $ this -> defaultFilters [ ] = new LocalizedPhrases ( ) ; } } else {...
output parsed template
229,825
private function extend ( ) { if ( preg_match ( $ this -> extendRex , $ this -> bufferInstance -> __rawContents , $ matches ) ) { $ blockRegExp = '~<!--\s*\{\s*block\s*:\s*' . $ matches [ 2 ] . '\s*\}\s* ; $ extendedContent = file_get_contents ( Application :: getInstance ( ) -> getRootPath ( ) . ( defined ( 'TPL_PATH'...
allow extension of a parent template with current template
229,826
private function applyFilters ( ) { foreach ( $ this -> defaultFilters as $ f ) { $ f -> apply ( $ this -> contents ) ; } foreach ( $ this -> filters as $ f ) { $ f -> apply ( $ this -> contents ) ; } }
applies all stacked filters to template before output
229,827
private function fillBuffer ( ) { $ closure = function ( $ outer ) { ob_start ( ) ; $ tpl = $ this ; eval ( '?>' . $ this -> __rawContents ) ; $ outer -> contents = ob_get_contents ( ) ; ob_end_clean ( ) ; } ; $ boundClosure = $ closure -> bindTo ( $ this -> bufferInstance ) ; $ boundClosure ( $ this ) ; }
fetches template file and evals content immediate output supressed by output buffering
229,828
public function collect ( Table $ table ) { foreach ( $ table -> getForeignKeys ( ) as $ foreignKey ) { $ this -> dropForeignKeyQueries = array_merge ( $ this -> dropForeignKeyQueries , $ this -> platform -> getDropForeignKeySQLQueries ( $ foreignKey , $ table -> getName ( ) ) ) ; } $ this -> dropTableQueries = array_m...
Collects queries to drop tables .
229,829
protected function parseURI ( $ uri , $ relative ) { $ result = array ( ) ; if ( ! $ relative ) { $ pos = strpos ( $ uri , ':' ) ; if ( ! $ pos ) { throw new \ InvalidArgumentException ( 'No scheme found' ) ; } $ result [ 'scheme' ] = substr ( $ uri , 0 , $ pos ) ; $ uri = ( string ) substr ( $ uri , $ pos + 1 ) ; } $ ...
Parses an URI using the grammar defined in RFC 3986 .
229,830
public static function normalizePercentReal ( $ hexchr ) { $ unreserved = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . 'abcdefghijklmnopqrstuvwxyz' . '-._~' ; $ chr = chr ( hexdec ( $ hexchr [ 1 ] ) ) ; if ( strpos ( $ unreserved , $ chr ) !== false ) { return $ chr ; } return '%' . strtoupper ( $ hexchr [ 1 ] ) ; }
Performs normalization of a percent - encoded character .
229,831
protected function merge ( $ path ) { if ( $ this -> host !== null && $ this -> path == '' ) { return '/' . $ path ; } $ pos = strrpos ( $ this -> path , '/' ) ; if ( $ pos === false ) { return $ path ; } return substr ( $ this -> path , 0 , $ pos + 1 ) . $ path ; }
Merges the given path with the current URI s path .
229,832
protected function validatePath ( $ path , $ relative ) { $ pchar = '(?:' . '[-[:alnum:]\\._~!\\$&\'\\(\\)\\*\\+,;=:@]|' . '%[[:xdigit:]]' . ')' ; $ segment = '(?:' . $ pchar . '*)' ; $ segmentNz = '(?:' . $ pchar . '+)' ; $ segmentNzNc = '(?:' . '[-[:alnum:]\\._~!\\$&\'\\(\\)\\*\\+,;=@]|' . '%[[:xdigit:]]' . ')+' ; $ ...
Validates the given path .
229,833
protected function realSetPath ( $ path , $ relative ) { if ( ! is_string ( $ path ) || ! $ this -> validatePath ( $ path , $ relative ) ) { throw new \ InvalidArgumentException ( 'Invalid path; use relative() for relative paths' ) ; } $ this -> path = $ path ; }
Sets the current URI s path .
229,834
public function build ( Connection $ aConnection = null ) { Type :: addType ( 'user_email' , UserEmailType :: class ) ; Type :: addType ( 'user_id' , UserIdType :: class ) ; Type :: addType ( 'user_password' , UserPasswordType :: class ) ; Type :: addType ( 'user_roles' , UserRolesType :: class ) ; Type :: addType ( 'u...
Creates an document manager instance enabling mappings and custom types .
229,835
static function FindContentGroup ( Content $ content ) { $ result = null ; $ currContent = $ content ; do { $ result = $ currContent -> GetUserGroup ( ) ; $ currContent = ContentTreeUtil :: ParentOf ( $ currContent ) ; } while ( ! $ result && $ currContent ) ; if ( $ result ) { return $ result ; } return self :: GetUpp...
Finds the user group by searching in element tree
229,836
private static function GetUpperContentGroup ( Content $ content ) { if ( $ content -> GetPageContent ( ) ) { return self :: FindPageGroup ( $ content -> GetPageContent ( ) -> GetPage ( ) ) ; } else if ( $ content -> GetLayoutContent ( ) ) { return $ content -> GetLayoutContent ( ) -> GetArea ( ) -> GetLayout ( ) -> Ge...
Gets the upper countent user group
229,837
static function FindPageGroup ( Page $ page ) { $ currPage = $ page ; $ result = null ; do { $ result = $ currPage -> GetUserGroup ( ) ; $ currPage = $ currPage -> GetParent ( ) ; } while ( ! $ result && $ currPage ) ; if ( ! $ result && $ page -> GetSite ( ) ) { return $ page -> GetSite ( ) -> GetUserGroup ( ) ; } ret...
Gets the page s user group
229,838
protected function DESC ( $ limit = NULL ) { $ value = array_reverse ( $ this -> value ) ; if ( $ limit === NULL ) { return $ value ; } else { return array_slice ( $ value , 0 , $ limit ) ; } }
Reverse the json data
229,839
public function toJson ( $ all = false ) { return $ all ? json_encode ( $ this -> getAllData ( ) ) : json_encode ( $ this -> toArray ( ) ) ; }
Convert the fetched row to json
229,840
protected function render ( $ templates , array $ data = array ( ) ) { $ content = $ this -> view -> render ( $ templates , $ data ) ; $ response = new Response ( ) ; $ response -> setContent ( $ content ) ; return $ response ; }
Render template and get Response
229,841
protected function dereferenceArray ( array & $ arrayData ) { try { foreach ( $ arrayData as $ idx => $ data ) { if ( is_array ( $ data ) ) { $ this -> dereferenceArray ( $ arrayData [ $ idx ] ) ; } elseif ( false !== ( $ ref = $ this -> isReference ( $ data ) ) ) { $ arrayData [ $ idx ] = $ this -> getReferenceValue (...
Replace all the references in the array with values
229,842
protected function getReferenceValue ( ReferenceAbstract $ reference , $ level = 0 ) { $ name = $ reference -> getName ( ) ; if ( $ level > 2 ) { throw new NotFoundException ( Message :: get ( Message :: PARAMETER_LOOP_FOUND , $ name ) , Message :: PARAMETER_LOOP_FOUND ) ; } if ( $ reference instanceof ServiceReference...
Get the reference value
229,843
protected function isReference ( $ data ) { if ( is_object ( $ data ) && $ data instanceof ReferenceAbstract ) { return $ data ; } elseif ( is_string ( $ data ) ) { $ pat = '/^(@|%)([^\s]+)\1$/' ; $ mat = [ ] ; if ( preg_match ( $ pat , $ data , $ mat ) ) { return $ mat [ 1 ] === '@' ? new ServiceReference ( $ mat [ 2 ...
Is a reference string or reference object . convert to object
229,844
public function execute ( ) { $ this -> resultPrinter -> printBenchmarkIntro ( $ this ) ; $ results = array ( ) ; foreach ( $ this -> tests as $ test ) { $ testResults = array ( ) ; for ( $ i = 0 ; $ i < $ this -> iterations ; $ i ++ ) { $ start = time ( ) + microtime ( ) ; $ test -> run ( $ this -> parameters ) ; $ te...
Execute the registered tests and display the results
229,845
protected function doValidate ( ) { if ( $ this -> argumentTypes === false ) { throw new CallableFunctionValidatorException ( 'Variable $argumentTypes must be defined.' ) ; } $ argumentCount = count ( $ this -> argumentTypes ) ; $ reflectionFunction = new \ ReflectionFunction ( $ this -> callableFunction ) ; $ reflecti...
Validates callable function arguments .
229,846
public static function save ( $ form , $ formid , $ prepare = true ) { if ( $ prepare ) { self :: prepareSession ( ) ; } $ _SESSION [ 'bbforms' ] [ $ formid ] = $ form ; }
Save Form into session and prepare it for validation later on
229,847
public function load ( $ parameters , $ prepare = true ) { $ this -> parameters = $ parameters ; if ( $ prepare ) { $ this -> prepareSession ( ) ; } if ( isset ( $ parameters [ 'bootbuilder-form' ] ) && isset ( $ _SESSION [ 'bbforms' ] ) && isset ( $ _SESSION [ 'bbforms' ] [ $ parameters [ 'bootbuilder-form' ] ] ) ) { ...
Load previous form from session
229,848
public function validate ( ) { $ status = new ValidationResult ( ) ; if ( ! $ this -> form instanceof \ bootbuilder \ Form ) { $ status -> setError ( true ) ; return $ status ; } foreach ( $ this -> form -> getRawControls ( ) as $ nr => $ control ) { if ( ! $ this -> validateControl ( $ control , $ status ) ) { $ statu...
Validate the form controls validates by the required status and some specific control validations such as email control
229,849
public function create ( string $ name , callable $ definition ) { $ this -> _name = $ name ; $ this -> _definition = $ definition ; }
Create the Hook
229,850
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ drv = $ params -> getDriver ( ) ; $ fieldname = $ drv -> toSQL ( $ params , $ this -> getField ( ) ) ; $ value = $ drv -> toSQL ( $ params , $ this -> getValue ( ) ) ; return $ fieldname . ' = ' . $ value ; }
Write a update assignment as SQL query syntax
229,851
public function toDictionary ( ) { $ value = \ ltrim ( $ this -> toNative ( ) , '?' ) ; \ parse_str ( $ value , $ data ) ; return Dictionary :: fromNative ( $ data ) ; }
Returns a Dictionary structured representation of the query string
229,852
public function removeSubscriber ( SubscriberInterface $ instance ) { if ( FALSE !== ( $ pos = array_search ( spl_object_hash ( $ instance ) , $ this -> registeredHashes ) ) ) { unset ( $ this -> registeredHashes [ $ pos ] ) ; foreach ( $ instance :: getEventsToSubscribe ( ) as $ eventName => $ parameters ) { $ methodN...
remove a subscriber from the registry
229,853
public function addSubscriber ( SubscriberInterface $ instance ) { $ this -> removeSubscriber ( $ instance ) ; $ this -> registeredHashes [ ] = spl_object_hash ( $ instance ) ; foreach ( $ instance :: getEventsToSubscribe ( ) as $ eventName => $ parameters ) { $ parameters = ( array ) $ parameters ; $ methodName = arra...
register a subscriber for event types provided by subscriber
229,854
public function getListeners ( $ eventName = null ) { if ( $ eventName ) { if ( empty ( $ this -> registry [ $ eventName ] ) ) { return [ ] ; } return $ this -> getSortedRegistry ( $ eventName ) ; } foreach ( $ this -> registry as $ eventName => $ listeners ) { $ this -> getSortedRegistry ( $ eventName ) ; } return $ t...
get all listeners registered for a given event name if no event name is supplied this will return all registered listeners grouped by event name and sorted by priority
229,855
public function hasListeners ( $ eventName = null ) { if ( $ eventName ) { return ! empty ( $ this -> registry [ $ eventName ] ) ; } foreach ( $ this -> registry as $ eventName => $ listeners ) { if ( ! empty ( $ listeners ) ) { return true ; } } return false ; }
check whether listeners for a given event name are registered if no event name is supplied this will evaluate to true if there any listeners registered
229,856
private function getSortedRegistry ( $ eventName ) { if ( ! isset ( $ this -> sortedRegistry [ $ eventName ] ) ) { $ this -> sortedRegistry [ $ eventName ] = [ ] ; if ( isset ( $ this -> registry [ $ eventName ] ) ) { krsort ( $ this -> registry [ $ eventName ] ) ; $ this -> sortedRegistry [ $ eventName ] = call_user_f...
helper method to collect all listener callbacks for a named event into one array observing priorities
229,857
public function noReferer ( ) { if ( $ this -> getParameter ( 'url' ) == null ) return ; if ( $ this -> getParameter ( 'service' ) == null ) return "http://hiderefer.com/?" . $ this -> getParameter ( 'url' ) ; return $ this -> getParameter ( 'service' ) . $ this -> getParameter ( 'url' ) ; }
Returns a url safe from referers
229,858
public function appendQueryString ( ) { $ url = $ this -> getParameter ( 'url' ) ; $ params = $ this -> getParameters ( ) ; unset ( $ params [ 'url' ] ) ; return URLUtils :: appendQueryString ( $ url , $ params ) ; }
Constructs a URL with query string arguments from the given base url and parameters
229,859
public static function getTitleById ( $ table , $ id ) { if ( $ table == "users" ) { return self :: getUserForIndexListing ( $ id ) ; } if ( $ table == "posts" ) { return self :: getPostForIndexListing ( $ id ) ; } $ title = DB :: table ( $ table ) -> where ( 'id' , '=' , $ id ) -> pluck ( 'title' ) ; if ( $ title == "...
Grab the title by ID
229,860
public static function getPostForIndexListing ( $ id ) { $ title = DB :: table ( 'posts' ) -> where ( 'id' , '=' , $ id ) -> pluck ( 'title' ) ; $ html = $ title . " (" . $ id . ")" ; return $ html ; }
Grab the Post info from the posts table . Created specifically for the Post Updates index listing
229,861
public static function finagleVarcharFieldTypeForIndexListing ( $ field , $ data ) { if ( empty ( $ field [ 'persist_wash' ] ) ) { return $ data ; } if ( strtolower ( $ field [ 'persist_wash' ] ) == "url" ) { $ prefacedURL = self :: prefaceURLwithHTTP ( $ data ) ; return '<a href="' . $ prefacedURL . '" target="_blank"...
Need a helper method to finagle the varchar field in the index listing .
229,862
public static function categoryParentSingleSelectCreate ( $ categories ) { $ html = "" ; $ html .= '<select name="parent_id" id="parent_id" size="6" class="form-control" >' ; $ html .= '<option ' ; $ html .= 'value="' ; $ html .= 0 ; $ html .= '">' ; $ html .= 'No Parent Category' ; $ html .= '</option>"' ; foreach ( $...
Create a dropdown with a single select for the parent category
229,863
public static function categoryParentSingleSelectEdit ( $ categories , $ parent_id , $ category_id ) { $ html = "" ; $ html .= '<select name="parent_id" id="parent_id" size="6" class="form-control">' ; $ html .= '<option ' ; if ( $ parent_id == 0 ) { $ html .= ' selected="selected" ' ; } $ html .= 'value="' ; $ html .=...
Create a multiple select drop down for tags that have the existing tags for that post already selected
229,864
public static function adminPageTitle ( $ package_title , $ table_type_plural , $ extra_title = '' ) { $ table_type_plural = self :: properPlural ( $ table_type_plural ) ; $ html = '' ; $ html .= '<br /><br />' ; $ html .= '<div class="row">' ; $ html .= ' <div class="oaerror info">' ; $ html .= ' <strong>' ....
Page title for admin pages
229,865
public static function adminPageSubTitle ( $ record = null , $ modelClass , $ show = false ) { $ modelClass = self :: properPlural ( $ modelClass ) ; $ html = '' ; $ html .= '<div class="row">' ; $ html .= '<div class="col-md-3"></div>' ; $ html .= '<div class="col-md-6">' ; $ html .= '<h1>' ; $ html .= '<span class="l...
Display button with a label describing what the form is doing .
229,866
public static function adminFormFieldLabel ( $ field ) { $ name = $ field [ 'name' ] ; if ( ! empty ( $ field [ 'alternate_form_name' ] ) ) { $ name = $ field [ 'alternate_form_name' ] ; } if ( $ name == "id" ) return "ID" ; $ html = str_replace ( "_" , " " , $ name ) ; $ html = ucwords ( $ html ) ; return $ html ; }
Transform the field name into a format suitable for a form label
229,867
public static function properPlural ( $ pluralWordToCheck ) { $ listOfPlurals = [ 'categorys' => 'categories' , 'kb_item' => 'item' , 'kb_items' => 'Items' , 'list_email' => 'email list' , 'listlist' => 'list' , 'people' => 'person' , 'peoples' => 'people' , 'postupdate' => 'post update' , 'postupdates' => 'post update...
Is the plural word grammatically correct?
229,868
public static function determineEpisodeImagePath ( $ episode , $ show ) { if ( empty ( $ episode -> featured_image ) ) { return $ show -> featured_image ; } return $ show -> image_file_storage_url . $ episode -> featured_image ; }
What is the episode s image s path?
229,869
public static function createOpenGraphTagsForPost ( $ post ) { return [ 'og:title' => $ post -> title , 'og:type' => 'article' , 'og:url' => $ post -> canonical_url , 'og:image' => $ post -> urlImage , 'og:description' => $ post -> meta_description , 'og:site_name' => Config :: get ( 'lasallecmsfrontend.og_site_name' )...
Create an array of OG tags and their values for a post .
229,870
public static function createTwitterTagsForPost ( $ post ) { return [ 'twitter:card' => Config :: get ( 'lasallecmsfrontend.twitter_card' ) , 'twitter:site' => Config :: get ( 'lasallecmsfrontend.twitter_site' ) , 'twitter:title' => $ post -> title , 'twitter:description' => $ post -> meta_description , 'twitter:creato...
Create an array of Twitter tags and their values for a post .
229,871
public static function prefaceURLwithHTTP ( $ url ) { $ url = trim ( $ url ) ; if ( substr ( $ url , 0 , 7 ) == "http://" ) { return $ url ; } if ( substr ( $ url , 0 , 8 ) == "https://" ) { return $ url ; } return "http://" . $ url ; }
Make sure the URL is fully qualified
229,872
public function processClassMetadata ( ClassMetadata $ metadata , $ property , $ prefix ) { if ( in_array ( $ metadata -> getName ( ) , $ this -> processedClasses ) ) { return ; } $ metadata -> mapEmbedded ( [ 'fieldName' => $ property , 'class' => $ this -> embeddableMetadata -> getName ( ) , 'columnPrefix' => empty (...
Processes the class metadata .
229,873
protected function normalizeObject ( $ object , $ format , array $ context ) { if ( ! $ this -> serializer instanceof NormalizerInterface ) { throw new LogicException ( 'Cannot normalize object because the injected serializer is not a normalizer' ) ; } return $ this -> serializer -> normalize ( $ object , $ format , $ ...
Normalizes the object .
229,874
protected function denormalizeObject ( $ data , $ class , $ format , array $ context ) { if ( ! $ this -> serializer instanceof DenormalizerInterface ) { throw new LogicException ( 'Cannot denormalize object because the injected serializer is not a denormalizer' ) ; } return $ this -> serializer -> denormalize ( $ data...
Denormalizes the object .
229,875
public static function rotateX ( array & $ array , int $ distance , int $ startX = 0 , int $ startY = 0 , int $ stopX = null , int $ stopY = null ) { self :: prepare ( $ array , $ stopX , $ stopY ) ; $ rotateLeft = $ distance > 0 ; $ distance = abs ( $ distance ) % ( $ stopX - $ startX ) ; $ x = $ rotateLeft ? $ startX...
Array items rotate left if distance is greater than 0 .
229,876
public static function rotateY ( array & $ array , int $ distance , int $ startX = 0 , int $ startY = 0 , int $ stopX = null , int $ stopY = null ) { self :: prepare ( $ array , $ stopX , $ stopY ) ; $ rotateUp = $ distance > 0 ; $ distance = abs ( $ distance ) % ( $ stopY - $ startY ) ; $ y = $ rotateUp ? $ startY + $...
Array items rotate up if distance is greater than 0 .
229,877
public function statisticsEnd ( $ name ) { $ this -> hr ( ) ; $ this -> out ( 'Took: ' . $ this -> _startTime [ $ name ] -> diff ( new DateTime ( ) ) -> format ( '%ad %hh %im %ss' ) ) ; $ this -> out ( 'Memory: ' . sprintf ( '%0.3f' , memory_get_peak_usage ( true ) / ( 1024 * 1024 ) ) . "Mb max used" ) ; $ this -> hr (...
Stop and output statistics
229,878
public function sqlDump ( $ sorted = false , $ clear = true ) { if ( ! class_exists ( 'ConnectionManager' ) || Configure :: read ( 'debug' ) < 2 ) { return ; } $ sources = ConnectionManager :: sourceList ( ) ; $ logs = array ( ) ; foreach ( $ sources as $ source ) { $ db = ConnectionManager :: getDataSource ( $ source ...
Shows sql dump
229,879
public function query ( $ query ) { if ( method_exists ( $ this -> db , 'query' ) ) { return $ this -> db -> query ( $ query ) ; } else { throw new Exception ( __METHOD__ . " not implemented" ) ; } }
The following methods either execute or if the method is not defined throw an Exception
229,880
public function allowAttribute ( $ attribute ) { if ( is_array ( $ attribute ) ) { foreach ( $ attribute as $ attrib ) $ this -> allowed_attributes [ $ attrib ] = true ; } else $ this -> allowed_attributes [ $ attribute ] = true ; return $ this ; }
Add an attribute to the whitelist
229,881
public function removeTag ( $ tag ) { if ( is_array ( $ tag ) ) { foreach ( $ tag as $ t ) { if ( isset ( $ this -> allowed_tags [ $ t ] ) ) unset ( $ this -> allowed_tags [ $ t ] ) ; $ this -> remove_tags [ $ t ] = true ; } } else { if ( isset ( $ this -> allowed_tags [ $ tag ] ) ) unset ( $ this -> allowed_tags [ $ t...
Add a tag to the list of tags to remove including all child nodes
229,882
public function allowProtocol ( $ protocol ) { if ( is_array ( $ protocol ) ) { foreach ( $ protocol as $ proto ) $ this -> allowed_protocols [ $ proto ] = true ; } else $ this -> allowed_protocols [ $ protocol ] = true ; return $ this ; }
Add a protocol to the list of protocols to allow linking to .
229,883
public function getHTML ( ) { $ dom = new DOMDocument ( ) ; $ interceptor = new ErrorInterceptor ( array ( $ dom , 'loadHTML' ) ) ; $ interceptor -> registerError ( E_WARNING , "DOMDocument::loadHTML" ) ; $ interceptor -> execute ( $ this -> html ) ; $ body = $ dom -> getElementsByTagName ( 'body' ) -> item ( 0 ) ; $ t...
Return the sanitized HTML according to the set up list of tags and attributes .
229,884
private function sanitizeNode ( DOMNode $ node ) { $ child = ( ! empty ( $ node -> childNodes ) && $ node -> childNodes -> length > 0 ) ? $ node -> childNodes -> item ( 0 ) : null ; while ( $ child !== null ) { $ tag = $ child -> nodeName ; if ( $ tag === "#text" ) { $ child = $ child -> nextSibling ; continue ; } if (...
Helper function to recursively sanitize nodes
229,885
private function unwrapContents ( DOMNode $ node , DOMNode $ child ) { $ next = $ child -> nextSibling ; if ( $ next === null ) $ next = $ child ; if ( $ child -> childNodes !== null ) { $ l = $ child -> childNodes -> length ; for ( $ i = $ l - 1 ; $ i >= 0 ; -- $ i ) { $ sub = $ child -> childNodes [ $ i ] ; $ next = ...
Helper function to unwrap the contents of a node and remove the node .
229,886
private function sanitizeAttributes ( DOMNode $ child ) { $ remove_attributes = array ( ) ; foreach ( $ child -> attributes as $ attrib ) { $ name = $ attrib -> name ; if ( ! isset ( $ this -> allowed_attributes [ $ name ] ) ) { $ remove_attributes [ ] = $ attrib ; } elseif ( $ name === "href" ) { $ val = $ attrib -> n...
Helper function to sanitize the attributes for the specified node .
229,887
protected static function _recursiveJsonExprFinder ( & $ value , array & $ javascriptExpressions , $ currentKey = null ) { if ( $ value instanceof Expr ) { $ magicKey = " _" . $ currentKey . "_" . ( count ( $ javascriptExpressions ) ) ; $ javascriptExpressions [ ] = array ( "magicKey" => ( is_int ( $ currentKey ) ) ? $...
Check & Replace Aegis \ JSON \ Expr for tmp ids in the valueToEncode
229,888
public static function prettyPrint ( $ json , $ options = array ( ) ) { $ tokens = preg_split ( '|([\{\}\]\[,])|' , $ json , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; $ result = "" ; $ indent = 0 ; $ ind = " " ; if ( isset ( $ options [ 'indent' ] ) ) { $ ind = $ options [ 'indent' ] ; } $ inLiteral = false ; foreach ( $ t...
Pretty - print JSON string
229,889
public static function getInstance ( $ connect = true ) { if ( ! isset ( self :: $ instances [ static :: class ] ) ) { self :: $ instances [ static :: class ] = new static ( ) ; } $ instance = self :: $ instances [ static :: class ] ; if ( $ connect ) { $ instance -> connect ( ) ; } return $ instance ; }
Gets the singleton instance of the DB . Used throughout the framework .
229,890
public static function groupArray ( $ arr , $ groupField ) { $ result = array ( ) ; foreach ( $ arr as $ data ) { $ id = $ data [ $ groupField ] ; if ( isset ( $ result [ $ id ] ) ) { $ result [ $ id ] [ ] = $ data ; } else { $ result [ $ id ] = array ( $ data ) ; } } return $ result ; }
Groupping elements by field
229,891
public static function recursiveArraySearch ( $ needleKey , $ needleValue , array $ haystack ) { foreach ( $ haystack as $ key => $ value ) { $ currentKey = $ key ; if ( ( $ currentKey == $ needleKey && ( $ needleValue === null || $ needleValue == $ value ) ) || ( is_array ( $ value ) && self :: recursiveArraySearch ( ...
Search in array
229,892
protected function updatePaymentState ( PaymentInterface $ payment , $ nextState ) { if ( $ payment -> getState ( ) !== $ nextState ) { $ stateMachine = $ this -> factory -> get ( $ payment ) ; if ( null !== $ transition = $ stateMachine -> getTransitionToState ( $ nextState ) ) { $ stateMachine -> apply ( $ transition...
Updates the payment state .
229,893
protected function pImplode ( array $ nodes , $ glue = '' ) { $ strings = $ this -> pIterator ( $ nodes ) ; return implode ( $ glue , $ strings ) ; }
Pretty prints an array of nodes and implodes the printed values .
229,894
protected function pCommaSeparated ( array $ nodes , $ max_len = 80 ) { $ result = '' ; $ line = '' ; $ strings = $ this -> pIterator ( $ nodes ) ; foreach ( $ strings as $ node_str ) { if ( $ line !== '' && strlen ( $ line ) + strlen ( $ node_str ) > $ max_len ) { $ result .= $ line . ",\n" ; $ line = ' ' . $ node_...
Pretty prints an array of nodes and implodes the printed values with commas .
229,895
public function scanInstall ( ) { if ( ! $ this -> lockSystemChanges ) { foreach ( $ this -> ApplicationContext -> detectPluginDirectories ( ) -> getPluginDirectories ( ) as $ pluginDir ) { if ( is_dir ( $ pluginDir ) ) { $ slug = basename ( $ pluginDir ) ; if ( ! $ this -> PluginService -> slugExists ( $ slug ) ) { $ ...
Scans the plugin directories and installs plugins as needed
229,896
public function processPluginXML ( Plugin $ plugin , Errors & $ errors , & $ log = '' , $ xml = false ) { if ( ! $ xml ) $ xml = $ this -> loadXML ( $ plugin -> Path ) ; $ this -> processConfig ( $ plugin , $ log , $ xml ) ; $ this -> processPermissions ( $ plugin , $ log , $ xml ) ; $ this -> processCMSNavItems ( $ pl...
Processes the plugin s plugin . xml file
229,897
public function processPermissions ( Plugin $ plugin , & $ log = '' , $ xml = false ) { if ( ! $ xml ) $ xml = $ this -> loadXML ( $ plugin -> Path ) ; if ( ! $ xml ) throw new Exception ( 'Missing plugin.xml file for plugin [' . $ plugin -> Slug . ']' ) ; $ perms = $ xml -> permissions ; if ( ! empty ( $ perms ) ) for...
Add all of the Plugin s permissions from the specified XML
229,898
public function processConfig ( Plugin $ plugin , & $ log = '' , $ xml = false ) { if ( ! $ xml ) $ xml = $ this -> loadXML ( $ plugin -> Path ) ; if ( ! $ xml ) throw new Exception ( 'Missing plugin.xml file for plugin [' . $ plugin -> Slug . ']' ) ; if ( ! empty ( $ xml -> config ) ) { $ snippet = trim ( strval ( $ x...
Appends the plugin s config snippet to the config file
229,899
public function processCMSNavItems ( Plugin $ plugin , & $ log = '' , $ xml = false ) { if ( ! $ xml ) $ xml = $ this -> loadXML ( $ plugin -> Path ) ; if ( ! $ xml ) throw new Exception ( 'Missing plugin.xml file for plugin [' . $ plugin -> Slug . ']' ) ; $ processedSlugs = array ( ) ; $ navitems = $ xml -> cmsnavitem...
Add all the CMS nav items from the plugin