idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
25,700
public function updateValue ( $ group , $ variableCode , $ newValue ) { $ variable = clone $ this -> getVariable ( $ variableCode ) ; $ variable -> setValue ( $ newValue ) ; if ( ! isset ( $ this -> queuedForUpdate [ $ group -> getName ( ) ] ) ) { $ this -> queuedForUpdate [ $ group -> getName ( ) ] [ 'time' ] = microtime ( true ) ; } $ checkVariable = clone $ this -> checkVariable ; $ uniqueId = uniqid ( 'exp_' , true ) ; $ checkVariable -> setValue ( "\"$uniqueId\"" ) ; $ this -> checkWindow -> setValue ( Builder :: escapeText ( get_called_class ( ) ) ) ; $ this -> queuedForUpdate [ $ group -> getName ( ) ] [ 'group' ] = $ group ; $ this -> queuedForUpdate [ $ group -> getName ( ) ] [ 'variables' ] [ $ variableCode ] = $ variable ; $ this -> queuedForUpdate [ $ group -> getName ( ) ] [ 'check' ] = $ checkVariable ; }
Update script value .
25,701
public function getScriptInitialization ( $ defaultValues = false ) { $ scriptContent = '' ; foreach ( $ this -> variables as $ variable ) { $ scriptContent .= $ variable -> getScriptDeclaration ( ) . "\n" ; if ( $ defaultValues ) { $ scriptContent .= $ variable -> getScriptValueSet ( ) . "\n" ; } } $ scriptContent .= $ this -> checkVariable -> getScriptDeclaration ( ) . "\n" ; $ scriptContent .= $ this -> checkOldVariable -> getScriptDeclaration ( ) . "\n" ; $ scriptContent .= $ this -> checkWindow -> getScriptDeclaration ( ) . "\n" ; $ scriptContent .= "declare check_original = " . $ this -> checkWindow -> getInitialValue ( ) . ";\n" ; if ( $ defaultValues ) { $ scriptContent .= $ this -> checkVariable -> getScriptValueSet ( ) . "\n" ; $ scriptContent .= $ this -> checkOldVariable -> getScriptValueSet ( ) . "\n" ; $ scriptContent .= $ this -> checkWindow -> getScriptValueSet ( ) . "\n" ; } return $ scriptContent ; }
Get initialization script .
25,702
public function register ( ListenerInterface $ listener , EventEmitter $ target = null ) { $ EElisteners = array ( ) ; if ( null !== $ target ) { $ EElisteners = $ this -> forwardEvents ( $ listener , $ target , $ listener -> forwardedEvents ( ) ) ; } $ this -> storage -> attach ( $ listener , $ EElisteners ) ; return $ this ; }
Registers a listener pass the listener events to the target .
25,703
public function unregister ( ListenerInterface $ listener ) { if ( ! isset ( $ this -> storage [ $ listener ] ) ) { throw new InvalidArgumentException ( 'Listener is not registered.' ) ; } foreach ( $ this -> storage [ $ listener ] as $ event => $ EElistener ) { $ listener -> removeListener ( $ event , $ EElistener ) ; } $ this -> storage -> detach ( $ listener ) ; return $ this ; }
Unregisters a listener removes the listener events from the target .
25,704
protected function _setLayout ( Controller & $ controller ) { if ( $ controller -> name == 'CakeError' ) { $ controller -> layout = 'CakeTheme.error' ; return ; } $ isAjax = $ controller -> request -> is ( 'ajax' ) ; $ isPjax = $ controller -> request -> is ( 'pjax' ) ; $ isHtml = $ this -> _controller -> ViewExtension -> isHtml ( ) ; if ( $ isPjax ) { $ controller -> layout = 'CakeTheme.pjax' ; } elseif ( $ isHtml && ! $ isAjax ) { if ( $ controller -> request -> param ( 'controller' ) === 'users' ) { $ controller -> layout = 'CakeTheme.login' ; } else { if ( $ controller -> layout === 'default' ) { $ controller -> layout = 'CakeTheme.main' ; } } } }
Sets the layer depending on the request
25,705
protected function _setConfigVar ( Controller & $ controller ) { $ additionalCssFiles = $ this -> _modelConfigTheme -> getListCssFiles ( ) ; $ additionalJsFiles = $ this -> _modelConfigTheme -> getListJsFiles ( ) ; $ controller -> set ( compact ( 'additionalCssFiles' , 'additionalJsFiles' ) ) ; }
Set global variable of used plugins
25,706
public function filterByLogin ( $ login = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ login ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_LOGIN , $ login , $ comparison ) ; }
Filter the query on the login column
25,707
public function filterByNickname ( $ nickname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ nickname ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_NICKNAME , $ nickname , $ comparison ) ; }
Filter the query on the nickname column
25,708
public function filterByNicknameStripped ( $ nicknameStripped = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ nicknameStripped ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_NICKNAME_STRIPPED , $ nicknameStripped , $ comparison ) ; }
Filter the query on the nickname_stripped column
25,709
public function filterByPath ( $ path = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ path ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_PATH , $ path , $ comparison ) ; }
Filter the query on the path column
25,710
public function filterByWins ( $ wins = null , $ comparison = null ) { if ( is_array ( $ wins ) ) { $ useMinMax = false ; if ( isset ( $ wins [ 'min' ] ) ) { $ this -> addUsingAlias ( PlayerTableMap :: COL_WINS , $ wins [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ wins [ 'max' ] ) ) { $ this -> addUsingAlias ( PlayerTableMap :: COL_WINS , $ wins [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_WINS , $ wins , $ comparison ) ; }
Filter the query on the wins column
25,711
public function filterByOnlineTime ( $ onlineTime = null , $ comparison = null ) { if ( is_array ( $ onlineTime ) ) { $ useMinMax = false ; if ( isset ( $ onlineTime [ 'min' ] ) ) { $ this -> addUsingAlias ( PlayerTableMap :: COL_ONLINE_TIME , $ onlineTime [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ onlineTime [ 'max' ] ) ) { $ this -> addUsingAlias ( PlayerTableMap :: COL_ONLINE_TIME , $ onlineTime [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_ONLINE_TIME , $ onlineTime , $ comparison ) ; }
Filter the query on the online_time column
25,712
public function filterByLastOnline ( $ lastOnline = null , $ comparison = null ) { if ( is_array ( $ lastOnline ) ) { $ useMinMax = false ; if ( isset ( $ lastOnline [ 'min' ] ) ) { $ this -> addUsingAlias ( PlayerTableMap :: COL_LAST_ONLINE , $ lastOnline [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ lastOnline [ 'max' ] ) ) { $ this -> addUsingAlias ( PlayerTableMap :: COL_LAST_ONLINE , $ lastOnline [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( PlayerTableMap :: COL_LAST_ONLINE , $ lastOnline , $ comparison ) ; }
Filter the query on the last_online column
25,713
public function filterByRecord ( $ record , $ comparison = null ) { if ( $ record instanceof \ eXpansion \ Bundle \ LocalRecords \ Model \ Record ) { return $ this -> addUsingAlias ( PlayerTableMap :: COL_ID , $ record -> getPlayerId ( ) , $ comparison ) ; } elseif ( $ record instanceof ObjectCollection ) { return $ this -> useRecordQuery ( ) -> filterByPrimaryKeys ( $ record -> getPrimaryKeys ( ) ) -> endUse ( ) ; } else { throw new PropelException ( 'filterByRecord() only accepts arguments of type \eXpansion\Bundle\LocalRecords\Model\Record or Collection' ) ; } }
Filter the query by a related \ eXpansion \ Bundle \ LocalRecords \ Model \ Record object
25,714
public function useRecordQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinRecord ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Record' , '\eXpansion\Bundle\LocalRecords\Model\RecordQuery' ) ; }
Use the Record relation Record object
25,715
public function draw ( ) { $ file = Application :: current ( ) -> getDirectory ( ) ; $ file .= "views/{$this->templateName}." ; $ file .= self :: $ extension ; if ( ! file_exists ( $ file ) ) { throw new Exception ( "Template file not found: $file" ) ; } return $ this -> templateEngine -> draw ( $ file , $ this -> data ) ; }
Draw a template using application defined template engine .
25,716
public function _bad ( $ errstr , $ isbad = true ) { global $ _web_access_retry_timeout ; $ this -> console -> writeln ( $ this -> _webaccess_str . '$f00' . $ errstr ) ; if ( $ this -> _socket ) { @ fclose ( $ this -> _socket ) ; } $ this -> _socket = null ; if ( $ isbad ) { if ( isset ( $ this -> _spool [ 0 ] [ 'State' ] ) ) { $ this -> _spool [ 0 ] [ 'State' ] = 'BAD' ; } $ this -> _state = 'BAD' ; $ this -> _bad_time = time ( ) ; if ( $ this -> _bad_timeout < $ _web_access_retry_timeout ) { $ this -> _bad_timeout = $ _web_access_retry_timeout ; } else { $ this -> _bad_timeout *= 2 ; } } else { if ( isset ( $ this -> _spool [ 0 ] [ 'State' ] ) ) { $ this -> _spool [ 0 ] [ 'State' ] = 'OPEN' ; } $ this -> _state = 'CLOSED' ; } $ this -> _callCallback ( $ this -> _webaccess_str . $ errstr ) ; }
put connection in BAD state
25,717
public function rawQuery ( string $ sql , array $ params = [ ] ) : array { $ rows = [ ] ; if ( empty ( $ sql ) ) { return $ rows ; } $ autoCommit = $ this -> beginTransaction ( ) ; if ( $ sth = $ this -> prepare ( $ sql ) ) { foreach ( $ params as $ bind => $ value ) { $ sth -> bindValue ( ':' . \ ltrim ( $ bind , ':' ) , $ value ) ; } if ( $ sth -> execute ( ) ) { $ rows = $ sth -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; } $ sth -> closeCursor ( ) ; } if ( $ autoCommit ) $ this -> commit ( ) ; return $ rows ; }
Execute a SELECT statement
25,718
public function rawExec ( string $ sql , array $ params = [ ] ) : bool { $ result = false ; if ( empty ( $ sql ) ) { return $ result ; } $ autoCommit = $ this -> beginTransaction ( ) ; if ( $ sth = $ this -> prepare ( $ sql ) ) { foreach ( $ params as $ bind => $ value ) { $ sth -> bindValue ( ':' . \ ltrim ( $ bind , ':' ) , $ value ) ; } if ( $ sth -> execute ( ) ) { $ result = $ sth -> rowCount ( ) > 0 ; } $ sth -> closeCursor ( ) ; } if ( $ autoCommit ) $ this -> commit ( ) ; return $ result ; }
Execute an INSERT UPDATE or DELETE statement
25,719
public function get ( $ eventType ) { $ handlers = array_merge_recursive ( array_key_exists ( $ eventType , $ this -> handlers ) ? $ this -> handlers [ $ eventType ] : [ ] , array_key_exists ( '*' , $ this -> handlers ) ? $ this -> handlers [ '*' ] : [ ] ) ; krsort ( $ handlers , SORT_NUMERIC ) ; $ eventHandlers = [ ] ; foreach ( $ handlers as $ priority => $ handlersByPriority ) { foreach ( $ handlersByPriority as $ handler ) { if ( $ this -> resolver ) { $ handler = call_user_func ( $ this -> resolver , $ handler , $ eventType ) ; } $ eventHandlers [ ] = $ handler ; } } return $ eventHandlers ; }
Returns an array of event handlers sorted by priority from highest to lowest
25,720
protected function handshake ( ) { $ key = & $ this -> key ; $ lastPing = & $ this -> lastPing ; $ that = $ this ; $ logger = $ this -> logger ; $ query = http_build_query ( [ 'login' => $ this -> gameData -> getSystemInfo ( ) -> serverLogin ] ) ; $ url = $ this -> handshakeUrl . '?' . $ query ; $ lastPing = time ( ) ; $ this -> logger -> debug ( "[eXpansion analytics]Starting handshake" ) ; $ this -> http -> put ( $ url , [ ] , function ( HttpResult $ result ) use ( & $ key , & $ lastPing , $ logger , $ that ) { $ key = null ; if ( $ result -> getHttpCode ( ) != '200' ) { $ logger -> debug ( '[eXpansion analytics]Handshake failed' , [ 'http_code' => $ result -> getHttpCode ( ) ] ) ; return ; } $ json = json_decode ( $ result -> getResponse ( ) ) ; if ( isset ( $ json -> key ) && ! empty ( $ json -> key ) ) { $ logger -> debug ( '[eXpansion analytics]Handshake successfull' , [ 'key' => $ json -> key ] ) ; $ key = $ json -> key ; $ that -> ping ( ) ; $ lastPing = 0 ; } } ) ; }
Handshake with analytics tool!
25,721
public function ping ( ) { if ( ! $ this -> key || $ this -> operationInProgress || ( time ( ) - $ this -> lastPing ) < $ this -> pingInterval ) { if ( is_null ( $ this -> key ) && ( time ( ) - $ this -> lastPing ) > $ this -> retryInterval ) { $ this -> lastPing = time ( ) ; $ this -> handshake ( ) ; } return ; } $ data = $ this -> getBasePingData ( ) ; $ query = http_build_query ( $ data ) ; $ url = $ this -> pingUrl . '?' . $ query ; $ this -> operationInProgress = true ; $ this -> lastPing = time ( ) ; $ operationInProgress = & $ this -> operationInProgress ; $ key = & $ this -> key ; $ logger = $ this -> logger ; $ logger -> debug ( '[eXpansion analytics]Starting ping' ) ; $ this -> http -> put ( $ url , [ ] , function ( HttpResult $ result ) use ( & $ operationInProgress , & $ key , $ logger ) { if ( $ result -> getHttpCode ( ) == '200' ) { $ operationInProgress = false ; $ logger -> debug ( '[eXpansion analytics]Ping successfull' ) ; } else { $ logger -> debug ( '[eXpansion analytics]Ping failed' , [ 'http_code' => $ result -> getHttpCode ( ) , 'result' => $ result -> getResponse ( ) ] ) ; $ key = null ; } } ) ; }
Ping the analytics server with proper information .
25,722
protected function getBasePingData ( ) { return [ 'key' => $ this -> key , 'nbPlayers' => count ( $ this -> playerStorage -> getOnline ( ) ) , 'country' => $ this -> countries -> getIsoAlpha2FromName ( $ this -> countries -> parseCountryFromPath ( $ this -> gameData -> getServerPath ( ) ) ) , 'version' => Application :: EXPANSION_VERSION , 'php_version' => $ this -> gameData -> getServerCleanPhpVersion ( ) , 'php_version_short' => $ this -> gameData -> getServerMajorPhpVersion ( ) , 'mysql_version' => 'unknown' , 'memory' => memory_get_usage ( ) , 'memory_peak' => memory_get_peak_usage ( ) , 'title' => str_replace ( '@' , '_by_' , $ this -> gameData -> getVersion ( ) -> titleId ) , 'game' => $ this -> gameData -> getTitleGame ( ) , 'mode' => strtolower ( $ this -> gameData -> getGameInfos ( ) -> scriptName ) , 'serverOs' => $ this -> gameData -> getServerOs ( ) , ] ; }
Get base data for pinging the server .
25,723
public function render ( array $ data , array $ attrs = array ( ) ) { $ output = array ( ) ; $ attrs = array_merge ( array ( 'class' => 'uk-description-list-horizontal' ) , $ attrs ) ; $ attrs = $ this -> _mergeAttr ( $ attrs , $ this -> _jbSrt ( 'data-list' ) ) ; $ output [ ] = '<dl ' . $ this -> buildAttrs ( $ attrs ) . '>' ; foreach ( $ data as $ label => $ text ) { $ label = $ this -> _translate ( $ label ) ; $ output [ ] = '<dt title="' . $ this -> _cleanValue ( $ label ) . '">' . $ label . '</dt>' ; $ output [ ] = '<dd>' . $ text . '</dd>' ; } $ output [ ] = '</dl>' ; return implode ( '' , $ output ) ; }
Create data list .
25,724
private function getTranslations ( $ string , $ params ) { $ out = [ ] ; $ messages = $ this -> translationsHelper -> getTranslations ( $ string , $ params ) ; foreach ( $ messages as $ message ) { $ out [ $ message [ 'Lang' ] ] = $ message [ 'Text' ] ; } return $ out ; }
Generates the needed data structure
25,725
public function toThrowable ( ) { $ class = $ this -> class ; $ prev = $ this -> prev !== null ? $ this -> prev -> toThrowable ( ) : $ this -> prev ; return new $ class ( $ this -> message , 0 , $ prev ) ; }
Return proxied Throwable .
25,726
public function setStartDay ( $ daysBack ) { if ( ! is_null ( $ daysBack ) ) { $ this -> addStatusMessage ( 'Start Date ' . date ( 'Y-m-d' , mktime ( 0 , 0 , 0 , date ( "m" ) , date ( "d" ) - $ daysBack , date ( "Y" ) ) ) ) ; } $ this -> daysBack = $ daysBack ; }
Start set date
25,727
public function getInvoicer ( ) { if ( ! is_object ( $ this -> invoicer ) ) { $ this -> invoicer = new \ FlexiPeeHP \ FakturaVydana ( null , $ this -> config ) ; } return $ this -> invoicer ; }
Prepare invoice helper
25,728
public function getPaymentsToProcess ( $ daysBack = 1 , $ direction = 'in' ) { $ result = [ ] ; $ this -> banker -> defaultUrlParams [ 'order' ] = 'datVyst@A' ; $ payments = $ this -> banker -> getColumnsFromFlexibee ( [ 'id' , 'kod' , 'varSym' , 'specSym' , 'sumCelkem' , 'buc' , 'smerKod' , 'mena' , 'datVyst' ] , [ "sparovano eq false AND typPohybuK eq '" . ( ( $ direction == 'out' ) ? 'typPohybu.vydej' : 'typPohybu.prijem' ) . "' AND storno eq false " . ( is_null ( $ daysBack ) ? '' : "AND datVyst eq '" . \ FlexiPeeHP \ FlexiBeeRW :: timestampToFlexiDate ( mktime ( 0 , 0 , 0 , date ( "m" ) , date ( "d" ) - $ daysBack , date ( "Y" ) ) ) . "' " ) ] , 'id' ) ; if ( $ this -> banker -> lastResponseCode == 200 ) { if ( empty ( $ payments ) ) { $ result = [ ] ; } else { $ result = $ payments ; } } return $ result ; }
Get unmatched payments within given days and direction
25,729
public function getCompanyForBUC ( $ account , $ bankCode = null ) { $ bucer = new \ FlexiPeeHP \ FlexiBeeRW ( null , [ 'evidence' => 'adresar-bankovni-ucet' ] ) ; $ companyRaw = $ bucer -> getColumnsFromFlexibee ( [ 'firma' ] , empty ( $ bankCode ) ? [ 'buc' => $ account ] : [ 'buc' => $ account , 'smerKod' => $ bankCode ] ) ; return array_key_exists ( 0 , $ companyRaw ) ? $ companyRaw [ 0 ] [ 'firma' ] : null ; }
Obtain FlexiBee company code for given bank account number
25,730
public static function reorderInvoicesByAge ( $ invoices ) { $ invoicesByAge = [ ] ; $ invoicesByAgeRaw = [ ] ; foreach ( $ invoices as $ invoiceData ) { $ invoicesByAgeRaw [ \ FlexiPeeHP \ FlexiBeeRW :: flexiDateToDateTime ( $ invoiceData [ 'datVyst' ] ) -> getTimestamp ( ) ] = $ invoiceData ; } ksort ( $ invoicesByAgeRaw ) ; foreach ( $ invoicesByAgeRaw as $ invoiceData ) { $ invoicesByAge [ $ invoiceData [ 'kod' ] ] = $ invoiceData ; } return $ invoicesByAge ; }
Reorder invoices by Age .
25,731
public function getOriginDocumentType ( $ typDokl ) { if ( empty ( $ this -> docTypes ) ) { $ this -> docTypes = $ this -> getDocumentTypes ( ) ; } $ documentType = \ FlexiPeeHP \ FlexiBeeRO :: uncode ( $ typDokl ) ; return array_key_exists ( $ documentType , $ this -> docTypes ) ? $ this -> docTypes [ $ documentType ] : 'typDokladu.neznamy' ; }
Return Document original type
25,732
public function getFiles ( ) : array { $ files = [ ] ; if ( ! empty ( $ _FILES ) ) { foreach ( $ _FILES as $ inputName => $ phpFile ) { if ( ! is_array ( $ phpFile [ 'name' ] ) ) { $ files [ $ inputName ] = $ this -> handleUniqueFile ( $ phpFile ) ; } else { $ files [ $ inputName ] = $ this -> handleMultipleFile ( $ phpFile ) ; } } } return $ files ; }
Gets an array of uploaded files from the request .
25,733
protected function handleUniqueFile ( $ file ) { $ uploadedFile = null ; if ( ! $ file [ 'error' ] ) { $ uploadedFile = new UploadedFile ( $ file [ 'tmp_name' ] , $ file [ 'name' ] , $ file [ 'type' ] ) ; } return $ uploadedFile ; }
Handle a file input when it IS NOT multiple .
25,734
protected function handleMultipleFile ( $ file ) : array { $ fileBag = [ ] ; foreach ( $ file [ 'name' ] as $ idx => $ name ) { $ uploadedFile = null ; if ( ! $ file [ $ idx ] [ 'error' ] ) { $ uploadedFile = new UploadedFile ( $ file [ $ idx ] [ 'tmp_name' ] , $ file [ $ idx ] [ 'name' ] , $ file [ $ idx ] [ 'type' ] ) ; } $ fileBag [ $ idx ] = $ uploadedFile ; } return $ fileBag ; }
Handle a file input when it IS multiple .
25,735
private function setupDefaultConfigs ( ) { $ this -> setLayout ( ) ; $ this -> setSummary ( ) ; if ( ! $ this -> isEmpty ( ) ) { $ this -> setActionBar ( ) ; } $ this -> showOnEmpty = false ; }
Set up default configs for Grid View
25,736
private function setLayout ( ) { $ this -> layout = Html :: tag ( 'div' , "{items}" , [ 'class' => 'table-responsive' ] ) . Html :: tag ( 'div' , Html :: tag ( 'div' , "{summary}" , [ 'class' => 'pagination-summary' ] ) . Html :: tag ( 'div' , "{pager}" , [ 'class' => 'pagination-wrap' ] ) , [ 'class' => 'pagination-box' ] ) ; }
set the layout
25,737
public function setActionBar ( ) { if ( is_null ( $ this -> actionButtonLabel ) && is_null ( $ this -> actionButtonModalId ) ) { return ; } $ this -> getView ( ) -> params [ 'content-header-button' ] = [ 'label' => $ this -> actionButtonLabel , 'options' => [ 'data-toggle' => 'modal' , 'data-target' => $ this -> actionButtonModalId , 'href' => $ this -> actionButtonModalHref ? : '#' ] ] ; }
set the Action bar
25,738
public function getPaymentErrorMessage ( ) { if ( ! $ lastPayment = $ this -> reservation -> Payments ( ) -> first ( ) ) { return false ; } $ lastErrorMessage = null ; $ errorMessages = $ lastPayment -> Messages ( ) -> exclude ( 'Message' , '' ) -> sort ( 'Created' , 'DESC' ) ; foreach ( $ errorMessages as $ errorMessage ) { if ( $ errorMessage instanceof GatewayErrorMessage ) { $ lastErrorMessage = $ errorMessage ; break ; } } if ( ! $ lastErrorMessage ) { return false ; } return _t ( "{$lastErrorMessage->Gateway}.{$lastErrorMessage->Code}" , $ lastErrorMessage -> Message ) ; }
Get the last error message from the payment attempts
25,739
public function start ( Player $ player , $ params ) { $ this -> currentVote = new Vote ( $ player , $ this -> getCode ( ) , $ params ) ; return $ this -> currentVote ; }
Start a new vote .
25,740
public function castYes ( $ login ) { if ( $ this -> currentVote ) { $ this -> currentVote -> castYes ( $ login ) ; $ player = $ this -> playerStorage -> getPlayerInfo ( $ login ) ; $ this -> dispatcher -> dispatch ( "votemanager.voteyes" , [ $ player , $ this -> currentVote ] ) ; } }
User votes yes
25,741
public function update ( $ time = null ) { if ( ! $ this -> currentVote || $ this -> currentVote -> getStatus ( ) == Vote :: STATUS_CANCEL ) { return ; } if ( is_null ( $ time ) ) { $ time = time ( ) ; } $ playerCount = count ( $ this -> playerStorage -> getOnline ( ) ) ; if ( $ playerCount > 0 && ( $ this -> currentVote -> getYes ( ) / $ playerCount ) > $ this -> ratio ) { $ this -> votePassed ( ) ; return ; } if ( ( $ time - $ this -> currentVote -> getStartTime ( ) ) > $ this -> duration ) { $ totalVotes = $ this -> currentVote -> getYes ( ) + $ this -> currentVote -> getNo ( ) * 1.0 ; if ( $ totalVotes >= 1 && ( $ this -> currentVote -> getYes ( ) / $ totalVotes ) > $ this -> ratio ) { $ this -> votePassed ( ) ; } else { $ this -> voteFailed ( ) ; } } }
Update the status of the vote and execute actions if vote passed .
25,742
public function showForm ( ) { $ blockcenter = new XmlBlockCollection ( $ this -> _myWords -> Value ( "MSGFILL" ) , BlockPosition :: Center ) ; $ this -> _document -> addXmlnukeObject ( $ blockcenter ) ; $ paragraph = new XmlParagraphCollection ( ) ; $ blockcenter -> addXmlnukeObject ( $ paragraph ) ; $ form = new XmlFormCollection ( $ this -> _context , "module:sendpage" , $ this -> _myWords -> Value ( "CAPTION" ) ) ; $ paragraph -> addXmlnukeObject ( $ form ) ; $ caption = new XmlInputCaption ( $ this -> _myWords -> ValueArgs ( "INFO" , array ( urldecode ( $ this -> _link ) ) ) ) ; $ form -> addXmlnukeObject ( $ caption ) ; $ hidden = new XmlInputHidden ( "action" , "submit" ) ; $ form -> addXmlnukeObject ( $ hidden ) ; $ hidden = new XmlInputHidden ( "link" , $ this -> _link ) ; $ form -> addXmlnukeObject ( $ hidden ) ; $ textbox = new XmlInputTextBox ( $ this -> _myWords -> Value ( "FLDNAME" ) , "fromname" , "" , 40 ) ; $ textbox -> setRequired ( true ) ; $ form -> addXmlnukeObject ( $ textbox ) ; $ textbox = new XmlInputTextBox ( $ this -> _myWords -> Value ( "FLDEMAIL" ) , "frommail" , "" , 40 ) ; $ textbox -> setDataType ( INPUTTYPE :: EMAIL ) ; $ textbox -> setRequired ( true ) ; $ form -> addXmlnukeObject ( $ textbox ) ; $ textbox = new XmlInputTextBox ( $ this -> _myWords -> Value ( "FLDTONAME" ) , "toname" , "" , 40 ) ; $ textbox -> setRequired ( true ) ; $ form -> addXmlnukeObject ( $ textbox ) ; $ textbox = new XmlInputTextBox ( $ this -> _myWords -> Value ( "FLDTOEMAIL" ) , "tomail" , "" , 40 ) ; $ textbox -> setDataType ( INPUTTYPE :: EMAIL ) ; $ textbox -> setRequired ( true ) ; $ form -> addXmlnukeObject ( $ textbox ) ; $ memo = new XmlInputMemo ( $ this -> _myWords -> Value ( "LABEL_MESSAGE" ) , "custommessage" , "" ) ; $ form -> addXmlnukeObject ( $ memo ) ; $ form -> addXmlnukeObject ( new XmlInputImageValidate ( $ this -> _myWords -> Value ( "TYPETEXTFROMIMAGE" ) ) ) ; $ button = new XmlInputButtons ( ) ; $ button -> addSubmit ( $ this -> _myWords -> Value ( "TXT_SUBMIT" ) , "" ) ; $ form -> addXmlnukeObject ( $ button ) ; }
Show the form
25,743
public function goBack ( $ showMessage ) { $ blockcenter = new XmlBlockCollection ( $ this -> _myWords -> Value ( "MSGERROR" ) , BlockPosition :: Center ) ; $ this -> _document -> addXmlnukeObject ( $ blockcenter ) ; $ paragraph = new XmlParagraphCollection ( ) ; $ blockcenter -> addXmlnukeObject ( $ paragraph ) ; $ paragraph -> addXmlnukeObject ( new XmlnukeText ( $ showMessage , true ) ) ; $ anchor = new XmlAnchorCollection ( "javascript:history.go(-1)" ) ; $ anchor -> addXmlnukeObject ( new XmlnukeText ( $ this -> _myWords -> Value ( "TXT_BACK" ) ) ) ; $ paragraph -> addXmlnukeObject ( $ anchor ) ; }
Go to the last page
25,744
public function showMessage ( ) { $ blockcenter = new XmlBlockCollection ( $ this -> _myWords -> Value ( "MSGOK" ) , BlockPosition :: Center ) ; $ this -> _document -> addXmlnukeObject ( $ blockcenter ) ; $ paragraph = new XmlParagraphCollection ( ) ; $ blockcenter -> addXmlnukeObject ( $ paragraph ) ; $ paragraph -> addXmlnukeObject ( new XmlnukeText ( $ _customMessage ) ) ; }
Show a message of the error
25,745
private static function fillCurrentHeaders ( self $ request ) { $ headers = [ ] ; if ( function_exists ( 'getallheaders' ) ) { if ( ( $ headers = getallheaders ( ) ) === false ) { $ headers = [ ] ; } } if ( empty ( $ headers ) ) { foreach ( $ _SERVER as $ key => $ value ) { if ( substr ( $ key , 0 , 5 ) === 'HTTP_' ) { $ newKey = str_replace ( ' ' , '-' , ucwords ( strtolower ( str_replace ( '_' , ' ' , substr ( $ key , 5 ) ) ) ) ) ; $ headers [ $ newKey ] = $ value ; } } } $ request -> setHeaders ( $ headers ) ; }
Fill up the headers property with the values provided by the client browser .
25,746
private static function fillCurrentRouteString ( self $ request ) { $ requestUri = urldecode ( $ _SERVER [ 'REQUEST_URI' ] ) ; $ scriptName = $ _SERVER [ 'SCRIPT_NAME' ] ; $ length = strlen ( dirname ( $ scriptName ) ) ; $ routeAux = substr ( explode ( '?' , $ requestUri ) [ 0 ] , $ length ) ; $ route = '/' ; if ( $ routeAux && $ routeAux != '/' ) { $ route .= trim ( str_replace ( '\\' , '/' , $ routeAux ) , '/' ) . '/' ; } $ request -> setRouteStr ( $ route ) ; }
Capture the route string .
25,747
private function selectDataParser ( ) { $ selected = null ; if ( ! empty ( $ this -> getContentType ( ) ) ) { foreach ( self :: $ registeredParsers as $ parser ) { if ( $ parser -> canHandle ( $ this -> getContentType ( ) ) ) { $ selected = $ parser ; break ; } } } if ( is_null ( $ selected ) ) { $ selected = new GenericParser ( ) ; } $ selected -> setRequest ( $ this ) ; $ this -> parser = $ selected ; }
Pick a content type parser from the list .
25,748
public function create ( $ resource ) { $ className = $ this -> getResourceClassName ( $ resource -> type ) ; if ( ! class_exists ( $ className ) ) { throw new Exception ( 'Unknown resource type "' . $ resource -> type . '".' , Exception :: UNKNOWN_RESOURCE_TYPE ) ; } $ object = $ this -> objectManager -> get ( $ className ) ; foreach ( $ resource as $ property => $ value ) { if ( ! ObjectAccess :: isPropertySettable ( $ object , $ property ) ) { continue ; } ObjectAccess :: setProperty ( $ object , $ property , $ value ) ; } $ this -> postProcessResources ( $ object ) ; return $ object ; }
Create a Resource object from the supplied resource .
25,749
public function getPeriod ( $ period , $ mode = self :: DAYS_ONLY ) { $ result = $ this -> parsePeriod ( $ period ) ; if ( $ result [ 'max' ] && $ mode == self :: DAYS_AND_TIME ) { $ result [ 'max' ] -> modify ( "+1 day -1 second" ) ; } foreach ( $ result as $ key => $ value ) { if ( ! $ value ) { unset ( $ result [ $ key ] ) ; } elseif ( $ mode == self :: DAYS_ONLY ) { $ result [ $ key ] = new DateTime ( $ result [ $ key ] -> format ( 'Y-m-d' ) , $ this -> getTimezoneTo ( ) ) ; } elseif ( $ this -> getTimezoneTo ( ) ) { $ result [ $ key ] -> setTimezone ( $ this -> getTimezoneTo ( ) ) ; } } return $ result ; }
Calculate min and max dates and return them as DateTime objects .
25,750
public function transcode ( $ input , $ format , $ outputFile , $ pageRange = null ) { if ( ! file_exists ( $ input ) ) { throw new InvalidFileArgumentException ( sprintf ( 'File %s does not exists' , $ input ) ) ; } $ arguments = array ( '--format=' . $ format , '--stdout' ) ; if ( preg_match ( '/\d+-\d+/' , $ pageRange ) ) { $ arguments [ ] = '-e' ; $ arguments [ ] = 'PageRange=' . $ pageRange ; } $ arguments [ ] = $ input ; try { $ output = $ this -> command ( $ arguments ) ; } catch ( ExecutionFailureException $ e ) { throw new RuntimeException ( 'Unoconv failed to transcode file' , $ e -> getCode ( ) , $ e ) ; } if ( ! is_writable ( dirname ( $ outputFile ) ) || ! file_put_contents ( $ outputFile , $ output ) ) { throw new RuntimeException ( sprintf ( 'Unable to write to output file `%s`' , $ outputFile ) ) ; } return $ this ; }
Transcodes a file to another format
25,751
public function checkDependencies ( array $ requiredBundles , ContainerBuilder $ container ) { if ( false === ( $ this instanceof Bundle ) ) { throw new RuntimeException ( 'It is a bundle trait, you shouldn\'t have to use in other instances' ) ; } $ enabledBundles = $ container -> getParameter ( 'kernel.bundles' ) ; foreach ( $ requiredBundles as $ requiredBundle ) { if ( ! isset ( $ enabledBundles [ $ requiredBundle ] ) ) { throw new RuntimeException ( sprintf ( 'In order to use "%s" you also need to enable and configure the "%s"' , $ this -> getName ( ) , $ requiredBundle ) ) ; } } }
Checks the given bundles are enabled in the container .
25,752
public function loadFromFlexiBee ( $ id = null ) { $ result = $ this -> adresar -> loadFromFlexiBee ( $ id ) ; $ this -> takeData ( $ this -> adresar -> getData ( ) ) ; return $ result ; }
Load Customer from FlexiBee
25,753
public function getCustomerScore ( $ addressID ) { $ score = 0 ; $ debts = $ this -> getCustomerDebts ( $ addressID ) ; $ stitkyRaw = $ this -> adresar -> getColumnsFromFlexiBee ( [ 'stitky' ] , [ 'id' => $ addressID ] ) ; $ stitky = $ stitkyRaw [ 0 ] [ 'stitky' ] ; if ( ! empty ( $ debts ) ) { foreach ( $ debts as $ did => $ debt ) { $ ddiff = \ FlexiPeeHP \ FakturaVydana :: overdueDays ( $ debt [ 'datSplat' ] ) ; if ( ( $ ddiff <= 7 ) && ( $ ddiff >= 1 ) ) { $ score = self :: maxScore ( $ score , 1 ) ; } else { if ( ( $ ddiff > 7 ) && ( $ ddiff <= 14 ) ) { $ score = self :: maxScore ( $ score , 2 ) ; } else { if ( $ ddiff > 14 ) { $ score = self :: maxScore ( $ score , 3 ) ; } } } } } if ( $ score == 3 && ! strstr ( $ stitky , 'UPOMINKA2' ) ) { $ score = 2 ; } if ( ! strstr ( $ stitky , 'UPOMINKA1' ) && ! empty ( $ debts ) ) { $ score = 1 ; } return $ score ; }
Obtain Customer Score
25,754
public function getUserEmail ( ) { return strlen ( $ this -> kontakt -> getDataValue ( $ this -> mailColumn ) ) ? $ this -> kontakt -> getDataValue ( $ this -> mailColumn ) : $ this -> adresar -> getDataValue ( $ this -> mailColumn ) ; }
Retrun user s mail address .
25,755
public function getListQueuedTask ( ) { $ result = [ ] ; if ( ! CakeSession :: check ( $ this -> _sessionKey ) ) { return $ result ; } $ tasks = CakeSession :: read ( $ this -> _sessionKey ) ; if ( ! is_array ( $ tasks ) ) { return $ result ; } return $ tasks ; }
Get list of queued tasks .
25,756
public function deleteQueuedTask ( $ tasks = [ ] ) { if ( empty ( $ tasks ) || ! is_array ( $ tasks ) ) { return false ; } if ( ! CakeSession :: check ( $ this -> _sessionKey ) ) { return false ; } $ existsTasks = CakeSession :: read ( $ this -> _sessionKey ) ; if ( empty ( $ existsTasks ) ) { return false ; } $ resultTasks = array_values ( array_diff ( ( array ) $ existsTasks , $ tasks ) ) ; return CakeSession :: write ( $ this -> _sessionKey , $ resultTasks ) ; }
Delete queued tasks .
25,757
public static function parseChartMask ( $ mask ) { $ result = [ ] ; $ arrayParts = explode ( '|' , $ mask ) ; foreach ( $ arrayParts as $ partOfMask ) { $ arrayLib = explode ( '~' , $ partOfMask ) ; $ result [ ] = [ 'size' => ( int ) $ arrayLib [ 0 ] , 'suffixe' => $ arrayLib [ 1 ] ] ; } return $ result ; }
Parse a type of a libRecord
25,758
public static function getValues ( $ mask , $ value ) { $ parse = self :: parseChartMask ( $ mask ) ; $ negative = 0 === strpos ( $ value , '-' ) ; $ value = $ negative ? ( int ) substr ( $ value , 1 ) : $ value ; $ data = [ ] ; $ laValue = $ value ; for ( $ k = count ( $ parse ) - 1 ; $ k >= 0 ; $ k -- ) { $ size = $ parse [ $ k ] [ 'size' ] ; if ( strlen ( $ laValue ) > $ size ) { $ result = substr ( $ laValue , strlen ( $ laValue ) - $ size , $ size ) ; $ laValue = substr ( $ laValue , 0 , strlen ( $ laValue ) - $ size ) ; } else { if ( $ k !== 0 ) { $ result = str_pad ( $ laValue , $ size , '0' , STR_PAD_LEFT ) ; $ laValue = '' ; } else { $ result = $ laValue ; if ( '' === $ laValue ) { $ result = '0' ; } if ( $ negative ) { $ result = '-' . $ result ; } } } if ( $ value === null ) { $ result = '' ; } $ data [ ] = [ 'value' => $ result ] ; } return array_reverse ( $ data ) ; }
Transform a value for the form
25,759
public static function formToBdd ( $ mask , $ values ) { $ parse = self :: parseChartMask ( $ mask ) ; $ nbInput = count ( $ parse ) ; $ value = '' ; foreach ( $ values as $ row ) { $ value .= $ row [ 'value' ] ; } if ( $ value == '' ) { return null ; } if ( $ nbInput === 1 ) { return $ values [ 0 ] [ 'value' ] ; } $ value = '' ; for ( $ k = 0 ; $ k <= $ nbInput - 1 ; $ k ++ ) { $ part = $ values [ $ k ] [ 'value' ] ; $ length = $ parse [ $ k ] [ 'size' ] ; if ( strlen ( $ part ) < $ length ) { if ( $ k === 0 ) { if ( $ part === '' ) { $ part = '0' ; } } else { if ( $ k === $ nbInput - 1 ) { $ part = str_pad ( $ part , $ length , '0' , STR_PAD_RIGHT ) ; } else { $ part = str_pad ( $ part , $ length , '0' , STR_PAD_LEFT ) ; } } } $ value .= $ part ; } return $ value ; }
Transform values to insert database
25,760
public function render ( $ content , $ class = '' , $ id = '' , array $ attrs = array ( ) ) { $ attrs = $ this -> _setId ( $ attrs , $ id ) ; $ attrs = $ this -> _cleanAttrs ( $ attrs ) ; if ( ! empty ( $ class ) ) { $ attrs = $ this -> _normalizeClassAttr ( $ attrs , $ class ) ; } $ tag = $ this -> _tag ; if ( Arr :: key ( 'tag' , $ attrs ) ) { $ tag = $ attrs [ 'tag' ] ; unset ( $ attrs [ 'tag' ] ) ; } $ format = ( ! empty ( $ attrs ) ) ? '<%s %s>%s</%s>' : '<%s%s>%s</%s>' ; $ output = sprintf ( $ format , $ tag , $ this -> buildAttrs ( $ attrs ) , $ content , $ tag ) ; return $ output ; }
Create html tag .
25,761
public function onPlayerConnect ( $ login , $ isSpectator = false , $ dispatch = true ) { try { $ playerData = $ this -> playerStorage -> getPlayerInfo ( $ login ) ; } catch ( \ Exception $ e ) { return ; } $ this -> playerStorage -> onPlayerConnect ( $ playerData ) ; if ( $ dispatch ) { $ this -> dispatch ( __FUNCTION__ , [ $ playerData ] ) ; } }
Called when a player connects
25,762
public function onPlayerDisconnect ( $ login , $ disconnectionReason ) { $ playerData = $ this -> playerStorage -> getPlayerInfo ( $ login ) ; if ( $ playerData -> getPlayerId ( ) == 0 ) { $ this -> application -> stopApplication ( ) ; return ; } $ this -> playerStorage -> onPlayerDisconnect ( $ playerData , $ disconnectionReason ) ; $ this -> dispatch ( __FUNCTION__ , [ $ playerData , $ disconnectionReason ] ) ; }
Called when a player disconnects
25,763
public function onPlayerAlliesChanged ( $ login ) { $ playerData = $ this -> playerStorage -> getPlayerInfo ( $ login ) ; $ newPlayerData = $ this -> playerStorage -> getPlayerInfo ( $ login , true ) ; $ this -> playerStorage -> onPlayerAlliesChanged ( $ playerData , $ newPlayerData ) ; $ this -> dispatch ( __FUNCTION__ , [ $ playerData , $ newPlayerData ] ) ; }
When player changes allies .
25,764
public function createManialinkAction ( ManialinkInterface $ manialink , $ callable , $ args , $ permanent = false ) { $ class = $ this -> class ; $ action = new $ class ( $ callable , $ args , $ permanent ) ; $ this -> actions [ $ action -> getId ( ) ] = $ action ; $ this -> actionsByManialink [ $ manialink -> getId ( ) ] [ $ action -> getId ( ) ] = $ action ; $ this -> manialinkByAction [ $ action -> getId ( ) ] = $ manialink ; return $ action -> getId ( ) ; }
Create a Manialink action for a manialink .
25,765
public function destroyManialinkActions ( ManialinkInterface $ manialink ) { if ( isset ( $ this -> actionsByManialink [ $ manialink -> getId ( ) ] ) ) { foreach ( $ this -> actionsByManialink [ $ manialink -> getId ( ) ] as $ actionId => $ action ) { unset ( $ this -> actions [ $ actionId ] ) ; unset ( $ this -> manialinkByAction [ $ actionId ] ) ; } unset ( $ this -> actionsByManialink [ $ manialink -> getId ( ) ] ) ; } }
Destroy all actions for a manialink .
25,766
public function destroyNotPermanentActions ( ManialinkInterface $ manialink ) { if ( isset ( $ this -> actionsByManialink [ $ manialink -> getId ( ) ] ) ) { foreach ( $ this -> actionsByManialink [ $ manialink -> getId ( ) ] as $ actionId => $ action ) { if ( ! $ action -> isPermanent ( ) ) { $ this -> destroyAction ( $ actionId ) ; } } } }
Destroy actions that are not permanent actions .
25,767
public function destroyAction ( $ actionId ) { if ( isset ( $ this -> manialinkByAction [ $ actionId ] ) ) { unset ( $ this -> actionsByManialink [ $ this -> manialinkByAction [ $ actionId ] -> getId ( ) ] [ $ actionId ] ) ; unset ( $ this -> actions [ $ actionId ] ) ; } }
Destroy an individual action .
25,768
public function onMapRatingsLoaded ( $ ratings ) { $ this -> widget -> setMapRatings ( $ ratings ) ; $ this -> widget -> update ( $ this -> players ) ; }
Called when map ratings are loaded .
25,769
public function onMapRatingsChanged ( $ login , $ score , $ ratings ) { $ this -> widget -> setMapRatings ( $ ratings ) ; $ this -> widget -> update ( $ this -> players ) ; }
Called when map ratings are changed .
25,770
public function addCallback ( string $ name , $ callback ) { if ( ! is_object ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Given callback must be an object' ) ; } $ this -> callbacks [ $ name ] = $ callback ; }
register a new instance as callback
25,771
private function callback ( string $ name ) { if ( ! $ this -> hasCallback ( $ name ) ) { throw new XslCallbackException ( 'A callback with the name ' . $ name . ' does not exist.' ) ; } return $ this -> callbacks [ $ name ] ; }
returns a callback
25,772
public static function create ( string $ title , string $ link , string $ description ) : self { return new self ( $ title , $ link , $ description ) ; }
create a new stubRssFeedItem
25,773
public static function fromEntity ( $ entity , array $ overrides = [ ] ) : self { if ( ! is_object ( $ entity ) ) { throw new \ InvalidArgumentException ( 'Given entity must be an object.' ) ; } $ annotations = annotationsOf ( $ entity ) ; if ( ! $ annotations -> contain ( 'RssFeedItem' ) ) { throw new XmlException ( 'Class ' . get_class ( $ entity ) . ' is not annotated with @RssFeedItem.' ) ; } $ rssFeedItemAnnotation = $ annotations -> firstNamed ( 'RssFeedItem' ) ; $ self = new self ( $ overrides [ 'title' ] ?? self :: getRequiredAttribute ( $ entity , 'title' , $ rssFeedItemAnnotation -> getTitleMethod ( 'getTitle' ) ) , $ overrides [ 'link' ] ?? self :: getRequiredAttribute ( $ entity , 'link' , $ rssFeedItemAnnotation -> getLinkMethod ( 'getLink' ) ) , $ overrides [ 'description' ] ?? self :: getRequiredAttribute ( $ entity , 'description' , $ rssFeedItemAnnotation -> getDescriptionMethod ( 'getDescription' ) ) ) ; foreach ( self :: METHODS as $ itemMethod => $ defaultMethod ) { if ( isset ( $ overrides [ $ itemMethod ] ) ) { $ self -> $ itemMethod ( $ overrides [ $ itemMethod ] ) ; continue ; } if ( substr ( $ defaultMethod , 0 , 3 ) === 'get' ) { $ annotationMethod = $ defaultMethod . 'Method' ; } else { $ annotationMethod = 'get' . $ defaultMethod . 'Method' ; } $ entityMethod = $ rssFeedItemAnnotation -> $ annotationMethod ( $ defaultMethod ) ; if ( method_exists ( $ entity , $ entityMethod ) ) { $ self -> $ itemMethod ( $ entity -> $ entityMethod ( ) ) ; } } return $ self ; }
creates a new stubRssFeedItem from given entity
25,774
private static function getRequiredAttribute ( $ entity , string $ name , string $ method ) { if ( ! method_exists ( $ entity , $ method ) ) { throw new XmlException ( 'RSSFeedItem ' . get_class ( $ entity ) . ' does not offer a method named "' . $ method . '" to return the ' . $ name . ', but ' . $ name . ' is required.' ) ; } return $ entity -> $ method ( ) ; }
helper method to retrieve a required attribute
25,775
public function byAuthor ( string $ author ) : self { if ( ! strstr ( $ author , '@' ) ) { $ this -> author = 'nospam@example.com (' . $ author . ')' ; } else { $ this -> author = $ author ; } return $ this ; }
set the email address of the author of the item who created the item
25,776
public function inCategory ( string $ category , string $ domain = '' ) : self { $ this -> categories [ ] = [ 'category' => $ category , 'domain' => $ domain ] ; return $ this ; }
set one or more categories where the item is included into
25,777
public function inCategories ( array $ categories ) : self { foreach ( $ categories as $ category ) { if ( is_array ( $ category ) ) { $ this -> inCategory ( $ category [ 'category' ] , $ category [ 'domain' ] ) ; } else { $ this -> inCategory ( $ category ) ; } } return $ this ; }
sets categories where the item is included into
25,778
public function deliveringEnclosure ( string $ url , int $ length , string $ type ) : self { $ this -> enclosures [ ] = [ 'url' => $ url , 'length' => $ length , 'type' => $ type ] ; return $ this ; }
add an enclosure to the item
25,779
public function withGuid ( string $ guid ) : self { $ this -> guid = $ guid ; $ this -> isPermaLink = true ; return $ this ; }
set id of rss feed item
25,780
public function inspiredBySource ( string $ name , string $ url ) : self { $ this -> sources [ ] = [ 'name' => $ name , 'url' => $ url ] ; return $ this ; }
set the source where that the item came from
25,781
public static function parse ( Tag & $ Tag ) { if ( ! empty ( $ Tag -> content ) && $ Tag -> hasOption ( 'translate' ) && is_callable ( Config :: get ( 'translator' ) ) ) { $ Tag -> content = call_user_func_array ( Config :: get ( 'translator' ) , array ( $ Tag -> content , Config :: get ( 'textdomain' ) ) ) ; } if ( $ Tag -> hasOption ( 'bbContent' ) ) { self :: bb ( $ Tag -> content ) ; } if ( $ Tag -> hasOption ( 'markdown' ) ) { $ Tag -> addOption ( 'cleanContent' ) ; self :: markdown ( $ Tag -> content ) ; } if ( $ Tag -> hasOption ( 'compress' ) ) { self :: compress ( $ Tag ) ; } return $ Tag -> content ; }
Checks if any parsing method should be appended to the Tags content .
25,782
public static function bb ( & $ content ) { $ content = preg_replace ( array_flip ( self :: $ _bbs ) , self :: $ _bbs , $ content ) ; return $ content ; }
Appends the BB replacements to the tags content .
25,783
public static function markdown ( & $ content ) { if ( self :: $ MarkdownParser === null ) { if ( class_exists ( 'dflydev\markdown\MarkdownParser' ) ) { self :: $ MarkdownParser = new \ dflydev \ markdown \ MarkdownParser ; } else { self :: $ MarkdownParser = false ; } } if ( self :: $ MarkdownParser !== false ) { $ content = trim ( self :: $ MarkdownParser -> transformMarkdown ( $ content ) ) ; } return $ content ; }
Appends markdown to the tags content .
25,784
public function run ( $ sessionId = null ) { $ this -> sessionId = ( $ sessionId !== null ) ? $ sessionId : uniqid ( ) ; if ( function_exists ( 'pcntl_signal' ) ) { pcntl_signal ( SIGTERM , [ $ this , 'signalHandler' ] ) ; pcntl_signal ( SIGINT , [ $ this , 'signalHandler' ] ) ; pcntl_signal ( SIGHUP , [ $ this , 'signalHandler' ] ) ; } $ this -> daemon -> start ( ) ; }
Run as a daemon
25,785
public static function add ( Tag & $ Tag ) { if ( Config :: get ( 'store' ) == 'global' ) { self :: $ _tagStore [ $ Tag -> ID ] = & $ Tag ; } elseif ( Config :: get ( 'store' ) == 'internal' ) { Config :: getHTMLInstance ( ) -> tagStore [ $ Tag -> ID ] = & $ Tag ; } }
Pass a opened tag to the store
25,786
public static function get ( $ ID = 'latest' , $ offset = 0 ) { if ( $ ID === 'latest' ) { if ( $ offset > 0 ) { $ offset = $ offset * - 1 ; } if ( Config :: get ( 'store' ) == 'global' ) { $ k = array_splice ( @ array_keys ( self :: $ _tagStore ) , - 1 + $ offset , 1 ) ; return self :: $ _tagStore [ $ k [ 0 ] ] ; } elseif ( Config :: get ( 'store' ) == 'internal' ) { $ Store = Config :: getHTMLInstance ( ) -> tagStore ; $ k = array_splice ( @ array_keys ( $ Store ) , - 1 + $ offset , 1 ) ; return $ Store [ $ k [ 0 ] ] ; } } elseif ( is_int ( $ ID ) ) { if ( Config :: get ( 'store' ) == 'global' && isset ( self :: $ _tagStore [ $ ID ] ) ) { return self :: $ _tagStore [ $ ID ] ; } elseif ( Config :: get ( 'store' ) == 'internal' && isset ( Config :: getHTMLInstance ( ) -> tagStore [ $ ID ] ) ) { return Config :: getHTMLInstance ( ) -> tagStore [ $ ID ] ; } } return false ; }
Gets a Tag from store .
25,787
public static function remove ( Tag & $ Tag ) { if ( Config :: get ( 'store' ) == 'global' && isset ( self :: $ _tagStore [ $ Tag -> ID ] ) ) { unset ( self :: $ _tagStore [ $ Tag -> ID ] ) ; } elseif ( Config :: get ( 'store' ) == 'internal' && isset ( Config :: getHTMLInstance ( ) -> tagStore [ $ Tag -> ID ] ) ) { unset ( Config :: getHTMLInstance ( ) -> tagStore [ $ Tag -> ID ] ) ; } }
Removes the passed tag from tag store .
25,788
public static function hasTags ( ) { if ( Config :: get ( 'store' ) == 'global' ) { return count ( self :: $ _tagStore ) ; } elseif ( Config :: get ( 'store' ) == 'internal' ) { return count ( Config :: getHTMLInstance ( ) -> tagStore ) ; } }
Checks if some Tags are stored .
25,789
public function sure ( ) { $ this -> _label = null ; switch ( $ this -> called ) { case 'textarea' : $ i = 2 ; break ; default : $ i = 1 ; break ; } if ( isset ( $ this -> args [ $ i ] ) ) { $ this -> _label = $ this -> args [ $ i ] ; } return true ; }
Check if Module can be used .
25,790
public function asDom ( ) : \ DOMDocument { $ doc = new \ DOMDocument ( ) ; $ doc -> loadXML ( $ this -> writer -> outputMemory ( ) ) ; return $ doc ; }
Return the XML as a DOM
25,791
public function addItem ( string $ title , string $ link , string $ description ) : RssFeedItem { return $ this -> items [ ] = RssFeedItem :: create ( $ title , $ link , $ description ) ; }
add an item to the feed and returns it
25,792
public function addEntity ( $ entity , array $ overrides = [ ] ) : RssFeedItem { return $ this -> items [ ] = RssFeedItem :: fromEntity ( $ entity , $ overrides ) ; }
creates an item from an entity to the rss feed
25,793
public function setManagingEditor ( string $ managingEditor ) : self { if ( ! strstr ( $ managingEditor , '@' ) ) { $ this -> managingEditor = 'nospam@example.com (' . $ managingEditor . ')' ; } else { $ this -> managingEditor = $ managingEditor ; } return $ this ; }
set email address for person responsible for editorial content
25,794
public function setWebMaster ( string $ webMaster ) : self { if ( ! strstr ( $ webMaster , '@' ) ) { $ this -> webMaster = 'nospam@example.com (' . $ webMaster . ')' ; } else { $ this -> webMaster = $ webMaster ; } return $ this ; }
set email address for person responsible for technical issues relating to channel
25,795
public function setImage ( string $ url , string $ description , int $ width = 88 , int $ height = 31 ) : self { if ( 144 < $ width || 0 > $ width ) { throw new \ InvalidArgumentException ( 'Width must be a value between 0 and 144.' ) ; } if ( 400 < $ height || 0 > $ height ) { throw new \ InvalidArgumentException ( 'Height must be a value between 0 and 400.' ) ; } $ this -> image = [ 'url' => $ url , 'description' => $ description , 'width' => $ width , 'height' => $ height ] ; return $ this ; }
specify a GIF JPEG or PNG image to be displayed with the channel
25,796
public function sure ( ) { if ( $ this -> hasOption ( 'start' ) ) { $ this -> addOption ( 'doNotSelfQlose' ) ; } if ( empty ( $ this -> args [ 0 ] ) ) { $ this -> args [ 0 ] = array ( ) ; } switch ( $ this -> called ) { case 'jquery' : $ this -> called = 'script' ; $ this -> args [ 0 ] = array_merge ( array ( 'type' => 'text/javascript' , 'src' => 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' ) , $ this -> args [ 0 ] ) ; return false ; case 'jqueryui' : $ this -> called = 'script' ; $ this -> args [ 0 ] = array_merge ( array ( 'type' => 'text/javascript' , 'src' => 'https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js' ) , $ this -> args [ 0 ] ) ; return false ; default : $ this -> called = 'script' ; break ; } if ( empty ( $ this -> args [ 0 ] ) ) { return false ; } return is_array ( $ this -> args [ 0 ] ) || ! ( substr ( $ this -> args [ 0 ] , 0 , 4 ) == 'http' || substr ( $ this -> args [ 0 ] , 0 , 3 ) == '../' || substr ( $ this -> args [ 0 ] , 0 , 3 ) == '\./' || substr ( $ this -> args [ 0 ] , 0 , 2 ) == './' || substr ( $ this -> args [ 0 ] , 0 , 1 ) == '/' ) ; }
Check if Module should be used .
25,797
public static function init ( array $ initArgs = array ( ) ) { if ( ! self :: $ _initiated ) { if ( ! defined ( 'XIPHE_HTML_BASE_FOLDER' ) ) { define ( 'XIPHE_HTML_BASE_FOLDER' , dirname ( __DIR__ ) . DIRECTORY_SEPARATOR ) ; } foreach ( self :: getThemasterSettings ( ) as $ key => $ s ) { if ( is_array ( $ s ) && isset ( $ s [ 'default' ] ) ) { self :: $ _defaults [ $ key ] = $ s [ 'default' ] ; } } $ config = array ( ) ; if ( file_exists ( XIPHE_HTML_BASE_FOLDER . 'config.php' ) ) { call_user_func ( function ( ) use ( & $ config ) { include XIPHE_HTML_BASE_FOLDER . 'config.php' ; } ) ; } elseif ( ! file_exists ( XIPHE_HTML_BASE_FOLDER . 'config-sample.php' ) ) { self :: _createSampleConfig ( ) ; } if ( ! is_array ( $ config ) ) { Generator :: debug ( '$config is not an array.' , 3 , 7 ) ; $ config = array ( ) ; } $ defaults = array_merge ( self :: $ _defaults , $ config ) ; foreach ( self :: $ _defaults as $ k => $ v ) { self :: $ _config [ $ k ] = ( isset ( $ initArgs [ $ k ] ) ? $ initArgs [ $ k ] : $ defaults [ $ k ] ) ; } self :: $ _initiated = true ; } }
One - time - initiation for this Class .
25,798
public static function ajax ( $ activate = true ) { if ( $ activate && ! in_array ( 'ajax' , self :: $ modes ) ) { self :: setMode ( 'ajax' ) ; } else { self :: unsetMode ( 'ajax' ) ; } }
Activates or deactivates the ajax mode .
25,799
public static function get ( $ key , $ preferGlobal = false ) { if ( ! self :: $ _initiated ) { self :: init ( ) ; } if ( ! isset ( self :: $ _config [ $ key ] ) ) { return null ; } foreach ( self :: $ modes as $ mode ) { if ( isset ( self :: $ modeSettings [ $ mode ] [ $ key ] ) ) { return self :: $ modeSettings [ $ mode ] [ $ key ] ; } } if ( ! $ preferGlobal && self :: $ _CurrentHTMLInstance && isset ( self :: $ _CurrentHTMLInstance -> $ key ) ) { return self :: $ _CurrentHTMLInstance -> $ key ; } else { if ( class_exists ( 'Xiphe\THEMASTER\core\THE' ) && class_exists ( TM \ THE :: WPSETTINGS ) ) { try { return TM \ THEWPSETTINGS :: sGet_setting ( $ key , XIPHE_HTML_TEXTID ) ; } catch ( \ Exception $ c ) { return self :: $ _config [ $ key ] ; } } return self :: $ _config [ $ key ] ; } }
Getter for the current value for the requested key .