idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
9,900
public function receiveCommand ( Command $ command ) : void { $ curie = $ command :: schema ( ) -> getCurie ( ) ; $ curieStr = $ curie -> toString ( ) ; if ( isset ( $ this -> handlers [ $ curieStr ] ) ) { $ handler = $ this -> handlers [ $ curieStr ] ; } else { try { $ handler = $ this -> locator -> getCommandHandler ...
Invokes the handler that services the given command . If an exception occurs it will be processed by the exception handler and not thrown by this method .
9,901
public function end ( array $ divOptions = [ ] ) { $ buffer = ob_get_contents ( ) ; if ( empty ( $ buffer ) ) { return ; } ob_end_clean ( ) ; if ( preg_match_all ( '/(<a[^>]*>.*?<\/a[^>]*>)/' , $ buffer , $ matches ) === 0 ) { return ; } $ divOptions = optionsParser ( $ divOptions ) -> append ( 'class' , 'dropdown-menu...
End a buffered section of dropdown menu capturing .
9,902
public function checkbox ( $ fieldName , array $ options = [ ] ) { $ options = optionsParser ( $ options ) ; if ( ! $ options -> exists ( 'hiddenField' ) || ! $ options -> contains ( 'hiddenField' , false ) ) { $ options -> add ( 'hiddenField' , true ) ; } return parent :: checkbox ( $ fieldName , $ options -> toArray ...
Creates a checkbox element
9,903
public function ckeditor ( $ fieldName , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'label' => false , 'type' => 'textarea' ] ) -> append ( 'templates' , [ 'textarea' => '<textarea name="{{name}}" class="form-control wysiwyg editor"{{attrs}}>{{value}}</textarea>' , ] ) ; return $ this -> contro...
Creates a CKEditor textarea .
9,904
public function control ( $ fieldName , array $ options = [ ] ) { $ this -> resetTemplates ( ) ; $ options = optionsParser ( $ options ) ; if ( strpos ( $ fieldName , 'password' ) !== false ) { $ options -> Default -> add ( [ 'type' => 'password' ] ) ; } $ type = $ options -> get ( 'type' ) ? : self :: _inputType ( $ f...
Generates an input element complete with label and wrapper div
9,905
public function createInline ( $ model = null , array $ options = [ ] ) { $ this -> inline = true ; $ options = optionsParser ( $ options ) -> delete ( 'inline' ) -> append ( 'class' , 'form-inline' ) ; return parent :: create ( $ model , $ options -> toArray ( ) ) ; }
Returns an inline form element .
9,906
public function datepicker ( $ fieldName , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'data-date-format' => 'YYYY-MM-DD' , 'type' => 'text' ] ) -> append ( 'templates' , [ 'input' => '<input type="{{type}}" name="{{name}}" class="form-control datepicker"{{attrs}}/>' , 'inputError' => '<input ty...
Creates a datepicker .
9,907
public function datetimepicker ( $ fieldName , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'data-date-format' => 'YYYY-MM-DD HH:mm' , 'type' => 'text' ] ) -> append ( 'templates' , [ 'input' => '<input type="{{type}}" name="{{name}}" class="form-control datetimepicker"{{attrs}}/>' , 'inputError'...
Creates a datetimepicker .
9,908
public function postButton ( $ title , $ url , array $ options = [ ] ) { $ options = optionsParser ( $ options ) -> add ( 'role' , 'button' ) -> addButtonClasses ( ) ; return self :: postLink ( $ title , $ url , $ options -> toArray ( ) ) ; }
Creates a button with a surrounding form that submits via POST .
9,909
public function select ( $ fieldName , $ options = [ ] , array $ attributes = [ ] ) { $ attributes = optionsParser ( $ attributes ) ; if ( ! $ attributes -> exists ( 'default' ) && ! $ attributes -> exists ( 'value' ) ) { $ attributes -> Default -> add ( 'empty' , true ) ; } return parent :: select ( $ fieldName , $ op...
Returns a formatted SELECT element
9,910
public function submit ( $ caption = null , array $ options = [ ] ) { $ options = optionsParser ( $ options ) -> add ( 'type' , 'submit' ) ; return self :: button ( $ caption , $ options -> toArray ( ) ) ; }
Creates a submit button
9,911
public function textarea ( $ fieldName , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'cols' => null , 'rows' => null ] ) ; return parent :: textarea ( $ fieldName , $ options -> toArray ( ) ) ; }
Creates a textarea widget
9,912
public function timepicker ( $ fieldName , array $ options = [ ] ) { $ options = optionsParser ( $ options , [ 'data-date-format' => 'HH:mm' , 'type' => 'text' ] ) -> append ( 'templates' , [ 'input' => '<input type="{{type}}" name="{{name}}" class="form-control timepicker"{{attrs}}/>' , 'inputError' => '<input type="{...
Creates a timepicker .
9,913
public static function instance ( ) { if ( empty ( self :: $ inst ) ) { $ klass = \ HPCloud \ Bootstrap :: config ( 'transport' ) ; self :: $ inst = new $ klass ( ) ; } return self :: $ inst ; }
Get an instance of a Transporter .
9,914
public function run ( $ id ) { if ( ! Yii :: $ app -> request -> isPost ) { throw new MethodNotAllowedHttpException ( 'Method Not Allowed. This url can only handle post' ) ; } $ position = Yii :: $ app -> request -> getQueryParam ( $ this -> positionParam , null ) ; if ( empty ( $ position ) ) { throw new BadRequestHtt...
Updates existing record specified by id .
9,915
protected function respondSuccess ( $ model ) { if ( Yii :: $ app -> request -> isAjax ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; return [ 'success' => true ] ; } return $ this -> controller -> redirect ( $ this -> createReturnUrl ( 'view' , $ model ) ) ; }
Composes success response .
9,916
public function get ( $ pointer ) { $ pointer = new Pointer ( $ pointer ) ; $ data = $ pointer -> evaluate ( $ this -> _properties ) ; return $ data ; }
Resolves the provided json pointer to an element in the document or returns null if the element does not exist
9,917
public function patch ( array $ operations ) { $ patch = new Patch ( $ operations ) ; $ data = $ patch -> patch ( $ this -> _properties ) ; $ this -> _properties = $ data ; }
Executes patch operations on this document
9,918
public static function render ( $ string , $ fontName ) { if ( ! in_array ( $ fontName , static :: getKnownFonts ( ) ) ) { throw new Exception ( "Error unknown font ID fontID" ) ; } $ figletString = FigletEngine :: create ( $ string , $ fontName ) ; return $ figletString ; }
Compute text banner from given string
9,919
public function setUpBlockManagers ( array $ blocks ) { foreach ( $ blocks as $ block ) { $ blockManager = $ this -> blockManagerFactory -> createBlockManager ( $ block ) ; if ( null === $ blockManager ) { continue ; } $ this -> blockManagersCollection -> addBlockManager ( $ blockManager ) ; } }
Sets up the block managers .
9,920
protected function buildValue ( & $ value , $ key ) { if ( in_array ( $ key , $ this -> toBeExploded ) ) { $ value = array_clean ( is_array ( $ value ) ? Hash :: flatten ( $ value ) : explode ( ' ' , $ value ) ) ; sort ( $ value ) ; $ value = implode ( ' ' , $ value ) ; } return is_string ( $ value ) ? trim ( $ value )...
Internal method to build a value
9,921
public function add ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { array_map ( [ $ this , __METHOD__ ] , array_keys ( $ key ) , $ key ) ; return $ this ; } $ this -> options [ $ key ] = $ this -> buildValue ( $ value , $ key ) ; return $ this ; }
Adds a value .
9,922
public function addButtonClasses ( $ classes = 'btn-light' ) { $ baseClasses = [ 'primary' , 'secondary' , 'success' , 'danger' , 'warning' , 'info' , 'light' , 'dark' , 'link' ] ; $ allClasses = array_merge ( $ baseClasses , [ 'outline-primary' , 'outline-secondary' , 'outline-success' , 'outline-danger' , 'outline-wa...
Adds button classes .
9,923
public function append ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { array_map ( [ $ this , __METHOD__ ] , array_keys ( $ key ) , $ key ) ; return $ this ; } $ existing = $ this -> get ( $ key ) ; if ( in_array ( $ key , $ this -> toBeExploded ) ) { $ existing = explode ( ' ' , $ existing ) ; $ value = is_ar...
Appends a value .
9,924
public function consume ( $ key ) { $ value = $ this -> get ( $ key ) ; $ this -> delete ( $ key ) ; return $ value ; }
Used to read and delete a value from a key
9,925
public function contains ( $ key , $ value ) { if ( ! $ this -> exists ( $ key ) ) { return false ; } $ existing = $ this -> get ( $ key ) ; $ existing = in_array ( $ key , $ this -> toBeExploded ) ? explode ( ' ' , $ existing ) : $ existing ; if ( is_array ( $ existing ) ) { if ( is_array ( $ value ) ) { return empty ...
Checks if a key contains a value .
9,926
public function get ( $ key ) { $ default = $ this -> Default ? $ this -> Default -> get ( $ key ) : null ; return Hash :: get ( $ this -> options , $ key , $ default ) ; }
Gets the value for a key
9,927
public function toArray ( ) { $ options = $ this -> options ; if ( $ this -> Default ) { $ options = array_merge ( $ this -> Default -> options , $ options ) ; } ksort ( $ options ) ; return $ options ; }
Returns options as array
9,928
public function toString ( ) { $ options = $ this -> toArray ( ) ; array_walk ( $ options , function ( & $ value , $ key ) { if ( is_array ( $ value ) ) { $ value = implode ( ' ' , $ value ) ; } elseif ( is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } elseif ( is_null ( $ value ) ) { $ value = 'null' ;...
Returns options as string
9,929
public function tooltip ( ) { $ tooltip = $ this -> consume ( 'tooltip' ) ; if ( ! $ tooltip ) { return $ this ; } $ this -> append ( 'data-toggle' , 'tooltip' ) ; $ this -> add ( 'title' , trim ( h ( strip_tags ( $ tooltip ) ) ) ) ; if ( $ this -> exists ( 'tooltip-align' ) ) { $ this -> add ( 'data-placement' , $ thi...
Builds keys for tooltip .
9,930
protected function generateSiteMap ( $ websiteUrl ) { $ urls = array ( ) ; foreach ( $ this -> pageTreeCollection -> getPages ( ) as $ pageTree ) { $ page = $ pageTree -> getPage ( ) ; if ( ! $ page -> getIsPublished ( ) ) { continue ; } $ seo = $ pageTree -> getSeo ( ) ; $ permalink = "" ; if ( ! $ pageTree -> getLang...
Generated the site map
9,931
public function getCompact ( $ key ) { $ headers = self :: base64Encode ( Parser :: encode ( $ this -> headers ) ) ; $ claim = self :: base64Encode ( $ this -> claim ) ; $ signature = $ this -> getEncodedSignature ( $ key ) ; return $ headers . '.' . $ claim . '.' . $ signature ; }
Returns this signature in the JWS Compact Serialization format
9,932
public function getJson ( $ key ) { $ signature = array ( ) ; $ signature [ 'protected' ] = self :: base64Encode ( Parser :: encode ( $ this -> headers ) ) ; $ signature [ 'payload' ] = self :: base64Encode ( $ this -> claim ) ; $ signature [ 'signature' ] = $ this -> getEncodedSignature ( $ key ) ; return Parser :: en...
Returns this signature in the JWS JSON Serialization format
9,933
public function deleteSeoAttributesFromLanguage ( $ languageId , $ pageId ) { $ alSeo = $ this -> seoRepository -> fromPageAndLanguage ( $ languageId , $ pageId ) ; if ( null === $ alSeo ) return true ; $ this -> set ( $ alSeo ) ; $ result = $ this -> delete ( ) ; $ this -> set ( null ) ; return $ result ; }
Deletes the seo attribute identified by the given language and page
9,934
protected function add ( array $ values ) { $ values = $ this -> dispatchBeforeOperationEvent ( '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeSeoAddingEvent' , SeoEvents :: BEFORE_ADD_SEO , $ values , array ( 'message' => 'exception_seo_adding_aborted' , 'domain' => 'exceptions' , ) ) ; try { $...
Adds a new Seo object from the given params
9,935
protected function edit ( array $ values = array ( ) ) { $ values = $ this -> dispatchBeforeOperationEvent ( '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Seo\BeforeSeoEditingEvent' , SeoEvents :: BEFORE_EDIT_SEO , $ values , array ( 'message' => 'exception_seo_editing_aborted' , 'domain' => 'exceptions'...
Edits the managed page attributes object
9,936
public function getFormId ( ) { $ form = $ this -> getForm ( ) ; $ formId = $ form -> getName ( ) ; if ( $ form instanceof FormCollectionInterface ) { $ formId .= '_' . $ this -> getEntityContainer ( ) -> getName ( ) ; } $ formId .= '_' . $ this -> getName ( ) ; return $ formId ; }
return prepared property id for html attribute id
9,937
public function getFormName ( ) { $ form = $ this -> getForm ( ) ; $ formName = $ form -> getName ( ) ; if ( $ form instanceof FormCollectionInterface ) { $ formName .= '[' . $ this -> getEntityContainer ( ) -> getName ( ) . ']' ; } $ formName .= '[' . $ this -> getName ( ) . ']' ; return $ formName ; }
return prepared property name for html attribute name
9,938
public function getFormValue ( ) { $ mapper = new PropertyMapper ( ) ; return $ mapper -> mapDataToForm ( $ this -> getEntityContainer ( ) -> getEntity ( ) , $ this -> getName ( ) ) ; }
return property value
9,939
public function getFormLabel ( $ domain = null ) { $ form = $ this -> getForm ( ) ; $ translationDomain = ! is_null ( $ domain ) ? $ domain : 'forms' ; $ translator = $ form -> getTranslator ( ) ; $ id = $ form -> getName ( ) ; if ( $ form instanceof FormCollectionInterface ) { if ( ! is_int ( $ this -> getEntityContai...
return prepared property label
9,940
protected function createUrl ( $ query ) { $ options = $ this -> getOptions ( ) ; $ path = sprintf ( 'http://translate.google.com/translate_tts?ie=%s&tl=%s&q=%s' , $ options -> hasEncoding ( ) ? $ options -> getEncoding ( ) : 'UTF-8' , $ options -> getLanguage ( ) , urlencode ( $ query ) ) ; return $ path ; }
Create url from options
9,941
protected function create ( ) { $ fields = [ ] ; $ keys = [ ] ; foreach ( $ this -> getCurrentTable ( ) -> getFields ( ) as $ name => $ field ) { $ fields [ ] = implode ( ' ' , [ '`' . $ field -> getName ( ) . '`' , $ field -> getType ( ) . '(' . $ field -> getLength ( ) . ')' , ( $ field -> isUnsigned ( ) ) ? 'UNSIGNE...
Return table create schema .
9,942
public static function translateLayout ( LayoutInterface $ template , $ locale , TranslatorInterface $ translator = null ) { if ( null === $ template -> getTranslationDomain ( ) ) { $ template = $ template -> getTranslation ( $ locale ) ; } elseif ( null !== $ translator ) { static :: injectTranslatorValues ( $ transla...
Translate the layout template with the translator .
9,943
public static function translateMail ( MailInterface $ template , $ locale , TranslatorInterface $ translator = null ) { if ( null === $ template -> getTranslationDomain ( ) ) { $ template = $ template -> getTranslation ( $ locale ) ; } elseif ( null !== $ translator ) { static :: injectTranslatorValues ( $ translator ...
Translate the mail template with the translator .
9,944
public static function find ( $ template , $ locale ) { $ locale = strtolower ( $ locale ) ; foreach ( $ template -> getTranslations ( ) as $ translation ) { if ( $ locale === strtolower ( $ translation -> getLocale ( ) ) ) { static :: injectValue ( $ template , $ translation , 'label' ) ; static :: injectValue ( $ tem...
Find the translation and translate the template if translation is found .
9,945
public static function injectFile ( TemplateInterface $ template , TemplateTranslationInterface $ translation ) : void { if ( $ template instanceof TemplateFileInterface && $ translation instanceof TemplateFileInterface ) { static :: injectValue ( $ template , $ translation , 'file' ) ; } }
Inject the translation file in template .
9,946
protected static function injectValue ( TemplateInterface $ template , TemplateTranslationInterface $ translation , $ field ) : void { $ setter = 'set' . ucfirst ( $ field ) ; $ getter = 'get' . ucfirst ( $ field ) ; $ refTpl = new \ ReflectionClass ( $ template ) ; $ refTrans = new \ ReflectionClass ( $ translation ) ...
Inject the translation value in template .
9,947
protected static function injectTranslatorValues ( TranslatorInterface $ translator , TemplateInterface $ template ) : void { static :: injectTranslatorValue ( $ translator , $ template , 'label' ) ; static :: injectTranslatorValue ( $ translator , $ template , 'description' ) ; static :: injectTranslatorValue ( $ tran...
Inject the translation values of translator in template .
9,948
protected static function injectTranslatorValue ( TranslatorInterface $ translator , TemplateInterface $ template , $ field ) : void { $ setter = 'set' . ucfirst ( $ field ) ; $ getter = 'get' . ucfirst ( $ field ) ; $ refTpl = new \ ReflectionClass ( $ template ) ; if ( $ refTpl -> hasMethod ( $ getter ) && $ refTpl -...
Inject the translation value of translator in template .
9,949
public static function chr ( int $ codepoint ) : string { if ( $ codepoint <= 0x7F ) { return \ chr ( $ codepoint ) ; } if ( $ codepoint <= 0x7FF ) { return \ chr ( 0xC0 | $ codepoint >> 6 ) . \ chr ( 0x80 | $ codepoint & 0x3F ) ; } if ( $ codepoint <= 0xFFFF ) { return \ chr ( 0xE0 | $ codepoint >> 12 ) . \ chr ( 0x80...
Get UTF - 8 character for the given codepoint
9,950
public static function ord ( string $ char ) : int { $ h = \ ord ( $ char [ 0 ] ) ; if ( $ h <= 0x7F ) { return $ h ; } if ( $ h < 0xC2 ) { throw new \ InvalidArgumentException ( 'Could not get unicode codepoint for character: "' . $ char . '"' ) ; } if ( $ h <= 0xDF ) { return ( $ h & 0x1F ) << 6 | ( \ ord ( $ char [ ...
Get codepoint of the first UTF - 8 character in the given string .
9,951
public static function makePublic ( ) { $ acl = new ACL ( ) ; $ acl -> addReferrer ( self :: READ , '*' ) ; $ acl -> allowListings ( ) ; return $ acl ; }
Allow READ access to the public .
9,952
public static function newFromHeaders ( $ headers ) { $ acl = new ACL ( ) ; $ rules = array ( ) ; if ( ! empty ( $ headers [ self :: HEADER_READ ] ) ) { $ read = $ headers [ self :: HEADER_READ ] ; $ rules = explode ( ',' , $ read ) ; foreach ( $ rules as $ rule ) { $ ruleArray = self :: parseRule ( self :: READ , $ ru...
Given a list of headers get the ACL info .
9,953
public function addAccount ( $ perm , $ account , $ user = NULL ) { $ rule = array ( 'account' => $ account ) ; if ( ! empty ( $ user ) ) { $ rule [ 'user' ] = $ user ; } $ this -> addRule ( $ perm , $ rule ) ; return $ this ; }
Grant ACL access to an account .
9,954
public function headers ( ) { $ headers = array ( ) ; $ readers = array ( ) ; $ writers = array ( ) ; foreach ( $ this -> rules as $ rule ) { if ( self :: READ & $ rule [ 'mask' ] ) { $ ruleStr = $ this -> ruleToString ( self :: READ , $ rule ) ; if ( ! empty ( $ ruleStr ) ) { $ readers [ ] = $ ruleStr ; } } if ( self ...
Generate HTTP headers for this ACL .
9,955
protected function ruleToString ( $ perm , $ rule ) { if ( self :: READ & $ perm ) { if ( ! empty ( $ rule [ 'host' ] ) ) { return '.r:' . $ rule [ 'host' ] ; } if ( ! empty ( $ rule [ 'rlistings' ] ) ) { return '.rlistings' ; } } if ( ! empty ( $ rule [ 'account' ] ) ) { if ( empty ( $ rule [ 'user' ] ) ) { return $ r...
Convert a rule to a string .
9,956
public function isPublic ( ) { $ allowsAllHosts = FALSE ; $ allowsRListings = FALSE ; foreach ( $ this -> rules as $ rule ) { if ( self :: READ & $ rule [ 'mask' ] ) { if ( ! empty ( $ rule [ 'rlistings' ] ) ) { $ allowsRListings = TRUE ; } elseif ( ! empty ( $ rule [ 'host' ] ) && trim ( $ rule [ 'host' ] ) == '*' ) {...
Check whether this object allows public reading .
9,957
protected function createDashDriver ( string $ name ) : Handlers \ Dash { $ config = $ this -> app -> make ( 'config' ) -> get ( "orchestra/widget::dash.{$name}" , [ ] ) ; return new Handlers \ Dash ( $ name , $ config ) ; }
Create Dash driver .
9,958
protected function createMenuDriver ( string $ name ) : Handlers \ Menu { $ config = $ this -> app -> make ( 'config' ) -> get ( "orchestra/widget::menu.{$name}" , [ ] ) ; return new Handlers \ Menu ( $ name , $ config ) ; }
Create Menu driver .
9,959
protected function createPaneDriver ( string $ name ) : Handlers \ Pane { $ config = $ this -> app -> make ( 'config' ) -> get ( "orchestra/widget::pane.{$name}" , [ ] ) ; return new Handlers \ Pane ( $ name , $ config ) ; }
Create Pane driver .
9,960
protected function createPlaceholderDriver ( string $ name ) : Handlers \ Placeholder { $ config = $ this -> app -> make ( 'config' ) -> get ( "orchestra/widget::placeholder.{$name}" , [ ] ) ; return new Handlers \ Placeholder ( $ name , $ config ) ; }
Create Placeholder driver .
9,961
public function of ( $ name , Closure $ callback = null ) : Handler { if ( $ name instanceof Closure ) { $ callback = $ name ; $ name = $ this -> getDefaultDriver ( ) ; } $ instance = $ this -> make ( $ name ) ; if ( $ instance instanceof Handler && ! \ is_null ( $ callback ) ) { $ callback ( $ instance ) ; } return $ ...
Get the selected driver and extend it via callback .
9,962
public function consumer ( $ url , $ key , $ secret ) { Argument :: i ( ) -> test ( 1 , 'string' ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) ; return Consumer :: i ( $ url , $ key , $ secret ) ; }
Returns the oauth consumer class
9,963
public function getHmacGetAccessToken ( $ url , $ key , $ secret , $ token , $ tokenSecret , array $ query = array ( ) , $ realm = null , $ verifier = null ) { Argument :: i ( ) -> test ( 1 , 'string' ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) -> test ( 4 , 'string' ) -> test ( 5 , 'string' ) -> test ( 7 , 'st...
Returns an access token given the requiremets GET HMAC - SHA1
9,964
public function getHmacGetAuthorizationRequestToken ( $ url , $ key , $ secret , array $ query = array ( ) , $ realm = null ) { Argument :: i ( ) -> test ( 1 , 'string' ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) -> test ( 5 , 'string' , 'null' ) ; return $ this -> consumer ( $ url , $ key , $ secret ) -> useAu...
Returns a request token given the requiremets GET HMAC - SHA1 use Authorization Header
9,965
public function addValidationMapping ( BaseValidatorBuilderInterface $ builder , $ dirs ) { if ( empty ( $ dirs ) ) { return ; } $ finder = Finder :: create ( ) -> files ( ) -> filter ( function ( \ SplFileInfo $ file ) { return 1 === substr_count ( $ file -> getBasename ( ) , '.' ) && preg_match ( '/validation\.(yml|y...
add validation mapping
9,966
public function indexAt ( $ index ) { return ( $ index >= 0 && $ index <= $ this -> count ( ) - 1 ) ? $ this -> blockManagers [ $ index ] : null ; }
Returns the block manager at the given index .
9,967
public function getManagerInfoByBlockId ( $ idBlock ) { foreach ( $ this -> blockManagers as $ index => $ blockManager ) { if ( $ blockManager -> get ( ) -> getId ( ) == $ idBlock ) { return array ( 'index' => $ index , 'manager' => $ blockManager ) ; } } return null ; }
Retrieves the block manager and the index by the block s id
9,968
public function getBlockManager ( $ idBlock ) { $ info = $ this -> getManagerInfoByBlockId ( $ idBlock ) ; return ( null !== $ info ) ? $ info [ 'manager' ] : null ; }
Retrieves the block manager by the block s id
9,969
public function getBlockManagerIndex ( $ idBlock ) { $ info = $ this -> getManagerInfoByBlockId ( $ idBlock ) ; return ( null !== $ info ) ? $ info [ 'index' ] : null ; }
Retrieves the block manager index by the block s id
9,970
public function toArray ( ) { $ result = array ( ) ; foreach ( $ this -> blockManagers as $ blockManager ) { if ( null !== $ blockManager ) { $ result [ ] = $ blockManager -> toArray ( ) ; } } return $ result ; }
Returns the managed blocks as an array
9,971
public function insertAt ( BlockManagerInterface $ element , $ at ) { $ elements = count ( $ this -> blockManagers ) ; $ leftPart = array_slice ( $ this -> blockManagers , 0 , $ at ) ; $ rightPart = array_slice ( $ this -> blockManagers , $ at , $ elements ) ; $ this -> blockManagers = array_merge ( $ leftPart , array ...
Inserts a block manager at the specified index
9,972
public function removeAt ( $ at ) { $ elements = count ( $ this -> blockManagers ) - 1 ; $ leftPart = array_slice ( $ this -> blockManagers , 0 , $ at ) ; $ rightPart = array_slice ( $ this -> blockManagers , $ at + 1 , $ elements ) ; $ this -> blockManagers = array_merge ( $ leftPart , $ rightPart ) ; return array ( "...
Removes the block manager at the specified index
9,973
public function set ( string $ key , $ element ) : self { $ this -> validate ( $ element ) ; $ this -> elements [ $ key ] = $ element ; foreach ( $ this -> indexes as $ index ) { $ index -> add ( $ key , $ element ) ; } return $ this ; }
Adds a single element with the given key to the collection .
9,974
public function execute ( Arguments $ args , ConsoleIo $ io ) { foreach ( Configure :: read ( 'WRITABLE_DIRS' ) as $ path ) { $ this -> folderChmod ( $ io , $ path ) ; } return null ; }
Sets directories permissions
9,975
public static function maybeForward ( $ answerId , $ postId , $ comment , $ email , $ topicId ) { $ toGlobal = get_field ( 'feedback_forwarding' , 'option' ) ; $ toLocal = get_field ( 'feedback_forwarding' , $ postId ) ; if ( ! is_array ( $ toGlobal ) ) { $ toGlobal = array ( ) ; } if ( ! is_array ( $ toLocal ) ) { $ t...
Forwards a feedback comment if needed
9,976
public static function path ( $ plugin , $ file = null , $ check = false ) { $ plugin = parent :: path ( $ plugin ) ; if ( ! $ file ) { return $ plugin ; } $ path = $ plugin . $ file ; if ( $ check && ! is_readable ( $ path ) ) { throw new MissingPluginException ( __d ( 'me_tools' , 'File or directory `{0}` does not ex...
Gets a path for a plugin . It can also be used to get the path of a plugin file .
9,977
protected function rewriteImagesPathForProduction ( $ content ) { $ imagesSourcePath = $ this -> imagesSourcePath ; $ imagesTargetPath = $ this -> imagesTargetPath ; return preg_replace_callback ( '/([\/]?)(' . str_replace ( '/' , '\/' , $ imagesSourcePath ) . ')/s' , function ( $ matches ) use ( $ imagesTargetPath ) {...
Rewrites the images to be correctly displayed in the production environment
9,978
protected function rewriteLinksForProduction ( $ content ) { $ urlManager = $ this -> urlManager ; $ content = preg_replace_callback ( '/(\<a[^\>]+href[="\s]+)([^"\s]+)?([^\>]+\>)/s' , function ( $ matches ) use ( $ urlManager ) { $ url = $ matches [ 2 ] ; if ( preg_match ( '/route:([^"]+)/i' , $ url , $ route ) ) { $ ...
Rewrites the website links for the production environment
9,979
public function getInstantiator ( ) : Instantiator { if ( is_null ( $ this -> instantiator ) ) { $ this -> setInstantiator ( new Instantiator ( null , $ this ) ) ; } return $ this -> instantiator ; }
Get instantiator .
9,980
private function setInstantiator ( Instantiator $ instantiator ) { $ this -> instantiator = $ instantiator ; $ this -> add ( new Service ( $ this -> instantiator ) ) ; }
Set instantiator .
9,981
public function addSection ( Section $ section ) { $ this -> registry [ 'sections' ] [ ] = $ section ; $ this -> currentSection = $ section ; return $ this ; }
Adds a new section
9,982
public function addField ( Field $ field ) { $ field -> setSection ( $ this -> currentSection ) -> setOptionName ( $ this -> registry [ 'option_name' ] ) ; if ( isset ( $ this -> registry [ 'field_values' ] [ $ field -> getId ( ) ] ) ) { $ field -> setValue ( $ this -> registry [ 'field_values' ] [ $ field -> getId ( )...
Adds a field
9,983
public function render ( ) { $ reg = $ this -> registry ; ?> <div class="wrap"> <h1> <?php echo $ reg [ 'page_title' ] ; ?> </h1> <form action="options.php" method="post"> <?php settings_errors ( $ reg [ 'option_name' ] ) ?> <?php settings_fields ( $ reg [ 'option_name' ] ) ; ?> <?...
Renders settings page
9,984
public function render ( ) { $ text = parent :: render ( ) ; $ borderedText = BorderManager :: buildBorder ( $ text , $ this -> border ) ; return $ borderedText ; }
Render bordered element
9,985
public function item ( $ data , $ transformer = null , $ key = null ) { $ this -> setResource ( new Item ( $ data , $ transformer , $ key ) ) ; return $ this ; }
Set the resource item to be transformed .
9,986
public function collection ( $ data , TransformerInterface $ transformer = null , $ key = null , callable $ callback = null ) { $ this -> setResource ( new Collection ( $ data , $ transformer , $ key ) ) ; if ( $ callback !== null ) { $ callback ( $ this -> resource ) ; } return $ this ; }
Set the resource collection to be transformed .
9,987
public function setTransformer ( $ transformer = null ) { if ( ! $ this -> resource ) { throw new MissingResourceException ( 'Resource must be specified before setting a transformer' ) ; } $ this -> resource -> setTransformer ( $ transformer ) ; return $ this ; }
Sets the transformer to be used to transform the resource ... later .
9,988
public function parseIncludes ( $ str ) { $ this -> includes = $ this -> getIncludeParser ( ) -> parse ( ! empty ( $ str ) ? $ str : '' ) ; return $ this ; }
Parse the given string to generate a new Includes object .
9,989
public function create ( DynamoDbClient $ client , string $ tableName ) : void { try { $ client -> describeTable ( [ 'TableName' => $ tableName ] ) ; return ; } catch ( DynamoDbException $ e ) { } try { $ client -> createTable ( [ 'TableName' => $ tableName , 'AttributeDefinitions' => [ [ 'AttributeName' => self :: HAS...
Creates a DynamoDb table with the event store schema .
9,990
public function addCors ( bool $ isConsole = false ) { if ( $ isConsole ) return ; header ( 'Access-Control-Allow-Credentials: 0' ) ; header ( 'Access-Control-Allow-Origin: *' ) ; header ( 'Access-Control-Allow-Headers: *' ) ; header ( 'Access-Control-Allow-Methods: *' ) ; if ( isset ( $ _SERVER [ "REQUEST_METHOD" ] ) ...
Add cors to request
9,991
public function toXML ( ) { $ dom = new DOMDocument ( '1.0' , 'utf-8' ) ; $ dom -> formatOutput = true ; $ success = $ dom -> loadXML ( '<page />' ) ; $ pageNode = $ dom -> documentElement ; foreach ( $ this -> attributes as $ attrName => $ attrValue ) { switch ( $ attrName ) { case 'id' : $ pageNode -> setAttribute ( ...
Dumps object structure into XML type string
9,992
public static function createFromXML ( $ source ) { $ newObj = new eZPage ( ) ; if ( $ source ) { $ dom = new DOMDocument ( '1.0' , 'utf-8' ) ; $ success = $ dom -> loadXML ( $ source ) ; $ root = $ dom -> documentElement ; foreach ( $ root -> childNodes as $ node ) { if ( $ node -> nodeType == XML_ELEMENT_NODE && $ no...
Creates object structure from given XML type string
9,993
public function getZone ( $ index ) { $ zone = null ; if ( isset ( $ this -> attributes [ 'zones' ] [ $ index ] ) ) $ zone = $ this -> attributes [ 'zones' ] [ $ index ] ; return $ zone ; }
Return zone object by given index
9,994
public function removeZones ( ) { foreach ( $ this -> attributes [ 'zones' ] as $ index => $ zone ) { if ( $ zone -> toBeAdded ( ) ) $ this -> removeZone ( $ index ) ; else $ zone -> setAttribute ( 'action' , 'remove' ) ; } }
Remove zones from eZPage object with action add or set action to remove for zones which already presists
9,995
public function removeProcessed ( ) { if ( $ this -> hasAttribute ( 'action' ) ) { unset ( $ this -> attributes [ 'action' ] ) ; } if ( $ this -> getZoneCount ( ) > 0 ) { foreach ( $ this -> attributes [ 'zones' ] as $ index => $ zone ) { if ( $ zone -> toBeRemoved ( ) ) $ this -> removeZone ( $ index ) ; else $ zone -...
Cleanup processed objects removes action attribute removes all zones marked with remove action
9,996
public function sortZones ( ) { $ ini = eZINI :: instance ( 'zone.ini' ) ; $ zones = $ ini -> variable ( $ this -> attribute ( 'zone_layout' ) , 'Zones' ) ; $ sortedZones = array ( ) ; foreach ( $ zones as $ zone ) { foreach ( $ this -> attribute ( 'zones' ) as $ zoneObj ) { if ( ! ( $ zoneObj instanceof eZPageZone ) )...
Sorting zones array according to the INI file configuration .
9,997
public function map ( $ definition ) { $ fixed = preg_replace ( '/\s+/' , ' ' , $ definition ) ; if ( empty ( $ fixed ) ) { return ; } $ names = explode ( ' ' , $ fixed ) ; $ newArgs = [ ] ; foreach ( $ this -> args as $ key => $ value ) { if ( ! is_int ( $ key ) && in_array ( $ key , $ names ) ) { throw new \ Exceptio...
Map command line arguments to keys
9,998
public function actionGenerate ( ) { $ versionList = MiscHelper :: getAllVersions ( ) ; $ versionList = array_combine ( $ versionList , $ versionList ) ; $ selected = Select :: display ( 'Select package' , $ versionList ) ; $ version = Select :: getFirstValue ( $ selected ) ; ApiDocHelper :: generate ( $ version ) ; Ou...
Generate API documentation
9,999
function getPath ( ) { $ path = $ this -> getName ( ) ; if ( $ this -> __nestLeft ) $ path = $ this -> __nestLeft -> getPath ( ) . self :: SEPARATOR . $ path ; return $ path ; }
Get Namespace Path Of Nested Containers