idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
25,000 | public function addDeletePaymentRequest ( string $ payerNr ) : void { $ this -> amendments [ ] = new Record ( 'AmendmentRequest' , $ this -> payeeBgNode , new Number ( 0 , $ payerNr , 'PayerNumber' ) , new Text ( 0 , str_repeat ( ' ' , 52 ) ) ) ; } | Add a delete payment request to tree |
25,001 | public function buildTree ( ) : Node { $ sections = [ ] ; foreach ( self :: SECTION_TO_RECORD_STORE_MAP as $ sectionName => $ recordStore ) { if ( ! empty ( $ this -> $ recordStore ) ) { $ sections [ ] = new Section ( $ sectionName , $ this -> opening , ... $ this -> $ recordStore ) ; } } return new AutogiroFile ( 'AutogiroRequestFile' , ... $ sections ) ; } | Get the created request tree |
25,002 | public function autocomplete ( ) { Configure :: write ( 'debug' , 0 ) ; if ( ! $ this -> request -> is ( 'ajax' ) || ! $ this -> request -> is ( 'post' ) || ! $ this -> RequestHandler -> prefers ( 'json' ) ) { throw new BadRequestException ( ) ; } $ data = [ ] ; $ query = $ this -> request -> data ( 'query' ) ; if ( empty ( $ query ) ) { $ this -> set ( compact ( 'data' ) ) ; $ this -> set ( '_serialize' , 'data' ) ; return ; } $ type = $ this -> request -> data ( 'type' ) ; $ plugin = $ this -> request -> data ( 'plugin' ) ; $ limit = $ this -> ConfigTheme -> getAutocompleteLimitConfig ( ) ; $ data = $ this -> Filter -> getAutocomplete ( $ query , $ type , $ plugin , $ limit ) ; if ( empty ( $ data ) ) { $ data = [ ] ; } $ this -> set ( compact ( 'data' ) ) ; $ this -> set ( '_serialize' , 'data' ) ; } | Action autocomplete . Is used to autocomplte input fields . |
25,003 | public function addDocumentation ( string $ url , ? string $ anchor = null ) : KBDocumentation { $ this -> url = $ url ; if ( $ this -> docs === null ) { $ this -> docs = array ( ) ; } $ kbd = new KBDocumentation ( $ url , $ anchor ) ; $ this -> docs [ ] = $ kbd ; return $ kbd ; } | Add documentation link |
25,004 | public function getColumn ( $ name ) { return isset ( $ this -> columns [ $ name ] ) ? $ this -> columns [ $ name ] : false ; } | Get one table column object . |
25,005 | public function add ( array $ data ) { try { $ lastInsertId = $ this -> visitorMapper -> add ( $ data ) ; return $ lastInsertId ; } catch ( MongoMapperException $ e ) { throw new StorageServiceException ( $ e -> getMessage ( ) ) ; } } | Add record to collection |
25,006 | public static function arrayPick ( array & $ array , $ key , $ value = null ) { if ( array_key_exists ( $ key , $ array ) ) { $ value = $ array [ $ key ] ?? $ value ; unset ( $ array [ $ key ] ) ; } return $ value ; } | Array pick . |
25,007 | public static function getIp ( ) : string { $ ip = 'unknown' ; if ( '' != ( $ ip = ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ?? '' ) ) ) { if ( false !== strpos ( $ ip , ',' ) ) { $ ip = trim ( ( string ) end ( explode ( ',' , $ ip ) ) ) ; } } elseif ( '' != ( $ ip = ( $ _SERVER [ 'HTTP_CLIENT_IP' ] ?? '' ) ) ) { } elseif ( '' != ( $ ip = ( $ _SERVER [ 'HTTP_X_REAL_IP' ] ?? '' ) ) ) { } elseif ( '' != ( $ ip = ( $ _SERVER [ 'REMOTE_ADDR_REAL' ] ?? '' ) ) ) { } elseif ( '' != ( $ ip = ( $ _SERVER [ 'REMOTE_ADDR' ] ?? '' ) ) ) { } return $ ip ; } | Get IP . |
25,008 | public static function generateDeprecatedMessage ( $ class , string $ oldStuff , string $ newStuff ) : void { if ( is_object ( $ class ) ) { $ class = get_class ( $ class ) ; } user_error ( sprintf ( '%1$s::%2$s is deprecated, use %1$s::%3$s instead!' , $ class , $ oldStuff , $ newStuff ) , E_USER_DEPRECATED ) ; } | Generate deprecated message . |
25,009 | public function save ( Player $ player ) { $ player -> clearAllReferences ( false ) ; $ player -> save ( ) ; PlayerTableMap :: clearInstancePool ( ) ; } | Save individual player . |
25,010 | public function saveAll ( $ players ) { $ connection = Propel :: getWriteConnection ( PlayerTableMap :: DATABASE_NAME ) ; $ connection -> beginTransaction ( ) ; foreach ( $ players as $ record ) { $ this -> save ( $ record ) ; } $ connection -> commit ( ) ; PlayerTableMap :: clearInstancePool ( ) ; } | Save multiple player models at the tume |
25,011 | private function getConnectUri ( \ Phalcon \ Config $ config ) { if ( $ config -> offsetExists ( 'user' ) && $ config -> offsetExists ( 'password' ) ) { return "mongodb://" . $ config [ 'user' ] . ":" . $ config [ 'password' ] . "@" . $ config [ 'host' ] . ":" . $ config [ 'port' ] . "/" . $ config [ 'dbname' ] ; } else { return "mongodb://" . $ config [ 'host' ] . ":" . $ config [ 'port' ] . "/" . $ config [ 'dbname' ] ; } } | Get mongo connection URI |
25,012 | public function setProfiler ( $ level = self :: PROFILE_ALL , $ slowms = 100 ) { return $ this -> db -> command ( [ 'profile' => ( int ) $ level , 'slowms' => ( int ) $ slowms ] ) ; } | Set MongoDb profiler |
25,013 | public static function get ( array $ arg_params ) { $ data = self :: getParams ( $ arg_params ) ; $ url = '/ecommerce/customers' ; if ( ! empty ( $ data [ 'id' ] ) ) { $ url .= '/' . $ data [ 'id' ] ; } else { return null ; } $ customer_data = APIRequests :: request ( $ url , APIRequests :: METHOD_GET ) ; return self :: toObj ( $ customer_data [ 'body' ] ) ; } | Get Customer Data |
25,014 | public static function create ( array $ arg_params ) { $ data = self :: getParams ( $ arg_params ) ; if ( ! empty ( $ data [ 'metadata' ] ) ) { $ data [ 'metadata' ] = json_encode ( $ data [ 'metadata' ] ) ; } $ customer_data = APIRequests :: request ( '/ecommerce/customers' , APIRequests :: METHOD_POST , $ data ) ; return self :: toObj ( $ customer_data [ 'body' ] ) ; } | Create A Customer |
25,015 | public static function update ( $ arg_params ) { if ( is_array ( $ arg_params ) ) { $ data = self :: getParams ( $ arg_params ) ; } else { $ data = self :: getParams ( json_decode ( json_encode ( $ arg_params ) , true ) ) ; } $ url = '/ecommerce/customers' ; if ( ! empty ( $ data [ 'id' ] ) ) { $ url .= '/' . $ data [ 'id' ] ; } else { return null ; } unset ( $ data [ 'id' ] ) ; $ customer_data = APIRequests :: request ( $ url , APIRequests :: METHOD_PUT , $ data ) ; return self :: toObj ( $ customer_data [ 'body' ] ) ; } | Update A Customer |
25,016 | public function onManiaplanetGameBeginMap ( DedicatedEvent $ event ) { $ serverOptions = $ this -> factory -> getConnection ( ) -> getServerOptions ( ) ; $ this -> gameDataStorage -> setScriptOptions ( $ this -> factory -> getConnection ( ) -> getModeScriptSettings ( ) ) ; $ this -> gameDataStorage -> setServerOptions ( $ serverOptions ) ; $ this -> gameDataStorage -> setSystemInfo ( $ this -> factory -> getConnection ( ) -> getSystemInfo ( ) ) ; $ newGameInfos = $ this -> factory -> getConnection ( ) -> getCurrentGameInfo ( ) ; $ prevousGameInfos = $ this -> gameDataStorage -> getGameInfos ( ) ; $ this -> dispatcher -> reset ( $ this -> mapStorage -> getMap ( $ event -> getParameters ( ) [ 0 ] [ 'UId' ] ) ) ; if ( $ prevousGameInfos -> gameMode != $ newGameInfos -> gameMode || $ prevousGameInfos -> scriptName != $ newGameInfos -> scriptName ) { $ this -> gameDataStorage -> setGameInfos ( clone $ newGameInfos ) ; } } | Called on the begining of a new map . |
25,017 | protected function initNamespace ( DOMDocument $ document , $ namespace_prefix = null ) { $ this -> document_namespace = trim ( $ document -> documentElement -> namespaceURI ) ; $ namespace_prefix = trim ( $ namespace_prefix ) ; if ( $ this -> hasNamespace ( ) ) { $ this -> namespace_prefix = empty ( $ namespace_prefix ) ? $ this -> getDefaultNamespacePrefix ( ) : $ namespace_prefix ; $ this -> registerNamespace ( $ this -> namespace_prefix , $ this -> document_namespace ) ; } } | Get the namespace of the document if defined . |
25,018 | public function getBetterButtonsActions ( ) { $ fields = parent :: getBetterButtonsActions ( ) ; $ fields -> push ( BetterButtonCustomAction :: create ( 'send' , _t ( 'Reservation.RESEND' , 'Resend the reservation' ) ) ) ; return $ fields ; } | Add utility actions to the reservation details view |
25,019 | public function onBeforeWrite ( ) { $ this -> Title = $ this -> getName ( ) ; if ( $ this -> exists ( ) && empty ( $ this -> ReservationCode ) ) { $ this -> ReservationCode = $ this -> createReservationCode ( ) ; } parent :: onBeforeWrite ( ) ; } | Generate a reservation code if it does not yet exists |
25,020 | public function onBeforeDelete ( ) { foreach ( $ this -> Attendees ( ) as $ attendee ) { if ( $ attendee -> exists ( ) ) { $ attendee -> delete ( ) ; } } if ( ( $ folder = Folder :: get ( ) -> find ( 'Name' , $ this -> ReservationCode ) ) && $ folder -> exists ( ) && $ folder -> isEmpty ( ) ) { $ folder -> delete ( ) ; } parent :: onBeforeDelete ( ) ; } | After deleting a reservation delete the attendees and files |
25,021 | public function isDiscarded ( ) { $ deleteAfter = strtotime ( self :: config ( ) -> get ( 'delete_after' ) , strtotime ( $ this -> Created ) ) ; return ( $ this -> Status === 'CART' ) && ( time ( ) > $ deleteAfter ) ; } | Check if the cart is still in cart state and the delete_after time period has been exceeded |
25,022 | public function getName ( ) { if ( ( $ mainContact = $ this -> MainContact ( ) ) && $ mainContact -> exists ( ) && $ name = $ mainContact -> getName ( ) ) { return $ name ; } else { return 'new reservation' ; } } | Get the full name |
25,023 | public function calculateTotal ( ) { $ total = $ this -> Subtotal = $ this -> Attendees ( ) -> leftJoin ( 'Broarm\EventTickets\Ticket' , '`Broarm\EventTickets\Attendee`.`TicketID` = `Broarm\EventTickets\Ticket`.`ID`' ) -> sum ( 'Price' ) ; if ( $ this -> PriceModifiers ( ) -> exists ( ) ) { foreach ( $ this -> PriceModifiers ( ) as $ priceModifier ) { $ priceModifier -> updateTotal ( $ total ) ; } } return $ this -> Total = $ total ; } | Get the total by querying the sum of attendee ticket prices |
25,024 | public function changeState ( $ state ) { $ availableStates = $ this -> dbObject ( 'Status' ) -> enumValues ( ) ; if ( in_array ( $ state , $ availableStates ) ) { $ this -> Status = $ state ; return true ; } else { user_error ( _t ( 'Reservation.STATE_CHANGE_ERROR' , 'Selected state is not available' ) ) ; return false ; } } | Safely change to a state todo check if state direction matches |
25,025 | public function sendReservation ( ) { if ( ( $ from = self :: config ( ) -> get ( 'mail_sender' ) ) && empty ( $ from ) ) { $ from = Config :: inst ( ) -> get ( 'Email' , 'admin_email' ) ; } $ email = new Email ( ) ; $ email -> setSubject ( _t ( 'ReservationMail.TITLE' , 'Your order at {sitename}' , null , array ( 'sitename' => SiteConfig :: current_site_config ( ) -> Title ) ) ) ; $ email -> setFrom ( $ from ) ; $ email -> setTo ( $ this -> MainContact ( ) -> Email ) ; $ email -> setTemplate ( 'ReservationMail' ) ; $ email -> populateTemplate ( $ this ) ; $ this -> extend ( 'updateReservationMail' , $ email ) ; return $ email -> send ( ) ; } | Send the reservation mail |
25,026 | public function sendTickets ( ) { if ( ( $ from = self :: config ( ) -> get ( 'mail_sender' ) ) && empty ( $ from ) ) { $ from = Config :: inst ( ) -> get ( 'Email' , 'admin_email' ) ; } $ email = new Email ( ) ; $ email -> setSubject ( _t ( 'MainContactMail.TITLE' , 'Uw tickets voor {event}' , null , array ( 'event' => $ this -> Event ( ) -> Title ) ) ) ; $ email -> setFrom ( $ from ) ; $ email -> setTo ( $ this -> MainContact ( ) -> Email ) ; $ email -> setTemplate ( 'MainContactMail' ) ; $ email -> populateTemplate ( $ this ) ; $ this -> extend ( 'updateMainContactMail' , $ email ) ; $ sent = $ email -> send ( ) ; $ ticketReceivers = $ this -> Attendees ( ) -> filter ( 'TicketReceiver' , 1 ) -> exclude ( 'ID' , $ this -> MainContactID ) ; if ( $ ticketReceivers -> exists ( ) ) { foreach ( $ ticketReceivers as $ ticketReceiver ) { $ sentAttendee = $ ticketReceiver -> sendTicket ( ) ; if ( $ sent && ! $ sentAttendee ) { $ sent = $ sentAttendee ; } } } return $ sent ; } | Send the reserved tickets |
25,027 | public function sendNotification ( ) { if ( ( $ from = self :: config ( ) -> get ( 'mail_sender' ) ) && empty ( $ from ) ) { $ from = Config :: inst ( ) -> get ( 'Email' , 'admin_email' ) ; } if ( ( $ to = self :: config ( ) -> get ( 'mail_receiver' ) ) && empty ( $ to ) ) { $ to = Config :: inst ( ) -> get ( 'Email' , 'admin_email' ) ; } $ email = new Email ( ) ; $ email -> setSubject ( _t ( 'NotificationMail.TITLE' , 'Nieuwe reservering voor {event}' , null , array ( 'event' => $ this -> Event ( ) -> Title ) ) ) ; $ email -> setFrom ( $ from ) ; $ email -> setTo ( $ to ) ; $ email -> setTemplate ( 'NotificationMail' ) ; $ email -> populateTemplate ( $ this ) ; $ this -> extend ( 'updateNotificationMail' , $ email ) ; return $ email -> send ( ) ; } | Send a booking notification to the ticket mail sender or the site admin |
25,028 | public function send ( ) { $ this -> createFiles ( ) ; $ this -> SentReservation = ( boolean ) $ this -> sendReservation ( ) ; $ this -> SentNotification = ( boolean ) $ this -> sendNotification ( ) ; $ this -> SentTickets = ( boolean ) $ this -> sendTickets ( ) ; } | Create the files and send the reservation notification and tickets |
25,029 | public function getDownloadLink ( ) { if ( ( $ attendee = $ this -> Attendees ( ) -> first ( ) ) && ( $ file = $ attendee -> TicketFile ( ) ) && $ file -> exists ( ) ) { return $ file -> Link ( ) ; } return null ; } | Get the download link |
25,030 | protected function deleteCounter ( ) { if ( is_null ( \ Input :: get ( 'dlstatsid' , true ) ) ) { return ; } \ Database :: getInstance ( ) -> prepare ( "DELETE FROM tl_dlstatdets WHERE pid=?" ) -> execute ( \ Input :: get ( 'dlstatsid' , true ) ) ; \ Database :: getInstance ( ) -> prepare ( "DELETE FROM tl_dlstats WHERE id=?" ) -> execute ( \ Input :: get ( 'dlstatsid' , true ) ) ; return ; } | Delete a counter |
25,031 | protected function getStatusDetailed ( ) { if ( isset ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dlstats' ] ) && ( bool ) $ GLOBALS [ 'TL_CONFIG' ] [ 'dlstats' ] === true && isset ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dlstatdets' ] ) && ( bool ) $ GLOBALS [ 'TL_CONFIG' ] [ 'dlstatdets' ] === true ) { return '<span class="tl_green">' . $ GLOBALS [ 'TL_LANG' ] [ 'tl_dlstatstatistics_stat' ] [ 'status_activated' ] . '</span>' ; } $ this -> boolDetails = false ; return '<span class="">' . $ GLOBALS [ 'TL_LANG' ] [ 'tl_dlstatstatistics_stat' ] [ 'status_deactivated' ] . '</span>' ; } | Get Detailed Logging Status |
25,032 | protected function getMonth ( ) { $ arrMonth = array ( ) ; $ objMonth = \ Database :: getInstance ( ) -> prepare ( "SELECT FROM_UNIXTIME(`tstamp`,'%Y-%m') AS YM , COUNT(`id`) AS SUMDL FROM `tl_dlstatdets` WHERE 1 GROUP BY YM ORDER BY YM DESC" ) -> limit ( 12 ) -> execute ( ) ; $ intRows = $ objMonth -> numRows ; if ( $ intRows > 0 ) { while ( $ objMonth -> next ( ) ) { $ Y = substr ( $ objMonth -> YM , 0 , 4 ) ; $ M = ( int ) substr ( $ objMonth -> YM , - 2 ) ; $ arrMonth [ ] = array ( $ Y . ' ' . $ GLOBALS [ 'TL_LANG' ] [ 'MONTHS' ] [ ( $ M - 1 ) ] , $ this -> getFormattedNumber ( $ objMonth -> SUMDL , 0 ) ) ; } } return $ arrMonth ; } | Monthly Statistics last 12 Months |
25,033 | protected function getYear ( ) { $ arrYear = array ( ) ; $ objYear = \ Database :: getInstance ( ) -> prepare ( "SELECT FROM_UNIXTIME(`tstamp`,'%Y') AS Y , COUNT(`id`) AS SUMDL FROM `tl_dlstatdets` WHERE 1 GROUP BY Y ORDER BY Y DESC" ) -> limit ( 12 ) -> execute ( ) ; $ intRows = $ objYear -> numRows ; if ( $ intRows > 0 ) { while ( $ objYear -> next ( ) ) { $ arrYear [ ] = array ( $ objYear -> Y , $ this -> getFormattedNumber ( $ objYear -> SUMDL , 0 ) , $ objYear -> SUMDL ) ; } } return $ arrYear ; } | Years Statistic last 12 years |
25,034 | protected function getStartDate ( ) { $ StartDate = false ; $ objStartDate = \ Database :: getInstance ( ) -> prepare ( "SELECT MIN(`tstamp`) AS YMD FROM `tl_dlstatdets` WHERE 1" ) -> execute ( ) ; if ( $ objStartDate -> YMD !== null ) { $ StartDate = \ Date :: parse ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dateFormat' ] , $ objStartDate -> YMD ) ; } return $ StartDate ; } | Get Startdate of detailed logging |
25,035 | protected function getLastDownloads ( $ limit = 20 ) { $ newDate = '02.02.1971' ; $ oldDate = '01.01.1970' ; $ viewDate = false ; $ arrLastDownloads = array ( ) ; $ objLastDownloads = \ Database :: getInstance ( ) -> prepare ( "SELECT `tstamp`, `filename`, `downloads`, `id` FROM `tl_dlstats` ORDER BY `tstamp` DESC, `filename`" ) -> limit ( $ limit ) -> execute ( ) ; $ intRows = $ objLastDownloads -> numRows ; if ( $ intRows > 0 ) { while ( $ objLastDownloads -> next ( ) ) { $ viewDate = false ; if ( $ oldDate != \ Date :: parse ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dateFormat' ] , $ objLastDownloads -> tstamp ) ) { $ newDate = \ Date :: parse ( $ GLOBALS [ 'TL_CONFIG' ] [ 'dateFormat' ] , $ objLastDownloads -> tstamp ) ; $ viewDate = $ newDate ; } $ c4d = $ this -> check4details ( $ objLastDownloads -> id ) ; $ arrLastDownloads [ ] = array ( \ Date :: parse ( $ GLOBALS [ 'TL_CONFIG' ] [ 'datimFormat' ] , $ objLastDownloads -> tstamp ) , $ objLastDownloads -> filename , $ this -> getFormattedNumber ( $ objLastDownloads -> downloads , 0 ) , $ viewDate , $ objLastDownloads -> id , $ c4d , $ objLastDownloads -> downloads , $ objLastDownloads -> tstamp ) ; $ oldDate = $ newDate ; } } return $ arrLastDownloads ; } | Get Last Downloadslist |
25,036 | protected function check4details ( $ id ) { $ objC4D = \ Database :: getInstance ( ) -> prepare ( "SELECT count(`id`) AS num FROM `tl_dlstatdets` WHERE `pid`=?" ) -> execute ( $ id ) ; return $ objC4D -> num ; } | Get Number of Logged Details |
25,037 | public function addEvent ( $ payload , $ metadata = null ) { $ domainEventMessage = new GenericDomainEventMessage ( $ this -> aggregateType , $ this -> aggregateId , $ this -> newSequenceNumber ( ) , $ payload , $ metadata ) ; $ this -> addEventMessage ( $ domainEventMessage ) ; return $ domainEventMessage ; } | Add an event to this container . |
25,038 | public function getLastSequenceNumber ( ) { if ( count ( $ this -> events ) === 0 ) { return $ this -> lastCommittedSequenceNumber ; } if ( $ this -> lastSequenceNumber === null ) { $ event = end ( $ this -> events ) ; $ this -> lastSequenceNumber = $ event -> getSequenceNumber ( ) ; } return $ this -> lastSequenceNumber ; } | Returns the sequence number of the last committed event or null if no events have been committed . |
25,039 | public function prepareTitle ( ) { $ title = $ this -> format ; foreach ( array_keys ( self :: $ db ) as $ key ) { $ title = str_ireplace ( '%' . $ key , $ this -> $ key , $ title ) ; } return $ title ; } | Returns the title according to the configuration |
25,040 | public function cancelAction ( $ path ) { $ this -> securityService -> assertCommitter ( ) ; $ filePath = FilePath :: parse ( $ path ) ; $ user = $ this -> securityService -> getGitUser ( ) ; $ this -> wikiService -> removeLock ( $ user , $ filePath ) ; return $ this -> redirect ( $ this -> generateUrl ( 'ddr_gitki_file' , [ 'path' => $ filePath ] ) ) ; } | Cancels editing . |
25,041 | public function containsMultipleTypes ( ) { $ mixed = false ; $ types = [ ] ; foreach ( $ this -> items as $ item ) { $ class = get_class ( $ item -> getType ( ) ) ; if ( ! in_array ( $ class , $ types , true ) ) { $ types [ ] = $ class ; } } if ( count ( $ types ) > 1 ) { $ mixed = true ; } return $ mixed ; } | Returns whether the entities in the list have the same entity type |
25,042 | public function getEntityByIdentifier ( $ identifier ) { $ found_entities = $ this -> filter ( function ( EntityInterface $ entity ) use ( $ identifier ) { return $ entity -> getIdentifier ( ) === $ identifier ; } ) ; return $ found_entities -> getFirst ( ) ; } | Returns the entity in the list with the specified identifier . |
25,043 | protected function propagateEntityChangedEvent ( EntityChangedEvent $ event ) { foreach ( $ this -> listeners as $ listener ) { $ listener -> onEntityChanged ( $ event ) ; } } | Propagates a given entity - changed event to all attached entity - changed listeners . |
25,044 | protected function propagateCollectionChangedEvent ( CollectionChangedEvent $ event ) { if ( $ event -> getType ( ) === CollectionChangedEvent :: ITEM_REMOVED ) { $ event -> getItem ( ) -> removeEntityChangedListener ( $ this ) ; } else { $ event -> getItem ( ) -> addEntityChangedListener ( $ this ) ; } parent :: propagateCollectionChangedEvent ( $ event ) ; } | Propagates a given collection - changed event to all attached collection - changed listeners . |
25,045 | public final function getResourceStats ( ) : ? array { $ return = null ; $ resourceType = $ this -> resource -> getType ( ) ; $ resourceObject = $ this -> resource -> getObject ( ) ; if ( $ resourceType == Resource :: TYPE_MYSQL_LINK ) { $ result = $ resourceObject -> query ( 'SHOW SESSION STATUS' ) ; while ( $ row = $ result -> fetch_assoc ( ) ) { $ return [ strtolower ( $ row [ 'Variable_name' ] ) ] = $ row [ 'Value' ] ; } $ result -> free ( ) ; } elseif ( $ resourceType == Resource :: TYPE_PGSQL_LINK ) { $ result = pg_query ( $ resourceObject , sprintf ( "SELECT * FROM pg_stat_activity WHERE usename = '%s'" , pg_escape_string ( $ resourceObject , $ this -> config [ 'username' ] ) ) ) ; $ resultArray = pg_fetch_all ( $ result ) ; if ( isset ( $ resultArray [ 0 ] ) ) { $ return = $ resultArray [ 0 ] ; } pg_free_result ( $ result ) ; } return $ return ; } | Get resource stats . |
25,046 | public function quoteField ( string $ input ) : string { $ input = $ this -> unquoteField ( $ input ) ; if ( $ this -> isMysql ( ) ) { return '`' . str_replace ( '`' , '``' , $ input ) . '`' ; } elseif ( $ this -> isPgsql ( ) ) { return '"' . str_replace ( '"' , '""' , $ input ) . '"' ; } } | Quote field . |
25,047 | public function escapeLikeString ( string $ input , bool $ quote = true , bool $ escape = true ) : string { if ( $ escape ) { $ input = $ this -> escapeString ( $ input , $ quote ) ; } return addcslashes ( $ input , '%_' ) ; } | Escape like string . |
25,048 | public function escapeIdentifier ( $ input , bool $ join = true ) { if ( is_array ( $ input ) ) { $ input = array_map ( [ $ this , 'escapeIdentifier' ] , array_filter ( $ input ) ) ; return $ join ? join ( ', ' , $ input ) : $ input ; } elseif ( $ input instanceof Sql ) { return $ input -> toString ( ) ; } elseif ( $ input instanceof Identifier ) { $ input = $ input -> toString ( ) ; } if ( ! is_string ( $ input ) ) { throw new AgentException ( sprintf ( 'String, array and Query\Sql,Identifier type identifiers' . ' accepted only, %s given!' , gettype ( $ input ) ) ) ; } $ input = trim ( $ input ) ; if ( $ input == '' || $ input == '*' ) { return $ input ; } if ( strpos ( $ input , '(' ) !== false ) { throw new AgentException ( 'Found parentheses in input, complex identifiers not allowed!' ) ; } $ input = preg_replace ( '~^[^\w]|[^\w]$~' , '' , $ input ) ; if ( $ input == '' ) { return $ input ; } if ( strpos ( $ input , ',' ) ) { return $ this -> escapeIdentifier ( Util :: split ( ',' , $ input ) , $ join ) ; } if ( strpos ( $ input , ' ' ) ) { return preg_replace_callback ( '~([^\s]+)\s+(AS\s+)?(\w+)~i' , function ( $ match ) { return $ this -> escapeIdentifier ( $ match [ 1 ] ) . ( ( $ as = trim ( $ match [ 2 ] ) ) ? ' ' . strtoupper ( $ as ) . ' ' : ' ' ) . $ this -> escapeIdentifier ( $ match [ 3 ] ) ; } , $ input ) ; } if ( strpos ( $ input , '.' ) ) { return implode ( '.' , array_map ( [ $ this , 'escapeIdentifier' ] , explode ( '.' , $ input ) ) ) ; } return $ this -> quoteField ( $ input ) ; } | Escape identifier . |
25,049 | public function escapeBytea ( string $ input ) : string { if ( $ this -> resource -> getType ( ) != Resource :: TYPE_PGSQL_LINK ) { throw new AgentException ( 'escapeBytea() available for only Pgsql!' ) ; } return pg_escape_bytea ( $ this -> resource -> getObject ( ) , $ input ) ; } | Escape bytea . |
25,050 | public function unescapeBytea ( string $ input ) : string { if ( $ this -> resource -> getType ( ) != Resource :: TYPE_PGSQL_LINK ) { throw new AgentException ( 'unescapeBytea() available for only Pgsql!' ) ; } return pg_unescape_bytea ( $ input ) ; } | Unescape bytea . |
25,051 | public final function prepareIdentifier ( string $ input , $ inputParam ) : string { if ( empty ( $ inputParam ) ) { if ( strpos ( $ input , '%n' ) !== false ) { throw new AgentException ( 'Found %n operator but no replacement parameter given!' ) ; } elseif ( strpos ( $ input , '??' ) !== false ) { throw new AgentException ( 'Found ?? operator but no replacement parameter given!' ) ; } } else { $ input = $ this -> prepare ( $ input , ( array ) $ inputParam ) ; if ( strpos ( $ input , '=' ) ) { $ input = implode ( ', ' , array_map ( function ( $ input ) { $ input = trim ( $ input ) ; if ( $ input != '' ) { $ input = array_map ( 'trim' , explode ( '=' , $ input ) ) ; $ input = $ this -> escapeIdentifier ( $ input [ 0 ] ) . ' = ' . ( ( $ input [ 1 ] && $ input [ 1 ] [ 0 ] == '@' ) ? $ this -> escapeIdentifier ( $ input [ 1 ] ) : $ input [ 1 ] ) ; return $ input ; } } , explode ( ',' , $ input ) ) ) ; } return $ input ; } if ( strpos ( $ input , '=' ) ) { $ input = implode ( ', ' , array_map ( function ( $ input ) { $ input = trim ( $ input ) ; if ( $ input != '' ) { $ input = array_map ( 'trim' , explode ( '=' , $ input ) ) ; $ input = $ this -> escapeIdentifier ( $ input [ 0 ] ) . ' = ' . ( ( $ input [ 1 ] && $ input [ 1 ] [ 0 ] == '@' ) ? $ this -> escapeIdentifier ( $ input [ 1 ] ) : $ this -> escape ( $ input [ 1 ] ) ) ; return $ input ; } } , explode ( ',' , $ input ) ) ) ; } else { $ input = $ this -> escapeIdentifier ( $ input ) ; } return $ input ; } | Prepare identifier . |
25,052 | public function getMessage ( $ key = null ) { $ result = [ ] ; if ( empty ( $ key ) ) { return $ result ; } $ sessionKey = $ this -> _sessionKey . '.' . $ key ; if ( ! CakeSession :: check ( $ sessionKey ) ) { return $ result ; } $ data = CakeSession :: read ( $ sessionKey ) ; if ( empty ( $ data ) ) { return $ result ; } $ result = ( array ) $ data ; if ( isAssoc ( $ result ) ) { $ result = [ $ result ] ; } return $ result ; } | Get list of Flash messages . |
25,053 | public function deleteMessage ( $ key = null ) { if ( empty ( $ key ) ) { return false ; } $ sessionKey = $ this -> _sessionKey . '.' . $ key ; if ( ! CakeSession :: check ( $ sessionKey ) ) { return false ; } return CakeSession :: delete ( $ sessionKey ) ; } | Delete Flash messages . |
25,054 | private function registerProviders ( ) { $ providers = $ this -> config ( 'app' ) [ 'providers' ] ; foreach ( $ providers as $ provider ) { $ obj = new $ provider ( $ this ) ; if ( ! $ obj instanceof Provider ) { throw new \ Exception ( "Invalid provider: $provider" ) ; } $ this -> container -> invoke ( $ obj , 'register' ) ; } } | Register application providers . |
25,055 | protected function isValid ( $ value ) { $ consumer = new Consumer ( ) ; $ embedObject = $ consumer -> consume ( $ value ) ; if ( $ embedObject === null ) { $ this -> addError ( 'This URI has no oEmbed support.' , 1403004582 , [ $ value ] ) ; } } | Checks if the given value is a specific boolean value . |
25,056 | protected static function getParams ( array $ arg_params ) { $ return = array ( ) ; $ data = array ( 'amount' , 'transaction_id' , 'customer_id' , 'security_token' , 'customer_ip' ) ; foreach ( $ data as $ key ) { if ( ! empty ( $ arg_params [ $ key ] ) ) { $ return [ $ key ] = $ arg_params [ $ key ] ; } } return $ return ; } | Get Class params |
25,057 | public static function doCardRefund ( $ arg_params ) { $ data = array ( ) ; if ( is_array ( $ arg_params ) ) { $ data = self :: getParams ( $ arg_params ) ; } else { $ transaction = json_decode ( json_encode ( $ arg_params ) , true ) ; if ( ! empty ( $ transaction [ 'id' ] ) ) { $ data = array ( 'transaction_id' => $ transaction [ 'id' ] ) ; } } $ refund_data = APIRequests :: request ( '/ecommerce/refund/card' , APIRequests :: METHOD_POST , array ( 'payload' => $ data ) ) ; return self :: toObj ( $ refund_data [ 'body' ] ) ; } | Refund A Card Payment |
25,058 | public function getAvailableFrom ( ) { if ( $ this -> AvailableFromDate ) { return $ this -> dbObject ( 'AvailableFromDate' ) ; } elseif ( $ startDate = $ this -> getEventStartDate ( ) ) { $ lastWeek = new Date ( ) ; $ lastWeek -> setValue ( strtotime ( self :: config ( ) -> get ( 'sale_start_threshold' ) , strtotime ( $ startDate -> value ) ) ) ; return $ lastWeek ; } return null ; } | Get the available form date if it is set otherwise get it from the parent |
25,059 | public function getAvailableTill ( ) { if ( $ this -> AvailableTillDate ) { return $ this -> dbObject ( 'AvailableTillDate' ) ; } elseif ( $ startDate = $ this -> getEventStartDate ( ) ) { $ till = strtotime ( self :: config ( ) -> get ( 'sale_end_threshold' ) , strtotime ( $ startDate -> Nice ( ) ) ) ; $ date = SS_Datetime :: create ( ) ; $ date -> setValue ( date ( 'Y-m-d H:i:s' , $ till ) ) ; return $ date ; } return null ; } | Get the available till date if it is set otherwise get it from the parent Use the event start date as last sale possibility |
25,060 | public function validateDate ( ) { if ( ( $ from = $ this -> getAvailableFrom ( ) ) && ( $ till = $ this -> getAvailableTill ( ) ) && $ from -> InPast ( ) && $ till -> InFuture ( ) ) { return true ; } return false ; } | Validate if the start and end date are in the past and the future todo check start time and treshhold |
25,061 | public function getAvailable ( ) { if ( ! $ this -> getAvailableFrom ( ) && ! $ this -> getAvailableTill ( ) ) { return false ; } elseif ( $ this -> validateDate ( ) && $ this -> validateAvailability ( ) ) { return true ; } return false ; } | Return if the ticket is available or not |
25,062 | private function getEventStartDate ( ) { $ currentDate = $ this -> Event ( ) -> getController ( ) -> CurrentDate ( ) ; if ( $ currentDate && $ currentDate -> exists ( ) ) { $ date = $ currentDate -> obj ( 'StartDate' ) -> Format ( 'Y-m-d' ) ; $ time = $ currentDate -> obj ( 'StartTime' ) -> Format ( 'H:i:s' ) ; $ dateTime = SS_Datetime :: create ( ) ; $ dateTime -> setValue ( "$date $time" ) ; return $ dateTime ; } else { return null ; } } | Get the event start date |
25,063 | public static function doDelete ( $ values , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( RecordTableMap :: DATABASE_NAME ) ; } if ( $ values instanceof Criteria ) { $ criteria = $ values ; } elseif ( $ values instanceof \ eXpansion \ Bundle \ LocalRecords \ Model \ Record ) { $ criteria = $ values -> buildPkeyCriteria ( ) ; } else { $ criteria = new Criteria ( RecordTableMap :: DATABASE_NAME ) ; $ criteria -> add ( RecordTableMap :: COL_ID , ( array ) $ values , Criteria :: IN ) ; } $ query = RecordQuery :: create ( ) -> mergeWith ( $ criteria ) ; if ( $ values instanceof Criteria ) { RecordTableMap :: clearInstancePool ( ) ; } elseif ( ! is_object ( $ values ) ) { foreach ( ( array ) $ values as $ singleval ) { RecordTableMap :: removeInstanceFromPool ( $ singleval ) ; } } return $ query -> delete ( $ con ) ; } | Performs a DELETE on the database given a Record or Criteria object OR a primary key value . |
25,064 | public function createForPlayer ( $ login ) { if ( ! isset ( $ this -> groups [ $ login ] ) ) { $ class = $ this -> class ; $ group = new $ class ( null , $ this -> dispatcher ) ; $ this -> groups [ $ login ] = $ group ; $ group -> addLogin ( $ login ) ; } return $ this -> groups [ $ login ] ; } | Get the individual group of a single player . |
25,065 | public function createForPlayers ( $ logins ) { $ class = $ this -> class ; $ group = new $ class ( null , $ this -> dispatcher ) ; $ this -> groups [ $ group -> getName ( ) ] = $ group ; foreach ( $ logins as $ login ) { $ group -> addLogin ( $ login ) ; } return $ group ; } | Create a group for array of logins . |
25,066 | public function create ( $ name ) { $ class = $ this -> class ; $ group = new $ class ( $ name , $ this -> dispatcher ) ; $ this -> groups [ $ group -> getName ( ) ] = $ group ; return $ group ; } | Create a persistent group . |
25,067 | public function getGroup ( $ groupName ) { return isset ( $ this -> groups [ $ groupName ] ) ? $ this -> groups [ $ groupName ] : null ; } | Get a group from it s name if it exist . |
25,068 | public function onExpansionGroupDestroy ( Group $ group , $ lastLogin ) { if ( isset ( $ this -> groups [ $ group -> getName ( ) ] ) ) { unset ( $ this -> groups [ $ group -> getName ( ) ] ) ; } } | When a group is destyoed delete object . |
25,069 | public static function buildHttpClient ( $ url = NULL , $ username = NULL , $ password = NULL , $ contentType = self :: CONTENT_JSON_API , $ language = self :: HEADER_LOCALE ) { $ client = new Client ( $ url ) ; $ client -> setHead ( [ 'Accept: ' . $ contentType , 'Accept-Language: ' . $ language , 'Content-Type: application/vnd.api+json' ] ) ; if ( is_scalar ( $ username ) && is_scalar ( $ password ) ) { $ client -> setOptions ( [ CURLOPT_HTTPAUTH , CURLAUTH_ANY ] ) ; $ client -> setOption ( CURLOPT_USERPWD , $ username . ':' . $ password ) ; } return $ client ; } | Obtiene un cliente de HTTP . |
25,070 | public static function normalizeType ( string $ type ) : string { switch ( $ type ) { case self :: DATA_TYPE_INT : case self :: DATA_TYPE_BIGINT : case self :: DATA_TYPE_TINYINT : case self :: DATA_TYPE_SMALLINT : case self :: DATA_TYPE_MEDIUMINT : case self :: DATA_TYPE_INTEGER : case self :: DATA_TYPE_SERIAL : case self :: DATA_TYPE_BIGSERIAL : return 'int' ; case self :: DATA_TYPE_FLOAT : case self :: DATA_TYPE_DECIMAL : case self :: DATA_TYPE_DOUBLE : case self :: DATA_TYPE_DOUBLEP : case self :: DATA_TYPE_REAL : case self :: DATA_TYPE_NUMERIC : return 'float' ; case self :: DATA_TYPE_BOOLEAN : return 'bool' ; case self :: DATA_TYPE_BIT : return 'bit' ; } return 'string' ; } | Normalize type . |
25,071 | public function addFromCsv ( ) { $ files = array_diff ( scandir ( $ this -> directory . '/in' , SCANDIR_SORT_NONE ) , [ '..' , '.' ] ) ; foreach ( $ files as $ file ) { if ( 0 !== strpos ( $ file , 'game-add' ) ) { continue ; } $ fileIn = $ this -> directory . '/in/' . $ file ; $ fileOut = $ this -> directory . '/out/' . $ file ; $ handle = fopen ( $ fileIn , 'rb' ) ; $ idGame = substr ( $ file , 8 , - 4 ) ; if ( ! is_numeric ( $ idGame ) ) { continue ; } $ game = $ this -> em -> getReference ( GameEntity :: class , $ idGame ) ; if ( $ game === null ) { continue ; } $ group = null ; $ types = null ; while ( ( $ row = fgetcsv ( $ handle , null , ';' ) ) !== false ) { list ( $ type , $ libEn , $ libFr ) = $ row ; if ( isset ( $ row [ 3 ] ) && null !== $ row [ 3 ] && in_array ( $ type , [ 'group' , 'chart' ] ) ) { $ types = explode ( '|' , $ row [ 3 ] ) ; } switch ( $ row [ 0 ] ) { case 'object' : break ; case 'group' : $ group = new Group ( ) ; $ group -> translate ( 'en' , false ) -> setName ( $ libEn ) ; $ group -> translate ( 'fr' , false ) -> setName ( $ libFr ) ; $ group -> setGame ( $ game ) ; $ group -> mergeNewTranslations ( ) ; $ this -> em -> persist ( $ group ) ; break ; case 'chart' : $ chart = new Chart ( ) ; $ chart -> translate ( 'en' , false ) -> setName ( $ libEn ) ; $ chart -> translate ( 'fr' , false ) -> setName ( $ libFr ) ; $ chart -> setGroup ( $ group ) ; $ chart -> mergeNewTranslations ( ) ; if ( $ types !== null ) { foreach ( $ types as $ idType ) { $ chartLib = new ChartLib ( ) ; $ chartLib -> setChart ( $ chart ) -> setType ( $ this -> em -> getReference ( ChartType :: class , $ idType ) ) ; $ chart -> addLib ( $ chartLib ) ; } } $ this -> em -> persist ( $ chart ) ; break ; } } $ this -> em -> flush ( ) ; rename ( $ fileIn , $ fileOut ) ; } } | Add groups and charts from a csv file |
25,072 | public function updateFromCsv ( ) { $ files = array_diff ( scandir ( $ this -> directory . '/in' , SCANDIR_SORT_NONE ) , [ '..' , '.' ] ) ; foreach ( $ files as $ file ) { if ( 0 !== strpos ( $ file , 'game-update' ) ) { continue ; } $ fileIn = $ this -> directory . '/in/' . $ file ; $ fileOut = $ this -> directory . '/out/' . $ file ; $ handle = fopen ( $ fileIn , 'rb' ) ; $ idGame = substr ( $ file , 11 , - 4 ) ; if ( ! is_numeric ( $ idGame ) ) { continue ; } $ group = null ; $ types = null ; while ( ( $ row = fgetcsv ( $ handle , null , ';' ) ) !== false ) { list ( $ type , $ id , $ libEn , $ libFr ) = $ row ; switch ( $ type ) { case 'object' : break ; case 'group' : $ group = $ this -> em -> getRepository ( 'VideoGamesRecordsCoreBundle:Group' ) -> find ( $ id ) ; $ group -> translate ( 'en' , false ) -> setName ( $ libEn ) ; $ group -> translate ( 'fr' , false ) -> setName ( $ libFr ) ; $ group -> mergeNewTranslations ( ) ; $ this -> em -> persist ( $ group ) ; break ; case 'chart' : $ chart = $ this -> em -> getRepository ( 'VideoGamesRecordsCoreBundle:Chart' ) -> find ( $ id ) ; $ chart -> translate ( 'en' , false ) -> setName ( $ libEn ) ; $ chart -> translate ( 'fr' , false ) -> setName ( $ libFr ) ; $ chart -> mergeNewTranslations ( ) ; $ this -> em -> persist ( $ chart ) ; break ; } } $ this -> em -> flush ( ) ; rename ( $ fileIn , $ fileOut ) ; } } | Update groups and charts from a csv file |
25,073 | public static function setEnvName ( $ arg_env_name ) { if ( $ arg_env_name == 'stage' ) { self :: $ envName = 'stage' ; self :: $ domain = self :: $ domainStage ; } elseif ( $ arg_env_name == 'prod' ) { self :: $ envName = 'prod' ; self :: $ domain = self :: $ domainProd ; } else { throw new \ Exception ( 'Invalid Environment Given' , 4046969 ) ; } } | Set Environment Name |
25,074 | public static function debug ( array $ strings , array $ placeholders = [ ] ) { if ( ! isset ( $ _SESSION [ __TRAIT__ ] ) ) { $ _SESSION [ __TRAIT__ ] = [ ] ; } array_unshift ( $ strings , '<question>DEBUG:</question>' ) ; $ _SESSION [ __TRAIT__ ] [ ] = new Message ( 'comment' , 4 , $ strings , $ placeholders , ( bool ) getenv ( 'BEHAT_DEBUG' ) ) ; } | Store message for debugging . |
25,075 | public static function printMessages ( $ clearQueue = true ) { if ( ! empty ( $ _SESSION [ __TRAIT__ ] ) ) { foreach ( $ _SESSION [ __TRAIT__ ] as $ message ) { $ message -> output ( ) ; } } if ( $ clearQueue ) { static :: clearQueue ( ) ; } } | Output messages to a command line . |
25,076 | public static function getTypeForExtension ( $ extension ) { static :: ensureDataLoaded ( ) ; $ extension = strtolower ( $ extension ) ; foreach ( static :: $ mime_types as $ mime_type => $ extensions ) { if ( is_array ( $ extensions ) ) { if ( in_array ( $ extension , $ extensions , true ) ) { return $ mime_type ; } } else if ( $ extension === $ extensions ) { return $ mime_type ; } } } | Get the MIME type associated with a given extension . |
25,077 | public static function getExtensionForType ( $ mime_type ) { static :: ensureDataLoaded ( ) ; if ( ! static :: hasType ( $ mime_type ) ) { return ; } $ extensions = static :: $ mime_types [ $ mime_type ] ; if ( is_array ( $ extensions ) ) { return $ extensions [ 0 ] ; } return $ extensions ; } | Get the extension associated with a given MIME type . |
25,078 | public static function hasExtension ( $ extension ) { static :: ensureDataLoaded ( ) ; $ extension = strtolower ( $ extension ) ; foreach ( static :: $ mime_types as $ extensions ) { if ( is_array ( $ extensions ) ) { if ( in_array ( $ extension , $ extensions , true ) ) { return true ; } } else if ( $ extension === $ extensions ) { return true ; } } return false ; } | Check if an extension is known . |
25,079 | public static function guessType ( $ file_path , $ reference_name = null , $ default = 'application/octet-stream' ) { if ( ! $ reference_name ) { $ reference_name = basename ( $ file_path ) ; } $ extension = pathinfo ( $ reference_name , PATHINFO_EXTENSION ) ; if ( $ extension and $ mime_type = static :: getTypeForExtension ( $ extension ) ) { return $ mime_type ; } if ( $ mime_type = static :: getMagicType ( $ file_path ) ) { return $ mime_type ; } return $ default ; } | Guess the MIME type of a given file first by checking the extension then by falling back to magic . |
25,080 | public static function guessExtension ( $ file_path , $ reference_name = null , $ default = 'bin' ) { if ( ! $ reference_name ) { $ reference_name = basename ( $ file_path ) ; } if ( $ extension = pathinfo ( $ reference_name , PATHINFO_EXTENSION ) and static :: hasExtension ( $ extension ) ) { return strtolower ( $ extension ) ; } $ mime_type = static :: getMagicType ( $ file_path ) ; if ( $ mime_type and $ extension = static :: getExtensionForType ( $ mime_type ) ) { return $ extension ; } return $ default ; } | Guess the extension of a given file first by checking the path then by falling back to magic . |
25,081 | public static function getMagicType ( $ file_path ) { $ file_info = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mime_type = finfo_file ( $ file_info , $ file_path ) ; finfo_close ( $ file_info ) ; if ( static :: hasType ( $ mime_type ) ) { return $ mime_type ; } } | Get the MIME type of a file using magic . |
25,082 | protected function parseParameters ( $ parameters ) { if ( isset ( $ parameters [ 0 ] ) ) { $ params = json_decode ( $ parameters [ 0 ] , true ) ; if ( $ params ) { return $ params ; } } return $ parameters ; } | Parse parameters that are usually in json . |
25,083 | public function isDefault ( ) { if ( $ this -> getAttribute ( ) -> hasOption ( UuidAttribute :: OPTION_DEFAULT_VALUE ) && $ this -> getAttribute ( ) -> getOption ( UuidAttribute :: OPTION_DEFAULT_VALUE ) !== 'auto_gen' ) { return $ this -> sameValueAs ( $ this -> getAttribute ( ) -> getDefaultValue ( ) ) ; } throw new RuntimeException ( 'Operation not supported. A new UUIDv4 is generated for every getNullValue call. No default value set.' ) ; } | Tells whether the valueholder s value is considered to be the same as the default value defined on the attribute . |
25,084 | private function rmdir ( $ dir , $ recursive ) { $ is_link = is_link ( $ dir ) ; if ( $ is_link ) { if ( ! unlink ( $ dir ) ) throw new Exception ( "Error unlinking $dir" ) ; } else if ( ! $ recursive ) { if ( ! rmdir ( $ dir ) ) throw new Exception ( "Error removing temp dir: $dir" ) ; } else { $ dh = opendir ( $ dir ) ; if ( ! $ dh ) throw new Exception ( "Cannot read temp dir contents for removal: $dir" ) ; do { $ file = readdir ( $ dh ) ; if ( $ file === false ) break ; if ( $ file === '.' || $ file === '..' ) continue ; $ path = $ dir . DIRECTORY_SEPARATOR . $ file ; $ is_link = is_link ( $ path ) ; $ is_dir = is_dir ( $ path ) ; if ( $ is_dir && ! $ is_link ) { $ this -> rmdir ( $ path , true ) ; } else { if ( ! unlink ( $ path ) ) throw new Exception ( "Cannot remove nested temp file: $path" ) ; } } while ( $ file !== false ) ; closedir ( $ dh ) ; $ this -> rmdir ( $ dir , false ) ; } } | Remove the directory |
25,085 | public function Setup ( $ xmlModuleName , $ customArgs ) { parent :: Setup ( $ xmlModuleName , $ customArgs ) ; $ this -> _ErrorMessage = $ customArgs ; } | This method receive a external error message and show it . |
25,086 | public function addMapToQueue ( $ login , $ id , $ mxsite ) { if ( ! $ this -> adminGroups -> hasPermission ( $ login , "maps.add" ) ) { $ this -> chatNotification -> sendMessage ( 'expansion_mx.chat.nopermission' , $ login ) ; return ; } if ( $ this -> downloadProgressing || count ( $ this -> addQueue ) > 1 ) { $ this -> addQueue [ ] = [ 'mxid' => $ id , 'mxsite' => $ mxsite ] ; $ this -> chatNotification -> sendMessage ( "|info| Adding map to download queue..." , $ login ) ; return ; } else { $ this -> addMap ( $ login , $ id , $ mxsite ) ; } } | add map to queue |
25,087 | public function getUiHandler ( ConfigInterface $ config ) { if ( $ config -> isHidden ( ) ) { return null ; } foreach ( $ this -> uiHandlers as $ ui ) { if ( $ ui -> isCompatible ( $ config ) ) { return $ ui ; } } return null ; } | Get proper handler to generate ui for a config element . |
25,088 | public function render ( ) { $ process = $ this -> getProcess ( ) ; $ process -> run ( ) ; if ( 0 === $ process -> getExitCode ( ) ) { return file_get_contents ( $ this -> getOutput ( ) ) ; } throw new \ RuntimeException ( sprintf ( 'Unable to render PDF. Command "%s" exited with "%s" (code: %s): %s' , $ process -> getCommandLine ( ) , $ process -> getExitCodeText ( ) , $ process -> getExitCode ( ) , $ process -> getErrorOutput ( ) ) ) ; } | Render a PDF with this builder s configuration |
25,089 | public function getProcess ( ) { $ this -> processBuilder -> setArguments ( array ( ) ) ; foreach ( $ this -> options as $ option => $ value ) { if ( ! $ value ) { continue ; } if ( ! in_array ( $ option , static :: $ nonPrefixedOptions ) ) { $ option = sprintf ( '--%s' , $ option ) ; } $ this -> processBuilder -> add ( $ option ) ; if ( true !== $ value ) { $ this -> processBuilder -> add ( $ value ) ; } } $ this -> processBuilder -> add ( '-' ) -> add ( $ this -> getOutput ( ) ) ; $ process = $ this -> processBuilder -> getProcess ( ) ; $ process -> setCommandLine ( sprintf ( 'echo "%s" | %s' , addslashes ( $ this -> getInput ( ) ) , $ process -> getCommandLine ( ) ) ) ; return $ process ; } | Builds command line arguments based on the current configuration |
25,090 | public function addJavaScriptMethod ( $ jsObject , $ jsMethod , $ jsSource , $ jsParameters = "" ) { $ jsEventSource = "$(function() { \n" . " $('$jsObject').$jsMethod(function($jsParameters) { \n" . " $jsSource \n" . " }); \n" . "});\n\n" ; $ this -> addJavaScriptSource ( $ jsEventSource , false ) ; } | Add a JavaScript method to a JavaScript object . |
25,091 | public function addJavaScriptAttribute ( $ jsObject , $ jsAttrName , $ attrParam ) { if ( ! is_array ( $ attrParam ) ) { $ attrParam = array ( $ attrParam ) ; } $ jsEventSource = "$(function() { \n" . " $('$jsObject').$jsAttrName({ \n" ; $ first = true ; foreach ( $ attrParam as $ key => $ value ) { $ jsEventSource .= ( ! $ first ? ",\n" : "" ) . " " . ( ! is_numeric ( $ key ) ? "$key: " : "" ) . $ value ; $ first = false ; } $ jsEventSource .= "\n }); \n" . "});\n\n" ; $ this -> addJavaScriptSource ( $ jsEventSource , false ) ; } | Add a JavaScript attribute to a JavaScript object . |
25,092 | protected function CompactJs ( $ sText ) { $ sBuffer = "" ; $ i = 0 ; $ iStop = strlen ( $ sText ) ; $ sChar = '' ; $ sLast = '' ; $ sWanted = '' ; $ fEscape = false ; for ( $ i = $ i ; $ i < $ iStop ; $ i ++ ) { $ sLast = $ sChar ; $ sChar = substr ( $ sText , $ i , 1 ) ; if ( $ sChar == '\\' ) if ( $ sWanted == '"' || $ sWanted == "'" ) $ fEscape = ! $ fEscape ; if ( $ sChar == '"' && ! $ fEscape ) if ( $ sWanted == '' ) $ sWanted = '"' ; else if ( $ sWanted == '"' ) $ sWanted = '' ; if ( $ sChar == "'" && ! $ fEscape ) if ( $ sWanted == '' ) $ sWanted = "'" ; else if ( $ sWanted == "'" ) $ sWanted = '' ; if ( $ sChar == '/' && $ sWanted == '' ) if ( substr ( $ sText , $ i + 1 , 1 ) == '/' ) { $ sWanted = "\n" ; $ i ++ ; continue ; } if ( $ sChar == "\n" && $ sWanted == "\n" ) { $ sWanted = '' ; continue ; } if ( $ sChar == '/' && $ sWanted == '' ) if ( substr ( $ sText , $ i + 1 , 1 ) == '*' ) { $ sWanted = "*/" ; $ i ++ ; continue ; } if ( $ sChar == '*' && $ sWanted == '*/' ) if ( substr ( $ sText , $ i + 1 , 1 ) == '/' ) { $ sWanted = '' ; $ i ++ ; continue ; } if ( ( $ sChar == "\t" || $ sChar == "\n" || $ sChar == "\r" ) && $ sWanted == '' ) { $ sChar = ' ' ; if ( $ sLast == ' ' ) continue ; } if ( $ sChar == ' ' && ( $ sLast == ' ' || $ sLast == '' ) && $ sWanted == '' ) continue ; if ( $ sWanted == '' || $ sWanted == '"' || $ sWanted == "'" ) $ sBuffer .= $ sChar ; if ( $ fEscape && $ sChar != '\\' ) $ fEscape = false ; } $ sBuffer .= substr ( $ sText , $ iStop ) ; return ( $ sBuffer ) ; } | A 3rd party implementation for compact a javascript . |
25,093 | private function getPropertySettings ( $ property ) { $ data = [ ] ; $ settings = [ 'minimum' => 'min' , 'maximum' => 'max' , ] ; foreach ( $ settings as $ setting => $ name ) { if ( isset ( $ property [ $ setting ] ) ) { $ data [ ] = $ name . ':' . $ property [ $ setting ] ; } } return implode ( ' | ' , $ data ) ; } | Build a string for the Other column for the given property . |
25,094 | public static function doDelete ( $ values , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( PlayerTableMap :: DATABASE_NAME ) ; } if ( $ values instanceof Criteria ) { $ criteria = $ values ; } elseif ( $ values instanceof \ eXpansion \ Framework \ PlayersBundle \ Model \ Player ) { $ criteria = $ values -> buildPkeyCriteria ( ) ; } else { $ criteria = new Criteria ( PlayerTableMap :: DATABASE_NAME ) ; $ criteria -> add ( PlayerTableMap :: COL_ID , ( array ) $ values , Criteria :: IN ) ; } $ query = PlayerQuery :: create ( ) -> mergeWith ( $ criteria ) ; if ( $ values instanceof Criteria ) { PlayerTableMap :: clearInstancePool ( ) ; } elseif ( ! is_object ( $ values ) ) { foreach ( ( array ) $ values as $ singleval ) { PlayerTableMap :: removeInstanceFromPool ( $ singleval ) ; } } return $ query -> delete ( $ con ) ; } | Performs a DELETE on the database given a Player or Criteria object OR a primary key value . |
25,095 | private function publishEvents ( ) { foreach ( CalendarEvent :: get ( ) as $ event ) { if ( $ event -> Tickets ( ) -> exists ( ) ) { if ( $ event -> doPublish ( ) ) { echo "[$event->ID] Published event \n" ; $ this -> moveFieldData ( $ event ) ; } else { echo "[$event->ID] Failed to publish event \n\n" ; } } } } | Publishes the events so the default fields are created |
25,096 | private function moveFieldData ( CalendarEvent $ event ) { if ( $ event -> Attendees ( ) -> exists ( ) ) { foreach ( $ event -> Attendees ( ) as $ attendee ) { foreach ( $ event -> Fields ( ) as $ field ) { $ q = SQLSelect :: create ( $ field -> FieldName , "`{$attendee->getClassName()}`" , array ( 'ID' => $ attendee -> ID ) ) ; try { $ value = $ q -> execute ( ) -> value ( ) ; $ attendee -> Fields ( ) -> add ( $ field , array ( 'Value' => $ value ) ) ; echo "[$event->ID][$attendee->ID] Set '$field->FieldName' with '{$value}' \n" ; } catch ( \ Exception $ e ) { echo "[$event->ID][$attendee->ID] Failed, '$field->FieldName' does not exist \n" ; } } } echo "[$event->ID] Finished migrating event \n\n" ; } else { echo "[$event->ID] No attendees to migrate \n\n" ; } } | Migrate the field data from the attendee model to relations Use an SQLSelect to access the data directly from the database |
25,097 | public function visitBefore ( Node $ node ) : void { parent :: visitBefore ( $ node ) ; foreach ( $ this -> visitors as $ visitor ) { $ visitor -> visitBefore ( $ node ) ; } } | Delegate visit before to registered visitors |
25,098 | public function visitAfter ( Node $ node ) : void { foreach ( $ this -> visitors as $ visitor ) { $ visitor -> visitAfter ( $ node ) ; } parent :: visitAfter ( $ node ) ; } | Delegate visit after to registered visitors |
25,099 | protected function buildLoadableBundles ( ContainerBuilder $ container ) { $ bundles = $ container -> getParameter ( 'kernel.bundles' ) ; foreach ( $ bundles as $ bundle ) { $ reflectionClass = new \ ReflectionClass ( $ bundle ) ; if ( $ reflectionClass -> implementsInterface ( LoadableBundle :: class ) ) { ( new $ bundle ( ) ) -> load ( $ container ) ; } } } | Executes the load method of LoadableBundle instances . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.