idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
9,600 | public function getTopGames ( $ params = [ ] ) { $ defaults = [ 'limit' => 10 , 'offset' => 0 , ] ; return $ this -> wrapper -> request ( 'GET' , 'games/top' , [ 'query' => $ this -> resolveOptions ( $ params , $ defaults ) ] ) ; } | Returns a list of games objects sorted by number of current viewers on Twitch most popular first . |
9,601 | public function load ( $ workingDir ) { $ locator = new FileLocator ( $ this -> getPotentialDirectories ( $ workingDir ) ) ; $ loader = new YamlLoader ( $ locator ) ; $ processor = new Processor ( ) ; $ schema = new BuddySchema ( ) ; $ files = $ locator -> locate ( static :: FILENAME , NULL , FALSE ) ; foreach ( $ file... | Loads the configuration file data . |
9,602 | public function getCommand ( $ command ) { return new CommandShortcut ( $ command , $ this -> commands [ $ command ] [ 'options' ] , $ this -> commands [ $ command ] [ 'file' ] ) ; } | Provides the command specification . |
9,603 | protected function getPotentialDirectories ( $ workingDir ) { $ paths = array ( ) ; $ path = '' ; foreach ( explode ( '/' , $ workingDir ) as $ part ) { $ path .= $ part . '/' ; $ paths [ ] = rtrim ( $ path , '/' ) ; } return $ paths ; } | Helper to provide potential directories to look for . buddy . yml files . |
9,604 | public function get_group_by ( array $ cfg ) : string { $ res = '' ; $ group_to_put = [ ] ; if ( ! empty ( $ cfg [ 'group_by' ] ) ) { foreach ( $ cfg [ 'group_by' ] as $ g ) { if ( isset ( $ cfg [ 'available_fields' ] [ $ g ] ) ) { $ group_to_put [ ] = $ this -> escape ( $ g ) ; } else { $ this -> db -> error ( "Error!... | Returns a string with the GROUP BY part of the query if there is empty otherwise |
9,605 | public function get_having ( array $ cfg ) : string { $ res = '' ; if ( ! empty ( $ cfg [ 'group_by' ] ) && ! empty ( $ cfg [ 'having' ] ) && ( $ cond = $ this -> get_conditions ( $ cfg [ 'having' ] , $ cfg , true ) ) ) { $ res .= 'HAVING ' . $ cond . PHP_EOL ; } return $ res ; } | Returns a string with the HAVING part of the query if there is empty otherwise |
9,606 | public function create_index ( string $ table , $ column , bool $ unique = false , $ length = null ) : bool { $ column = ( array ) $ column ; if ( $ length ) { $ length = ( array ) $ length ; } $ name = bbn \ str :: encode_filename ( $ table ) ; if ( $ table = $ this -> table_full_name ( $ table , true ) ) { foreach ( ... | Creates an index |
9,607 | public function delete_user ( string $ user ) : bool { if ( bbn \ str :: check_name ( $ user ) ) { $ this -> db -> raw_query ( " REVOKE ALL PRIVILEGES ON *.* FROM $user" ) ; return ( bool ) $ this -> db -> query ( "DROP USER $user" ) ; } return false ; } | Deletes a database user |
9,608 | public function manageRoles ( User $ user ) { $ this -> authorize ( 'roles' , $ user ) ; $ roles = Role :: all ( ) ; return view ( 'laralum_users::roles' , [ 'user' => $ user , 'roles' => $ roles ] ) ; } | Manage roles from users . |
9,609 | public function transform ( $ user ) { $ user = $ this -> entityToArray ( User :: class , $ user ) ; return [ 'id' => ( int ) $ user [ 'id' ] , 'email' => $ user [ 'email' ] , 'nick' => $ user [ 'nick' ] , 'firstName' => $ user [ 'first_name' ] , 'lastName' => $ user [ 'last_name' ] , 'roles' => ! empty ( $ user [ 'rol... | Transforms user entity |
9,610 | public function handleXmlHttpRequest ( MvcEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( $ request -> isXMLHttpRequest ( ) ) { $ dispatchResult = $ event -> getResult ( ) ; if ( $ dispatchResult instanceof ViewModel ) { $ dispatchResult -> setTerminal ( true ) ; } } } | If request is an XML HTTP Request disable layouts |
9,611 | protected function allowedSessionsExceeded ( $ orderedSessions , $ allowableSessions , SessionRegistry $ registry ) { if ( $ this -> errorIfMaximumExceeded ) { throw new MaxSessionsExceededException ( sprintf ( 'Maximum number of sessions (%s) exceeded' , $ allowableSessions ) ) ; } $ orderedSessionsVector = array_valu... | Allows subclasses to customize behavior when too many sessions are detected . |
9,612 | public function actionGetMenus ( ) { $ request = \ Yii :: $ app -> request ; if ( $ request -> getIsOptions ( ) ) { return $ this -> ResponseOptions ( $ this -> verbs ( ) [ 'index' ] ) ; } try { return Menu :: getMenuSource ( ) ; } catch ( Exception $ e ) { throw new Exception ( $ e ) ; } } | list all menus |
9,613 | public function actionGetSavedRoutes ( ) { $ request = \ Yii :: $ app -> request ; if ( $ request -> getIsOptions ( ) ) { return $ this -> ResponseOptions ( $ this -> verbs ( ) [ 'index' ] ) ; } try { return Menu :: getSavedRoutes ( ) ; } catch ( Exception $ e ) { throw new Exception ( $ e ) ; } } | list all menus route |
9,614 | public function generate ( $ obj ) { if ( ! is_object ( $ obj ) ) { throw new \ InvalidArgumentException ( 'OpenGraphGenerator::generate only accept object argument.' ) ; } $ openGraph = new OpenGraph ( ) ; $ classType = get_class ( $ obj ) ; $ metadata = $ this -> factory -> getMetadataForClass ( $ classType ) ; if ( ... | Generate OpenGraph through metadata |
9,615 | private function getStreamInformationsOfEpisode ( $ episode ) { $ uri = $ this -> getContainer ( ) -> get ( 'bprs.asset_helper' ) -> getAbsoluteUrl ( $ episode -> getVideo ( ) ) ; if ( ! $ uri ) { $ this -> logbook -> error ( 'oktolab_media.episode_assetdatajob_nourl' , [ ] , $ this -> args [ 'uniqID' ] ) ; return fals... | extracts streaminformations of an episode from its video . returns false if informations can t be extracted returns array of video and audio info . |
9,616 | public static function createLayoutFactoryBuilder ( ) { $ builder = new LayoutFactoryBuilder ( new ExpressionProcessor ( new ExpressionLanguage ( ) , new ExpressionEncoderRegistry ( [ 'json' => new JsonExpressionEncoder ( new ExpressionManipulator ( ) ) ] ) ) ) ; $ builder -> addExtension ( new CoreExtension ( ) ) ; re... | Creates a layout factory builder with the default configuration . |
9,617 | public static function clearXml ( $ xml = '' , $ remEnc = false ) { $ aFind = [ 'xmlns:default="http://www.w3.org/2000/09/xmldsig#"' , ' standalone="no"' , 'default:' , ':default' , "\n" , "\r" , "\t" , ] ; if ( $ remEnc ) { $ aFind [ ] = '<?xml version="1.0"?>' ; $ aFind [ ] = '<?xml version="1.0" encoding="utf-8"?>' ... | clearXml Remove \ r \ n \ s \ t . |
9,618 | public static function countChars ( $ string ) { if ( function_exists ( 'iconv_strlen' ) ) { return iconv_strlen ( $ string , 'utf-8' ) ; } elseif ( function_exists ( 'mb_strlen' ) ) { return mb_strlen ( $ string , 'utf-8' ) ; } elseif ( function_exists ( 'utf8_decode' ) ) { return strlen ( utf8_decode ( $ string ) ) ;... | Count the number of characters in a string . |
9,619 | public static function convertToUTF8 ( $ data , $ encoding = 'UTF-8' ) { if ( function_exists ( 'mb_convert_encoding' ) ) { $ save = ini_get ( 'mbstring.substitute_character' ) ; ini_set ( 'mbstring.substitute_character' , "none" ) ; $ data = mb_convert_encoding ( $ data , 'UTF-8' , $ encoding ) ; ini_set ( 'mbstring.s... | Convert data from the given encoding to UTF - 8 . |
9,620 | public static function checkForIllegalCodepoints ( $ data ) { if ( ! function_exists ( 'preg_match_all' ) ) { throw HTML5_Exception ( 'The PCRE library is not loaded or is not available.' ) ; } $ errors = array ( ) ; for ( $ i = 0 , $ count = substr_count ( $ data , "\0" ) ; $ i < $ count ; $ i ++ ) { $ errors [ ] = 'n... | Checks for Unicode code points that are not valid in a document . |
9,621 | public function apply ( $ context ) { if ( ! $ context instanceof RContext ) { $ context = new Context ( $ context ) ; } return $ this -> evaluate ( $ context ) ; } | Evaluate the Rule with the given Context . |
9,622 | public static function generateMessageId ( $ hostname ) { if ( strpos ( $ hostname , '@' ) !== false ) { $ hostname = strstr ( $ hostname , '@' ) ; } else { $ hostname = '@' . $ hostname ; } return date ( 'YmdGHjs' ) . '.' . getmypid ( ) . '.' . self :: $ idCounter ++ . $ hostname ; } | Returns an unique message ID to be used for a mail message . |
9,623 | public static function mimeDecode ( $ text , $ charset = 'utf-8' ) { $ origtext = $ text ; $ text = @ iconv_mime_decode ( $ text , 0 , $ charset ) ; if ( $ text !== false ) { return $ text ; } $ text = preg_replace_callback ( '/=(([a-f][a-f0-9])|([a-f0-9][a-f]))/' , create_function ( '$matches' , 'return strtoupper($ma... | Decodes mime encoded fields and tries to recover from errors . |
9,624 | static public function replyToMail ( ezcMail $ mail , ezcMailAddress $ from , $ type = self :: REPLY_SENDER , $ subjectPrefix = "Re: " , $ mailClass = "ezcMail" ) { $ reply = new $ mailClass ( ) ; $ reply -> from = $ from ; if ( $ mail -> getHeader ( 'Reply-To' ) != '' ) { $ reply -> to = ezcMailTools :: parseEmailAddr... | Returns a new mail object that is a reply to the current object . |
9,625 | static public function guessContentType ( $ fileName , & $ contentType , & $ mimeType ) { $ extension = strtolower ( pathinfo ( $ fileName , PATHINFO_EXTENSION ) ) ; switch ( $ extension ) { case 'gif' : $ contentType = 'image' ; $ mimeType = 'gif' ; break ; case 'jpg' : case 'jpe' : case 'jpeg' : $ contentType = 'imag... | Guesses the content and mime type by using the file extension . |
9,626 | public function authenticate ( Authenticatable $ user , array $ credentials ) { $ handler = ldap_connect ( $ this -> host ) ; if ( ! $ handler ) { throw new RuntimeException ( "Connection fail! Check your server address: '{$this->host}'." ) ; } try { ldap_set_option ( $ handler , LDAP_OPT_PROTOCOL_VERSION , 3 ) ; } cat... | Check user s credentials against LDAP server . |
9,627 | public function getList ( array $ query = [ ] ) { $ list = $ this -> execute ( self :: HTTP_GET , self :: DOMUSERP_API_PEDIDOVENDA . '/empresas' ) ; return $ list ; } | List of companies |
9,628 | public function flush ( ) { rewind ( $ this -> handle ) ; $ out = stream_get_contents ( $ this -> handle ) ; fseek ( $ this -> handle , 0 , SEEK_END ) ; return $ out ; } | Output all written data as string . |
9,629 | private function write ( array $ row ) { if ( $ this -> encodingFrom !== null && $ this -> encodingTo !== null ) { foreach ( $ row as $ k => $ v ) { $ row [ $ k ] = iconv ( $ this -> encodingFrom , $ this -> encodingTo , $ v ) ; } } return fputcsv ( $ this -> handle , $ row , $ this -> delimiter , $ this -> enclosure ,... | Wrapper for fputcsv function |
9,630 | public function createTemporaryTable ( $ tableName , $ tableDefinition ) { $ tableName = str_replace ( '%' , '' , $ tableName ) ; $ tableName = $ this -> getPrefixedTableNames ( $ tableName ) ; $ this -> db -> exec ( "CREATE TEMPORARY TABLE $tableName ($tableDefinition)" ) ; return $ tableName ; } | Create temporary table . |
9,631 | public function handles ( $ name ) { try { $ this -> view -> getHelper ( $ name ) ; } catch ( Zend_Loader_PluginLoader_Exception $ e ) { return false ; } return true ; } | Called from Dwoo_Compiler to check if the requested plugin is available |
9,632 | public function decorate ( Collection $ items , $ type = 'notification' ) { $ view = config ( 'antares/notifications::templates.' . $ type ) ; if ( is_null ( $ view ) ) { throw new RuntimeException ( 'Unable to resolve notification partial view.' ) ; } $ return = [ ] ; foreach ( $ items as $ item ) { $ return [ ] = $ t... | Decorates notifications of alerts |
9,633 | public function item ( Model $ item , $ view ) { $ content = $ this -> getVariablesAdapter ( ) -> get ( $ item -> content [ 0 ] -> content , ( array ) $ item -> variables ) ; return view ( $ view , [ 'id' => $ item -> id , 'author' => $ item -> author , 'title' => $ item -> content [ 0 ] -> title , 'value' => $ content... | Decorates single item |
9,634 | public function switchAction ( Request $ request , string $ currency ) : RedirectResponse { $ result = $ this -> get ( 'currency.repository' ) -> findOneBy ( [ 'code' => $ currency ] ) ; if ( null !== $ result ) { $ request -> getSession ( ) -> set ( '_currency' , $ currency ) ; } return new RedirectResponse ( $ reques... | Sets new session currency |
9,635 | private function sanitize ( $ st ) { $ st = trim ( ( string ) $ st ) ; if ( strpos ( $ st , ';' ) !== false ) { return '' ; } if ( strpos ( $ st , '<' ) !== false ) { return '' ; } if ( strpos ( $ st , '"' ) !== false ) { return '' ; } if ( strpos ( $ st , "'" ) !== false ) { return '' ; } return $ st ; } | This function is used to sanitize the strings which are given as parameters |
9,636 | private function process_parameters ( $ param ) { foreach ( $ param as $ key => $ val ) { if ( \ is_array ( $ val ) ) { $ param [ $ key ] = $ this -> process_parameters ( $ val ) ; } else { $ param [ $ key ] = $ this -> sanitize ( $ val ) ; } } return $ param ; } | Sanitize each parameter |
9,637 | public function get_args ( $ name ) { if ( $ this -> checked ) { $ cmd_name = str_replace ( '_' , '-' , $ name ) ; return isset ( $ this -> commands [ $ cmd_name ] , $ this -> commands [ $ cmd_name ] [ 'args' ] ) ? $ this -> commands [ $ cmd_name ] [ 'args' ] : [ ] ; } } | Returns the arguments description of a given command |
9,638 | public function generate ( $ command ) { $ perl_cmd = str_replace ( '_' , '-' , $ command ) ; if ( isset ( $ this -> commands [ $ perl_cmd ] ) ) { $ cmd = $ this -> commands [ $ perl_cmd ] ; $ st = '$vm->' . $ command . '([' . PHP_EOL ; foreach ( $ cmd [ 'args' ] as $ k => $ v ) { $ st .= "'$k' => " . ( $ v [ 'binary' ... | Returns a string of PHP code for executing a given command with all its possible parameters pre - populated |
9,639 | public function openFiscalReceipt ( $ tipo_ticket ) { $ tipo_ticket = $ this -> arrayMapTipoTicket [ $ tipo_ticket ] ; return "@" . $ this -> cm ( 'FS' ) . $ tipo_ticket . $ this -> cm ( 'FS' ) . "T" ; } | Me abre un documento fiscal |
9,640 | public function printFiscalText ( $ texto , $ doble_ancho = false , $ display = 0 ) { $ texto = substr ( $ texto , 0 , 30 ) ; if ( $ doble_ancho ) { $ texto = $ this -> cm ( 'DOBLE_ANCHO' ) . $ texto ; } return "A" . $ this -> cm ( 'FS' ) . $ texto . $ this -> cm ( 'FS' ) . $ display ; } | Imprime texto fiscal que se muestra por lo general antes de los articulos . No puede contener la palabra TOTAL porque se puede bloquear la impresora |
9,641 | public function setDateTime ( $ fecha = 'now' , $ hora = 'now' ) { $ ymd = date ( "ymd" , strtotime ( $ fecha ) ) ; $ his = date ( "His" , strtotime ( $ hora ) ) ; return "X" . $ this -> cm ( 'FS' ) . $ ymd . $ this -> cm ( 'FS' ) . $ his ; } | Setea fecha y hora |
9,642 | public function setHeaderTrailer ( $ numero_de_linea , $ texto = "-" , $ doble_ancho = false ) { $ texto = substr ( $ texto , 0 , 45 ) ; if ( $ numero_de_linea > - 3 && $ numero_de_linea <= 0 ) { $ comando = "]" . $ this -> cm ( 'FS' ) . $ numero_de_linea ; } if ( $ numero_de_linea > 0 && $ numero_de_linea < 21 ) { if ... | Setea el encabezado y el pie de pagina |
9,643 | public function setTrailer ( $ linea , $ texto , $ doble_ancho = false ) { $ texto = substr ( $ texto , 0 , 45 ) ; $ comando = '' ; if ( $ linea > - 1 && $ linea < 10 ) { if ( $ doble_ancho ) { $ texto = $ this -> cm ( 'DOBLE_ANCHO' ) . $ texto ; } $ numero_de_linea = 11 + $ linea ; $ comando = "]" . $ this -> cm ( 'FS... | Setea el pie de pagina |
9,644 | public function addView ( View $ view ) { $ name = $ view -> getName ( ) ; $ path = $ view -> getPath ( ) ; if ( ! is_object ( $ path ) ) { if ( $ path ) { $ path = ltrim ( str_replace ( base_path ( ) , '' , realpath ( $ path ) ) , '/' ) ; } if ( substr ( $ path , - 10 ) == '.blade.php' ) { $ type = 'blade' ; } else { ... | Add a View instance to the Collector |
9,645 | protected function getSummaryColumns ( ) { $ columns = [ ] ; $ model = $ this -> getSampleModel ( ) ; $ columnName = $ model -> getLabelColumnName ( ) ; if ( $ columnName != "" ) { $ columns [ ] = $ columnName ; } return $ columns ; } | Override to control the columns returned in HEAD requests |
9,646 | protected function get_field ( \ WP_Post $ post ) { $ field = parent :: get_field ( $ post ) ; $ automatic = $ this -> original_callback ? ' original' : '' ; $ geocder = $ this -> show_geocoder ? $ this -> geocoder ( ) : '' ; return <<<HTML {$field} <div id="{$this->name}-map" class="wpametu-map{... | Add map canvas |
9,647 | protected function geocoder ( ) { $ helper = $ this -> __ ( 'Input address' ) ; $ btn = $ this -> __ ( 'Move point' ) ; $ fail = esc_attr ( $ this -> __ ( 'Sorry, but nothing found with input address' ) ) ; return <<<HTML <p> <input type="text" class="gmap-geocoder regular-text" placeholder="{$helper... | Get GeoCoder input |
9,648 | public function channel ( $ channel ) { $ channel = $ this -> client -> get ( config ( 'twitch-api.api_url' ) . '/kraken/channels/' . $ channel ) ; return $ channel -> json ( ) ; } | Returns a channel object . |
9,649 | public function getGeneratorSettings ( $ generator ) { return $ this -> settings -> getOptional ( "generators" , $ generator , fphp \ Generator \ Settings :: emptyInstance ( ) ) ; } | Returns the product line s settings for a generator . |
9,650 | public function getProduct ( $ configuration = null ) { if ( ! $ configuration ) $ configuration = $ this -> getDefaultConfiguration ( ) ; return new Product ( $ this , $ configuration ) ; } | Returns a product of the product line for a configuration . If the configuration is omitted the default configuration is used . |
9,651 | public function trace ( $ artifact ) { $ featureName = str_replace ( "\"" , """ , $ artifact -> getFeature ( ) -> getName ( ) ) ; $ xmlConfiguration = fphp \ Model \ XmlConfiguration :: fromString ( '<configuration><feature name="' . $ featureName . '" automatic="undefined" manual="selected"/></configuration>' ) ;... | Returns tracing links for an artifact . |
9,652 | public function renderTracingLinkAnalysis ( $ artifact , $ textOnly = false ) { return ( new fphp \ Artifact \ TracingLinkRenderer ( $ this -> trace ( $ artifact ) ) ) -> render ( $ textOnly ) ; } | Analyzes an artifact s tracing links by returning a web page . |
9,653 | public function initializeObject ( ) { $ this -> queue = new \ SplQueue ( ) ; $ this -> synchronousEventMap = $ this -> cache -> get ( 'DispatcherConfiguration_Synchronous' ) ; $ this -> asynchronousEventMap = $ this -> cache -> get ( 'DispatcherConfiguration_Asynchronous' ) ; if ( FALSE === ( $ this -> synchronousEven... | Initializes the broker . Loads the dispatching configuration from cache or builds it . |
9,654 | public function queueEvent ( $ event ) { $ this -> queue -> enqueue ( $ event ) ; $ class = get_class ( $ event ) ; foreach ( $ this -> synchronousEventMap -> getListenersForEvent ( $ class ) as $ listener ) { $ this -> invokeListener ( $ listener , $ event ) ; } } | Enqueues an arbitrary event . |
9,655 | public function flush ( ) { $ this -> queue -> setIteratorMode ( \ SplQueue :: IT_MODE_DELETE ) ; foreach ( $ this -> queue as $ event ) { $ class = get_class ( $ event ) ; foreach ( $ this -> asynchronousEventMap -> getListenersForEvent ( $ class ) as $ listener ) { $ this -> invokeListener ( $ listener , $ event ) ; ... | Publishes queued events . |
9,656 | private function invokeListener ( $ listener , $ event ) { if ( is_array ( $ listener ) ) { list ( $ listenerClass , $ method ) = $ listener ; $ listenerInstance = $ this -> objectManager -> get ( $ listenerClass ) ; $ listenerInstance -> { $ method } ( $ event ) ; } else { call_user_func ( $ listener , $ event ) ; } } | Invokes a listener for an event . |
9,657 | private function buildEventMap ( ) { $ this -> synchronousEventMap = new EventMapping ( ) ; $ this -> asynchronousEventMap = new EventMapping ( ) ; $ eventMap = NULL ; $ annotationName = 'Helmich\\EventBroker\\Annotations\\Listener' ; $ classes = $ this -> reflectionService -> getClassesContainingMethodsAnnotatedWith (... | Builds the event dispatching configuration . |
9,658 | protected function create_regObjects ( ) { $ this -> working_node = $ this -> oai_pmh -> addChild ( $ this -> working_node , 'lom:lom' ) ; $ this -> working_node -> setAttribute ( 'xmlns:lom' , "http://ltsc.ieee.org/xsd/LOM" ) ; $ this -> working_node -> setAttribute ( 'xmlns:dc' , "http://purl.org/dc/elements/1.1/" ) ... | Override create registry objects to use oai_lom as holder |
9,659 | public function generate_metadata ( $ lom_identifier , $ res ) { debug_message ( '****** In ' . __FILE__ . ' function ' . __FUNCTION__ . ' was called.' ) ; $ lom_data = new LOM_DataHolder ( ) ; $ lom_data -> setIdentifiers ( $ lom_identifier , $ this -> def_catalog ) ; $ res -> setFetchMode ( \ PDO :: FETCH_CLASS , LOM... | Generates metadata xml |
9,660 | public function combine ( $ another ) { debug_message ( __CLASS__ . '.' . __FUNCTION__ . " LLOM_DataHolder class is " . LOM_DataHolder :: getKlass ( ) ) ; debug_message ( __CLASS__ . '.' . __FUNCTION__ . " another is " . get_class ( $ another ) ) ; if ( is_a ( $ another , LOM_DataHolder :: getKlass ( ) ) ) { debug_mess... | Combines this object with another LOM_DataHolder object |
9,661 | private function addElement ( $ elem , $ to_add ) { if ( isset ( $ to_add -> $ elem ) && ! empty ( $ to_add -> $ elem ) && $ to_add -> $ elem != ' ' ) { $ elem_to_add = str_replace ( '&' , '-and-' , $ to_add -> $ elem ) ; if ( ! in_array ( $ elem_to_add , $ this -> $ elem ) ) { array_push ( $ this -> $ elem , $ elem_to... | adds a db element only if it is new |
9,662 | private function asVcard ( $ name ) { $ name = preg_replace ( '/\s\s+/i' , '' , $ name ) ; $ name = preg_replace ( '/[^A-Za-z0-9\x{002D}\x{002E}\x{00C0}-\x{00FF} -]/' , '' , $ name ) ; $ name = trim ( $ name ) ; $ nm_expl = explode ( ' ' , $ name ) ; $ head = '' ; if ( in_array ( $ nm_expl [ 0 ] , array ( 'Prof.' , 'Pr... | turns the elements into a string formatted for VCard |
9,663 | public function get ( array $ data = null ) { if ( $ this -> check ( ) ) { if ( \ is_null ( $ this -> content ) ) { $ this -> content = file_get_contents ( $ this -> file ) ; } if ( empty ( $ this -> content ) ) { return '' ; } if ( $ this -> checkers ) { $ st = '' ; foreach ( $ this -> checkers as $ chk ) { $ st .= fi... | Processes the controller and checks whether it has been routed or not . |
9,664 | public function setSessionValue ( $ name , $ value ) { if ( method_exists ( $ this -> session , 'driver' ) && $ this -> session -> driver ( ) instanceof \ Illuminate \ Contracts \ Session \ Session ) { $ this -> session -> put ( $ name , $ value ) ; return ; } $ this -> session -> set ( $ name , $ value ) ; } | Sets a value in the session |
9,665 | public function getCmsCategories ( ) { $ categories = array ( '' => 'No category' ) ; $ results = $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ , $ this , array ( 'categories' => $ categories ) ) -> last ( ) ; if ( $ results ) { $ categories = $ results ; } return $ categories ; } | An event is triggered so that the modules wishing to associate a category to a CMS page can add their own categories without adherence between the 2 modules |
9,666 | static public function createNewTable ( $ fields , $ indexes ) { self :: initOptions ( ) ; $ className = ezcDbSchema :: $ options -> tableClassName ; return new $ className ( $ fields , $ indexes ) ; } | Returns an object to represent a table in the schema . |
9,667 | protected function getPaths ( ContextInterface $ context ) { if ( $ this -> pathProvider instanceof ContextAwareInterface ) { $ this -> pathProvider -> setContext ( $ context ) ; } return $ this -> pathProvider -> getPaths ( [ ] ) ; } | Return paths that comes from provider and returns array of resource files |
9,668 | public static function get ( $ url , array $ params = [ ] , array $ headers = [ ] ) { if ( $ params ) { $ url .= ( strpos ( $ url , '?' ) ? '&' : '?' ) . http_build_query ( $ params ) ; } $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; curl_set... | send GET request |
9,669 | public static function post ( $ url , array $ data = [ ] , array $ headers = [ ] ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ data ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; curl_setopt (... | send POST request |
9,670 | public function marketRequest ( $ segment , array $ parameters = [ ] ) { $ baseUrl = $ this -> market_url ; return $ this -> privateRequest ( $ baseUrl , $ segment , $ parameters ) ; } | Execute a market API request |
9,671 | public function accountRequest ( $ segment , array $ parameters = [ ] ) { $ baseUrl = $ this -> account_url ; return $ this -> privateRequest ( $ baseUrl , $ segment , $ parameters ) ; } | Execute an account API request |
9,672 | private function _curlConnection ( $ request ) { $ curl = curl_init ( ) ; $ method = $ request -> getRequestMethod ( ) ; $ headers = array ( 'Expect:' ) ; foreach ( $ request -> getHeaders ( ) as $ header ) { $ headers [ ] = rtrim ( $ header -> __toString ( ) ) ; } curl_setopt ( $ curl , CURLOPT_URL , $ request -> getU... | Initializes the curl connection |
9,673 | private function _buildResponse ( $ response ) { $ sections = explode ( "\r\n\r\n" , $ response , 2 ) ; $ body = isset ( $ sections [ 1 ] ) ? $ sections [ 1 ] : NULL ; $ headers = array ( ) ; $ headerlines = explode ( "\n" , $ sections [ 0 ] ) ; list ( $ http , $ code , $ message ) = explode ( ' ' , $ headerlines [ 0 ]... | Parses a response into headers and a body |
9,674 | public function addCustomer ( AddCustomerToCustomerGroupEvent $ event ) { ( new CustomerCustomerGroupQuery ( ) ) -> filterByCustomerId ( $ event -> getCustomerId ( ) ) -> filterByCustomerGroupId ( $ event -> getCustomerGroupId ( ) ) -> findOneOrCreate ( ) -> save ( ) ; } | Add a customer to a customer group . |
9,675 | public function compare ( $ date , $ comparator ) { if ( $ date instanceof $ this ) { $ tmp = $ date ; } else { $ tmp = new \ bbn \ time ( $ date ) ; } switch ( $ comparator ) { case $ comparator === '>' : return $ this -> get_time ( ) > $ tmp -> get_time ( ) ; break ; case $ comparator === '>=' : return $ this -> get_... | Compares two dates |
9,676 | public function write ( $ sessionId , $ data ) { $ this -> cache -> save ( $ this -> prefix . $ sessionId , $ data , $ this -> lifetime ) ; } | Writes the data to the table |
9,677 | public function destroy ( $ session_id = null ) { @ session_unset ( ) ; if ( $ session_id === null ) { $ session_id = $ this -> getId ( ) ; } return $ this -> cache -> delete ( $ this -> prefix . $ session_id ) ; } | Destroyes the session |
9,678 | public function text ( $ ele ) { if ( isset ( $ ele -> parentNode ) && isset ( $ ele -> parentNode -> tagName ) && HTML5_Elements :: isA ( $ ele -> parentNode -> localName , HTML5_Elements :: TEXT_RAW ) ) { $ this -> wr ( $ ele -> data ) ; return ; } $ this -> wr ( $ this -> enc ( $ ele -> data ) ) ; } | Write a text node . |
9,679 | protected function namespaceAttrs ( $ ele ) { if ( ! $ this -> xpath || $ this -> xpath -> document !== $ ele -> ownerDocument ) { $ this -> xpath = new \ DOMXPath ( $ ele -> ownerDocument ) ; } foreach ( $ this -> xpath -> query ( 'namespace::*[not(.=../../namespace::*)]' , $ ele ) as $ nsNode ) { if ( ! in_array ( $ ... | Write the namespace attributes |
9,680 | protected function closeTag ( $ ele ) { if ( $ this -> outputMode == static :: IM_IN_HTML || $ ele -> hasChildNodes ( ) ) { $ this -> wr ( '</' ) -> wr ( $ this -> traverser -> isLocalElement ( $ ele ) ? $ ele -> localName : $ ele -> tagName ) -> wr ( '>' ) ; } } | Write the closing tag . |
9,681 | protected function enc ( $ text , $ attribute = false ) { if ( ! $ this -> encode ) { return $ this -> escape ( $ text , $ attribute ) ; } if ( $ this -> hasHTML5 ) { return htmlentities ( $ text , ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES , 'UTF-8' , false ) ; } else { return strtr ( $ text , HTML5_Serializer_HTML5Entit... | Encode text . |
9,682 | protected function padText ( $ text , $ mode , $ blockSize , $ paddingType ) { $ paddingSize = 0 ; $ padding = '' ; if ( $ mode === 'cbc' || $ mode === 'ecb' ) { $ paddingSize = $ blockSize - ( strlen ( $ text ) % $ blockSize ) ; if ( $ paddingSize >= 256 ) { throw new InvalidArgumentException ( "Block size [$blockSize... | Pads texts before encryption |
9,683 | public function encryptBase64 ( $ text , $ key = null , $ safe = false ) { if ( $ safe === true ) { return strtr ( base64_encode ( $ this -> encrypt ( $ text , $ key ) ) , '+/' , '-_' ) ; } return base64_encode ( $ this -> encrypt ( $ text , $ key ) ) ; } | Encrypts a text returning the result as a base64 string |
9,684 | public function decryptBase64 ( $ text , $ key = null , $ safe = false ) { if ( $ safe === true ) { return $ this -> decrypt ( base64_decode ( strtr ( $ text , '-_' , '+/' ) ) , $ key ) ; } return $ this -> decrypt ( base64_decode ( $ text ) , $ key ) ; } | Decrypt a text that is coded as a base64 string |
9,685 | public function getListItems ( ) { $ item_arr = [ ] ; foreach ( $ this -> items as $ item ) { $ item_arr [ $ item -> id ] = $ item -> title ; } return $ item_arr ; } | For special widget |
9,686 | protected function createArgumentDescriptor ( $ functionDescriptor , $ argument ) { $ params = $ functionDescriptor -> getTags ( ) -> get ( 'param' , array ( ) ) ; if ( ! $ this -> argumentAssembler -> getBuilder ( ) ) { $ this -> argumentAssembler -> setBuilder ( $ this -> builder ) ; } return $ this -> argumentAssemb... | Creates a new ArgumentDescriptor from the given Reflector and Param . |
9,687 | private function createCallbackFromString ( $ callFunc , $ params ) { if ( is_string ( $ callFunc ) ) { $ callFunc = function ( ) use ( $ callFunc , $ params ) { $ controllerParts = explode ( '@' , $ callFunc ) ; $ controllerParts [ 0 ] = explode ( '\\' , $ controllerParts [ 0 ] ) ; $ hmvc = '' ; $ controllerPaths = co... | Create Callback from string |
9,688 | public function get ( ) { $ this -> RoutedStatus = FALSE ; if ( ! $ this -> route -> isGet ( ) ) { return $ this ; } if ( is_callable ( $ this -> callable ) ) { return $ this ; } $ this -> middleware = array ( 'before' => array ( ) , 'after' => array ( ) ) ; self :: $ FullRender = '' ; $ args = func_get_args ( ) ; if (... | Set route for Get Method request |
9,689 | public function group ( ) { if ( is_callable ( $ this -> callable ) ) { return $ this ; } self :: $ FullRender = '' ; $ args = func_get_args ( ) ; self :: $ group .= $ args [ 0 ] . '/' ; if ( is_callable ( $ args [ 1 ] ) ) { $ this -> GroupFunc = Closure :: bind ( $ args [ 1 ] , $ this , get_class ( ) ) ; call_user_fun... | Set of Group route |
9,690 | public function template ( $ template , $ replace = FALSE ) { if ( $ this -> RoutedStatus || $ replace === TRUE ) { self :: $ FullRender = $ template ; } return $ this ; } | Set template before render |
9,691 | public function header ( $ code = 200 ) { if ( ! is_array ( $ code ) ) { $ code = array ( $ code ) ; } self :: $ header = array ( ) ; foreach ( $ code as $ value ) { if ( is_int ( $ value ) ) { self :: $ header [ ] = $ _SERVER [ "SERVER_PROTOCOL" ] . ' ' . Route :: $ HttpResponse [ $ value ] ; } else { self :: $ header... | Set Header Response |
9,692 | private function createMyCnf ( array $ db_info , $ path ) { $ this -> db_info = $ db_info ; $ data = array ( 'head' => '[client]' , 'user' => 'user = ' . $ this -> db_info [ 'user' ] , 'password' => 'password = ' . $ this -> db_info [ 'password' ] , 'host' => 'host = ' . $ this -> db_info [ 'host' ] ) ; $ content = imp... | Creates the my . cnf file for |
9,693 | public function run ( ) { $ result = $ this -> getCommand ( ) -> run ( ) ; if ( $ result -> getExitCode ( ) != 0 ) { throw new \ RuntimeException ( sprintf ( 'Command failed. Exit code %d, output %s' , $ result -> getExitCode ( ) , $ result -> getStdErr ( ) ) ) ; } return $ this -> parse ( $ result -> getStdOut ( ) ) ;... | Run configured command |
9,694 | protected function parse ( $ output ) { $ lines = explode ( PHP_EOL , $ output ) ; $ stats = array ( ) ; foreach ( $ lines as $ line ) { $ data = explode ( ' ' , $ line ) ; array_walk ( $ data , 'trim' ) ; $ stats [ ] = array_values ( array_filter ( $ data , function ( $ value ) { return strlen ( $ value ) > 0 ; } ) ) ... | Parse top utility command output |
9,695 | protected function buildCommand ( ) { $ command = new Command ( \ Tivie \ Command \ ESCAPE ) ; $ command -> setCommand ( 'top' ) -> addArgument ( new Argument ( '-b' ) ) -> addArgument ( new Argument ( '-n' , 1 ) ) ; return $ command ; } | Build commit command |
9,696 | public function resolve ( $ name , $ declaringClass ) { if ( strpos ( $ name , '\\' ) !== false ) { return $ name ; } $ imports = $ this -> cache -> get ( '_PHX.imports.' . $ declaringClass ) ; if ( ! isset ( $ imports ) ) { $ imports = ClassHelper :: getImports ( $ declaringClass ) ; $ this -> cache -> save ( '_PHX.im... | Gets full class name |
9,697 | public function add ( $ tag , ... $ arguments ) { $ tag = strtolower ( $ tag ) ; $ text = '' ; $ attributes = [ ] ; for ( $ i = 0 ; $ i <= 1 ; $ i ++ ) { if ( array_has ( $ arguments , $ i ) ) { if ( is_array ( array_get ( $ arguments , $ i ) ) ) { $ attributes = array_get ( $ arguments , $ i ) ; } elseif ( is_string (... | Add a child node to this tag . |
9,698 | public function setTag ( $ tag ) { if ( in_array ( $ tag , $ this -> getParent ( ) -> allowed_tags ) ) { throw new \ Exception ( $ tag . ' can not be changed as it is not allowed under ' . $ this -> getParent ( ) -> getTag ( ) . '.' ) ; } $ this -> tag = $ tag ; return $ this ; } | Set the tag name . |
9,699 | public function setText ( $ value ) { $ this -> text = $ value ; if ( is_object ( $ value ) && stripos ( get_class ( $ value ) , 'HtmlGenerator\\Html' ) ) { $ this -> text = ( string ) $ value ; } return $ this ; } | Set the text for this tag . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.