idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
47,400 | public function renameAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ folder -> setName ( $ request -> request -> get ( 'name' ) ) ; if ( true !== $ message = $ this ->... | Renames the folder . |
47,401 | public function deleteAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ result = array ( ) ; try { $ this -> removeFolder ( $ folder ) ; } catch ( DBALException $ e ) { $... | Deletes the folder . |
47,402 | public function moveAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ result = [ ] ; $ mode = $ request -> request -> get ( 'mode' ) ; if ( ! in_array ( $ mode , array ( ... | Moves the folder . |
47,403 | public function listMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ medias = $ this -> get ( 'ekyna_media.browser' ) -> setFolder ( $ folder ) -> findMedias ( ( ar... | Lists the medias by folder . |
47,404 | public function moveMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ media = $ this -> get ( 'ekyna_media.media.repository' ) -> find ( $ request -> attributes -> g... | Moves the media to the folder . |
47,405 | public function createMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folderId = $ request -> attributes -> get ( 'id' ) ; $ folder = $ this -> findFolderById ( $ folderId ) ; $ upload = new MediaUpload ( ) ; $ form = $ this -> createForm ( 'eky... | Creates the media into the folder . |
47,406 | public function importMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ modal = $ this -> createModal ( ) ; $ modal -> setTitle ( 'ekyna_media.import.title' ) ; $ folderId = $ request -> attributes -> get ( 'id' ) ; $ folder = $ this -> findFolder... | Imports the media into the folder . |
47,407 | private function persistFolder ( FolderInterface $ folder ) { $ em = $ this -> getEntityManager ( ) ; $ em -> persist ( $ folder ) ; $ em -> flush ( ) ; } | Persists the folder . |
47,408 | private function removeFolder ( FolderInterface $ folder ) { $ em = $ this -> getEntityManager ( ) ; $ em -> remove ( $ folder ) ; $ em -> flush ( ) ; } | Removes the folder . |
47,409 | private function validateFolder ( FolderInterface $ folder ) { $ errorList = $ this -> get ( 'validator' ) -> validate ( $ folder ) ; if ( $ errorList -> count ( ) ) { return $ errorList -> get ( 0 ) -> getMessage ( ) ; } return true ; } | Validates the folder . |
47,410 | private function findFolderById ( $ id ) { $ folder = $ this -> getFolderRepository ( ) -> find ( $ id ) ; if ( null === $ folder ) { throw new NotFoundHttpException ( 'Folder not found.' ) ; } return $ folder ; } | Returns the folder by id . |
47,411 | public function exec ( ARequest $ request ) { $ result = new AResponse ( ) ; $ orderId = $ request -> getSaleOrderId ( ) ; $ datePaid = $ request -> getSaleOrderDatePaid ( ) ; $ items = $ request -> getOrderItems ( ) ; $ orderTotal = 0 ; foreach ( $ items as $ item ) { $ prodId = $ item -> getProductId ( ) ; $ stockId ... | Save PV data on sale order save . |
47,412 | public static function createSmalldb ( $ config ) { $ smalldb = new \ Smalldb \ StateMachine \ JsonDirBackend ( $ config [ 'smalldb' ] , null , 'smalldb' ) ; $ flupdo = \ Smalldb \ Flupdo \ Flupdo :: createInstanceFromConfig ( $ config [ 'flupdo' ] ) ; if ( ! isset ( $ config [ 'auth' ] [ 'class' ] ) ) { throw new Inva... | Create and initialize Smalldb including Flupdo and Auth objects |
47,413 | public static function renderStateMachine ( \ Smalldb \ StateMachine \ AbstractBackend $ smalldb , $ machine , $ format ) { $ dot = $ smalldb -> getMachine ( $ machine ) -> exportDot ( ) ; if ( $ format == 'dot' ) { header ( 'Content-Type: text/plain; encoding=utf8' ) ; echo $ dot ; } else if ( $ format == 'png' || $ f... | Render state diagram |
47,414 | protected function getMysqlArguments ( $ credentials , $ appendDatabase = true ) { $ arguments = [ ] ; $ database = '' ; foreach ( $ this -> databaseArguments as $ key ) { if ( empty ( $ credentials [ $ key ] ) ) { continue ; } $ value = escapeshellarg ( $ credentials [ $ key ] ) ; if ( $ key === 'database' ) { $ datab... | Returns MySQL Arguments . |
47,415 | public static function split ( $ event ) { if ( ! is_string ( $ event ) ) { throw new InvalidArgumentException ( "invalid value provided for 'event'; expecting an event name " . "or event name and namespace as string" ) ; } list ( $ type , $ namespace ) = array_pad ( explode ( '.' , $ event , 2 ) , 2 , null ) ; return ... | Split an event in the type and namespace portions |
47,416 | public function withPredefinedColumnValues ( FieldBuilderBase $ field , array $ columnValues ) : TableRowFieldDefiner { $ this -> fieldBuilder -> attr ( TableType :: ATTR_PREDEFINED_COLUMNS , array_values ( $ columnValues ) ) ; return $ this -> withColumnKeyAs ( $ field ) ; } | Defines the columns as predefined set of values . |
47,417 | public function withColumnKeyAsField ( IField $ field ) : TableRowFieldDefiner { return new TableRowFieldDefiner ( $ this -> fieldBuilder , $ this -> cellClassName , $ field ) ; } | Defines the column field for the table . |
47,418 | public static function circularDiffKeys ( array $ left , array $ right ) { return [ array_diff_key ( $ left , $ right ) , array_intersect_key ( $ left , $ right ) , array_diff_key ( $ right , $ left ) ] ; } | Perform a circular diff between two arrays using keys . |
47,419 | public static function replaceStrict ( array $ source , array ... $ replace ) { $ replacements = [ ] ; foreach ( $ replace as $ items ) { $ replacements [ ] = array_intersect_key ( $ items , $ source ) ; } return array_merge ( $ source , ... $ replacements ) ; } | Replace items only if relative keys are actually defined in source array |
47,420 | public static function validateMeta ( array & $ array ) { foreach ( $ array as $ key => $ tag ) { if ( ! ( $ tag instanceof Meta ) ) { $ newtag = new Meta ( $ tag ) ; $ array [ $ key ] = $ newtag ; } } } | Validates that the given array contains all valid Meta entries |
47,421 | public static function truncateToMax ( $ obj , $ metaName , $ string , $ ellipsis = false ) { switch ( true ) { case $ obj instanceof Element : case $ obj instanceof Aspect : break ; case $ obj instanceof NodeRef : case $ obj instanceof Node : $ obj = $ obj -> Element ; break ; default : throw new Exception ( __CLASS__... | Returns a string truncated to fit inside a meta . |
47,422 | public final function populateObjectList ( $ input , $ deep = true ) { if ( $ this instanceof ArrayAccess == false ) throw new Exception ( "Cannot set properties on objects that are not children of 'ArrayAccess'" ) ; if ( ! is_array ( $ input ) ) { if ( $ input instanceof Traversable && method_exists ( $ input , "toArr... | Populate an object list from well anything really |
47,423 | public final function populateWithReference ( array & $ input ) { if ( $ this instanceof ObjectList == false ) throw new Exception ( "Cannot set list to reference on non-supported object types" ) ; $ this -> list = & $ input ; return $ this ; } | Populate this object with a reference |
47,424 | public function getQuery ( ) { $ query = 'SELECT ' . implode ( ', ' , $ this -> fields ) . ' FROM ' . implode ( ', ' , $ this -> from ) ; if ( count ( $ this -> conditions ) > 0 ) { $ query = $ query . ' WHERE ' . implode ( ' AND ' , $ this -> conditions ) ; } $ query = rtrim ( $ query ) . ';' ; return $ query ; } | Build query to generate a string |
47,425 | public static function explode ( $ array ) { $ results = [ ] ; foreach ( $ array as $ key => $ value ) { static :: set ( $ results , $ key , $ value ) ; } return $ results ; } | Explode a single level dots array into a multi - dimensional associative array . |
47,426 | public static function collate ( $ array , $ key , $ wildcard = null ) { if ( null === $ wildcard || strpos ( $ key , $ wildcard ) === false ) { return static :: has ( $ array , $ key ) ? [ $ key => static :: get ( $ array , $ key ) ] : [ ] ; } $ pattern = '' ; $ segments = explode ( '.' , $ key ) ; while ( ( $ segment... | Get all items from a multi - dimensional associative array using dots notation and return a flattened dots notation array . |
47,427 | public static function has ( $ array , $ keys , $ wildcard = null ) { if ( null === $ keys || empty ( $ array ) || ! Arr :: accessible ( $ array ) ) { return false ; } $ originalArray = $ array ; foreach ( ( array ) $ keys as $ key ) { $ array = $ originalArray ; if ( Arr :: exists ( $ array , $ key ) ) { continue ; } ... | Determine if an item or items exist in an multi - dimensional associative array using dots notation . |
47,428 | protected function parseUrl ( $ httpMethod , $ url ) { $ this -> server = $ _SERVER ; $ server = & $ this -> server ; if ( $ httpMethod ) { $ server [ 'REQUEST_METHOD' ] = $ httpMethod ; } elseif ( ! isset ( $ server [ 'REQUEST_METHOD' ] ) ) { $ server [ 'REQUEST_METHOD' ] = 'GET' ; } if ( empty ( $ url ) ) { $ this ->... | Parse a given URL |
47,429 | public function getAudios ( ) { $ qb = $ this -> entityManager -> createQueryBuilder ( ) ; $ qb -> select ( 'f' ) -> from ( '\Media\Entity\File' , 'f' ) -> innerJoin ( '\Media\Entity\ObjectFile' , 'obf' , Join :: WITH , 'f.id = obf.fileId' ) -> where ( 'f.type = :type' ) -> andWhere ( 'obf.entityName = :name' ) -> andW... | Returns an array of ids |
47,430 | public function router ( ) { return new Router \ Router ( $ this -> routeMap , new Router \ Resolver \ Container ( $ this -> container ) ) ; } | Routers are middleware and can be added to Tonis . |
47,431 | private function decorateRequest ( ServerRequestInterface $ request ) { if ( $ request instanceof Http \ Request ) { return $ request ; } return new Http \ Request ( $ this , $ request ) ; } | Decorates a request to add this app to it . |
47,432 | private function decorateResponse ( ResponseInterface $ response ) { if ( $ response instanceof Http \ Response ) { return $ response ; } return new Http \ Response ( $ this , $ response ) ; } | Decorates a response to add this app to it . |
47,433 | private function normalizeSpecification ( array $ input ) { $ output = [ ] ; $ mayBeChildless = null ; foreach ( $ input as $ key => $ spec ) { if ( $ key === 'attributes' ) { if ( ! is_array ( $ spec ) ) { throw new LogicException ( 'Value under key ' . $ key . ' have to be an array' ) ; } $ output [ $ key ] = [ ] ; f... | Convert simplified specification to full form used in validation . |
47,434 | public function getXML ( $ version = '1.0' , $ encoding = 'UTF-8' , $ willFormatOutput = true ) { if ( is_null ( self :: $ instance ) ) { self :: $ instance = new \ DOMDocument ( $ version , $ encoding ) ; self :: $ instance -> formatOutput = $ willFormatOutput ; } return self :: $ instance ; } | Creates the instance of DOMDocument all classes will be working with . |
47,435 | protected function addChild ( $ attribute , $ value = null , $ escape = false ) { if ( ! empty ( $ value ) ) { if ( $ escape === true ) { $ node = $ this -> XML -> createElement ( $ attribute ) ; $ node -> appendChild ( new \ DOMCdataSection ( $ value ) ) ; } else { $ node = $ this -> XML -> createElement ( $ attribute... | Adds a child node to the main node that each inherited class creates when it instantiates itself . |
47,436 | public function addStylesheet ( $ url ) { $ this -> XML -> appendChild ( $ this -> XML -> createProcessingInstruction ( 'xml-stylesheet' , sprintf ( 'type="text/xsl" href="%s"' , $ url ) ) ) ; } | Adds the XSL stylesheet to our document |
47,437 | protected function addExtraNamespaces ( $ nodeset ) { $ this -> addNamespace ( 'hasImages' , $ nodeset , 'xmlns:image' , "http://www.google.com/schemas/sitemap-image/1.1" ) ; $ this -> addNamespace ( 'hasVideos' , $ nodeset , 'xmlns:video' , "http://www.google.com/schemas/sitemap-video/1.1" ) ; $ this -> addNamespace (... | If we add nodes with special namespaces we setup a boolean in our iterator classes that switch to true so we can add the appropriate namespaces to our document . |
47,438 | protected function registerMiddleware ( $ middleware ) { $ kernel = $ this -> getContainer ( ) -> get ( KernelInterface :: class ) ; $ kernel -> prependMiddleware ( $ middleware ) ; } | Register the Debugbar Middleware |
47,439 | protected function getPlugin ( $ plugin ) { try { list ( $ vendor , $ package ) = explode ( '/' , $ plugin ) ; return $ this -> get ( 'anime_db.api.client' ) -> getPlugin ( $ vendor , $ package ) ; } catch ( \ RuntimeException $ e ) { return ; } } | Get plugin . |
47,440 | public function executeAction ( ) { if ( strpos ( php_uname ( 'v' ) , 'Windows XP' ) !== false ) { $ this -> redirect ( $ this -> generateUrl ( 'update' ) ) ; } file_put_contents ( $ this -> container -> getParameter ( 'kernel.root_dir' ) . '/../web/update.log' , '' ) ; $ this -> get ( 'anime_db.command' ) -> send ( 'p... | Execute update application . |
47,441 | public static function old ( $ value , $ fallback = '' ) { return Variable :: has ( 'form.old' ) ? ( isset ( Variable :: get ( 'form.old' ) [ $ value ] ) ? Variable :: get ( 'form.old' ) [ $ value ] : $ fallback ) : $ fallback ; } | Get old value or fallback |
47,442 | public static function is_base64 ( string $ string ) : bool { if ( base64_encode ( base64_decode ( $ string , true ) ) === $ string ) return true ; return false ; } | Check if string is base64 or not |
47,443 | public function getProvider ( $ name , $ request ) { $ class = isset ( $ this -> providers [ $ name ] ) ? $ this -> providers [ $ name ] : null ; if ( ! $ class ) { return null ; } return new $ class ( $ request , $ request -> input ( 'client_id' ) , $ request -> input ( 'client_secret' ) , $ request -> input ( 'redire... | Get provider . |
47,444 | public function signIn ( Request $ request ) { $ oauth_client = DB :: table ( 'oauth_clients' ) -> where ( 'password_client' , 1 ) -> first ( ) ; if ( ! $ oauth_client ) { return $ this -> response ( [ 'code' => 'CLIENT_NOT_FOUND' , ] , Response :: HTTP_BAD_REQUEST ) ; } $ request -> request -> add ( [ 'username' => $ ... | Sign in a user . |
47,445 | public function signInWithProvider ( $ provider_name , Request $ request ) { $ provider = $ this -> getProvider ( $ provider_name , $ request ) ; if ( ! $ provider ) { return $ this -> response ( [ 'errors' => [ 'code' => 'PROVIDER_NOT_FOUND' , 'message' => 'No provider found' , ] ] , Response :: HTTP_BAD_REQUEST ) ; }... | Request token and generate a new one . |
47,446 | public function authenticateByCode ( $ provider , string $ code ) { $ provider_user = $ provider -> user ( ) ; $ repository = $ this -> manager -> getRepository ( ) ; $ user = $ repository -> findOneByEmail ( $ provider_user -> getEmail ( ) ) ; if ( ! $ user ) { $ result = $ this -> manager -> create ( [ 'name' => $ pr... | Authenticate a user by the code of oauth2 . |
47,447 | private function constructIdentityToken ( ) { if ( isset ( $ _REQUEST [ self :: CODE ] ) ) { $ this -> requestToken ( $ _REQUEST [ self :: CODE ] , self :: IDENTITY_TOKEN ) ; $ _SESSION [ self :: SESSION ] [ self :: IS_API_TOKEN ] = false ; $ _SESSION [ self :: SESSION ] [ self :: STATE ] = self :: NEGOTIATION_COMPLETE... | Construct an OAuthNegotiator to use an access code to request an identity token |
47,448 | private function constructAPIToken ( ) { if ( isset ( $ _REQUEST [ self :: CODE ] ) ) { $ this -> requestToken ( $ _REQUEST [ self :: CODE ] , self :: API_TOKEN ) ; $ _SESSION [ self :: SESSION ] [ self :: IS_API_TOKEN ] = true ; $ _SESSION [ self :: SESSION ] [ self :: STATE ] = self :: NEGOTIATION_COMPLETE ; header (... | Construct an OAuthNegotiator to use an access code to request an API Token with matching user profile |
47,449 | private function constructNegotiationReporter ( ) { switch ( $ _SESSION [ self :: SESSION ] [ self :: STATE ] ) { case self :: NEGOTIATION_COMPLETE : case self :: NEGOTIATION_FAILED : { $ this -> ready = true ; $ this -> apiUrl = ( isset ( $ _SESSION [ self :: SESSION ] [ self :: API_URL ] ) ? $ _SESSION [ self :: SESS... | Prepare to report on the results of the OAuth negotiation |
47,450 | private function requestAuthorizationCode ( $ responseType , $ scopes , $ purpose ) { $ _SESSION [ self :: SESSION ] [ self :: STATE ] = self :: $ SCOPES [ $ scopes ] [ self :: CODE_REQUESTED ] ; if ( $ scopes === self :: IDENTITY_TOKEN ) { header ( "Location: {$_SESSION[self::SESSION][self::OAUTH_ENDPOINT]}/auth?" . h... | Request an authorization code from the OAuth server |
47,451 | private function requestToken ( $ code , $ tokenType ) { $ authApi = new PestJSON ( "{$_SESSION[self::SESSION][self::OAUTH_ENDPOINT]}" ) ; try { $ response = $ authApi -> post ( 'token' , array ( self :: CLIENT_ID => $ _SESSION [ self :: SESSION ] [ self :: CLIENT_ID ] , self :: REDIRECT_URI => $ _SESSION [ self :: SES... | Request a token from the OAuth server |
47,452 | public function addRoute ( $ route , $ callable , $ prepend = true ) { if ( $ prepend ) { $ this -> routes = array ( $ route => $ callable ) + $ this -> routes ; } else { $ this -> routes [ $ route ] = $ callable ; } $ this -> logger -> log ( 'Route added at ' . ( $ prepend ? 'top' : 'bottom' ) . ': "' . $ route . '"' ... | Add a route to the Router s routing table |
47,453 | public function route ( $ performLoading = true ) : bool { $ uri = implode ( '/' , $ this -> uri -> segments ) ; $ event = Events :: fireEvent ( 'routerRouteEvent' , $ this -> routes , $ performLoading , $ uri ) ; if ( $ event -> isCancelled ( ) ) { return false ; } $ routes = $ event -> routes ; $ performLoading = $ e... | Extracts the routing path from the URL using the routing table . |
47,454 | protected function routeDefault ( $ segments = array ( ) , $ route ) { if ( empty ( $ segments ) ) { $ segments [ 0 ] = $ this -> config -> routing -> default_controller ; } if ( $ this -> config -> routing -> translate_uri_dashes === true ) { $ segments [ 0 ] = str_replace ( '-' , '_' , $ segments [ 0 ] ) ; if ( isset... | Converts a routing string into parameters for the defaultCallable . |
47,455 | public function loadCallable ( $ matches = array ( ) , $ route ) : bool { $ this -> logger -> newLevel ( 'Loading callable' ) ; $ event = Events :: fireEvent ( 'routerLoadCallableEvent' , $ this -> callable , $ matches , $ route ) ; if ( $ event -> isCancelled ( ) ) { return false ; } $ args = $ event -> matches ; $ ar... | Load the callable to which the route matched . |
47,456 | public function defaultCallable ( $ arguments = array ( ) ) : bool { $ this -> logger -> log ( 'Default callable called!' ) ; $ controller = $ arguments [ 'controller' ] ; $ function = $ arguments [ 'function' ] ; $ parameters = empty ( $ arguments [ 'parameters' ] ) ? null : $ arguments [ 'parameters' ] ; $ class = '\... | The default callable . |
47,457 | public function withMiddleware ( MiddlewareInterface $ middleware ) { if ( ! ( $ middleware instanceof ServerMiddlewareInterface ) ) { throw new \ InvalidArgumentException ( 'ServerMiddlewareInterface request expected.' ) ; } foreach ( $ this -> middlewares as $ m ) { if ( $ m === $ middleware ) { return $ this ; } } $... | Return an instance with the specified middleware added to the stack . This method MUST be implemented in such a way as to retain the immutability of the stack and MUST return an instance that contains the specified middleware . |
47,458 | public function withoutMiddleware ( MiddlewareInterface $ middleware ) { if ( ! ( $ middleware instanceof ServerMiddlewareInterface ) ) { throw new \ InvalidArgumentException ( 'ServerMiddlewareInterface request expected.' ) ; } foreach ( $ this -> middlewares as $ k => $ m ) { if ( $ m === $ middleware ) { unset ( $ t... | Return an instance without the specified middleware . This method MUST be implemented in such a way as to retain the immutability of the stack and MUST return an instance that does not contain the specified middleware . |
47,459 | public function process ( RequestInterface $ request ) { if ( $ this -> processingStack !== null ) { throw new \ RuntimeException ( 'Middleware stack is already processing.' ) ; } if ( ! count ( $ this -> middlewares ) ) { throw new \ RuntimeException ( 'Middleware stack is empty.' ) ; } if ( ! ( $ request instanceof S... | Process the request through middleware and return the response . This method MUST be implemented in such a way as to allow the same stack to be reused for processing multiple requests in sequence . |
47,460 | public static function registerDefaultServices ( ContainerInterface $ container ) { if ( ! $ container -> has ( 'argv' ) ) { $ container [ 'argv' ] = $ _SERVER [ 'argv' ] ; } if ( ! $ container -> has ( 'Debug' ) ) { $ container [ 'Debug' ] = function ( ContainerInterface $ c ) { return new DebugMiddleware ( $ c ) ; } ... | This function registers the default services that Clim needs to work . |
47,461 | public function setState ( $ state ) { $ this -> complement [ 'state' ] = $ state ; $ this -> states [ 'state' ] = $ state ; $ this -> setStates ( ) ; return $ state ; } | Set complement state . |
47,462 | public function changeState ( ) { $ this -> getStates ( ) ; $ actualState = $ this -> getState ( ) ; $ newState = self :: $ statesHandler [ $ actualState ] [ 'state' ] ; $ action = self :: $ statesHandler [ $ actualState ] [ 'action' ] ; $ this -> setState ( $ newState ) ; $ this -> doAction ( $ action ) ; return $ new... | Change complement state . |
47,463 | public function getState ( ) { if ( isset ( $ this -> states [ 'state' ] ) ) { return $ this -> states [ 'state' ] ; } elseif ( isset ( $ this -> complement [ 'state' ] ) ) { return $ this -> complement [ 'state' ] ; } $ type = self :: getType ( ) ; return self :: $ defaultStates [ $ type ] ; } | Get complement state . |
47,464 | public function getStates ( ) { $ appID = App :: getCurrentID ( ) ; $ complementID = self :: getCurrentID ( ) ; $ states = $ this -> getStatesFromFile ( ) ; if ( isset ( $ states [ $ appID ] [ $ complementID ] ) ) { return $ this -> states = $ states [ $ appID ] [ $ complementID ] ; } return $ this -> states = [ ] ; } | Get complements states . |
47,465 | private function setStates ( ) { $ appID = App :: getCurrentID ( ) ; $ complementID = self :: getCurrentID ( ) ; if ( ! is_null ( $ this -> states ) ) { $ states = $ this -> getStatesFromFile ( ) ; if ( $ this -> stateChanged ( $ states ) ) { $ file = $ this -> getStatesFilePath ( ) ; $ states [ $ appID ] [ $ complemen... | Set complements states . |
47,466 | private function stateChanged ( $ states ) { $ appID = App :: getCurrentID ( ) ; $ complementID = self :: getCurrentID ( ) ; if ( isset ( $ states [ $ appID ] [ $ complementID ] ) ) { $ actualStates = $ states [ $ appID ] [ $ complementID ] ; if ( ! count ( array_diff_assoc ( $ actualStates , $ this -> states ) ) ) { r... | Check if complement state has changed . |
47,467 | private function getStatesFilePath ( ) { $ type = self :: getType ( ) ; $ complementType = self :: getType ( 'strtoupper' ) ; return App :: $ complementType ( ) . '.' . $ type . '-states.json' ; } | Get complements file path . |
47,468 | public function rollback ( $ transaction ) { $ status = $ this -> getStatus ( $ transaction ) ; if ( count ( $ status ) !== 1 ) { throw new \ LogicException ( "You can't rollback more than 1 transaction" ) ; } list ( $ transaction , $ transactionStatus ) = each ( $ status ) ; foreach ( $ transactionStatus as $ key => $... | Rollback a named transaction |
47,469 | public function isSuccess ( $ transaction = RecordManager :: TRANSACTIONS_ALL ) { $ output = true ; foreach ( $ this -> getStatus ( $ transaction ) as $ transaction => $ transactionStatus ) { foreach ( $ transactionStatus as $ status ) { $ output = ( $ output && $ status === self :: SUCCESS ) ; } } return $ output ; } | Has a named transaction been executed successfully |
47,470 | public function isRolledback ( $ transaction = RecordManager :: TRANSACTIONS_ALL ) { $ output = false ; foreach ( $ this -> getStatus ( $ transaction ) as $ transaction => $ transactionStatus ) { foreach ( $ transactionStatus as $ status ) { $ output = ( $ output || $ status === self :: ROLLEDBACK || $ status === self ... | Has a named transaction been rolledback |
47,471 | public function doneAnything ( ) { $ output = false ; foreach ( $ this -> status as $ transaction => $ transactionStatus ) { foreach ( $ transactionStatus as $ status ) { $ output = ( $ output || $ status === self :: SUCCESS ) ; } } return $ output ; } | Have we actually done anything? |
47,472 | public function filterByObject ( $ objectOrArray ) { $ response = new Response ( ) ; if ( ! is_array ( $ objectOrArray ) ) { $ objectOrArray = array ( $ objectOrArray ) ; } foreach ( $ objectOrArray as $ object ) { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( "can't findTransactionByObject i... | Get transaction response by object |
47,473 | public function getStatusText ( ) { $ statusCode = $ this -> getStatusCode ( ) ; if ( ! isset ( $ this -> defaultStatusTextList [ $ statusCode ] ) ) { return '' ; } return $ this -> defaultStatusTextList [ $ statusCode ] ; } | Retrieve the status text or empty string if one cannot be found |
47,474 | public function lookup_token_type ( $ findThis ) { $ retval = 0 ; $ sql = "SELECT * FROM cswal_token_type_table WHERE token_type=:type" ; try { $ numrows = $ this -> db -> run_query ( $ sql , array ( 'type' => $ findThis ) ) ; if ( $ numrows == 1 ) { $ data = $ this -> db -> get_single_record ( ) ; $ retval = $ data [ ... | Lookup a token type . |
47,475 | public function update_type ( $ id , $ type , $ desc ) { $ sql = "UPDATE cswal_token_type_table SET token_type=:type, token_desc=:desc WHERE token_type_id=:id" ; $ params = array ( 'id' => $ id , 'type' => $ type , 'desc' => $ desc , ) ; try { $ retval = $ this -> db -> run_update ( $ sql , $ params ) ; } catch ( Ex... | Updates the given ID in the token_type table . |
47,476 | public function create_token ( $ password , $ valueToStore = null , $ tokenId = null , $ lifetime = null , $ maxUses = null , $ tokenType = 0 , $ uid = 0 ) { if ( is_null ( $ tokenId ) || strlen ( $ tokenId ) < 1 ) { $ tokenId = $ this -> generate_token_string ( ) ; } $ finalHash = password_hash ( $ password , $ this -... | Build a token record in the database that can be authenticated against later . |
47,477 | public function destroy_token ( $ tokenId ) { try { $ sql = "DELETE FROM " . $ this -> table . " WHERE auth_token_id=:tokenId" ; $ deleteRes = $ this -> db -> run_update ( $ sql , array ( 'tokenId' => $ tokenId ) ) ; } catch ( exception $ e ) { throw new exception ( __METHOD__ . ": failed to destroy token::: " . $ e ->... | Deletes the given token ID from the database . |
47,478 | public function get_token_data ( $ tokenId ) { try { $ sql = "SELECT *, (max_uses - total_uses) as remaining_uses, " . "(NOW() - expiration) as time_remaining " . "FROM " . $ this -> table . " AS t1 INNER JOIN cswal_token_type_table AS t2 ON (t1.token_type_id=t2.token_type_id) WHERE auth_token_id=:tokenId" ;... | Retrieve data for the given ID . |
47,479 | public function attachmentsHaveApprovedFileExtensions ( $ mappedVars ) { if ( $ mappedVars [ 'number_of_attachments' ] == 0 ) { return true ; } $ approvedFileExtensions = config ( 'lasallecmsemail.inbound_attachments_approved_file_extensions' ) ; if ( empty ( $ approvedFileExtensions ) ) { return true ; } for ( $ i = 1... | All attachments have approved file extensions? |
47,480 | public function emailsComeFromListOfApprovedSenders ( $ emailAddress ) { if ( ! $ this -> isInboundEmailsFromAllowedSendersOnly ( ) ) { return true ; } if ( $ this -> isInboundEmailsFromAllowedSendersOnlyListOfSsenders ( $ emailAddress ) ) { return true ; } return false ; } | Check if emails must come from a list of approved senders . That is the person sending the email is allowed to send us inbound emails . |
47,481 | public static function generate ( $ network , Content $ page ) { $ text = self :: truncate ( $ page -> description , 137 ) ; return str_replace ( [ '{url}' , '{title}' , '{text}' , '{image}' ] , [ urlencode ( $ page -> url ) , urlencode ( $ page -> title ) , urlencode ( $ text ) , urlencode ( $ page -> get ( 'image' ) ... | Generate social network link . |
47,482 | public function decodeProperties ( $ properties , $ cache = false ) { $ this -> has_nocache_code = $ properties [ 'has_nocache_code' ] ; $ this -> properties [ 'nocache_hash' ] = $ properties [ 'nocache_hash' ] ; if ( isset ( $ properties [ 'cache_lifetime' ] ) ) { $ this -> properties [ 'cache_lifetime' ] = $ properti... | This function is executed automatically when a compiled or cached template file is included |
47,483 | public function cmdGetStore ( ) { $ result = $ this -> getListStore ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableStore ( $ result ) ; $ this -> output ( ) ; } | Callback for store - get command |
47,484 | public function cmdDeleteStore ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) || ! is_numeric ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } if ( ! $ this -> store -> delete ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> outpu... | Callback for store - delete command |
47,485 | public function cmdUpdateStore ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ->... | Callback for store - update command |
47,486 | protected function setStatusStore ( $ status ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( ! isset ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( isset ( $ id ) ) { if ( ! is_numeric ( $ id ) ) { $ this -> e... | Sets status for one or several stores |
47,487 | protected function submitAddStore ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedJson ( 'data' ) ; $ this -> validateComponent ( 'store' ) ; $ this -> addStore ( ) ; } | Add a new store at once |
47,488 | protected function addStore ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> store -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a store |
47,489 | protected function wizardAddStore ( ) { $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'store' ) ; $ this -> validatePrompt ( 'domain' , $ this -> text ( 'Domain or IP' ) , 'store' ) ; $ this -> validatePrompt ( 'basepath' , $ this -> text ( 'Path' ) , 'store' , '' ) ; $ this -> validatePrompt ( 'statu... | Add a new store step by step |
47,490 | public static function getQualifiedType ( $ value ) { if ( is_null ( $ value ) ) return 'NULL' ; if ( is_string ( $ value ) ) return 'string' ; else if ( is_array ( $ value ) ) { if ( ! empty ( $ value ) ) { foreach ( $ value as $ val ) { $ array_type = self :: getQualifiedType ( $ val ) ; if ( $ array_type != null ) b... | Determines the type of the specified value |
47,491 | public static function compare ( $ val1 , $ val2 ) { if ( in_array ( self :: getQualifiedType ( $ val1 ) , array ( 'int' , 'boolean' , 'float' , 'NULL' ) ) ) return $ val1 == $ val2 ? 0 : ( ( $ val1 < $ val2 ) ? - 1 : 1 ) ; if ( self :: isSubclass ( $ val1 , 'Date' ) ) return self :: compare ( $ val1 -> toUnix ( ) , $ ... | Compare two items for equivalence . Supports Date objects and all native types . |
47,492 | public static function fromArray ( array $ items = [ ] ) : Attribute { $ obj = new static ( ) ; $ obj -> setName ( $ items [ 'name' ] ) -> setDescription ( isset ( $ items [ 'description' ] ) && is_string ( $ items [ 'description' ] ) ? $ items [ 'description' ] : '' ) -> setSqlDescriptor ( isset ( $ items [ 'sqlDescri... | Create item from array |
47,493 | public function write ( Collection $ sequences ) { $ sequences = clone $ sequences ; $ expression = '' ; if ( $ sequences -> count ( ) > 0 ) { $ sequences = $ sequences -> reverse ( ) ; $ length = $ sequences -> count ( ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ sequence = $ sequences [ $ i ] ; if ( isset ( $ se... | Writes a sequence history to a string representation of the expression . |
47,494 | private function cors ( $ request ) { $ origin = $ request -> server -> http_origin ; $ allowed = Config :: get ( 'cors.allowedOrigins' ) ; if ( in_array ( '*' , $ allowed ) || in_array ( $ origin , $ allowed ) ) { $ this -> withHeaders ( $ request ) ; } } | Handles cors . |
47,495 | private function withHeaders ( $ request ) { $ headers = Config :: get ( 'cors.allowedHeaders' ) ; $ methods = Config :: get ( 'cors.allowedMethods' ) ; $ exposed = Config :: get ( 'cors.exposedHeaders' ) ; $ maxAge = Config :: get ( 'cors.maxAge' ) ; $ request -> headers -> addMany ( [ 'Access-Control-Allow-Credential... | Adds cors headers . |
47,496 | public static function get_DateTime ( & $ dateTime ) { if ( $ dateTime instanceof DateTime ) { return $ dateTime ; } return ! is_null ( $ dateTime ) ? new DateTime ( $ dateTime ) : null ; } | Get datetime from Entity |
47,497 | public static function get_Inet ( & $ inet ) { if ( $ inet instanceof Inet ) { return $ inet ; } return ! is_null ( $ inet ) ? new Inet ( $ inet ) : null ; } | Get inet from Entity |
47,498 | public static function set_Inet ( $ inet ) { if ( $ inet instanceof Inet ) { return $ inet ; } try { $ inet = new Inet ( $ inet ) ; return $ inet ; } catch ( \ InvalidArgumentException $ e ) { return null ; } } | Set entity datetime |
47,499 | public static function get_Hstore ( & $ store ) { if ( $ store instanceof Hstore ) { return $ store ; } return ! is_null ( $ store ) ? new Hstore ( $ store ) : null ; } | Get hstore from Entity |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.