idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
36,600 | public function isTrue ( IO $ io , Repository $ repository ) : bool { $ result = $ this -> processor -> run ( $ this -> command ) ; return $ result -> isSuccessful ( ) ; } | Evaluates a condition |
36,601 | public function pass ( CommitMessage $ msg ) : bool { if ( ! $ msg -> isEmpty ( ) ) { $ firstLetter = substr ( $ msg -> getSubject ( ) , 0 , 1 ) ; return $ firstLetter === strtoupper ( $ firstLetter ) ; } return false ; } | Check if commit message starts with upper case letter |
36,602 | public function get ( string $ name , $ default = null ) { return isset ( $ this -> options [ $ name ] ) ? $ this -> options [ $ name ] : $ default ; } | Return a option value |
36,603 | public function pass ( CommitMessage $ msg ) : bool { $ lineNr = 1 ; foreach ( $ msg -> getBodyLines ( ) as $ line ) { if ( strlen ( $ line ) > $ this -> maxLength ) { $ this -> hint .= PHP_EOL . 'Line ' . $ lineNr . ' of your body exceeds the max line length' ; return false ; } $ lineNr ++ ; } return true ; } | Check if a body line doesn t exceed the max length limit |
36,604 | public function run ( ) : void { $ config = $ this -> getConfigToManipulate ( ) ; $ setup = $ this -> getHookSetup ( ) ; $ setup -> configureHooks ( $ config ) ; Config \ Util :: writeToDisk ( $ config ) ; $ this -> io -> write ( [ '<info>Configuration created successfully</info>' , 'Run <comment>\'vendor/bin/captainho... | Execute the configurator |
36,605 | public function getConfigToManipulate ( ) : Config { if ( ! $ this -> isExtending ( ) ) { $ this -> ensureForce ( ) ; return new Config ( $ this -> config -> getPath ( ) ) ; } return $ this -> config ; } | Return config to handle |
36,606 | private function getHookSetup ( ) : Setup { return $ this -> advanced ? new Setup \ Advanced ( $ this -> io ) : new Setup \ Express ( $ this -> io ) ; } | Return the setup handler to ask the user questions |
36,607 | private function setupConditions ( array $ conditions ) : void { foreach ( $ conditions as $ condition ) { $ this -> conditions [ ] = new Condition ( $ condition [ 'exec' ] , $ condition [ 'args' ] ?? [ ] ) ; } } | Setup action conditions |
36,608 | private function getConditionJsonData ( ) : array { $ json = [ ] ; foreach ( $ this -> conditions as $ condition ) { $ json [ ] = $ condition -> getJsonData ( ) ; } return $ json ; } | Return conditions json data |
36,609 | public function getSupportedPorts ( ) { return [ Enum :: MELLAT , Enum :: SADAD , Enum :: ZARINPAL , Enum :: PARSIAN , Enum :: PASARGAD , Enum :: SAMAN , Enum :: PAYPAL , Enum :: ASANPARDAKHT , Enum :: PAYIR ] ; } | Get supported ports |
36,610 | protected function settleRequest ( ) { $ fields = array ( 'terminalId' => $ this -> config -> get ( 'gateway.mellat.terminalId' ) , 'userName' => $ this -> config -> get ( 'gateway.mellat.username' ) , 'userPassword' => $ this -> config -> get ( 'gateway.mellat.password' ) , 'orderId' => $ this -> transactionId ( ) , '... | Send settle request |
36,611 | public static function post2https ( $ fields_arr , $ url ) { $ fields_string = '' ; foreach ( $ fields_arr as $ key => $ value ) { $ fields_string .= $ key . '=' . $ value . '&' ; } $ fields_string = substr ( $ fields_string , 0 , - 1 ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt (... | CURL POST TO HTTPS |
36,612 | function verify ( $ transaction ) { $ this -> transaction = $ transaction ; $ this -> transactionId = $ transaction -> id ; $ this -> amount = intval ( $ transaction -> price ) ; $ this -> refId = $ transaction -> ref_id ; } | Return result of payment If result is done return true otherwise throws an related exception |
36,613 | protected function newTransaction ( ) { $ uid = $ this -> getTimeId ( ) ; $ this -> transactionId = $ this -> getTable ( ) -> insert ( [ 'id' => $ uid , 'port' => $ this -> getPortName ( ) , 'price' => $ this -> amount , 'status' => Enum :: TRANSACTION_INIT , 'ip' => Request :: getClientIp ( ) , 'description' => $ this... | Insert new transaction to poolport_transactions table |
36,614 | protected function transactionSucceed ( ) { return $ this -> getTable ( ) -> whereId ( $ this -> transactionId ) -> update ( [ 'status' => Enum :: TRANSACTION_SUCCEED , 'tracking_code' => $ this -> trackingCode , 'card_number' => $ this -> cardNumber , 'payment_date' => Carbon :: now ( ) , 'updated_at' => Carbon :: now... | Commit transaction Set status field to success status |
36,615 | protected function transactionFailed ( ) { return $ this -> getTable ( ) -> whereId ( $ this -> transactionId ) -> update ( [ 'status' => Enum :: TRANSACTION_FAILED , 'updated_at' => Carbon :: now ( ) , ] ) ; } | Failed transaction Set status field to error status |
36,616 | protected function transactionSetRefId ( ) { return $ this -> getTable ( ) -> whereId ( $ this -> transactionId ) -> update ( [ 'ref_id' => $ this -> refId , 'updated_at' => Carbon :: now ( ) , ] ) ; } | Update transaction refId |
36,617 | protected function makeCallback ( $ url , array $ query ) { return $ this -> url_modify ( array_merge ( $ query , [ '_token' => csrf_token ( ) ] ) , url ( $ url ) ) ; } | Add query string to a url |
36,618 | protected function verifyPayment ( ) { try { $ payment_id = \ Session :: get ( 'paypal_payment_id' ) ; \ Session :: forget ( 'paypal_payment_id' ) ; if ( ! $ this -> refId ( ) || ! $ this -> trackingCode ( ) ) { return false ; } $ payment = Payment :: get ( $ payment_id , $ this -> _api_context ) ; $ execution = new Pa... | Verify user payment from paypal server |
36,619 | protected function verifyAndSettlePayment ( ) { $ username = $ this -> config -> get ( 'gateway.asanpardakht.username' ) ; $ password = $ this -> config -> get ( 'gateway.asanpardakht.password' ) ; $ encryptedCredintials = $ this -> encrypt ( "{$username},{$password}" ) ; $ params = array ( 'merchantConfigurationID' =>... | Verify and settle user payment from bank server |
36,620 | private function encrypt ( $ string = "" ) { $ key = $ this -> config -> get ( 'gateway.asanpardakht.key' ) ; $ iv = $ this -> config -> get ( 'gateway.asanpardakht.iv' ) ; try { $ soap = new SoapClient ( "https://services.asanpardakht.net/paygate/internalutils.asmx?WSDL" ) ; $ params = array ( 'aesKey' => $ key , 'aes... | Encrypt string by key and iv from config |
36,621 | private function decrypt ( $ string = "" ) { $ key = $ this -> config -> get ( 'gateway.asanpardakht.key' ) ; $ iv = $ this -> config -> get ( 'gateway.asanpardakht.iv' ) ; try { $ soap = new SoapClient ( "https://services.asanpardakht.net/paygate/internalutils.asmx?WSDL" ) ; $ params = array ( 'aesKey' => $ key , 'aes... | Decrypt string by key and iv from config |
36,622 | protected function setServer ( ) { $ server = $ this -> config -> get ( 'gateway.zarinpal.server' , 'germany' ) ; switch ( $ server ) { case 'iran' : $ this -> serverUrl = $ this -> iranServer ; break ; case 'test' : $ this -> serverUrl = $ this -> sandboxServer ; $ this -> gateUrl = $ this -> sandboxGateUrl ; break ; ... | Set server for soap transfers data |
36,623 | protected function createCacheAdapter ( ) { $ adapter = new Adapter \ File ( $ this -> options [ 'files_cache_directory' ] ) ; $ adapter -> setOption ( 'ttl' , $ this -> options [ 'files_cache_ttl' ] ) ; return new Cache ( $ adapter ) ; } | Create a cache to store the broker session id . |
36,624 | protected function validateBrokerSessionId ( $ sid ) { $ matches = null ; if ( ! preg_match ( '/^SSO-(\w*+)-(\w*+)-([a-z0-9]*+)$/' , $ this -> getBrokerSessionID ( ) , $ matches ) ) { return $ this -> fail ( "Invalid session id" ) ; } $ brokerId = $ matches [ 1 ] ; $ token = $ matches [ 2 ] ; if ( $ this -> generateSes... | Validate the broker session id |
36,625 | public function userInfo ( ) { $ this -> startBrokerSession ( ) ; $ user = null ; $ username = $ this -> getSessionData ( 'sso_user' ) ; if ( $ username ) { $ user = $ this -> getUserInfo ( $ username ) ; if ( ! $ user ) return $ this -> fail ( "User not found" , 500 ) ; } header ( 'Content-type: application/json; char... | Ouput user information as json . |
36,626 | protected function getBrokerInfo ( $ brokerId ) { return isset ( self :: $ brokers [ $ brokerId ] ) ? self :: $ brokers [ $ brokerId ] : null ; } | Get the API secret of a broker and other info |
36,627 | protected function getUserInfo ( $ username ) { if ( ! isset ( self :: $ users [ $ username ] ) ) return null ; $ user = compact ( 'username' ) + self :: $ users [ $ username ] ; unset ( $ user [ 'password' ] ) ; return $ user ; } | Get the user information |
36,628 | protected function getSessionId ( ) { if ( ! isset ( $ this -> token ) ) return null ; $ checksum = hash ( 'sha256' , 'session' . $ this -> token . $ this -> secret ) ; return "SSO-{$this->broker}-{$this->token}-$checksum" ; } | Generate session id from session key |
36,629 | public function append ( array $ selectors , $ declarationsBlock , $ media = '' ) { $ selectorsAsKeys = \ array_flip ( $ selectors ) ; $ mediaRule = $ this -> getOrCreateMediaRuleToAppendTo ( $ media ) ; $ lastRuleBlock = \ end ( $ mediaRule -> ruleBlocks ) ; $ hasSameDeclarationsAsLastRule = $ lastRuleBlock !== false ... | Appends a declaration block to the CSS . |
36,630 | public function renderBodyContent ( ) { $ htmlWithPossibleErroneousClosingTags = $ this -> domDocument -> saveHTML ( $ this -> getBodyElement ( ) ) ; $ bodyNodeHtml = $ this -> removeSelfClosingTagsClosingTags ( $ htmlWithPossibleErroneousClosingTags ) ; return \ str_replace ( [ '<body>' , '</body>' ] , '' , $ bodyNode... | Renders the content of the BODY element of the normalized and processed HTML . |
36,631 | private function prepareHtmlForDomConversion ( $ html ) { $ htmlWithSelfClosingSlashes = $ this -> ensurePhpUnrecognizedSelfClosingTagsAreXml ( $ html ) ; $ htmlWithDocumentType = $ this -> ensureDocumentType ( $ htmlWithSelfClosingSlashes ) ; return $ this -> addContentTypeMetaTag ( $ htmlWithDocumentType ) ; } | Returns the HTML with added document type Content - Type meta tag and self - closing slashes if needed ensuring that the HTML will be good for creating a DOM document from it . |
36,632 | private function removeImportantAnnotationFromAllInlineStyles ( \ DOMXPath $ xPath ) { foreach ( $ this -> getAllNodesWithStyleAttribute ( $ xPath ) as $ node ) { $ this -> removeImportantAnnotationFromNodeInlineStyle ( $ node ) ; } } | Searches for all nodes with a style attribute and removes the !important annotations out of the inline style declarations eventually by rearranging declarations . |
36,633 | private function getCssRuleMatches ( $ css ) { $ ruleMatches = [ ] ; $ splitCss = $ this -> splitCssAndMediaQuery ( $ css ) ; foreach ( $ splitCss as $ cssPart ) { \ preg_match_all ( '/(?:^|[\\s^{}]*)([^{]+){([^}]*)}/mi' , $ cssPart [ 'css' ] , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ cssRule ) { $ ruleM... | Parses a string of CSS into the media query selectors and declarations for each ruleset in order . |
36,634 | public function removeUnprocessableHtmlTag ( $ tagName ) { $ key = \ array_search ( $ tagName , $ this -> unprocessableHtmlTags , true ) ; if ( $ key !== false ) { unset ( $ this -> unprocessableHtmlTags [ $ key ] ) ; } } | Drops a tag from the removal list . |
36,635 | private function fillStyleAttributesWithMergedStyles ( ) { foreach ( $ this -> styleAttributesForNodes as $ nodePath => $ styleAttributesForNode ) { $ node = $ this -> visitedNodes [ $ nodePath ] ; $ currentStyleAttributes = $ this -> parseCssDeclarationsBlock ( $ node -> getAttribute ( 'style' ) ) ; $ node -> setAttri... | Merges styles from styles attributes and style nodes and applies them to the attribute nodes |
36,636 | private function getCssFromAllStyleNodes ( \ DOMXPath $ xPath ) { $ styleNodes = $ xPath -> query ( '//style' ) ; if ( $ styleNodes === false ) { return '' ; } $ css = '' ; foreach ( $ styleNodes as $ styleNode ) { $ css .= "\n\n" . $ styleNode -> nodeValue ; $ styleNode -> parentNode -> removeChild ( $ styleNode ) ; }... | Returns CSS content . |
36,637 | private function removeUnprocessableTags ( ) { foreach ( $ this -> unprocessableHtmlTags as $ tagName ) { $ nodes = [ ] ; foreach ( $ this -> domDocument -> getElementsByTagName ( $ tagName ) as $ node ) { $ nodes [ ] = $ node ; } foreach ( $ nodes as $ node ) { $ hasContent = $ node -> hasChildNodes ( ) || $ node -> h... | Removes empty unprocessable tags from the DOM document . |
36,638 | private function ensureDocumentType ( $ html ) { $ hasDocumentType = \ stripos ( $ html , '<!DOCTYPE' ) !== false ; if ( $ hasDocumentType ) { return $ html ; } return static :: DEFAULT_DOCUMENT_TYPE . $ html ; } | Makes sure that the passed HTML has a document type . |
36,639 | private function addContentTypeMetaTag ( $ html ) { $ hasContentTypeMetaTag = \ stripos ( $ html , 'Content-Type' ) !== false ; if ( $ hasContentTypeMetaTag ) { return $ html ; } $ hasHeadTag = \ stripos ( $ html , '<head' ) !== false ; $ hasHtmlTag = \ stripos ( $ html , '<html' ) !== false ; if ( $ hasHeadTag ) { $ r... | Adds a Content - Type meta tag for the charset . |
36,640 | public function convertCssToVisualAttributes ( ) { foreach ( $ this -> getAllNodesWithStyleAttribute ( ) as $ node ) { $ inlineStyleDeclarations = $ this -> parseCssDeclarationsBlock ( $ node -> getAttribute ( 'style' ) ) ; $ this -> mapCssToHtmlAttributes ( $ inlineStyleDeclarations , $ node ) ; } return $ this ; } | Maps the CSS from the style nodes to visual HTML attributes . |
36,641 | private function mapSimpleCssProperty ( $ property , $ value , \ DOMElement $ node ) { if ( ! isset ( $ this -> cssToHtmlMap [ $ property ] ) ) { return false ; } $ mapping = $ this -> cssToHtmlMap [ $ property ] ; $ nodesMatch = ! isset ( $ mapping [ 'nodes' ] ) || \ in_array ( $ node -> nodeName , $ mapping [ 'nodes'... | Looks up the CSS property in the mapping table and maps it if it matches the conditions . |
36,642 | public function setHtml ( $ html ) { if ( ! \ is_string ( $ html ) ) { throw new \ InvalidArgumentException ( 'The provided HTML must be a string.' , 1540403913 ) ; } if ( $ html === '' ) { throw new \ InvalidArgumentException ( 'The provided HTML must not be empty.' , 1540403910 ) ; } $ this -> createUnifiedDomDocumen... | Sets the HTML to process . |
36,643 | private function postProcess ( \ DOMXPath $ xPath ) { if ( $ this -> shouldMapCssToHtml ) { $ this -> mapAllInlineStylesToHtmlAttributes ( $ xPath ) ; } if ( $ this -> shouldRemoveInvisibleNodes ) { $ this -> removeInvisibleNodes ( $ xPath ) ; } } | Applies some optional post - processing to the HTML in the DOM document . |
36,644 | private function mapAllInlineStylesToHtmlAttributes ( \ DOMXPath $ xPath ) { foreach ( $ this -> getAllNodesWithStyleAttribute ( $ xPath ) as $ node ) { $ inlineStyleDeclarations = $ this -> parseCssDeclarationsBlock ( $ node -> getAttribute ( 'style' ) ) ; $ this -> mapCssToHtmlAttributes ( $ inlineStyleDeclarations ,... | Searches for all nodes with a style attribute transforms the CSS found to HTML attributes and adds those attributes to each node . |
36,645 | private function mapWidthOrHeightProperty ( \ DOMElement $ node , $ value , $ property ) { if ( \ preg_match ( '/^\\d+(px|%)$/' , $ value ) ) { $ number = \ preg_replace ( '/[^0-9.%]/' , '' , $ value ) ; $ node -> setAttribute ( $ property , $ number ) ; } } | Maps the width or height CSS properties to visual HTML attributes . |
36,646 | private function translateCssToXpath ( $ cssSelector ) { $ paddedSelector = ' ' . $ cssSelector . ' ' ; $ lowercasePaddedSelector = \ preg_replace_callback ( '/\\s+\\w+\\s+/' , function ( array $ matches ) { return \ strtolower ( $ matches [ 0 ] ) ; } , $ paddedSelector ) ; $ trimmedLowercaseSelector = \ trim ( $ lower... | Maps a CSS selector to an XPath query string . |
36,647 | public function addPageRange ( $ start , $ end = null , $ handle = null , $ qualifier = null , $ rotation = null ) { $ this -> checkExecutionStatus ( ) ; if ( is_array ( $ start ) ) { if ( $ handle !== null ) { $ start = array_map ( function ( $ p ) use ( $ handle ) { return $ handle . $ p ; } , $ start ) ; } $ range =... | Add a page range as used by some operations |
36,648 | protected function processInputFiles ( ) { $ passwords = array ( ) ; foreach ( $ this -> _files as $ handle => $ file ) { $ this -> addArg ( $ handle . '=' , $ file [ 'name' ] ) ; if ( $ file [ 'password' ] !== null ) { $ passwords [ $ handle ] = $ file [ 'password' ] ; } } if ( $ passwords !== array ( ) ) { $ this -> ... | Process input PDF files and create respective command arguments |
36,649 | protected function processOptions ( $ filename = null ) { if ( $ filename !== null ) { $ this -> addArg ( 'output' , $ filename , true ) ; } foreach ( $ this -> _options as $ option ) { if ( is_array ( $ option ) ) { $ this -> addArg ( $ option [ 0 ] , $ option [ 1 ] , $ option [ 2 ] ) ; } else { $ this -> addArg ( $ o... | Process options and create respective command arguments |
36,650 | protected function processOperation ( ) { if ( $ this -> _operation !== null ) { $ value = $ this -> _operationArgument ? $ this -> _operationArgument : null ; if ( $ value instanceof TmpFile ) { $ value = ( string ) $ value ; } $ this -> addArg ( $ this -> _operation , $ value , $ this -> _escapeOperationArgument ) ; ... | Process opearation and create respective command arguments |
36,651 | public function burst ( $ filepattern = null ) { $ this -> constrainSingleFile ( ) ; $ this -> getCommand ( ) -> setOperation ( 'burst' ) ; $ this -> _output = $ filepattern === null ? 'pg_%04d.pdf' : $ filepattern ; return $ this -> execute ( ) ; } | Split the PDF document into pages |
36,652 | public function generateFdfFile ( $ name ) { $ this -> constrainSingleFile ( ) ; $ this -> getCommand ( ) -> setOperation ( 'generate_fdf' ) ; $ this -> _output = $ name ; return $ this -> execute ( ) ; } | Generate the FDF file for a single PDF file . |
36,653 | public function fillForm ( $ data , $ encoding = 'UTF-8' , $ dropXfa = true , $ format = 'xfdf' ) { $ this -> constrainSingleFile ( ) ; if ( is_array ( $ data ) ) { $ className = '\mikehaertl\pdftk\\' . ( $ format === 'xfdf' ? 'XfdfFile' : 'FdfFile' ) ; $ data = new $ className ( $ data , null , null , null , $ encodin... | Fill a PDF form |
36,654 | public function background ( $ file ) { $ this -> constrainSingleFile ( ) ; $ this -> getCommand ( ) -> setOperation ( 'background' ) -> setOperationArgument ( $ file , true ) ; return $ this ; } | Apply a PDF as watermark to the background of a single PDF file . |
36,655 | public function saveAs ( $ name ) { if ( ! $ this -> getCommand ( ) -> getExecuted ( ) && ! $ this -> execute ( ) ) { return false ; } $ tmpFile = ( string ) $ this -> getTmpFile ( ) ; if ( ! copy ( $ tmpFile , $ name ) ) { $ this -> _error = "Could not copy PDF from tmp location '$tmpFile' to '$name'" ; return false ;... | Execute the operation and save the output file |
36,656 | protected function writeFields ( $ fp , $ fields ) { foreach ( $ fields as $ key => $ value ) { if ( is_array ( $ value ) ) { fwrite ( $ fp , "<field name=\"$key\">\n" ) ; $ this -> writeFields ( $ fp , $ value ) ; fwrite ( $ fp , "</field>\n" ) ; } else { fwrite ( $ fp , "<field name=\"$key\">\n<value>$value</value>\n... | Write the fields to the given filepointer |
36,657 | public static function parse ( $ input ) { if ( strncmp ( '---' , $ input , 3 ) === 0 ) { $ blocks = preg_split ( '/^---(\r\n|\n|\r)(?=FieldType:)/m' , substr ( $ input , 3 ) ) ; return array_map ( '\mikehaertl\pdftk\DataFields::parseBlock' , $ blocks ) ; } else { return self :: parseBlock ( $ input ) ; } } | Parse the output of dump_data_fields into an array . |
36,658 | protected static function lineContinues ( $ lines , $ n , $ key ) { return in_array ( $ key , array ( 'FieldValue' , 'FieldValueDefault' ) ) && array_key_exists ( $ n + 1 , $ lines ) && ! preg_match ( '/^Field(Value|ValueDefault|Justification):/' , $ lines [ $ n + 1 ] ) ; } | Checks whether the value for the given line number continues on the next line i . e . is a multiline string . |
36,659 | public static function getIsSiteManagedSite ( $ pageId ) { $ siteFinder = GeneralUtility :: makeInstance ( SiteFinder :: class ) ; try { $ site = $ siteFinder -> getSiteByPageId ( $ pageId ) ; } catch ( SiteNotFoundException $ e ) { return false ; } return $ site instanceof Site ; } | Determines if the site where the page belongs to is managed with the TYPO3 site management . |
36,660 | protected static function applySortBy ( array $ prefixes , $ sortBy ) : array { if ( $ sortBy === 'count' || $ sortBy === '' ) { return $ prefixes ; } if ( $ sortBy === 'alpha' ) { sort ( $ prefixes ) ; return $ prefixes ; } } | Applies the configured sortBy . |
36,661 | public function log ( $ level , $ message , array $ data = [ ] ) { $ this -> getLogger ( ) -> log ( $ level , $ message , $ data ) ; $ this -> debugWriter -> write ( $ level , $ message , $ data ) ; } | Adds an entry to the LogManager |
36,662 | protected function initializeSettings ( ) { $ typoScriptService = $ this -> objectManager -> get ( TypoScriptService :: class ) ; $ this -> settings = $ typoScriptService -> convertTypoScriptArrayToPlainArray ( $ this -> typoScriptConfiguration -> getObjectByPathOrDefault ( 'plugin.tx_solr.settings.' , [ ] ) ) ; } | Inject settings of plugin . tx_solr |
36,663 | protected function initializeSearch ( ) { $ solrConnection = GeneralUtility :: makeInstance ( ConnectionManager :: class ) -> getConnectionByPageId ( $ this -> typoScriptFrontendController -> id , $ this -> typoScriptFrontendController -> sys_language_uid , $ this -> typoScriptFrontendController -> MP ) ; $ search = Ge... | Initialize the Solr connection and test the connection through a ping |
36,664 | protected function handleSolrUnavailable ( ) { if ( $ this -> typoScriptConfiguration -> getLoggingExceptions ( ) ) { $ logger = GeneralUtility :: makeInstance ( SolrLogManager :: class , __CLASS__ ) ; $ logger -> log ( SolrLogManager :: ERROR , 'Solr server is not available' ) ; } } | Called when the solr server is unavailable . |
36,665 | protected function emitActionSignal ( $ className , $ signalName , array $ signalArguments ) { return $ this -> signalSlotDispatcher -> dispatch ( $ className , $ signalName , $ signalArguments ) [ 0 ] ; } | Emits signal for various actions |
36,666 | protected function buildQueueStatisticFromResultSet ( array $ indexQueueStatisticResultSet ) : QueueStatistic { $ statistic = GeneralUtility :: makeInstance ( QueueStatistic :: class ) ; foreach ( $ indexQueueStatisticResultSet as $ row ) { if ( $ row [ 'failed' ] == 1 ) { $ statistic -> setFailedCount ( ( int ) $ row ... | Instantiates and fills QueueStatistic with values |
36,667 | protected function getSubPageIds ( $ pageId ) { $ queryGenerator = GeneralUtility :: makeInstance ( QueryGenerator :: class ) ; $ permissionClause = ' 1 ' . BackendUtility :: BEenableFields ( 'pages' ) ; $ treePageIdList = $ queryGenerator -> getTreeList ( $ pageId , 20 , 0 , $ permissionClause ) ; $ treePageIds = arra... | When the extend to subpages flag was set we determine the affected subpages and return them . |
36,668 | protected function isRecursivePageUpdateRequired ( $ pageId , $ changedFields ) { $ isRecursiveUpdateRequired = $ this -> isRecursiveUpdateRequired ( $ pageId , $ changedFields ) ; if ( $ isRecursiveUpdateRequired === false ) { $ solrConfiguration = Util :: getSolrConfigurationFromPageId ( $ pageId ) ; $ indexQueueConf... | Checks if a page update will trigger a recursive update of pages |
36,669 | public function useFilterArray ( array $ filterArray ) { foreach ( $ filterArray as $ key => $ additionalFilter ) { $ this -> useFilter ( $ additionalFilter , $ key ) ; } return $ this ; } | Uses an array of filters and applies them to the query . |
36,670 | public function useFilter ( $ filterString , $ filterName = '' ) { $ filterName = $ filterName === '' ? $ filterString : $ filterName ; $ nameWasPassedAndFilterIsAllreadySet = $ filterName !== '' && $ this -> queryToBuild -> getFilterQuery ( $ filterName ) !== null ; if ( $ nameWasPassedAndFilterIsAllreadySet ) { retur... | Can be used to use a specific filter string in the solr query . |
36,671 | public function removeFilterByFieldName ( $ fieldName ) { return $ this -> removeFilterByFunction ( function ( $ key , $ query ) use ( $ fieldName ) { $ queryString = $ query -> getQuery ( ) ; $ storedFieldName = substr ( $ queryString , 0 , strpos ( $ queryString , ":" ) ) ; return $ storedFieldName == $ fieldName ; }... | Removes a filter by the fieldName . |
36,672 | public function removeFilterByValue ( $ value ) { return $ this -> removeFilterByFunction ( function ( $ key , $ query ) use ( $ value ) { $ query = $ query -> getQuery ( ) ; return $ query == $ value ; } ) ; } | Removes a filter by the filter value . |
36,673 | public static function getPageDocumentId ( $ uid , $ typeNum = 0 , $ language = 0 , $ accessGroups = '0,-1' , $ mountPointParameter = '' ) { $ additionalParameters = $ typeNum . '/' . $ language . '/' . $ accessGroups ; if ( ( string ) $ mountPointParameter !== '' ) { $ additionalParameters = $ mountPointParameter . '/... | Generates a document id for documents representing page records . |
36,674 | public static function getSolrConfigurationFromPageId ( $ pageId , $ initializeTsfe = false , $ language = 0 ) { $ rootPath = '' ; return self :: getConfigurationFromPageId ( $ pageId , $ rootPath , $ initializeTsfe , $ language ) ; } | Gets the Solr configuration for a specific root page id . To be used from the backend . |
36,675 | public static function getConfigurationFromPageId ( $ pageId , $ path , $ initializeTsfe = false , $ language = 0 , $ useTwoLevelCache = true ) { $ pageId = self :: getConfigurationPageIdToUse ( $ pageId ) ; static $ configurationObjectCache = [ ] ; $ cacheId = md5 ( $ pageId . '|' . $ path . '|' . $ language . '|' . (... | Loads the TypoScript configuration for a given page id and language . Language usage may be disabled to get the default TypoScript configuration . |
36,676 | protected static function getConfigurationPageIdToUse ( $ pageId ) { $ extensionConfiguration = GeneralUtility :: makeInstance ( ExtensionConfiguration :: class ) ; if ( $ extensionConfiguration -> getIsUseConfigurationFromClosestTemplateEnabled ( ) ) { $ configurationPageResolver = GeneralUtility :: makeInstance ( Con... | This method retrieves the closest pageId where a configuration is located when this feature is enabled . |
36,677 | protected static function buildConfigurationArray ( $ pageId , $ path , $ initializeTsfe , $ language ) { if ( $ initializeTsfe ) { self :: initializeTsfe ( $ pageId , $ language ) ; $ configurationToUse = self :: getConfigurationFromInitializedTSFE ( $ path ) ; } else { $ configurationToUse = self :: getConfigurationF... | Initializes a TSFE if required and builds an configuration array containing the solr configuration . |
36,678 | protected static function buildTypoScriptConfigurationFromArray ( array $ configurationToUse , $ pageId , $ languageId , $ typoScriptPath ) { $ configurationManager = GeneralUtility :: makeInstance ( ConfigurationManager :: class ) ; return $ configurationManager -> getTypoScriptConfiguration ( $ configurationToUse , $... | Builds the configuration object from a config array and returns it . |
36,679 | private static function getConfigurationFromExistingTSFE ( $ pageId , $ path , $ language ) { if ( is_int ( $ language ) ) { GeneralUtility :: _GETset ( $ language , 'L' ) ; } $ pageSelect = GeneralUtility :: makeInstance ( PageRepository :: class ) ; $ rootLine = $ pageSelect -> getRootLine ( $ pageId ) ; $ initialize... | This function is used to retrieve the configuration from an existing TSFE instance |
36,680 | public static function initializeTsfe ( $ pageId , $ language = 0 , $ useCache = true ) { static $ tsfeCache = [ ] ; unset ( $ GLOBALS [ 'TSFE' ] ) ; $ cacheId = $ pageId . '|' . $ language ; if ( ! is_object ( $ GLOBALS [ 'TT' ] ) ) { $ GLOBALS [ 'TT' ] = GeneralUtility :: makeInstance ( TimeTracker :: class , false )... | Initializes the TSFE for a given page ID and language . |
36,681 | public static function isAllowedPageType ( array $ pageRecord , $ configurationName = 'pages' ) { $ isAllowedPageType = false ; $ configurationName = $ configurationName ?? 'pages' ; $ allowedPageTypes = self :: getAllowedPageTypes ( $ pageRecord [ 'uid' ] , $ configurationName ) ; if ( in_array ( $ pageRecord [ 'dokty... | Check if the page type of a page record is allowed |
36,682 | public static function getAllowedPageTypes ( $ pageId , $ configurationName = 'pages' ) { $ rootPath = '' ; $ configuration = self :: getConfigurationFromPageId ( $ pageId , $ rootPath ) ; return $ configuration -> getIndexQueueAllowedPageTypesArrayByConfigurationName ( $ configurationName ) ; } | Get allowed page types |
36,683 | public static function getAbsRefPrefixFromTSFE ( TypoScriptFrontendController $ TSFE ) { $ absRefPrefix = '' ; if ( empty ( $ TSFE -> config [ 'config' ] [ 'absRefPrefix' ] ) ) { return $ absRefPrefix ; } $ absRefPrefix = trim ( $ TSFE -> config [ 'config' ] [ 'absRefPrefix' ] ) ; if ( $ absRefPrefix === 'auto' ) { $ a... | Resolves the configured absRefPrefix to a valid value and resolved if absRefPrefix is set to auto . |
36,684 | public static function containsOneOfTheStrings ( $ haystack , array $ needles ) { foreach ( $ needles as $ needle ) { $ position = strpos ( $ haystack , $ needle ) ; if ( $ position !== false ) { return true ; } } return false ; } | This function can be used to check if one of the strings in needles is contained in the haystack . |
36,685 | public function format ( $ content , $ conf ) { $ inputFormat = $ conf [ 'inputFormat' ] ? : 'Y-m-d\TH:i:s\Z' ; $ outputFormat = $ conf [ 'outputFormat' ] ? : '' ; return $ this -> formatService -> format ( $ content , $ inputFormat , $ outputFormat ) ; } | Formats a given date string to another format |
36,686 | public function findAllRootPages ( ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> select ( 'uid' , 'title' ) -> from ( $ this -> table ) -> where ( $ queryBuilder -> expr ( ) -> neq ( 'pid' , - 1 ) , $ queryBuilder -> expr ( ) -> eq ( 'is_siteroot' , 1 ) ) ; $ this -> addDefaultLanguageUidConstr... | Gets the site s root pages . The Is root of website flag must be set which usually is the case for pages with pid = 0 . |
36,687 | protected function getPageIdsFromCurrentDepthAndCallRecursive ( int $ maxDepth , int $ recursionRootPageId , array $ pageIds , string $ initialPagesAdditionalWhereClause = '' ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) -> add ( GeneralUtility :: makeInstan... | This method retrieves the pages ids from the current tree level an calls getPages recursive when the maxDepth has not been reached . |
36,688 | public function findTranslationOverlaysByPageId ( int $ pageId ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) ; $ queryBuilder -> getRestrictions ( ) -> add ( GeneralUtility :: makeInstance ( DeletedRestriction :: class ) ) ; return $ queryBuilder -> ... | Finds translation overlays by given page Id . |
36,689 | public function findPageUidsWithContentsFromPid ( int $ pageId ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) ; $ queryBuilder -> getRestrictions ( ) -> add ( GeneralUtility :: makeInstance ( DeletedRestriction :: class ) ) ; $ queryBuilder -> select ... | Finds Pages which are showing content from the page currently being updated . |
36,690 | public function findAllMountPagesByWhereClause ( string $ whereClause ) : array { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) ; $ queryBuilder -> select ( 'uid' , 'mount_pid AS mountPageSource' , 'uid AS mountPageDestination' , 'mount_pid_ol AS mountPageOverla... | Finds all pages by given where clause |
36,691 | public function createNode ( $ parentKey , $ key , $ label , $ value , $ count , $ selected ) { $ parentNode = isset ( $ this -> nodesByKey [ $ parentKey ] ) ? $ this -> nodesByKey [ $ parentKey ] : null ; $ node = new Node ( $ this , $ parentNode , $ key , $ label , $ value , $ count , $ selected ) ; $ this -> nodesBy... | Creates a new node on the right position with the right parent node . |
36,692 | public function process ( array $ values ) { $ results = [ ] ; foreach ( $ values as $ value ) { $ results = array_merge ( $ results , $ this -> getSolrRootlineForCategoryId ( $ value ) ) ; } return $ results ; } | Expects a uid ID of a category . Returns a Solr hierarchy notation for the rootline of the category ID . |
36,693 | protected function getSolrRootlineForCategoryId ( $ categoryId ) { $ categoryIdRootline = $ this -> buildCategoryIdRootline ( $ categoryId ) ; $ solrRootline = $ this -> buildSolrHierarchyFromIdRootline ( $ categoryIdRootline ) ; return $ solrRootline ; } | Returns a Solr hierarchy notation string for rootline of given category uid . |
36,694 | protected function buildCategoryIdRootline ( $ uid ) { $ rootlineIds = [ ] ; $ parentCategory = intval ( $ uid ) ; while ( $ parentCategory !== 0 ) { $ rootlineIds [ ] = $ parentCategory ; $ childCategory = $ this -> systemCategoryRepository -> findOneByUid ( $ parentCategory ) ; if ( $ childCategory === null ) { $ par... | Builds a category s rootline of parent category Ids |
36,695 | public function getCorePath ( ) { $ endpoint = $ this -> getPrimaryEndpoint ( ) ; return is_null ( $ endpoint ) ? '' : $ endpoint -> getPath ( ) . '/' . $ endpoint -> getCore ( ) ; } | Returns the path to the core solr path + core path . |
36,696 | protected function _sendRawRequest ( $ url , $ method = Request :: METHOD_GET , $ body = '' , \ Closure $ initializeRequest = null ) { $ logSeverity = SolrLogManager :: INFO ; $ exception = null ; try { $ request = $ this -> buildSolariumRequestFromUrl ( $ url , $ method ) ; if ( $ initializeRequest !== null ) { $ requ... | Method that performs an http request with the solarium client . |
36,697 | protected function writeLog ( $ logSeverity , $ message , $ url , $ solrResponse , $ exception = null , $ contentSend = '' ) { $ logData = $ this -> buildLogDataFromResponse ( $ solrResponse , $ exception , $ url , $ contentSend ) ; $ this -> logger -> log ( $ logSeverity , $ message , $ logData ) ; } | Build the log data and writes the message to the log |
36,698 | protected function buildLogDataFromResponse ( ResponseAdapter $ solrResponse , \ Exception $ e = null , $ url = '' , $ contentSend = '' ) { $ logData = [ 'query url' => $ url , 'response' => ( array ) $ solrResponse ] ; if ( $ contentSend !== '' ) { $ logData [ 'content' ] = $ contentSend ; } if ( ! empty ( $ e ) ) { $... | Parses the solr information to build data for the logger . |
36,699 | protected function performPingRequest ( $ useCache = true ) { $ cacheKey = ( string ) ( $ this ) ; if ( $ useCache && isset ( static :: $ pingCache [ $ cacheKey ] ) ) { return static :: $ pingCache [ $ cacheKey ] ; } $ pingQuery = $ this -> client -> createPing ( ) ; $ pingResult = $ this -> createAndExecuteRequest ( $... | Performs a ping request and returns the result . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.