idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
8,600 | private function calculateYIQValue ( RGB $ color ) { $ yiq = ( ( $ color -> getRed ( ) * 299 ) + ( $ color -> getGreen ( ) * 587 ) + ( $ color -> getBlue ( ) * 114 ) ) / 1000 ; return $ yiq ; } | calculates the YIQ value for a given color . |
8,601 | protected static function extractKeyword ( string $ haystack , string $ needle , & $ matches = null ) { $ pattern = '/' . ( strpos ( $ needle , '^' ) === 0 ? '' : ' ?' ) . $ needle . ( strrpos ( $ needle , '$' ) === strlen ( $ needle ) - 1 ? '' : ' ?' ) . '/i' ; if ( preg_match ( $ pattern , $ haystack , $ matches , PR... | Extracts a keyword from a string |
8,602 | public function getDriver ( $ key ) { if ( isset ( $ this -> _drivers [ $ key ] ) ) { return $ this -> _drivers [ $ key ] ; } throw new MissingDriverException ( sprintf ( 'Driver %s does not exist' , $ key ) ) ; } | Return a driver by key . |
8,603 | public function createSubjectAction ( Category $ category ) { $ forum = $ category -> getForum ( ) ; $ collection = new ResourceCollection ( array ( $ forum -> getResourceNode ( ) ) ) ; if ( ! $ this -> authorization -> isGranted ( 'post' , $ collection ) ) { throw new AccessDeniedException ( $ collection -> getErrorsF... | The form submission is working but I had to do some weird things to make it works . |
8,604 | protected function addWithDecryptKey ( Builder $ builder ) { $ builder -> macro ( 'withDecryptKey' , function ( Builder $ builder , $ decryptKey ) { $ model = $ builder -> getModel ( ) ; $ encryptedFields = $ model :: getEncryptedFields ( ) ; if ( ! empty ( $ encryptedFields ) ) { $ builder -> setEncryptionModel ( $ mo... | Add the with - decrypt - key extension to the builder . |
8,605 | public static function factory ( $ aOptions ) { if ( $ aOptions instanceof \ Traversable ) $ aOptions = \ Zend \ Stdlib \ ArrayUtils :: iteratorToArray ( $ aOptions ) ; elseif ( ! is_array ( $ aOptions ) ) throw new \ InvalidArgumentException ( __METHOD__ . ' expects an array or Traversable object; received "' . ( is_o... | Instantiate AccessControl Authentication Service |
8,606 | public function loadBrowscapIni ( ) { $ sBrowscapIniPath = $ this -> getBrowscapIniPath ( ) ; if ( is_readable ( $ sBrowscapIniPath ) ) { $ aBrowscap = parse_ini_file ( $ this -> getBrowscapIniPath ( ) , true , INI_SCANNER_RAW ) ; if ( $ aBrowscap === false ) throw new \ RuntimeException ( 'Error appends while parsing ... | Load and parse browscap . ini file |
8,607 | public function image ( ) { if ( Request :: hasFile ( 'image' ) && Request :: has ( 'table_name' ) && Request :: has ( 'field_name' ) ) { return json_encode ( self :: saveImage ( Request :: input ( 'table_name' ) , Request :: input ( 'field_name' ) , Request :: file ( 'image' ) , null , Request :: file ( 'image' ) -> g... | handle image upload route |
8,608 | public function addRoute ( $ route , $ class , $ action , $ parameters = [ ] , $ hostparameters = [ ] ) { $ this -> log -> debug ( 'adding route : ' . $ route . ' to class ' . $ class . ' and action ' . $ action ) ; $ this -> routes [ $ route ] = [ "class" => $ class , "action" => $ action , "parameters" => $ parameter... | add route to list of known routes |
8,609 | public function setBaseHost ( $ baseHost = null ) { $ this -> log -> debug ( 'Setting Router baseHost to ' . $ baseHost ) ; $ this -> baseHost = $ baseHost ; return $ this ; } | method to set the basicHost for hostparameters in routing |
8,610 | private function handleRoute ( $ info , ServerRequestInterface $ request , $ route ) : ResponseInterface { $ attributes = [ 'params' => [ 'url' => [ ] , 'host' => [ ] ] ] ; if ( $ paramstr = substr ( $ request -> getUri ( ) -> getPath ( ) , strlen ( $ route ) ) ) { $ attributes [ 'params' ] [ 'url' ] = $ this -> filter... | Handle a regular route |
8,611 | private function extractHostParameters ( $ request , $ info ) { $ hostname = $ this -> cleanHostName ( $ request ) ; if ( empty ( $ hostname ) ) { $ params = [ ] ; } else { $ params = array_reverse ( explode ( "." , $ hostname ) ) ; } $ parameters = $ this -> filterParameters ( $ info [ 'hostparameters' ] , $ params ) ... | extract parameters from hostname |
8,612 | private function cleanHostName ( ServerRequestInterface $ request ) { if ( is_null ( $ this -> baseHost ) ) { $ hostname = $ request -> getUri ( ) -> getHost ( ) ; } else { $ hostname = str_replace ( $ this -> baseHost , "" , $ request -> getUri ( ) -> getHost ( ) ) ; } if ( substr ( $ hostname , - 1 ) == "." ) { $ hos... | will get hostname and clean basehost off it |
8,613 | public static function put ( $ arTags , $ sKeys , & $ arValue , $ iMinute ) { $ obDate = Carbon :: now ( ) -> addMinute ( $ iMinute ) ; $ sCacheDriver = config ( 'cache.default' ) ; if ( ! empty ( $ arTags ) ) { if ( $ sCacheDriver == 'redis' ) { Cache :: tags ( $ arTags ) -> put ( $ sKeys , $ arValue , $ obDate ) ; re... | Put cache data |
8,614 | public static function forever ( $ arTags , $ sKeys , & $ arValue ) { $ sCacheDriver = config ( 'cache.default' ) ; if ( ! empty ( $ arTags ) ) { if ( $ sCacheDriver == 'redis' ) { Cache :: tags ( $ arTags ) -> forever ( $ sKeys , $ arValue ) ; return ; } else { $ sKeys = implode ( '_' , $ arTags ) . '_' . $ sKeys ; } ... | Forever cache data |
8,615 | public static function clear ( $ arTags , $ sKeys = null ) { $ sCacheDriver = config ( 'cache.default' ) ; if ( ! empty ( $ arTags ) ) { if ( $ sCacheDriver == 'redis' ) { if ( ! empty ( $ sKeys ) ) { Cache :: tags ( $ arTags ) -> forget ( $ sKeys ) ; } else { Cache :: tags ( $ arTags ) -> flush ( ) ; } } else { $ sKey... | Clear cache data |
8,616 | public function onTrial ( ) { if ( ! is_null ( $ this -> getTrialEndDate ( ) ) ) { return Carbon :: today ( ) -> lt ( $ this -> getTrialEndDate ( ) ) ; } else { return false ; } } | Determine if the entity is within their trial period . |
8,617 | public function onGracePeriod ( ) { if ( ! is_null ( $ endsAt = $ this -> getSubscriptionEndDate ( ) ) ) { return Carbon :: now ( ) -> lt ( Carbon :: instance ( $ endsAt ) ) ; } else { return false ; } } | Determine if the entity is on grace period after cancellation . |
8,618 | public function subscribed ( ) { if ( $ this -> requiresCardUpFront ( ) ) { return $ this -> braintreeIsActive ( ) || $ this -> onGracePeriod ( ) ; } else { return $ this -> braintreeIsActive ( ) || $ this -> onTrial ( ) || $ this -> onGracePeriod ( ) ; } } | Determine if the entity has an active subscription . |
8,619 | public function push ( MiddlewareInterface $ middleware ) : self { $ stack = clone $ this ; array_unshift ( $ stack -> middlewares , $ middleware ) ; return $ stack ; } | Creates a new stack with the given middleware pushed . |
8,620 | protected function getDataDirectoryPath ( ) { $ data_dir = $ this -> getEnvironment ( ) -> getDataDirectory ( ) ; $ config = $ this -> getConfiguration ( ) ; return str_replace ( '{branch}' , $ config -> getBranch ( ) , $ data_dir ) ; } | The absolute path of the client site data directory . |
8,621 | protected function mysqlAesKey ( $ key ) { $ newKey = str_repeat ( chr ( 0 ) , 16 ) ; for ( $ i = 0 , $ len = strlen ( $ key ) ; $ i < $ len ; $ i ++ ) { $ newKey [ $ i % 16 ] = $ newKey [ $ i % 16 ] ^ $ key [ $ i ] ; } return $ newKey ; } | Converts the key into the MySQL equivalent version |
8,622 | private function prependYui ( ContainerBuilder $ container ) { $ container -> setParameter ( 'smile_ez_uicron.public_dir' , 'bundles/smileezuicron' ) ; $ yuiConfigFile = __DIR__ . '/../Resources/config/yui.yml' ; $ config = Yaml :: parse ( file_get_contents ( $ yuiConfigFile ) ) ; $ container -> prependExtensionConfig ... | Prepend ezplatform yui interface plugin |
8,623 | private function prependCss ( ContainerBuilder $ container ) { $ container -> setParameter ( 'smile_ez_uicron.css_dir' , 'bundles/smileezuicron/css' ) ; $ cssConfigFile = __DIR__ . '/../Resources/config/css.yml' ; $ config = Yaml :: parse ( file_get_contents ( $ cssConfigFile ) ) ; $ container -> prependExtensionConfig... | Prepend ezplatform css interface plugin |
8,624 | public function generateHeaders ( ) { $ this -> setHeader ( "Content-Type" , "text/" . $ this -> subType . "; charset=" . $ this -> charset ) ; $ this -> setHeader ( "Content-Transfer-Encoding" , $ this -> encoding ) ; return parent :: generateHeaders ( ) ; } | Returns the headers set for this part as a RFC822 compliant string . |
8,625 | protected function buildCollection ( array $ sources , array $ extensions ) { $ collection = new Collection ( ) ; $ collection -> setAllowedExtensions ( $ extensions ) ; foreach ( $ sources as $ path ) { if ( is_dir ( $ path ) ) { $ collection -> addDirectory ( $ path ) ; continue ; } $ collection -> addFile ( $ path )... | Constructs a Fileset collection and returns that . |
8,626 | public function swrite ( $ severity , $ value = '' ) { if ( sizeof ( $ this -> cache ) == $ this -> messageLimit ) { array_shift ( $ this -> cache ) ; } $ this -> cache [ ] = $ value ; } | Stores messages in the public cache by priority |
8,627 | public function actionRemoveItems ( ) { if ( false === Yii :: $ app -> request -> isAjax ) { throw new NotFoundHttpException ( Yii :: t ( 'users' , 'Page not found' ) ) ; } $ type = Yii :: $ app -> request -> post ( 'item-type' , 0 ) ; self :: checkPermissions ( $ type ) ; $ items = Yii :: $ app -> request -> post ( 'i... | Respond only on Ajax |
8,628 | public function actionDelete ( $ id , $ type , $ returnUrl = '' ) { self :: checkPermissions ( $ type ) ; if ( true === Yii :: $ app -> getAuthManager ( ) -> remove ( new Item ( [ 'name' => $ id ] ) ) ) { Yii :: $ app -> session -> setFlash ( 'info' , Yii :: t ( 'users' , "Item successfully removed" ) ) ; } else { Yii ... | Deletes an existing RBAC Item model . |
8,629 | public function transform ( $ data = null , $ rules = null ) { if ( ! $ data ) $ data = $ this -> data ; if ( ! $ rules ) $ rules = $ this -> rules ; $ rules = array_merge ( $ this -> defaultRules , $ rules ) ; foreach ( $ rules as $ key => $ rule ) { if ( isset ( $ data [ $ key ] ) ) { if ( $ rule == 'datetime' ) $ da... | Transform data types for item |
8,630 | public function match ( $ permissions , array $ authzGroups ) { $ privileges = [ ] ; foreach ( $ permissions as $ permissionAuthzGroup => $ permissionPrivileges ) { $ matchingAuthzGroup = $ this -> getMatchingAuthzGroup ( $ permissionAuthzGroup , $ authzGroups ) ; if ( ! $ matchingAuthzGroup ) { continue ; } $ privileg... | Get a flat list of privileges for matching authz groups |
8,631 | public function matchFull ( $ permissions , array $ authzGroups ) { $ privileges = [ ] ; foreach ( $ permissions as $ permissionAuthzGroup => $ permissionPrivileges ) { $ matchingAuthzGroup = $ this -> getMatchingAuthzGroup ( $ permissionAuthzGroup , $ authzGroups ) ; if ( ! $ matchingAuthzGroup ) { continue ; } $ priv... | Get a list of privileges for matching authz groups containing more information Returns an array of objects where the privilege is the key and authzgroups the value |
8,632 | protected function getMatchingAuthzGroup ( $ permissionAuthzGroup , array $ authzGroups ) { $ invert = $ this -> stringStartsWith ( $ permissionAuthzGroup , '!' ) ; if ( $ invert ) { $ permissionAuthzGroup = substr ( $ permissionAuthzGroup , 1 ) ; } $ matches = [ ] ; foreach ( $ authzGroups as $ authzGroup ) { $ match ... | Check if one of the authz groups match |
8,633 | protected function authzGroupsAreEqual ( $ permissionAuthzGroup , $ authzGroup ) { return $ this -> pathsAreEqual ( $ permissionAuthzGroup , $ authzGroup ) && $ this -> queryParamsAreEqual ( $ permissionAuthzGroup , $ authzGroup ) ; } | Check if authz groups match |
8,634 | protected function pathsAreEqual ( $ permissionAuthzGroup , $ authzGroup ) { $ permissionAuthzGroupPath = rtrim ( strtok ( $ permissionAuthzGroup , '?' ) , '/' ) ; $ authzGroupPath = rtrim ( strtok ( $ authzGroup , '?' ) , '/' ) ; return $ this -> matchAuthzGroupPaths ( $ permissionAuthzGroupPath , $ authzGroupPath ) |... | Compare the paths of two authz groups |
8,635 | protected function matchAuthzGroupPaths ( $ pattern , $ subject ) { $ regex = '^' . str_replace ( '[^/]+' , '\\*' , preg_quote ( $ pattern , '~' ) ) . '$' ; $ regex = str_replace ( '\\*' , '(.*)' , $ regex ) ; $ match = preg_match ( '~' . $ regex . '~i' , $ subject ) ; return $ match ; } | Check if one paths mathes the other |
8,636 | protected function queryParamsAreEqual ( $ permissionAuthzGroup , $ authzGroup ) { $ authzGroupQueryParams = array_change_key_case ( $ this -> getStringQueryParameters ( $ authzGroup ) , CASE_LOWER ) ; $ permissionAuthzGroupQueryParams = array_change_key_case ( $ this -> getStringQueryParameters ( $ permissionAuthzGrou... | Compare the query parameters of two authz groups |
8,637 | protected function getStringQueryParameters ( $ string ) { $ query = parse_url ( $ string , PHP_URL_QUERY ) ; $ params = [ ] ; if ( $ query ) parse_str ( $ query , $ params ) ; return $ params ; } | Get the query parameters used in a string |
8,638 | protected function flatten ( $ input ) { $ list = [ ] ; foreach ( $ input as $ item ) { $ list = array_merge ( $ list , ( array ) $ item ) ; } return array_unique ( $ list ) ; } | Turn a 2 dimensional privilege array into a list of privileges |
8,639 | protected function addAuthzGroupsToPrivileges ( array $ privileges , $ authzGroupsPrivileges , array $ authzGroups ) { $ authzGroupsPrivileges = ! is_string ( $ authzGroupsPrivileges ) ? $ authzGroupsPrivileges : [ $ authzGroupsPrivileges ] ; foreach ( $ authzGroupsPrivileges as $ privilege ) { $ current = ! empty ( $ ... | Populate an array of privileges with their corresponding authz groups |
8,640 | public static function fromHex ( $ hex ) { $ string = "" ; if ( strlen ( $ hex ) % 2 == 1 ) { throw new Exception ( "given parameter '" . $ hex . "' is not a valid hexadecimal number" ) ; } foreach ( str_split ( $ hex , 2 ) as $ chunk ) { $ string .= chr ( hexdec ( $ chunk ) ) ; } return new self ( $ string ) ; } | Returns the Str based on a given hex value . |
8,641 | protected function createRequest ( $ type , $ url , $ token ) { return $ this -> client -> createRequest ( $ type , $ url , $ this -> getDefaultHeaders ( $ token ) ) ; } | Creates an authorized request |
8,642 | public function buildTable ( $ name , $ id ) { $ this -> modelBuilder -> build ( $ name ) ; $ this -> formBuilder -> build ( $ name ) ; $ migration = $ this -> migrationBuilder -> buildSourceTableMigration ( $ name ) ; $ this -> migrateUp ( $ migration ) ; } | Builds a source table and associated entities |
8,643 | public function buildField ( $ name , $ type , $ indexed , $ tableName , NodeTypeContract $ nodeType ) { $ this -> modelBuilder -> build ( $ tableName , $ nodeType -> getFields ( ) ) ; $ this -> buildForm ( $ nodeType ) ; $ migration = $ this -> migrationBuilder -> buildFieldMigrationForTable ( $ name , $ type , $ inde... | Builds a field on a source table and associated entities |
8,644 | public function destroyTable ( $ name , array $ fields , $ id ) { $ this -> modelBuilder -> destroy ( $ name ) ; $ this -> formBuilder -> destroy ( $ name ) ; $ migration = $ this -> migrationBuilder -> getMigrationClassPathByKey ( $ name ) ; $ this -> migrateDown ( $ migration ) ; $ this -> migrationBuilder -> destroy... | Destroys a source table and all associated entities |
8,645 | public function destroyField ( $ name , $ tableName , NodeTypeContract $ nodeType ) { $ this -> modelBuilder -> build ( $ tableName , $ nodeType -> getFields ( ) ) ; $ this -> formBuilder -> build ( $ tableName , $ nodeType -> getFields ( ) ) ; $ migration = $ this -> migrationBuilder -> getMigrationClassPathByKey ( $ ... | Destroys a field on a source table and all associated entities |
8,646 | protected function getFunctionArgs ( \ stdClass $ route , \ ReflectionFunctionAbstract $ refl ) { $ args = [ ] ; $ params = $ refl -> getParameters ( ) ; foreach ( $ params as $ param ) { $ key = $ param -> name ; if ( property_exists ( $ route , $ key ) ) { $ value = $ route -> $ key ; } else { if ( ! $ param -> isOpt... | Get the arguments for a function from a route using reflection |
8,647 | public function validateLogin ( $ email , $ password ) { $ password = md5 ( $ password ) ; $ result = $ this -> fetchOne ( "SELECT * FROM {$this->table} WHERE email = ? AND password = ?" , array ( $ email , $ password ) ) ; if ( ! empty ( $ result ) ) { return true ; } return false ; } | Validates username and password against the DB . If success sets the user info in the object and return true . If fails returns false . |
8,648 | public function regeneratePassword ( ) { $ clean_password = generatePassword ( 6 , 4 ) ; $ password = md5 ( $ clean_password ) ; $ this -> db ( ) -> executeUpdate ( "UPDATE {$this->table} SET password = ? WHERE ID = ?" , array ( $ password , $ this -> getId ( ) ) ) ; return $ clean_password ; } | Regenerates and sets the new password for a User . |
8,649 | public function isLogged ( ) { $ this -> byPassIsLogged = true ; try { if ( ! session_id ( ) ) { if ( $ this -> sessionManager ) { $ this -> sessionManager -> start ( ) ; } else { throw new MoufException ( "The session must be initialized before checking if the user is logged. Please use session_start()." ) ; } } if ( ... | Returns true if the user is logged false otherwise . |
8,650 | public function logoff ( ) { if ( ! session_id ( ) ) { if ( $ this -> sessionManager ) { $ this -> sessionManager -> start ( ) ; } else { throw new MoufException ( "The session must be initialized before trying to login. Please use session_start()." ) ; } } if ( isset ( $ _SESSION [ $ this -> sessionPrefix . 'MoufUserL... | Logs the user off . |
8,651 | public function getUserLogin ( ) { if ( ! session_id ( ) ) { if ( $ this -> sessionManager ) { $ this -> sessionManager -> start ( ) ; } else { throw new MoufException ( "The session must be initialized before checking if the user is logged. Please use session_start()." ) ; } } if ( isset ( $ _SESSION [ $ this -> sessi... | Returns the current user login . |
8,652 | public function apply ( $ builder ) { if ( ! empty ( $ values = $ this -> getValues ( ) ) ) { $ range = json_decode ( $ values , true ) ; if ( ! isset ( $ range [ 'start' ] ) or ! isset ( $ range [ 'end' ] ) ) { return $ builder ; } $ start = $ range [ 'start' ] . ' 00:00:00' ; $ end = $ range [ 'end' ] . ' 23:59:59' ;... | Filters data by parameters from memory |
8,653 | public function broadcast ( array $ params ) { if ( ! isset ( $ params [ 'identifier' ] ) && ! isset ( $ params [ 'device_token' ] ) ) { throw new MissingArgumentException ( 'identifier or device_token' ) ; } if ( ! isset ( $ params [ 'message' ] ) ) { throw new MissingArgumentException ( 'message' ) ; } return $ this ... | Shares activity information directly with a provider . The information provided in the parameters is passed to a provider to publish on their network . |
8,654 | public function direct ( array $ params ) { if ( ! isset ( $ params [ 'identifier' ] ) && ! isset ( $ params [ 'device_token' ] ) ) { throw new MissingArgumentException ( 'identifier or device_token' ) ; } if ( ! isset ( $ params [ 'recipients' ] ) ) { throw new MissingArgumentException ( 'recipients' ) ; } else if ( !... | Shares activity information directly with the specified recipents on a provider s network instead of publishing it to everyone on the network . |
8,655 | public function getShareProviders ( $ format = 'json' , $ callback = '' ) { $ params = compact ( 'format' ) ; if ( ! empty ( $ callback ) ) { $ params [ 'callback' ] = $ callback ; } return $ this -> post ( 'get_share_providers' , $ params ) ; } | Returns a list of email and sharing providers configured for the widget . This call has no required parameters ; it identifies the proper application by the realm prefacing the URL path . |
8,656 | public function isDateWillComeIn ( $ interval ) { if ( ! ( $ interval instanceof \ DateInterval ) ) { $ interval = new \ DateInterval ( ( string ) $ interval ) ; } $ now = new \ DateTime ( 'now' ) ; return 0 === $ this -> diff ( $ now -> add ( $ interval ) ) -> invert ; } | Return TRUE if this date will come in a given interval |
8,657 | public function replyTo ( Message $ message , $ messageOrContent , $ cost = 0 , $ messageId = null , $ adjustCost = true ) { return $ this -> reply ( $ message -> id , $ message -> mobile , $ messageOrContent , $ cost , $ messageId , $ adjustCost ) ; } | Reply to a message |
8,658 | public function run ( $ view , $ data = array ( ) ) { return parent :: run ( $ view , \ array_merge ( View :: get_additional_data ( $ view , $ data ) , $ data ) ) ; } | Run the blade engine . Is only called when rendering a view . |
8,659 | public function setPhone ( \ Gpupo \ CommonSchema \ ORM \ Entity \ People \ Phone $ phone = null ) { $ this -> phone = $ phone ; return $ this ; } | Set phone . |
8,660 | public function setAlternativePhone ( \ Gpupo \ CommonSchema \ ORM \ Entity \ People \ AlternativePhone $ alternativePhone = null ) { $ this -> alternative_phone = $ alternativePhone ; return $ this ; } | Set alternativePhone . |
8,661 | public function setAddressBilling ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Customer \ AddressBilling $ addressBilling = null ) { $ this -> address_billing = $ addressBilling ; return $ this ; } | Set addressBilling . |
8,662 | public function setAddressDelivery ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Customer \ AddressDelivery $ addressDelivery = null ) { $ this -> address_delivery = $ addressDelivery ; return $ this ; } | Set addressDelivery . |
8,663 | public static function copy ( BaseColumn $ column ) { $ definition = self :: filterArray ( get_object_vars ( $ column ) ) ; return new self ( $ definition [ 'name' ] , $ definition ) ; } | Copy to new column |
8,664 | public function quoteIdentifier ( $ identifier ) { if ( sizeof ( $ this -> identifierQuoteChars ) === 2 ) { $ identifier = $ this -> identifierQuoteChars [ "start" ] . str_replace ( $ this -> identifierQuoteChars [ "end" ] , $ this -> identifierQuoteChars [ "end" ] . $ this -> identifierQuoteChars [ "end" ] , $ identif... | Returns the quoted version of an identifier to be used in an SQL query . This method takes a given identifier and quotes it so it can safely be used in SQL queries . |
8,665 | static public function validate ( ezcDbSchema $ schema ) { $ indexes = array ( ) ; $ errors = array ( ) ; foreach ( $ schema -> getSchema ( ) as $ tableName => $ table ) { foreach ( $ table -> indexes as $ indexName => $ dummy ) { $ indexes [ $ indexName ] [ ] = $ tableName ; } } foreach ( $ indexes as $ indexName => $... | Validates if all the index names used are unique accross the schema . |
8,666 | public function rest_api_init ( ) { $ register = [ ] ; foreach ( [ 'GET' , 'POST' , 'PUT' , 'PATCH' , 'DELETE' , 'HEAD' , 'OPTION' ] as $ method ) { $ method_name = strtolower ( "handle_{$method}" ) ; if ( ! method_exists ( $ this , $ method_name ) ) { continue ; } $ register [ ] = [ 'methods' => $ method , 'callback' ... | Register rest endpoints |
8,667 | public static function getTableEnumList ( string $ field , string $ labelKey = null , string $ translationCode = null ) { $ type = DB :: select ( DB :: raw ( 'SHOW COLUMNS FROM ' . self :: getTableName ( ) . ' WHERE Field = "' . $ field . '"' ) ) [ 0 ] -> Type ; preg_match ( '/^enum\((.*)\)$/' , $ type , $ matches ) ; ... | Get table enum field list with translations or not |
8,668 | public static function get ( $ module ) { if ( self :: $ modules === array ( ) ) self :: initialize ( ) ; if ( ! isset ( self :: $ modules [ $ module ] ) ) return false ; return self :: $ modules [ $ module ] ; } | Retrieve module information . |
8,669 | public static function installRequiredFiles ( ) { $ htaccess = __DIR__ . '/../../../../../../.htaccess' ; $ robots = __DIR__ . '/../../../../../../robots.txt' ; $ wpConfig = __DIR__ . '/../../../../../../wp-config-custom' ; $ fileSystem = new Filesystem ( ) ; try { if ( false === $ fileSystem -> exists ( $ htaccess ) )... | Static method that creates . htaccess robots . txt and wp - config - custom . php files if they do not exist . |
8,670 | protected function decorateWhere ( $ method , & $ args ) { $ column = $ args [ 0 ] ; $ expression = isset ( $ args [ 1 ] ) ? $ args [ 1 ] : null ; $ value = isset ( $ args [ 2 ] ) ? $ args [ 2 ] : null ; if ( ! $ expression instanceof Entity && ! $ value instanceof Entity ) { return ; } $ entity_class = $ this -> entit... | Modify the arguments of a where method to account for selecting by entity objects . |
8,671 | public function execute ( ) { if ( $ this -> counting ) { return $ this -> executeCount ( ) ; } if ( $ this -> single ) { return $ this -> executeSingle ( $ this -> entity_class ) ; } return $ this -> executeCollection ( $ this -> entity_class ) ; } | Execute the query and return the result . |
8,672 | public function setBody ( $ body ) { $ node = $ this -> getBody ( false ) ; if ( ! $ node ) { $ node = $ this -> createElement ( 'body' ) ; $ this -> doc -> appendChild ( $ node ) ; } $ node -> nodeValue = htmlspecialchars ( $ body ) ; } | Sets the body of the message to be send |
8,673 | public function setSubject ( $ subject ) { $ node = $ this -> getSubject ( false ) ; if ( ! $ node ) { $ node = $ this -> createElement ( 'subject' ) ; $ this -> doc -> appendChild ( $ node ) ; } $ node -> nodeValue = htmlspecialchars ( $ subject ) ; } | Set the subject of the message |
8,674 | public function setHTML ( $ html ) { $ node = $ this -> createDocumentFragment ( ) ; $ node -> appendXML ( '<html xmlns="http://www.w3.org/1999/xhtml">' . $ html . '</html>' ) ; $ this -> doc -> appendChild ( $ node ) ; } | Sets the html node of the message expiremental |
8,675 | public function reply ( $ str ) { $ message = new \ sb \ XMPP \ Message ( ) ; $ message -> setTo ( $ this -> getFrom ( ) ) ; $ message -> setFrom ( $ this -> getTo ( ) ) ; $ message -> setBody ( $ str ) ; $ this -> client -> sendMessage ( $ message ) ; } | Creates a reply message and sends it to the user that sent the original message . This can be used only on \ sb \ XMPP \ Message instances that came over the socket and were passed to the onMessage method . |
8,676 | public static function is ( $ feature ) { return function ( $ features ) use ( $ feature ) { return fphp \ Model \ Feature :: has ( $ features , $ feature ) ; } ; } | Returns a formula that tests for the presence of a feature . |
8,677 | public static function _and ( ) { $ args = func_get_args ( ) ; return function ( $ features ) use ( $ args ) { $ acc = true ; foreach ( $ args as $ arg ) $ acc = $ acc && $ arg ( $ features ) ; return $ acc ; } ; } | Returns a formula that is the conjunction of other formulas . Formulas can be supplied variadically . |
8,678 | public static function _or ( ) { $ args = func_get_args ( ) ; return function ( $ features ) use ( $ args ) { $ acc = false ; foreach ( $ args as $ arg ) $ acc = $ acc || $ arg ( $ features ) ; return $ acc ; } ; } | Returns a formula that is the disjunction of other formulas . Formulas can be supplied variadically . |
8,679 | public static function equiv ( $ constraintA , $ constraintB ) { return function ( $ features ) use ( $ constraintA , $ constraintB ) { return $ constraintA ( $ features ) === $ constraintB ( $ features ) ; } ; } | Returns a formula that is the biconditional of two formulas . |
8,680 | public static function implies ( $ constraintA , $ constraintB ) { return function ( $ features ) use ( $ constraintA , $ constraintB ) { return ! $ constraintA ( $ features ) || $ constraintB ( $ features ) ; } ; } | Returns a formula that is the material conditional of two formulas . |
8,681 | private function generateHead ( ) { $ out = '<?xml version="1.0" encoding="utf-8"?>' . "\n" ; if ( $ this -> version == self :: RSS2 ) { $ out .= '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" >' . PHP_EOL ; } elseif ( $ this ->... | Prints the xml and rss namespace |
8,682 | private function makeNode ( $ tagName , $ tagContent , $ attributes = null ) { $ nodeText = '' ; $ attrText = '' ; if ( is_array ( $ attributes ) ) { foreach ( $ attributes as $ key => $ value ) { $ attrText .= " $key=\"$value\" " ; } } if ( is_array ( $ tagContent ) && $ this -> version == self :: RSS1 ) { $ attrText ... | Creates a single node as xml format |
8,683 | public function handle ( GetResponseEvent $ event ) { $ request = BridgeRequest :: createFromRequest ( $ event -> getRequest ( ) ) ; $ response = new BridgeResponse ; if ( ! $ this -> oauth2Server -> verifyResourceRequest ( $ request , $ response ) ) { return ; } try { $ token = $ this -> oauth2Server -> getAccessToken... | Handles basic authentication . |
8,684 | public static function preProcessing ( Dwoo_Compiler $ compiler , array $ params , $ prepend , $ append , $ type ) { return Dwoo_Compiler :: PHP_OPEN . $ prepend . '$this->addStack("' . $ type . '", array(' . Dwoo_Compiler :: implode_r ( $ compiler -> getCompiledParams ( $ params ) ) . '));' . $ append . Dwoo_Compiler ... | called at compile time to define what the block should output in the compiled template code happens when the block is declared |
8,685 | private function download ( $ productLineName ) { $ productLineName = str_replace ( "\"" , "" , $ productLineName ) ; if ( headers_sent ( ) ) throw new DownloadZipExporterException ( "could download zip archive" ) ; header ( "Content-Type: application/zip" ) ; header ( "Content-Disposition: attachment; filename=\"$prod... | Downloads the temporary ZIP archive . This only works when no headers and no output have been sent yet otherwise users receive corrupted ZIP files . |
8,686 | public function export ( $ product ) { try { parent :: export ( $ product ) ; $ this -> download ( $ product -> getProductLine ( ) -> getName ( ) ) ; } catch ( \ Exception $ e ) { } try { $ this -> remove ( ) ; } catch ( \ Exception $ e ) { } } | Exports a product as a ZIP archive and offers it for downloading . This only works when no headers and no output have been sent yet . Note that any occurring errors are ignored so that the downloaded archive will not be corrupted . There is currently no way to obtain error information in this case because feature - php... |
8,687 | protected function finalizeConfiguration ( string $ code , array $ dataGridConfiguration ) : array { if ( isset ( $ dataGridConfiguration [ 'parent' ] ) ) { $ parent = $ dataGridConfiguration [ 'parent' ] ; if ( empty ( $ this -> globalConfiguration [ 'configurations' ] [ $ parent ] ) ) { throw new UnexpectedValueExcep... | Handle configuration parsing logic not handled by the semantic configuration definition |
8,688 | public function afterInitialize ( Event $ event , ModelsManager $ manager , $ model ) { $ reflector = $ this -> annotations -> get ( $ model ) ; $ annotations = $ reflector -> getClassAnnotations ( ) ; if ( $ annotations ) { foreach ( $ annotations as $ annotation ) { switch ( $ annotation -> getName ( ) ) { case 'Sour... | This is called after initialize the model |
8,689 | public function dequeue ( ) { if ( ! count ( $ this -> cached_jobs ) ) { $ this -> cached_jobs = $ this -> repo -> getAvailableJobs ( $ this -> name ) ; } if ( ! count ( $ this -> cached_jobs ) ) { return ; } $ job_row = array_shift ( $ this -> cached_jobs ) ; $ job = Job \ WrappedJob :: fromString ( $ job_row [ 'job' ... | take a job off of the queue |
8,690 | public function getChildren ( $ objects , $ path ) { $ array = array ( ) ; if ( ! is_array ( $ path ) ) { $ path = explode ( '/' , $ path ) ; } if ( ! is_array ( $ objects ) ) { $ objects = array ( $ objects ) ; } $ ret = $ objects ; foreach ( $ path as $ child ) { $ array = [ ] ; $ meta = null ; $ properties = null ; ... | Retrieve all object child values through a property path . |
8,691 | public function indexBy ( $ list , $ property , $ meta = null , $ allowDupes = null , $ ignoreNulls = null ) { $ allowDupes = $ allowDupes !== null ? $ allowDupes : false ; $ ignoreNulls = $ ignoreNulls !== null ? $ ignoreNulls : true ; if ( ! $ list ) { return [ ] ; } if ( $ meta ) { $ meta = ! $ meta instanceof Meta ... | Iterate over an array of objects and returns an array of objects indexed by a property |
8,692 | public function groupBy ( $ list , $ property , $ meta = null ) { if ( ! $ list ) { return [ ] ; } if ( ! $ meta ) { if ( ! ( $ first = current ( $ list ) ) ) { throw new \ UnexpectedValueException ( ) ; } $ meta = $ this -> mapper -> getMeta ( get_class ( $ first ) ) ; } $ groups = [ ] ; $ props = $ meta -> getPropert... | Iterate over an array of objects and group them by the value of a property |
8,693 | protected function _open ( $ mode ) { $ this -> _fileHandler = @ bzopen ( $ this -> _filePath , $ mode ) ; if ( false === $ this -> _fileHandler ) { throw new Mage_Exception ( 'Failed to open file ' . $ this -> _filePath ) ; } } | Open bz archive file |
8,694 | protected function _read ( $ length ) { $ data = bzread ( $ this -> _fileHandler , $ length ) ; if ( false === $ data ) { throw new Mage_Exception ( 'Failed to read data from ' . $ this -> _filePath ) ; } return $ data ; } | Read data from bz archive |
8,695 | public function buildValue ( ) { $ actions = [ 'add' => [ ] , 'replace' => [ ] , 'remove' => [ ] , ] ; foreach ( $ this -> actions as $ action ) { switch ( $ action -> getName ( ) ) { case 'add' : $ actions [ 'add' ] [ ] = [ $ action -> getArgument ( 0 ) ] ; break ; case 'replace' : $ actions [ 'replace' ] [ ] = [ $ ac... | Builds a block option value using the given builder |
8,696 | protected function getBuilder ( ) { $ isArray = false ; if ( $ this -> actions ) { $ action = reset ( $ this -> actions ) ; $ arguments = $ action -> getArguments ( ) ; if ( $ arguments ) { $ argument = reset ( $ arguments ) ; if ( is_array ( $ argument ) ) { $ isArray = true ; } } } if ( $ isArray ) { return new Array... | Returns options builder based on values in value bag |
8,697 | public function getNodeValue ( $ nodeName , $ itemNum = 0 , $ extraTextBefore = '' , $ extraTextAfter = '' ) { $ node = $ this -> getElementsByTagName ( $ nodeName ) -> item ( $ itemNum ) ; if ( isset ( $ node ) ) { $ texto = html_entity_decode ( trim ( $ node -> nodeValue ) , ENT_QUOTES , 'UTF-8' ) ; return $ extraTex... | getNodeValue . Extrai o valor do node DOM . |
8,698 | public function getNode ( $ nodeName , $ itemNum = 0 ) { $ node = $ this -> getElementsByTagName ( $ nodeName ) -> item ( $ itemNum ) ; if ( isset ( $ node ) ) { return $ node ; } return '' ; } | getNode Retorna o node solicitado . |
8,699 | public function appChild ( & $ parent , $ child , $ msg = '' ) { if ( empty ( $ parent ) ) { throw new Exception ( $ msg ) ; } if ( ! empty ( $ child ) ) { $ parent -> appendChild ( $ child ) ; } } | appChild Acrescenta DOMElement a pai DOMElement Caso o pai esteja vazio retorna uma exception com a mensagem O parametro child pode ser vazio . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.