idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
60,100 | private function rebuildAttrIndex ( string $ key ) { $ this -> index [ $ key ] = [ ] ; foreach ( $ this -> elements as $ id => $ element ) { if ( $ element instanceof $ this -> elementClassName ) { $ value = $ element -> getAttr ( $ key ) ; $ this -> index [ $ key ] [ $ value ] [ $ id ] = $ element ; } else { throw new... | Rebuild the entire index from provided elements . |
60,101 | public function removeElement ( AbstractElement $ element ) { $ id = $ element -> getId ( ) ; if ( ! isset ( $ this -> elements [ $ id ] ) ) { throw new MissingElementException ( "Element \"$id\" is not indexed." ) ; } unset ( $ this -> elements [ $ id ] ) ; $ indexedAttrs = array_intersect_key ( $ element -> getAttrib... | Remove element from index |
60,102 | public function update ( string $ key , $ oldValue , $ newValue , AbstractElement $ element ) { if ( ! isset ( $ this -> index [ $ key ] ) ) { throw new MissingAttrIndexException ( "Attribute index \"$key\" is not defined." ) ; } $ id = $ element -> getId ( ) ; if ( isset ( $ this -> index [ $ key ] [ $ oldValue ] [ $ ... | Update indices to match the changed attribute of the element |
60,103 | public function getElements ( string $ key , $ value ) : array { if ( ! isset ( $ this -> index [ $ key ] ) ) { throw new MissingAttrIndexException ( "Attribute index \"$key\" is not defined." ) ; } return $ this -> index [ $ key ] [ $ value ] ?? [ ] ; } | Get elements by the value of the attribute |
60,104 | public static function image ( $ src , $ alt = '' , $ options = [ ] ) { $ image_tag_tpl = '<img src="%s" alt="%s"%s />' ; $ cdnHost = Lb :: app ( ) -> getCdnHost ( ) ; if ( $ cdnHost ) { if ( ! ValidationHelper :: isUrl ( $ src ) ) { $ src = $ cdnHost . $ src ; } else { $ src = preg_replace ( '/^(http|https):\/\/.+?\//... | Generate image tag |
60,105 | public static function purify ( $ dirtyHtml ) { if ( self :: $ htmlPurifier && self :: $ htmlPurifier instanceof \ HTMLPurifier ) { $ purifier = self :: $ htmlPurifier ; } else { $ purifier = ( self :: $ htmlPurifier = new \ HTMLPurifier ( \ HTMLPurifier_Config :: createDefault ( ) ) ) ; } return $ purifier -> purify (... | Purify dirty html |
60,106 | public static function GetRequestToken ( OAuthConsumer $ consumer , $ scope , $ endpoint , $ applicationName , $ callbackUrl ) { $ signatureMethod = new OAuthSignatureMethod_HMAC_SHA1 ( ) ; $ params = array ( ) ; $ params [ 'scope' ] = $ scope ; if ( isset ( $ applicationName ) ) { $ params [ 'xoauth_displayname' ] = $... | Using the consumer and scope provided a request is made to the endpoint to generate an OAuth request token . |
60,107 | public static function GetAccessToken ( OAuthConsumer $ consumer , OAuthToken $ token , $ verifier , $ endpoint ) { $ signatureMethod = new OAuthSignatureMethod_HMAC_SHA1 ( ) ; $ params = array ( ) ; $ params [ 'oauth_verifier' ] = $ verifier ; $ request = OAuthRequest :: from_consumer_and_token ( $ consumer , $ token ... | Using the provided consumer and authorized request token a request is made to the endpoint to generate an OAuth access token . |
60,108 | private static function GetTokenFromUrl ( $ url ) { $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , 1 ) ; curl_setopt ( $ ch , CURLOPT_HEADER , 0 ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , 0 ) ; $ response = curl_exec ( $ ch ) ; $ hea... | Makes an HTTP request to the given URL and extracts the returned OAuth token . |
60,109 | public function init ( $ main_db , $ clone_db , $ table_list = null ) { try { if ( empty ( $ main_db ) && empty ( $ clone_db ) ) return false ; if ( ! $ this -> select_db ( ( string ) $ main_db ) ) { throw new DatabaseException ( 'Could not select Main Database ' . $ main_db ) ; } $ this -> clone_dbname = $ clone_db ; ... | starts the cloning process |
60,110 | public function clone_database ( $ main_db = null , $ clone_db = null ) { if ( empty ( $ this -> db ) ) { throw new DatabaseException ( 'Clone or Main database not connected' ) ; } if ( empty ( $ main_db ) || empty ( $ clone_db ) ) { throw new DatabaseException ( 'clone names havent been set' ) ; } $ sql = "SHOW CREATE... | clones the specific database |
60,111 | private function getPhotos ( Description $ description ) { return array_map ( function ( \ stdClass $ photoDescription ) { return $ this -> photoFactory -> create ( new Description ( $ photoDescription ) ) ; } , $ description -> getOptionalProperty ( 'items' , [ ] ) ) ; } | Get the venue photos . |
60,112 | public static function getString ( $ status = FALSE , $ tagStart = NULL , $ tagEnd = "\n" ) { $ arr = self :: get ( $ status ) ; $ str = '' ; foreach ( $ arr as $ msg ) { $ str .= $ tagStart . $ msg . $ tagEnd ; } return $ str ; } | Return messages as a string |
60,113 | public static function count ( $ status = FALSE ) { if ( $ status === FALSE ) { return count ( self :: $ messages ) ; } if ( isset ( self :: $ messages [ $ status ] ) ) { return count ( self :: $ messages [ $ status ] ) ; } else { return 0 ; } } | Return number of messages |
60,114 | public function getBasicDefinition ( $ class ) { if ( ! class_exists ( $ class ) ) { throw new \ InvalidArgumentException ( "$class is not a valid class name" ) ; } $ definition = new Definition ( $ class , [ ] ) ; $ traits = $ this -> classUsesDeep ( $ class ) ; foreach ( $ traits as $ trait ) { switch ( $ trait ) { c... | Creates a basic service definition for the given class injecting the typical dependencies according with the traits the class uses . |
60,115 | function getLabel ( ) { if ( $ this -> filtername ) return $ this -> filtername ; $ className = explode ( '\\' , get_class ( $ this ) ) ; $ className = $ className [ count ( $ className ) - 1 ] ; return $ className . '.*' ; } | Label Used To Register Our Filter |
60,116 | protected function _getDataFromBucket ( $ in , & $ consumed ) { $ data = '' ; while ( $ bucket = stream_bucket_make_writeable ( $ in ) ) { $ data .= $ bucket -> data ; $ consumed += $ bucket -> datalen ; } return $ data ; } | Read Data From Bucket |
60,117 | protected function _writeBackDataOut ( $ out , $ data ) { $ buck = stream_bucket_new ( $ this -> bufferHandle , '' ) ; if ( false === $ buck ) return PSFS_ERR_FATAL ; $ buck -> data = $ data ; stream_bucket_append ( $ out , $ buck ) ; return PSFS_PASS_ON ; } | Write Back Filtered Data On Out Bucket |
60,118 | public function authPubkey ( $ session , $ username , $ pubkey , $ privkey , $ passphrase ) { return ssh2_auth_pubkey_file ( $ session , $ username , $ pubkey , $ privkey , $ passphrase ) ; } | Facade for ssh2_auth_pubkey_file . |
60,119 | public function scpSend ( $ session , $ local_file , $ remote_file , $ create_mode = 0644 ) { return ssh2_scp_send ( $ session , $ local_file , $ remote_file , $ create_mode ) ; } | Facade for ssh2_scp_send . |
60,120 | public function load ( $ packageName ) { if ( $ this -> loadedModules -> has ( $ packageName ) ) { return $ this -> loadedModules -> get ( $ packageName ) ; } if ( ! $ this -> installedModules -> has ( $ packageName ) ) { throw new ModuleException ( sprintf ( 'Module (%s) does not exist.' , $ packageName ) , 500 ) ; } ... | Loads a module and returns the associated class or returns if already loaded |
60,121 | public static function buildDescription ( ) { if ( DescriptionRegistry :: hasDescription ( __CLASS__ ) ) return DescriptionRegistry :: getDescription ( __CLASS__ ) ; $ desc = new Description ( 'String' , NativeType :: STRING , false ) ; DescriptionRegistry :: registerDescriptionFor ( __CLASS__ , $ desc ) ; return $ des... | The description is cached in the internal description property |
60,122 | protected function setLastRow ( BlockInterface $ block , BlockInterface $ row ) { if ( ! BlockUtil :: isBlockType ( $ row , PanelRowSpacerType :: class ) ) { $ block -> setAttribute ( 'last_row' , $ row -> getName ( ) ) ; } } | Set the last row . |
60,123 | protected function getLastRow ( BlockInterface $ block ) { if ( $ block -> hasAttribute ( 'last_row' ) ) { $ row = $ block -> get ( $ block -> getAttribute ( 'last_row' ) ) ; if ( \ count ( $ row ) < $ row -> getOption ( 'column' ) ) { return $ row ; } } $ rowName = BlockUtil :: createUniqueName ( ) ; $ block -> add ( ... | Get the last row . |
60,124 | static function execute ( Base $ base ) { self :: $ _base = $ base ; $ request = isset ( $ _REQUEST [ 'route' ] ) ? $ _REQUEST [ 'route' ] : '/' ; if ( strpos ( $ request , '?' ) > 0 ) { $ split = explode ( '?' , $ request ) ; $ request = $ split [ 0 ] ; } self :: $ _attr = array_slice ( explode ( '/' , trim ( $ reques... | Executes the router |
60,125 | private static function _run ( $ request ) { $ matched_route = false ; $ request = '/' . $ request ; $ request = rtrim ( $ request , '/' ) . '/' ; $ request = str_replace ( "//" , "/" , $ request ) ; ksort ( self :: $ _routes ) ; foreach ( self :: $ _routes as $ priority => $ routes ) { foreach ( $ routes as $ source =... | Tries to match one of the URL routes to the current URL otherwise execute the default function . Sets the callback that needs to be returned |
60,126 | private static function _set_callback ( $ destination ) { if ( is_callable ( $ destination ) ) { self :: $ callback = array ( $ destination , self :: $ _attr ) ; } else { $ result = explode ( '/' , trim ( $ destination , '/' ) ) ; $ controller = ( $ result [ 0 ] == "" ) ? configItem ( 'site' ) [ 'default_controller' ] ... | Sets the callback as an array containing Controller Method & Parameters |
60,127 | function __toArray ( ) { $ params = __ ( new HydrateGetters ( $ this ) ) -> setExcludeNullValues ( ) ; $ params = StdTravers :: of ( $ params ) -> toArray ( null , true ) ; return $ params ; } | Get Grant Request Params As Array |
60,128 | public function run ( $ workload , TaskWrapper $ task ) { $ result = false ; $ this -> id = $ task -> getId ( ) ; $ this -> name = $ task -> getName ( ) ; try { if ( false !== $ this -> beforeRun ( $ workload , $ task ) ) { $ result = $ this -> doRun ( $ workload , $ task ) ; $ this -> afterRun ( $ result ) ; } } catch... | do the job |
60,129 | public function filter ( $ value ) { $ value = strtr ( $ value , $ this -> transliteration ) ; if ( $ this -> transformCase ) { $ value = mb_convert_case ( $ value , MB_CASE_LOWER , 'utf8' ) ; } if ( $ this -> transformPunctuation ) { $ value = strtr ( $ value , $ this -> punctuation ) ; } return $ value ; } | Normalise the input string |
60,130 | public function setTransliterationReplacements ( $ replacements ) { if ( ! is_array ( $ replacements ) ) { throw new \ Thin \ Exception ( __METHOD__ . ': method expects a keyed array as argument.' , 500 ) ; } foreach ( $ replacements as $ key => $ value ) { $ this -> transliteration [ $ key ] = $ value ; } return $ thi... | Set transliteration replacement values . |
60,131 | public function setPunctuationReplacements ( $ replacements ) { if ( ! is_array ( $ replacements ) ) { throw new \ Thin \ Exception ( __METHOD__ . ': method expects a keyed array as argument.' , 500 ) ; } foreach ( $ replacements as $ key => $ value ) { $ this -> punctuation [ $ key ] = $ value ; } return $ this ; } | Set punctuation replacement values . |
60,132 | public function getArrayCopy ( ) : array { $ values = get_object_vars ( $ this ) ; foreach ( $ values as $ property => $ value ) { if ( is_object ( $ value ) ) { unset ( $ values [ $ property ] ) ; } } return $ values ; } | Gets an array copy |
60,133 | public function exchangeArray ( $ data ) { foreach ( $ data as $ property => $ value ) { if ( isset ( $ this -> $ property ) ) { $ method = 'set' . ucfirst ( $ property ) ; $ this -> $ method ( $ value ) ; } } } | Maps the specified data to the properties of this object |
60,134 | public function callAction ( ) { if ( $ this -> checkAuthenticated ( ) ) { $ this -> view -> assign ( 'user' , $ this -> user ) ; parent :: callAction ( ) ; } } | Call controller action method |
60,135 | public static function getMetadataByContent ( ezpContent $ content ) { $ aMetadata = array ( 'objectName' => $ content -> name , 'classIdentifier' => $ content -> classIdentifier , 'datePublished' => ( int ) $ content -> datePublished , 'dateModified' => ( int ) $ content -> dateModified , 'objectRemoteId' => $ content... | Returns metadata for given content as array |
60,136 | public static function getMetadataByLocation ( ezpContentLocation $ location ) { $ url = $ location -> url_alias ; eZURI :: transformURI ( $ url , false , 'full' ) ; $ aMetadata = array ( 'nodeId' => ( int ) $ location -> node_id , 'nodeRemoteId' => $ location -> remote_id , 'fullUrl' => $ url ) ; return $ aMetadata ; ... | Returns metadata for given content location as array |
60,137 | public static function getLocationsByContent ( ezpContent $ content ) { $ aReturnLocations = array ( ) ; $ assignedNodes = $ content -> assigned_nodes ; foreach ( $ assignedNodes as $ node ) { $ location = ezpContentLocation :: fromNode ( $ node ) ; $ locationData = self :: getMetadataByLocation ( $ location ) ; $ loca... | Returns all locations for provided content as array . |
60,138 | public static function getFieldsByContent ( ezpContent $ content ) { $ aReturnFields = array ( ) ; foreach ( $ content -> fields as $ name => $ field ) { $ aReturnFields [ $ name ] = self :: attributeOutputData ( $ field ) ; } return $ aReturnFields ; } | Returns all fields for provided content |
60,139 | public static function attributeOutputData ( ezpContentField $ field ) { switch ( $ field -> data_type_string ) { case 'ezxmltext' : $ html = $ field -> content -> attribute ( 'output' ) -> attribute ( 'output_text' ) ; $ attributeValue = array ( strip_tags ( $ html ) ) ; break ; case 'ezimage' : $ strRepImage = $ fiel... | Transforms an ezpContentField in an array representation |
60,140 | public static function getChildrenList ( ezpContentCriteria $ c , ezpRestRequest $ currentRequest , array $ responseGroups = array ( ) ) { $ aRetData = array ( ) ; $ aChildren = ezpContentRepository :: query ( $ c ) ; foreach ( $ aChildren as $ childNode ) { $ childEntry = self :: getMetadataByContent ( $ childNode ) ;... | Returns all children node data based on the provided criteria object |
60,141 | public static function authQueryString ( $ authKey , $ accessToken , $ request = null ) { return HashHelper :: hash ( $ request ? $ request -> getParam ( $ authKey ) : Lb :: app ( ) -> getParam ( $ authKey ) ) == $ accessToken ; } | Query String Authentication |
60,142 | public function toMessage ( ) { $ m = new Message ( array ( $ this -> getRequestId ( ) , $ this -> getActionName ( ) , ) ) ; $ m -> append ( $ this -> getParameters ( ) ) ; return $ m ; } | Create a new Message from this StorageStatus . |
60,143 | public static function msgfmt ( $ po , $ mo = null ) { $ stringset = Po :: fromFile ( $ po ) ; if ( $ mo === null ) { $ mo = substr ( $ po , 0 , - 3 ) . '.mo' ; } Mo :: toFile ( $ stringset , $ mo ) ; } | Read a po file and store a mo file . If no MO filename is given one will be generated from the PO filename . |
60,144 | public static function msgunfmt ( $ mo , $ po = null ) { $ stringset = Mo :: fromFile ( $ mo ) ; if ( $ po === null ) { print Po :: toString ( $ stringset ) ; } else { Po :: toFile ( $ stringset , $ po ) ; } } | Reads a mo file and stores the po file . If no PO file was given only displays what would be the result . |
60,145 | public function have_pages ( ) { $ this -> setup ( ) ; $ offset = $ this -> get_query_offset ( ) ; return ( bool ) ( $ offset < $ this -> total_posts ) ; } | Indicates if we have posts to process |
60,146 | protected function count_posts ( ) { global $ wpdb ; $ query = $ this -> get_count_query ( ) ; $ this -> total_posts = $ wpdb -> get_var ( $ query ) ; } | Counts the total number of posts that match the restrictions not including pagination . |
60,147 | protected function getCurrentTaxonomy ( ) { if ( ! isset ( $ this -> args [ 'taxonomies' ] ) || empty ( $ this -> args [ 'taxonomies' ] ) ) { $ this -> args [ 'taxonomies' ] = $ this -> getDefaultTaxonomies ( ) ; } foreach ( $ this -> args [ 'taxonomies' ] as $ tax ) { if ( $ tax = get_term_by ( 'slug' , get_query_var ... | Find a custom taxonomy |
60,148 | protected function getOverloaded ( $ postType ) { if ( ! isset ( $ this -> args [ 'overload' ] [ $ postType ] ) ) { return null ; } return $ this -> args [ 'overload' ] [ $ postType ] ; } | return the fake post type |
60,149 | private function validate ( $ method ) { $ actionMethod = $ method . 'Method' ; $ ref = new \ ReflectionClass ( $ this -> manager ) ; if ( null === $ this -> $ actionMethod || ! $ ref -> hasMethod ( $ this -> $ actionMethod ) ) { throw new \ RuntimeException ( sprintf ( 'The "%s" method for "%s" adapter is does not sup... | Validate the adapter method . |
60,150 | public function validateObject ( $ instance ) { if ( null !== $ this -> validator ) { $ violations = $ this -> validator -> validate ( $ instance ) ; if ( ! empty ( $ violations ) ) { throw new ValidationException ( $ violations ) ; } } } | Validate the object instance . |
60,151 | public static function relationFromField ( $ fieldName , $ method = null ) { if ( $ method ) return $ method ; if ( substr ( $ fieldName , - 3 ) == '_id' ) { return substr ( $ fieldName , 0 , - 3 ) ; } if ( substr ( $ fieldName , - 4 ) == '_ids' ) { return substr ( $ fieldName , 0 , - 4 ) . 's' ; } return $ fieldName ;... | Consider this as a bit of magic This method will return a guessed method name which is used from the relation Since there is no way in Eloquent to read the relations from a model we have to work with what we get |
60,152 | public static function factory ( $ config = array ( ) ) { $ required = array ( 'base_url' ) ; $ config = Collection :: fromConfig ( $ config , array ( ) , $ required ) ; $ client = new self ( $ config -> get ( 'base_url' ) ) ; $ cookiePlugin = new CookiePlugin ( new ArrayCookieJar ( ) ) ; $ client -> addSubscriber ( $ ... | Factory method to create a new MediawikiApiClient |
60,153 | public static function factory ( array $ dbConfig ) : DbItf { static $ instances = [ ] ; $ key = md5 ( json_encode ( $ dbConfig ) ) ; if ( isset ( $ instances [ $ key ] ) ) { return $ instances [ $ key ] ; } switch ( $ dbConfig [ DbItf :: DB_CFG_DRIVER ] ) { case DbItf :: DB_DRIVER_MYSQL : $ instances [ $ key ] = new M... | Database factory . |
60,154 | public function calculateChangeSet ( ) { if ( false === $ this -> isDirty ( ) ) { return [ ] ; } return [ 'old' => empty ( $ this -> original ) ? null : $ this -> original , 'new' => empty ( $ this -> models ) ? null : $ this -> models , ] ; } | Calculates the change set of this collection . |
60,155 | public function has ( AbstractModel $ model ) { $ key = $ model -> getCompositeKey ( ) ; return isset ( $ this -> models [ $ key ] ) ; } | Determines if the Model is included in the collection . |
60,156 | public function push ( AbstractModel $ model ) { $ this -> validateAdd ( $ model ) ; if ( true === $ this -> willAdd ( $ model ) ) { return $ this ; } if ( true === $ this -> willRemove ( $ model ) ) { $ this -> evict ( 'removed' , $ model ) ; $ this -> set ( 'models' , $ model ) ; return $ this ; } if ( true === $ thi... | Pushes a Model into the collection . |
60,157 | public function rollback ( ) { $ this -> models = $ this -> original ; $ this -> added = [ ] ; $ this -> removed = [ ] ; return $ this ; } | Rollsback the collection it it s original state . |
60,158 | public function willAdd ( AbstractModel $ model ) { $ key = $ model -> getCompositeKey ( ) ; return isset ( $ this -> added [ $ key ] ) ; } | Determines if the model is scheduled for addition to the collection . |
60,159 | public function willRemove ( AbstractModel $ model ) { $ key = $ model -> getCompositeKey ( ) ; return isset ( $ this -> removed [ $ key ] ) ; } | Determines if the model is scheduled for removal from the collection . |
60,160 | protected function add ( AbstractModel $ model ) { if ( true === $ this -> has ( $ model ) ) { return $ this ; } $ this -> validateAdd ( $ model ) ; if ( true === $ model -> getState ( ) -> is ( 'empty' ) ) { $ this -> loaded = false ; } $ key = $ model -> getCompositeKey ( ) ; $ this -> models [ $ key ] = $ model ; $ ... | Adds an model to this collection . Is used during initial collection construction . |
60,161 | protected function hasOriginal ( AbstractModel $ model ) { $ key = $ model -> getCompositeKey ( ) ; return isset ( $ this -> original [ $ key ] ) ; } | Determines if the model is included in the original set . |
60,162 | public function resolvePlatform ( EventManager $ eventManager ) { $ eventManager -> attachSubscriber ( new ConnectionAttemptSubscriber ( ) ) ; if ( ! $ this -> connectionManager instanceof ConnectionInterface ) { throw new RuntimeException ( 'Connection must implement \ConnectionInterface' ) ; } $ reflector = new \ Ref... | Resolve provided connection s platform . |
60,163 | private function getPlatformProvider ( $ platform = [ ] , EventManager $ eventManager ) { if ( is_null ( $ platform ) ) { return false ; } $ platformId = key ( $ platform ) ; $ platform = current ( $ platform ) ; if ( ! isset ( $ platform [ 'provider' ] ) ) { $ this -> connectionFailed = ':noPlatform' ; return false ; ... | Resolves a connector s provider and returns it s object . |
60,164 | public function encode ( $ numbers ) { $ chars = [ ] ; $ alphabet = $ this -> alphabet ; foreach ( $ numbers as $ number ) { if ( isset ( $ alphabet [ $ number ] ) ) { $ chars [ ] = $ alphabet [ $ number ] ; } else { throw new InvalidBase64Input ( $ number ) ; } } return implode ( '' , $ chars ) ; } | Encodes a block of numbers to a base64 - string |
60,165 | public function decode ( $ based ) { if ( ! is_array ( $ based ) ) { $ based = str_split ( $ based ) ; } $ numbers = [ ] ; $ char2int = $ this -> char2int ; foreach ( $ based as $ char ) { if ( isset ( $ char2int [ $ char ] ) ) { $ numbers [ ] = $ char2int [ $ char ] ; } else { throw new InvalidBase64 ( $ based ) ; } }... | Decodes a base64 - string to a block of numbers |
60,166 | public function parseLog ( $ log ) { $ commits = $ tags = [ ] ; for ( $ i = 0 , $ lines = count ( $ log ) ; $ i < $ lines ; $ i ++ ) { $ tmp = explode ( ': ' , $ log [ $ i ] ) ; $ tmp = array_map ( 'trim' , $ tmp ) ; if ( $ tmp [ 0 ] == 'changeset' ) { $ commit = $ tmp [ 1 ] ; } if ( $ tmp [ 0 ] == 'user' ) { $ email =... | Parse the log provided as a string |
60,167 | public function extractAuthor ( $ string ) { preg_match_all ( '/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i' , $ string , $ matches ) ; $ string = str_replace ( $ matches [ 0 ] , '' , $ string ) ; $ string = str_replace ( [ '<' , '>' , '()' ] , '' , $ string ) ; $ string = trim ( $ string ) ; return empty ( $ string ) ? 'Unkno... | Extract the Author name from the string remove emails if they exist |
60,168 | public function save ( $ savePath , $ imageQuality = 95 ) { if ( ! $ this -> imageResized ) { $ this -> imageResized = $ this -> image ; } $ extension = Inflector :: lower ( File :: extension ( $ savePath ) ) ; switch ( $ extension ) { case 'jpg' : case 'jpeg' : if ( imagetypes ( ) & IMG_JPG ) { imagejpeg ( $ this -> i... | Save the image based on its file type . |
60,169 | private function get_dimensions ( $ newWidth , $ newHeight , $ option ) { switch ( $ option ) { case 'exact' : $ optimalWidth = $ newWidth ; $ optimalHeight = $ newHeight ; break ; case 'portrait' : $ optimalWidth = $ this -> getSizeByFixedHeight ( $ newHeight ) ; $ optimalHeight = $ newHeight ; break ; case 'landscape... | Return the image dimensions based on the option that was chosen . |
60,170 | private function getCropPoints ( $ optimalWidth , $ optimalHeight , $ newWidth , $ newHeight ) { $ cropPoints = array ( ) ; $ vertical_start = arrayGet ( $ this -> config , 'crop_vertical_start_point' ) ; $ horizontal_start = arrayGet ( $ this -> config , 'crop_horizontal_start_point' ) ; switch ( $ vertical_start ) { ... | Gets the crop points based on the configuration either set in the file or overridden by user in their own config file or on the fly . |
60,171 | public static function toRavelryPostFile ( $ value , Parameter $ parameter ) { if ( is_string ( $ value ) ) { $ value = fopen ( $ value , 'r' ) ; } if ( ! ( $ value instanceof StreamInterface ) ) { $ value = \ GuzzleHttp \ Stream \ create ( $ value ) ; } if ( $ value instanceof MetadataStreamInterface ) { $ filename = ... | This is duplicating logic from GuzzleHttp \ Post \ PostFile in order to patch odd API server behavior . It also makes sure the value is a proper stream reference . |
60,172 | public function getPostType ( ) { global $ wp_query ; if ( isset ( $ wp_query -> post ) && $ wp_query -> post -> post_type ) { return $ wp_query -> post -> post_type ; } if ( isset ( $ wp_query -> query ) && isset ( $ wp_query -> query [ 'post_type' ] ) ) { return $ wp_query -> query [ 'post_type' ] ; } else if ( isset... | Return the post type slug if available |
60,173 | public function getTax ( ) { global $ wp_query ; if ( isset ( $ wp_query -> tax_query ) && ! empty ( $ wp_query -> tax_query ) ) { return reset ( $ wp_query -> tax_query -> queries ) [ 'taxonomy' ] ; } return false ; } | Return the taxonomy slug if available |
60,174 | public function getTerm ( ) { global $ wp_query ; if ( isset ( $ wp_query -> tax_query ) && ! empty ( $ wp_query -> tax_query ) ) { $ first = reset ( $ wp_query -> tax_query -> queries ) ; return is_array ( $ first ) ? reset ( $ first [ 'terms' ] ) : false ; } return false ; } | Return the taxonomy term if available |
60,175 | public function watch ( $ command , $ interval = 500 ) { $ count = 0 ; $ activeTime = time ( ) ; $ maxTime = ( int ) $ this -> config [ 'max_watch_time' ] ; $ intervalUs = $ interval * 1000 ; while ( true ) { $ count ++ ; $ result = $ this -> command ( $ command ) ; if ( 0 === strpos ( $ result , 'ERR' ) ) { echo "$res... | watch a command |
60,176 | public function interactive ( ) { echo "welcome! please input command('quit' or 'exit' to Quit).\n " ; while ( true ) { echo '> ' ; if ( $ cmd = trim ( fgets ( \ STDIN ) ) ) { if ( $ cmd === 'quit' || $ cmd === 'exit' ) { echo "Quit. Bye\n" ; break ; } echo $ this -> command ( $ cmd ) . PHP_EOL ; } usleep ( 50000 ) ; }... | into interactive environment |
60,177 | public function setSmartyFilter ( ChildSmartyFilter $ v = null ) { if ( $ v === null ) { $ this -> setId ( null ) ; } else { $ this -> setId ( $ v -> getId ( ) ) ; } $ this -> aSmartyFilter = $ v ; if ( $ v !== null ) { $ v -> addSmartyFilterI18n ( $ this ) ; } return $ this ; } | Declares an association between this object and a ChildSmartyFilter object . |
60,178 | public function getSmartyFilter ( ConnectionInterface $ con = null ) { if ( $ this -> aSmartyFilter === null && ( $ this -> id !== null ) ) { $ this -> aSmartyFilter = ChildSmartyFilterQuery :: create ( ) -> findPk ( $ this -> id , $ con ) ; } return $ this -> aSmartyFilter ; } | Get the associated ChildSmartyFilter object |
60,179 | public static function getMonthsRange ( $ startData , $ endDate ) { $ time1 = strtotime ( $ startData ) ; $ time2 = strtotime ( $ endDate ) ; $ year1 = date ( 'Y' , $ time1 ) ; $ year2 = date ( 'Y' , $ time2 ) ; $ years = range ( $ year1 , $ year2 ) ; $ months = Array ( ) ; foreach ( $ years as $ year ) { $ months [ $ ... | Cria um intervalo de Meses de acordo com a data inicial e final |
60,180 | protected function createEntry ( array $ data ) { return Entity \ AccountNode :: fromNode ( parent :: createEntry ( $ data ) , $ this -> getConnection ( ) -> getConfiguration ( ) ) ; } | Creates the data structure for the given entry data |
60,181 | public function sendTemplateMessageByType ( $ touser , $ type , $ data , $ url = null ) { return isset ( $ this -> templates [ $ type ] ) && $ this -> sendTemplateMessage ( $ touser , $ this -> templates [ $ type ] , $ data , $ url ) ; } | Send template by type |
60,182 | public function setTemplateIndustry ( $ industry_id1 , $ industry_id2 ) { $ data = $ this -> getData ( '/cgi-bin/template/api_set_industry' , [ 'access_token' => $ this -> getAccessToken ( ) , ] , Json :: encode ( [ 'industry_id1' => $ industry_id1 , 'industry_id2' => $ industry_id2 , ] ) ) ; return $ this -> errcode =... | Set template industry |
60,183 | public function delete ( $ key ) : Blob { if ( $ this -> offsetExists ( $ key ) ) { $ this -> offsetUnset ( $ key ) ; } return $ this ; } | Delete value for key in Blob . |
60,184 | final protected function doCommandImportSetUp ( ) { $ this -> writeln ( 'Executing <info>setup</info> tasks' , true ) ; $ this -> importManager -> setUp ( ) ; $ this -> writeln ( 'Startup tasks complete.' , true , true ) ; } | Performs startup tasks |
60,185 | final protected function doCommandImport ( ) { $ this -> writeln ( 'Starting Import' , true , true ) ; $ this -> indent ( ) ; foreach ( $ this -> importManager -> getConfiguration ( ) -> getSegments ( ) as $ segment ) { $ this -> importSegment ( $ segment ) ; } $ this -> outdent ( ) ; $ this -> writeln ( '<info>Import ... | The main import loop |
60,186 | final protected function doCommandImportTearDown ( ) { $ this -> writeln ( 'Executing <info>teardown</info> tasks' , false , true ) ; $ this -> indent ( ) ; $ this -> subscriberPass ( ) ; $ this -> outdent ( ) ; $ this -> writeln ( 'Teardown tasks complete.' , false , true ) ; } | Performs teardown tasks |
60,187 | public function listen ( Listener $ listener ) { if ( isset ( $ this -> listeners [ $ listener -> get_tag ( ) ] ) ) { return false ; } $ this -> listeners [ $ listener -> get_tag ( ) ] = $ listener ; return true ; } | Listen for a template tag . |
60,188 | public function get_listener ( $ tag ) { return isset ( $ this -> listeners [ $ tag ] ) ? $ this -> listeners [ $ tag ] : new Null_Listener ( ) ; } | Get a listener for a certain tag . |
60,189 | public function render_tags ( array $ data_sources ) { $ replaced = array ( ) ; foreach ( $ this -> get_listeners ( ) as $ tag => $ listener ) { $ params = $ listener -> get_callback_reflection ( ) -> getParameters ( ) ; $ args = array ( ) ; foreach ( $ params as $ param ) { $ found = false ; foreach ( $ data_sources a... | Return an array of the rendered tags . |
60,190 | public static function create ( $ dir , $ chmod = null ) { if ( ! file_exists ( $ dir ) ) { if ( $ chmod === null ) { $ chmod = self :: $ defaultChmod ; } mkdir ( $ dir , $ chmod , true ) ; chmod ( $ dir , $ chmod ) ; return true ; } return false ; } | create a directory . |
60,191 | public static function remove ( $ path , $ deleteDir = true ) { if ( $ path == '' || $ path == '/' || $ path == DIRECTORY_SEPARATOR ) { throw new \ InvalidArgumentException ( 'The root cannot be removed !!' ) ; } if ( ! file_exists ( $ path ) ) { return true ; } $ dir = new \ DirectoryIterator ( $ path ) ; foreach ( $ ... | Recursive function deleting a directory . |
60,192 | public static function removeExcept ( $ path , $ except , $ deleteDir = true ) { if ( ! is_array ( $ except ) || ! count ( $ except ) ) { throw new \ InvalidArgumentException ( 'list of exception is not an array or is empty' ) ; } if ( $ path == '' || $ path == '/' || $ path == DIRECTORY_SEPARATOR ) { throw new \ Inval... | Recursive function deleting all files into a directory except those indicated . |
60,193 | static function copy ( $ srcDir , $ destDir , $ overwrite = true ) { Directory :: create ( $ destDir ) ; $ dir = new \ DirectoryIterator ( $ srcDir ) ; foreach ( $ dir as $ dirContent ) { if ( $ dirContent -> isFile ( ) || $ dirContent -> isLink ( ) ) { $ target = $ destDir . '/' . $ dirContent -> getFilename ( ) ; if ... | Copy a content directory into an other |
60,194 | private function isAutoWirable ( $ id ) : bool { if ( is_string ( $ id ) && class_exists ( $ id ) ) { if ( count ( $ this -> interfaces ) > 0 ) { return ( bool ) array_intersect ( $ this -> interfaces , class_implements ( $ id ) ) ; } return true ; } return false ; } | Return whether the given id is an auto wirable class . |
60,195 | private function make ( string $ class ) { if ( ! array_key_exists ( $ class , $ this -> instances ) ) { try { return $ this -> instances [ $ class ] = ( $ this -> factory ) ( $ class ) -> value ( $ this ) ; } catch ( ResolvingExceptionInterface $ e ) { throw new ReflectionContainerException ( $ class , $ e ) ; } } ret... | Return an instance of the given class name . Cache the created instance so the same one is returned on multiple calls . |
60,196 | public function exportDataSets ( $ dataSetConfig = null ) { $ response = [ ] ; foreach ( $ this -> getDataSets ( ) as $ set ) { if ( $ set instanceof DataSet ) { $ response [ ] = $ set -> export ( $ dataSetConfig ) ; } else { $ response [ ] = $ set ; } } return $ response ; } | Export Data Sets |
60,197 | protected function changeOwner ( $ path , $ newOwner ) { $ ownerUid = fileowner ( $ path ) ; $ ownerData = posix_getpwuid ( $ ownerUid ) ; $ oldOwner = $ ownerData [ 'name' ] ; if ( $ oldOwner !== $ this -> user ) { if ( ! @ chown ( $ path , $ newOwner ) ) { throw new CException ( sprintf ( 'Unable to change owner for ... | Changes the owner for a directory . |
60,198 | protected function changeGroup ( $ path , $ newGroup ) { $ groupGid = filegroup ( $ path ) ; $ groupData = posix_getgrgid ( $ groupGid ) ; $ oldGroup = $ groupData [ 'name' ] ; if ( $ oldGroup !== $ newGroup ) { if ( ! @ chgrp ( $ path , $ newGroup ) ) { throw new CException ( sprintf ( 'Unable to change group for %s, ... | Changes the group for a directory . |
60,199 | protected function changeMode ( $ path , $ mode ) { $ oldPermission = substr ( sprintf ( '%o' , fileperms ( $ path ) ) , - 4 ) ; $ newPermission = sprintf ( '%04o' , $ mode ) ; if ( $ oldPermission !== $ newPermission ) { if ( ! @ chmod ( $ path , $ mode ) ) { throw new CException ( sprintf ( "Unable to change mode for... | Changes the mode for a directory . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.