idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
55,600 | private function buildBaseString ( $ baseURI , $ method , $ params ) { $ r = $ this -> normalizeParameters ( $ params ) ; return $ method . '&' . $ this -> encode ( $ baseURI ) . '&' . $ this -> encode ( $ r ) ; } | Build base string for OAuth 1 signature signing |
55,601 | private function generateNonce ( $ bits = 64 ) { $ result = '' ; $ accumulatedBits = 0 ; $ random = mt_getrandmax ( ) ; for ( $ totalBits = 0 ; $ random != 0 ; $ random >>= 1 ) { ++ $ totalBits ; } $ usableBits = intval ( $ totalBits / 8 ) * 8 ; while ( $ accumulatedBits < $ bits ) { $ bitsToAdd = min ( $ totalBits - $... | OAuth1 . 0 nonce generator |
55,602 | private function getCompositeKey ( ) { if ( isset ( $ this -> _access_token_secret ) && strlen ( $ this -> _access_token_secret ) > 0 ) { $ composite_key = $ this -> encode ( $ this -> _client_secret ) . '&' . $ this -> encode ( $ this -> _access_token_secret ) ; } elseif ( isset ( $ _SESSION [ 'oauth' ] [ 'token_secre... | Get composite key for OAuth 1 signature signing |
55,603 | private function getOauthHeaders ( $ includeCallback = false ) { $ oauth = array ( 'oauth_consumer_key' => $ this -> _client_id , 'oauth_nonce' => $ this -> generateNonce ( ) , 'oauth_signature_method' => 'HMAC-SHA1' , 'oauth_timestamp' => time ( ) , 'oauth_version' => '1.0' ) ; if ( isset ( $ this -> _access_token ) )... | Get OAuth 1 . 0 Headers |
55,604 | public function getEvents ( $ id , $ search = '' , array $ includeEvents = array ( ) , array $ excludeEvents = array ( ) , $ orderBy = '' , $ orderByDir = 'ASC' , $ page = 1 ) { return $ this -> fetchActivity ( '/' . $ id . '/events' , $ search , $ includeEvents , $ excludeEvents , $ orderBy , $ orderByDir , $ page ) ;... | Get a list of a contact s engagement events |
55,605 | public function getContactNotes ( $ id , $ search = '' , $ start = 0 , $ limit = 0 , $ orderBy = '' , $ orderByDir = 'ASC' ) { $ parameters = array ( 'search' => $ search , 'start' => $ start , 'limit' => $ limit , 'orderBy' => $ orderBy , 'orderByDir' => $ orderByDir , ) ; $ parameters = array_filter ( $ parameters ) ... | Get a list of a contact s notes |
55,606 | public function addDnc ( $ id , $ channel = 'email' , $ reason = Contacts :: MANUAL , $ channelId = null , $ comments = 'via API' ) { return $ this -> makeRequest ( 'contacts/' . $ id . '/dnc/' . $ channel . '/add' , array ( 'reason' => $ reason , 'channelId' => $ channelId , 'comments' => $ comments , ) , 'POST' ) ; } | Adds Do Not Contact |
55,607 | public function getSubmissionsForContact ( $ formId , $ contactId , $ search = '' , $ start = 0 , $ limit = 0 , $ orderBy = '' , $ orderByDir = 'ASC' , $ publishedOnly = false , $ minimal = false ) { $ parameters = array ( 'search' => $ search , 'start' => $ start , 'limit' => $ limit , 'orderBy' => $ orderBy , 'orderB... | Get a list of form submissions for specific form and contact |
55,608 | public function get ( $ id , $ limit = null , $ page = null , \ DateTime $ dateFrom = null , \ DateTime $ dateTo = null ) { $ options = array ( ) ; if ( $ limit ) { $ options [ 'limit' ] = ( int ) $ limit ; } if ( $ page ) { $ options [ 'page' ] = ( int ) $ page ; } if ( $ dateFrom ) { $ options [ 'dateFrom' ] = $ date... | Get a single report data |
55,609 | public function getContactEvents ( $ contactId , $ search = '' , $ start = 0 , $ limit = 0 , $ orderBy = '' , $ orderByDir = 'ASC' ) { $ parameters = array ( 'search' => $ search , 'start' => $ start , 'limit' => $ limit , 'orderBy' => $ orderBy , 'orderByDir' => $ orderByDir , ) ; $ parameters = array_filter ( $ param... | Get contact events across all campaigns |
55,610 | public function getContactCampaignEvents ( $ campaignId , $ contactId , $ search = '' , $ start = 0 , $ limit = 0 , $ orderBy = '' , $ orderByDir = 'ASC' ) { $ parameters = array ( 'search' => $ search , 'start' => $ start , 'limit' => $ limit , 'orderBy' => $ orderBy , 'orderByDir' => $ orderByDir , ) ; $ parameters =... | Get contact events for a single campaign |
55,611 | public function editContactEvent ( $ contactId , $ eventId , array $ parameters ) { return $ this -> makeRequest ( $ this -> endpoint . '/' . $ eventId . '/contact/' . $ contactId . '/edit' , $ parameters , 'PUT' ) ; } | Edit or schedule a campaign event for a specific contact . |
55,612 | public function setProxy ( $ host , $ port , $ type = CURLPROXY_HTTP ) { static $ types_str = [ 'HTTP' , 'SOCKS4' , 'SOCKS5' , 'SOCKS4A' , 'SOCKS5_HOSTNAME' ] ; $ types = [ ] ; foreach ( $ types_str as $ type_str ) { if ( defined ( 'CURLPROXY_' . $ type_str ) ) { $ types [ ] = constant ( 'CURLPROXY_' . $ type_str ) ; }... | Sets the proxy |
55,613 | protected function _parseApiParams ( $ params ) { $ apiparams = [ ] ; if ( count ( $ params ) === 0 ) { return $ apiparams ; } if ( is_array ( $ params [ 0 ] ) ) { $ apiparams = $ params [ 0 ] ; return $ apiparams ; } parse_str ( $ params [ 0 ] , $ apiparams ) ; if ( ! is_array ( $ apiparams ) ) { $ apiparams = [ ] ; }... | Parse given params detect query - style params |
55,614 | protected function _stringifyNullBoolParams ( $ apiparams ) { foreach ( $ apiparams as $ key => $ value ) { if ( ! is_scalar ( $ value ) ) { continue ; } if ( is_null ( $ value ) ) { $ apiparams [ $ key ] = 'null' ; } elseif ( is_bool ( $ value ) ) { $ apiparams [ $ key ] = $ value ? 'true' : 'false' ; } } return $ api... | Replace null and boolean parameters with their string representations |
55,615 | protected function _mapFnToApiMethod ( $ function , & $ apiparams ) { $ method = $ this -> _mapFnInsertSlashes ( $ function ) ; $ method = $ this -> _mapFnRestoreParamUnderscores ( $ method ) ; list ( $ method , $ method_template ) = $ this -> _mapFnInlineParams ( $ method , $ apiparams ) ; if ( substr ( $ method , 0 ,... | Maps called PHP magic method name to Twitter API method |
55,616 | protected function _mapFnInlineParams ( $ method , & $ apiparams ) { $ method_template = $ method ; $ match = [ ] ; if ( preg_match_all ( '/[A-Z_]{2,}/' , $ method , $ match ) ) { foreach ( $ match [ 0 ] as $ param ) { $ param_l = strtolower ( $ param ) ; if ( $ param_l === 'resumeid' ) { $ param_l = 'resumeId' ; } $ m... | Inserts inline parameters into the method name |
55,617 | protected function _json_decode ( $ data , $ need_array = false ) { if ( ! ( defined ( 'JSON_C_VERSION' ) && PHP_INT_SIZE > 4 ) ) { return json_decode ( $ data , $ need_array , 512 , JSON_BIGINT_AS_STRING ) ; } return json_decode ( $ data , $ need_array ) ; } | Avoids any JSON_BIGINT_AS_STRING errors |
55,618 | public function oauth_authenticate ( $ force_login = NULL , $ screen_name = NULL , $ type = 'authenticate' ) { if ( ! in_array ( $ type , [ 'authenticate' , 'authorize' ] ) ) { throw new \ Exception ( 'To get the ' . $ type . ' URL, use the correct third parameter, or omit it.' ) ; } if ( $ this -> _oauth_token === nul... | Gets the OAuth authenticate URL for the current request token |
55,619 | protected function _getCurlInitialization ( $ url ) { $ connection = $ this -> _curl_init ( $ url ) ; $ this -> _curl_setopt ( $ connection , CURLOPT_RETURNTRANSFER , 1 ) ; $ this -> _curl_setopt ( $ connection , CURLOPT_FOLLOWLOCATION , 0 ) ; $ this -> _curl_setopt ( $ connection , CURLOPT_HEADER , 1 ) ; $ this -> _cu... | Gets a cURL handle |
55,620 | protected function _getNoCurlInitialization ( $ url , $ contextOptions , $ hostname = '' ) { $ httpOptions = [ ] ; $ httpOptions [ 'header' ] = [ 'User-Agent: codebird-php/' . $ this -> getVersion ( ) . ' +https://github.com/jublonet/codebird-php' ] ; $ httpOptions [ 'ssl' ] = [ 'verify_peer' => true , 'cafile' => __DI... | Gets a non cURL initialization |
55,621 | private function _getProxyData ( $ name ) { return empty ( $ this -> _proxy [ $ name ] ) ? null : $ this -> _proxy [ $ name ] ; } | Gets data from the proxy configuration |
55,622 | protected function _oauth2TokenCurl ( ) { if ( self :: $ _consumer_key === null ) { throw new CodebirdCredentialsException ( 'To obtain a bearer token, the consumer key must be set.' ) ; } $ post_fields = [ 'grant_type' => 'client_credentials' ] ; $ url = self :: $ _endpoints [ 'oauth' ] . 'oauth2/token' ; $ connection... | Gets the OAuth bearer token using cURL |
55,623 | protected function _oauth2TokenNoCurl ( ) { if ( self :: $ _consumer_key == null ) { throw new CodebirdCredentialsException ( 'To obtain a bearer token, the consumer key must be set.' ) ; } $ url = self :: $ _endpoints [ 'oauth' ] . 'oauth2/token' ; $ hostname = parse_url ( $ url , PHP_URL_HOST ) ; if ( $ hostname === ... | Gets the OAuth bearer token without cURL |
55,624 | protected function _getHttpStatusFromHeaders ( $ headers ) { $ httpstatus = '500' ; $ match = [ ] ; if ( ! empty ( $ headers [ 0 ] ) && preg_match ( '/HTTP\/\d\.\d (\d{3})/' , $ headers [ 0 ] , $ match ) ) { $ httpstatus = $ match [ 1 ] ; } return $ httpstatus ; } | Extract HTTP status code from headers |
55,625 | protected function _parseBearerReply ( $ result , $ httpstatus ) { list ( $ headers , $ reply ) = $ this -> _parseApiHeaders ( $ result ) ; $ reply = $ this -> _parseApiReply ( $ reply ) ; $ rate = $ this -> _getRateLimitInfo ( $ headers ) ; switch ( $ this -> _return_format ) { case CODEBIRD_RETURNFORMAT_ARRAY : $ rep... | Parse oauth2_token reply and set bearer token if found |
55,626 | protected function _getRateLimitInfo ( $ headers ) { if ( ! isset ( $ headers [ 'x-rate-limit-limit' ] ) ) { return null ; } $ rate = [ 'limit' => $ headers [ 'x-rate-limit-limit' ] , 'remaining' => $ headers [ 'x-rate-limit-remaining' ] , 'reset' => $ headers [ 'x-rate-limit-reset' ] ] ; if ( $ this -> _return_format ... | Extract rate - limiting data from response headers |
55,627 | protected function _validateSslCertificate ( $ validation_result ) { if ( in_array ( $ validation_result , [ CURLE_SSL_CERTPROBLEM , CURLE_SSL_CACERT , CURLE_SSL_CACERT_BADFILE , CURLE_SSL_CRL_BADFILE , CURLE_SSL_ISSUER_ERROR ] ) ) { throw new \ Exception ( 'Error ' . $ validation_result . ' while validating the Twitte... | Check if there were any SSL certificate errors |
55,628 | protected function _url ( $ data ) { if ( is_array ( $ data ) ) { return array_map ( [ $ this , '_url' ] , $ data ) ; } elseif ( is_scalar ( $ data ) ) { return str_replace ( [ '+' , '!' , '*' , "'" , '(' , ')' ] , [ ' ' , '%21' , '%2A' , '%27' , '%28' , '%29' ] , rawurlencode ( $ data ) ) ; } return '' ; } | URL - encodes the given data |
55,629 | protected function _getMultipartRequestFromParams ( $ method_template , $ border , $ params ) { $ request = '' ; foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) { throw new CodebirdMediaException ( 'Using URL-encoded parameters is not supported for uploading media.' ) ; } $ request .= '--' . $ bo... | Merge multipart string from parameters array |
55,630 | protected function _checkForFiles ( $ method_template , $ key , $ value ) { if ( ! array_key_exists ( $ method_template , self :: $ _possible_files ) || ! in_array ( $ key , self :: $ _possible_files [ $ method_template ] ) ) { return false ; } $ data = $ this -> _buildBinaryBody ( $ value ) ; if ( $ data === $ value )... | Check for files |
55,631 | protected function _buildBinaryBody ( $ input ) { if ( @ file_exists ( $ input ) && @ is_readable ( $ input ) ) { $ data = @ file_get_contents ( $ input ) ; if ( $ data !== false && strlen ( $ data ) !== 0 ) { return $ data ; } } elseif ( filter_var ( $ input , FILTER_VALIDATE_URL ) && preg_match ( '/^https?:\/\//' , $... | Detect filenames in upload parameters |
55,632 | protected function _fetchRemoteFile ( $ url ) { if ( $ this -> _use_curl ) { $ connection = $ this -> _getCurlInitialization ( $ url ) ; $ this -> _curl_setopt ( $ connection , CURLOPT_RETURNTRANSFER , 1 ) ; $ this -> _curl_setopt ( $ connection , CURLOPT_HEADER , 0 ) ; $ this -> _curl_setopt ( $ connection , CURLOPT_S... | Fetches a remote file |
55,633 | protected function _detectStreaming ( $ method ) { $ streamings = [ 'public' => [ 'statuses/sample' , 'statuses/filter' ] ] ; foreach ( $ streamings as $ key => $ values ) { if ( in_array ( $ method , $ values ) ) { return $ key ; } } return false ; } | Detects if API call should use streaming endpoint and if yes which one |
55,634 | protected function _callApiNoCurl ( $ httpmethod , $ method , $ method_template , $ params = [ ] , $ multipart = false , $ app_only_auth = false ) { list ( $ authorization , $ url , $ params , $ request_headers ) = $ this -> _callApiPreparations ( $ httpmethod , $ method , $ method_template , $ params , $ multipart , $... | Calls the API without cURL |
55,635 | protected function _callApiPreparationsGet ( $ httpmethod , $ url , $ params , $ app_only_auth ) { return [ $ app_only_auth ? null : $ this -> _sign ( $ httpmethod , $ url , $ params ) , json_encode ( $ params ) === '[]' ? $ url : $ url . '?' . http_build_query ( $ params ) ] ; } | Do preparations to make the API GET call |
55,636 | protected function _callApiPreparationsPost ( $ httpmethod , $ url , $ method , $ method_template , $ params , $ multipart , $ app_only_auth ) { $ authorization = null ; $ request_headers = [ ] ; if ( $ multipart ) { if ( ! $ app_only_auth ) { $ authorization = $ this -> _sign ( $ httpmethod , $ url , [ ] ) ; } $ param... | Do preparations to make the API POST call |
55,637 | protected function _appendHttpStatusAndRate ( $ reply , $ httpstatus , $ rate ) { switch ( $ this -> _return_format ) { case CODEBIRD_RETURNFORMAT_ARRAY : $ reply [ 'httpstatus' ] = $ httpstatus ; $ reply [ 'rate' ] = $ rate ; break ; case CODEBIRD_RETURNFORMAT_OBJECT : $ reply -> httpstatus = $ httpstatus ; $ reply ->... | Appends HTTP status and rate limiting info to the reply |
55,638 | protected function _getBearerAuthorization ( ) { if ( self :: $ _consumer_key === null && self :: $ _bearer_token === null ) { throw new CodebirdCredentialsException ( 'To make an app-only auth API request, consumer key or bearer token must be set.' ) ; } if ( self :: $ _bearer_token === null ) { $ this -> oauth2_token... | Get Bearer authorization string |
55,639 | protected function _callApiPreparations ( $ httpmethod , $ method , $ method_template , $ params , $ multipart , $ app_only_auth ) { $ url = $ this -> _getEndpoint ( $ method , $ method_template ) ; $ request_headers = [ ] ; if ( $ httpmethod === 'GET' ) { list ( $ authorization , $ url ) = $ this -> _callApiPreparatio... | Do preparations to make the API call |
55,640 | protected function _parseApiHeaders ( $ reply ) { $ headers = [ ] ; $ reply = explode ( "\r\n\r\n" , $ reply , 4 ) ; $ proxy_tester = strtolower ( substr ( $ reply [ 0 ] , 0 , 35 ) ) ; if ( $ proxy_tester === 'http/1.0 200 connection established' || $ proxy_tester === 'http/1.1 200 connection established' ) { array_shi... | Parses the API reply to separate headers from the body |
55,641 | protected function _parseApiReplyPrefillHeaders ( $ headers , $ reply ) { if ( $ reply === '' && ( isset ( $ headers [ 'Location' ] ) || isset ( $ headers [ 'location' ] ) ) ) { $ reply = [ 'Location' => isset ( $ headers [ 'Location' ] ) ? $ headers [ 'Location' ] : $ headers [ 'location' ] ] ; if ( isset ( $ headers ... | Parses the API headers to return Location and Ton API headers |
55,642 | private function serializeComponents ( array $ components ) : string { return implode ( '|' , array_map ( function ( $ name , $ value ) { return sprintf ( '%s:%s' , $ name , $ value ) ; } , array_keys ( $ components ) , $ components ) ) ; } | Serialize the component query parameter . |
55,643 | private function validateResponse ( string $ url , $ content ) { if ( false !== strpos ( $ content , "Provided 'signature' is not valid for the provided client ID" ) ) { throw new InvalidCredentials ( sprintf ( 'Invalid client ID / API Key %s' , $ url ) ) ; } $ json = json_decode ( $ content ) ; if ( ! isset ( $ json )... | Decode the response content and validate it to make sure it does not have any errors . |
55,644 | private function parseCoordinates ( AddressBuilder $ builder , $ result ) { $ coordinates = $ result -> geometry -> location ; $ builder -> setCoordinates ( $ coordinates -> lat , $ coordinates -> lng ) ; if ( isset ( $ result -> geometry -> bounds ) ) { $ builder -> setBounds ( $ result -> geometry -> bounds -> southw... | Parse coordinats and bounds . |
55,645 | public static function reduce ( array $ xs , \ Closure $ fn , $ initial ) { foreach ( $ xs as $ key => $ value ) { $ initial = $ fn ( $ initial , $ key , $ value ) ; } return $ initial ; } | PHP s array_reduce does not provide access to the key . This function does the same as array produce while providing access to the key . |
55,646 | public function afferentCoupling ( DependencyMap $ map ) : array { return $ map -> fromDependencies ( ) -> reduce ( [ ] , function ( array $ afferent , Dependency $ from ) use ( $ map ) { $ afferent [ $ from -> toString ( ) ] = $ map -> reduce ( 0 , function ( int $ count , Dependency $ fromOther , Dependency $ to ) us... | Afferent coupling is an indicator for the responsibility of a package . |
55,647 | public function efferentCoupling ( DependencyMap $ map ) : array { return $ map -> reduce ( [ ] , function ( array $ efferent , Dependency $ from , Dependency $ to ) use ( $ map ) { $ efferent [ $ from -> toString ( ) ] = $ map -> get ( $ from ) -> count ( ) ; return $ efferent ; } ) ; } | Efferent coupling is an indicator for how independent a package is . |
55,648 | public function instability ( DependencyMap $ map ) : array { $ ce = $ this -> efferentCoupling ( $ map ) ; $ ca = $ this -> afferentCoupling ( $ map ) ; $ instability = [ ] ; foreach ( $ ce as $ class => $ count ) { $ totalCoupling = $ ce [ $ class ] + $ ca [ $ class ] ; $ instability [ $ class ] = $ ce [ $ class ] / ... | Instability is an indicator for how resilient a package is towards change . |
55,649 | public function leaveNode ( Node $ node ) { if ( ! $ node instanceof ClassLikeNode ) { return null ; } if ( $ this -> currentClass === null ) { $ this -> tempDependencies = new DependencySet ( ) ; return ; } $ this -> dependencies = $ this -> dependencies -> addSet ( $ this -> currentClass , $ this -> tempDependencies ... | As described in beforeTraverse we are going to update the class we are currently parsing for all dependencies . If we are not in class context we won t add the dependencies . |
55,650 | private function adjustVendor ( $ locales ) { if ( isset ( $ locales [ 'vendor' ] ) ) { foreach ( $ locales [ 'vendor' ] as $ vendor => $ data ) { foreach ( $ data as $ key => $ group ) { foreach ( $ group as $ locale => $ lang ) { $ locales [ $ key ] [ 'vendor' ] [ $ vendor ] [ $ locale ] = $ lang ; } } } unset ( $ lo... | Adjus vendor index placement . |
55,651 | private function removeExtension ( $ filename ) { $ pos = mb_strrpos ( $ filename , '.' ) ; if ( $ pos === false ) { return $ filename ; } return mb_substr ( $ filename , 0 , $ pos ) ; } | Returns filename with extension stripped |
55,652 | public function getPsr0 ( ) { if ( ! isset ( $ this -> autoload [ 'psr-0' ] ) ) { return array ( ) ; } $ resources = array ( ) ; foreach ( $ this -> autoload [ 'psr-0' ] as $ namespace => $ paths ) { foreach ( $ this -> correctSinglePath ( $ paths ) as $ path ) { $ resources [ ] = $ this -> buildNamespacePath ( $ names... | returns all pathes defined by PSR - 0 |
55,653 | public function getBundler ( Logger $ logger ) { $ bundlerName = 'complete' ; if ( isset ( $ this -> package [ 'extra' ] [ 'phar' ] [ 'bundler' ] ) ) { $ bundlerName = $ this -> package [ 'extra' ] [ 'phar' ] [ 'bundler' ] ; } if ( $ bundlerName === 'composer' ) { return new ExplicitBundler ( $ this , $ logger ) ; } el... | Get Bundler instance to bundle this package |
55,654 | public function getBlacklistFilter ( ) { $ blacklist = $ this -> getBlacklist ( ) ; return function ( SplFileInfo $ file ) use ( $ blacklist ) { return in_array ( $ file -> getPathname ( ) , $ blacklist ) ? false : null ; } ; } | Gets a filter function to exclude blacklisted files |
55,655 | protected function getCommandName ( InputInterface $ input ) { if ( $ input -> getFirstArgument ( ) === null && ! $ input -> hasParameterOption ( array ( '--help' , '-h' ) ) ) { $ this -> isDefault = true ; return $ this -> getDefaultCommandName ( ) ; } return parent :: getCommandName ( $ input ) ; } | Gets the name of the command based on input . |
55,656 | public function coerceWritable ( $ wait = 1 ) { try { $ this -> assertWritable ( ) ; } catch ( UnexpectedValueException $ e ) { if ( ! function_exists ( 'pcntl_exec' ) ) { $ this -> log ( '<error>' . $ e -> getMessage ( ) . '</error>' ) ; return ; } $ this -> log ( '<info>' . $ e -> getMessage ( ) . ', trying to re-spa... | ensure writing phar files is enabled or respawn with PHP setting which allows writing |
55,657 | public function addBundle ( Bundle $ bundle ) { foreach ( $ bundle as $ resource ) { if ( is_string ( $ resource ) ) { $ this -> addFile ( $ resource ) ; } else { $ this -> buildFromIterator ( $ resource ) ; } } } | adds given list of resources to phar |
55,658 | public function contains ( $ resource ) { foreach ( $ this -> resources as $ containedResource ) { if ( is_string ( $ containedResource ) && $ containedResource == $ resource ) { return true ; } if ( $ containedResource instanceof Finder && $ this -> directoryContains ( $ containedResource , $ resource ) ) { return tru... | checks if a bundle contains given resource |
55,659 | private function directoryContains ( Finder $ dir , $ resource ) { foreach ( $ dir as $ containedResource ) { if ( substr ( $ containedResource -> getRealPath ( ) , 0 , strlen ( $ resource ) ) == $ resource ) { return true ; } } return false ; } | checks if given directory contains given resource |
55,660 | public function setInlineTca ( $ json ) { $ notIrreTables = array ( "pages" , "tt_content" , "sys_file_reference" ) ; if ( $ json ) { foreach ( $ json as $ table => $ subJson ) { $ fieldTCA = array ( ) ; if ( array_search ( $ table , $ notIrreTables ) === false ) { $ this -> generateTableTca ( $ table , $ subJson [ "tc... | Generates and sets the correct tca for all the inline fields |
55,661 | public function setElementsTca ( $ tca ) { $ fieldHelper = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( 'MASK\\Mask\\Helper\\FieldHelper' ) ; $ defaultTabs = ",--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Langua... | Generates and sets the tca for all the content - elements |
55,662 | public function setPageTca ( $ tca ) { $ fieldHelper = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( 'MASK\\Mask\\Helper\\FieldHelper' ) ; $ prependTabs = "--div--;Content-Fields," ; if ( $ tca ) { $ i = 0 ; foreach ( $ tca as $ fieldKey => $ config ) { $ elements = $ fieldHelper -> getElementsWhich... | Generates and sets the tca for all the extended pages |
55,663 | public function allowInlineTablesOnStandardPages ( $ configuration ) { $ notIrreTables = array ( "pages" , "tt_content" , "sys_file_reference" ) ; if ( $ configuration ) { foreach ( $ configuration as $ table => $ subJson ) { if ( array_search ( $ table , $ notIrreTables ) === false ) { \ TYPO3 \ CMS \ Core \ Utility \... | allow all inline tables on standard pages |
55,664 | public function initializeObject ( ) { $ querySettings = $ this -> objectManager -> get ( 'TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings' ) ; $ querySettings -> setRespectStoragePage ( false ) ; $ this -> setDefaultQuerySettings ( $ querySettings ) ; $ this -> backendLayoutView = GeneralUtility :: makeI... | Initializes the repository . |
55,665 | public function findAll ( $ pageTsPids = array ( ) ) { $ backendLayouts = array ( ) ; foreach ( $ pageTsPids as $ pid ) { $ pageTsConfig = ( array ) \ TYPO3 \ CMS \ Backend \ Utility \ BackendUtility :: getPagesTSconfig ( $ pid ) ; $ dataProviderContext = $ this -> backendLayoutView -> createDataProviderContext ( ) -> ... | Returns all backendlayouts defined database and pageTs |
55,666 | public function findByIdentifier ( $ identifier , $ pageTsPids = array ( ) ) { $ backendLayouts = $ this -> findAll ( $ pageTsPids ) ; if ( isset ( $ backendLayouts [ $ identifier ] ) ) { return $ backendLayouts [ $ identifier ] ; } else { return null ; } } | Returns a backendlayout or null if non found |
55,667 | public function render ( ) : string { $ templatePath = MaskUtility :: getTemplatePath ( $ this -> settingsService -> get ( ) , $ this -> arguments [ 'data' ] ) ; $ content = '' ; if ( ! file_exists ( $ templatePath ) || ! is_file ( $ templatePath ) ) { $ content = '<div class="alert alert-warning"><div class="media"><d... | Checks Links for BE - module |
55,668 | public function render ( ) { $ key = $ this -> arguments [ 'key' ] ; $ extensionName = $ this -> arguments [ 'extensionName' ] ; if ( empty ( $ key ) || strpos ( $ key , 'LLL' ) > 0 ) { return $ key ; } $ request = $ this -> renderingContext -> getControllerContext ( ) -> getRequest ( ) ; $ extensionName = $ extensionN... | The given key will be translated . If the result is empty the key will be returned . |
55,669 | public function render ( ) { $ table = $ this -> arguments [ 'table' ] ; $ type = $ this -> arguments [ 'type' ] ; if ( empty ( $ GLOBALS [ 'TCA' ] [ $ table ] ) ) { return [ ] ; } $ fields = [ ] ; if ( $ type === 'Tab' ) { $ fields = $ this -> fieldHelper -> getFieldsByType ( $ type , $ table ) ; } else { if ( in_arra... | Generates TCA Selectbox - Options - Array for a specific TCA - type . |
55,670 | public function injectConfigurationManager ( \ TYPO3 \ CMS \ Extbase \ Configuration \ ConfigurationManagerInterface $ configurationManager ) { $ this -> configurationManager = $ configurationManager ; $ this -> cObj = $ this -> configurationManager -> getContentObject ( ) ; } | Injects Configuration Manager |
55,671 | public function generateTsConfig ( $ json ) { $ content = "" ; $ iconRegistry = GeneralUtility :: makeInstance ( "TYPO3\CMS\Core\Imaging\IconRegistry" ) ; if ( $ json [ "tt_content" ] [ "elements" ] ) { foreach ( $ json [ "tt_content" ] [ "elements" ] as $ element ) { $ iconIdentifier = 'mask-ce-' . $ element [ "key" ]... | Generates the tsConfig typoscript and registers the icons for the content elements |
55,672 | public function generatePageTyposcript ( $ json ) { $ pageColumns = array ( ) ; $ disableColumns = "" ; $ pagesContent = "" ; if ( $ json [ "pages" ] [ "elements" ] ) { foreach ( $ json [ "pages" ] [ "elements" ] as $ element ) { $ pagesContent .= "\n[userFunc = user_mask_beLayout(" . $ element [ "key" ] . ")]\n" ; if ... | Generates the typoscript for pages |
55,673 | public function generateSetupTyposcript ( $ configuration , $ settings ) { $ setupContent = [ ] ; $ setupContent [ ] = $ this -> convertArrayToTypoScript ( [ 'view' => [ 'templateRootPaths' => [ 10 => 'EXT:mask/Resources/Private/Backend/Templates/' ] , 'partialRootPaths' => [ 10 => 'EXT:mask/Resources/Private/Backend/P... | Generates the typoscript for the setup field |
55,674 | protected function convertArrayToTypoScript ( array $ typoScriptArray , $ addKey = '' , $ tab = 0 , $ init = true ) { $ typoScript = '' ; if ( $ addKey !== '' ) { $ typoScript .= str_repeat ( "\t" , ( $ tab === 0 ) ? $ tab : $ tab - 1 ) . $ addKey . " {\n" ; if ( $ init === true ) { $ tab ++ ; } } $ tab ++ ; foreach ( ... | Converts given array to TypoScript |
55,675 | public function preProcess ( \ TYPO3 \ CMS \ Backend \ View \ PageLayoutView & $ parentObject , & $ drawItem , & $ headerContent , & $ itemContent , array & $ row ) { $ this -> settingsService = GeneralUtility :: makeInstance ( SettingsService :: class ) ; $ this -> extSettings = $ this -> settingsService -> get ( ) ; ... | Preprocesses the preview rendering of a content element . |
55,676 | protected function getContentObject ( $ uid ) { $ contentTable = 'tt_content' ; $ queryBuilder = GeneralUtility :: makeInstance ( ConnectionPool :: class ) -> getQueryBuilderForTable ( $ contentTable ) ; $ queryBuilder -> select ( '*' ) -> from ( $ contentTable ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'uid' , $ ... | Returns an array with properties of content element with given uid |
55,677 | public function getRteTransformMode ( $ fieldKey , $ type = "tt_content" ) { $ storage = $ this -> storageRepository -> load ( ) ; $ transformMode = "" ; $ matches = array ( ) ; if ( $ storage [ $ type ] [ "tca" ] [ $ fieldKey ] [ "defaultExtras" ] != "" ) { $ re = "/(rte_transform\\[([a-z=_]+)\\])/" ; preg_match ( $ r... | Returns the rte_transform properties |
55,678 | public function getJsOpenParamValue ( $ fieldKey , $ property , $ type = 'tt_content' ) { $ storage = $ this -> storageRepository -> load ( ) ; $ value = null ; $ windowOpenParameters = $ storage [ $ type ] [ 'tca' ] [ $ fieldKey ] [ 'config' ] [ 'fieldControl' ] [ 'linkPopup' ] [ 'options' ] [ 'windowOpenParameters' ]... | Returns value for jsopenparams property |
55,679 | public function getFirstNoneTabField ( $ fields ) { if ( count ( $ fields ) ) { $ potentialFirst = $ fields [ 0 ] ; if ( strpos ( $ potentialFirst , "--div--" ) !== false ) { unset ( $ fields [ 0 ] ) ; return $ this -> getFirstNoneTabField ( $ fields ) ; } else { return $ potentialFirst ; } } else { return "" ; } } | Searches an array of strings and returns the first string that is not a tab |
55,680 | public function removeBlankOptions ( $ haystack ) { foreach ( $ haystack as $ key => $ value ) { if ( is_array ( $ value ) ) { $ haystack [ $ key ] = $ this -> removeBlankOptions ( $ haystack [ $ key ] ) ; } if ( ( is_array ( $ haystack [ $ key ] ) && empty ( $ haystack [ $ key ] ) ) || ( is_string ( $ haystack [ $ key... | Removes all the blank options from the tca |
55,681 | public static function getTemplatePath ( $ settings , $ elementKey , $ onlyTemplateName = false , $ path = null ) : string { if ( ! $ path ) { $ path = self :: getFileAbsFileName ( rtrim ( $ settings [ 'content' ] , '/' ) . '/' ) ; } $ fileExtension = '.html' ; if ( file_exists ( $ path . CoreUtility :: underscoredToUp... | Check which template path to return |
55,682 | public function itemsProcFunc ( & $ params ) { if ( $ params [ "row" ] [ "colPos" ] == $ this -> colPos ) { $ params [ "items" ] = array ( array ( \ TYPO3 \ CMS \ Extbase \ Utility \ LocalizationUtility :: translate ( 'mask_content_colpos' , 'mask' ) , $ this -> colPos , null , null ) ) ; } else { if ( ! empty ( $ para... | Render the allowed colPos for nested content elements |
55,683 | protected function generateMarkup ( Icon $ icon , array $ options ) { $ previewIconAvailable = $ this -> isPreviewIconAvailable ( $ options [ 'contentElementKey' ] ) ; $ fontAwesomeKeyAvailable = $ this -> isFontAwesomeKeyAvailable ( $ this -> contentElement ) ; if ( $ fontAwesomeKeyAvailable ) { $ color = $ this -> ge... | Renders the actual icon |
55,684 | protected function getContentObjectVariables ( array $ conf = array ( ) ) { $ variables = parent :: getContentObjectVariables ( $ conf ) ; $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ this -> inlineHelper = $ objectManager -> get ( InlineHelper :: class ) ; $ data = $ variables [ 'dat... | Change variables for view |
55,685 | public function itemsProcFunc ( & $ params ) { if ( $ params [ "row" ] [ "colPos" ] == $ this -> colPos ) { $ fieldHelper = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( 'MASK\\Mask\\Helper\\FieldHelper' ) ; $ this -> storageRepository = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstanc... | Render the allowed CTypes for nested content elements |
55,686 | protected function deleteHtml ( $ key ) : void { $ paths = [ ] ; $ paths [ ] = MaskUtility :: getTemplatePath ( $ this -> extSettings , $ key ) ; $ paths [ ] = MaskUtility :: getTemplatePath ( $ this -> extSettings , $ key , false , $ this -> extSettings [ 'backend' ] ) ; foreach ( $ paths as $ path ) { if ( file_exist... | Deletes Fluid html if file exists |
55,687 | protected function createHtmlAction ( $ key ) { $ html = $ this -> htmlCodeGenerator -> generateHtml ( $ key , 'tt_content' ) ; $ this -> saveHtml ( $ key , $ html ) ; $ this -> redirect ( 'list' ) ; } | Create single Fluid html |
55,688 | public function render ( ) { $ fieldKey = $ this -> arguments [ 'fieldKey' ] ; $ elementKey = $ this -> arguments [ 'elementKey' ] ; $ property = $ this -> arguments [ 'property' ] ; $ field = $ this -> arguments [ 'field' ] ; $ this -> generalUtility = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( ... | Returns value from jsopenParams |
55,689 | public function getInlineElements ( $ data , $ name , $ cType , $ parentFieldName = "parentid" , $ parenttable = "tt_content" , $ childTable = null ) { if ( ! $ childTable ) { $ childTable = $ name ; } if ( TYPO3_MODE == 'FE' && isset ( $ GLOBALS [ 'TSFE' ] -> sys_language_uid ) ) { $ sysLangUid = $ GLOBALS [ 'TSFE' ] ... | Returns Inline - Elements of Data - Object |
55,690 | public function getFieldsByType ( $ key , $ type ) { $ storage = $ this -> storageRepository -> load ( ) ; if ( empty ( $ storage [ $ type ] ) || empty ( $ storage [ $ type ] [ 'tca' ] ) ) { return [ ] ; } $ fields = [ ] ; foreach ( $ storage [ $ type ] [ 'tca' ] as $ field => $ config ) { if ( $ config [ 'config' ] [ ... | Returns all fields of a type from a table |
55,691 | public function render ( ) { $ table = $ this -> arguments [ 'table' ] ; $ field = $ this -> arguments [ 'field' ] ; $ queryBuilder = GeneralUtility :: makeInstance ( ConnectionPool :: class ) -> getQueryBuilderForTable ( $ table ) ; $ queryBuilder -> select ( '*' ) -> where ( 'uid IN (' . $ field . ')' ) ; $ queryBuil... | Returns Shuttle - Elements of Data - Object |
55,692 | public function get ( ) { if ( $ this -> extSettings === null ) { $ this -> extSettings = $ this -> getExtSettings ( ) ; } return $ this -> extSettings ; } | Returns the settings |
55,693 | public function loadInlineFields ( $ parentKey ) { $ json = $ this -> load ( ) ; $ inlineFields = array ( ) ; foreach ( $ json as $ table ) { if ( $ table [ "tca" ] ) { foreach ( $ table [ "tca" ] as $ key => $ tca ) { if ( $ tca [ "inlineParent" ] == $ parentKey ) { if ( $ tca [ "config" ] [ "type" ] == "inline" ) { $... | Loads all the inline fields of an inline - field recursively! |
55,694 | public function loadElement ( $ type , $ key ) { $ json = $ this -> load ( ) ; $ fields = array ( ) ; $ columns = $ json [ $ type ] [ "elements" ] [ $ key ] [ "columns" ] ; if ( is_array ( $ columns ) && count ( $ columns ) > 0 ) { foreach ( $ columns as $ fieldName ) { $ fields [ $ fieldName ] = $ json [ $ type ] [ "t... | Load Element with all the field configurations |
55,695 | public function remove ( $ type , $ key , $ remainingFields = array ( ) ) { $ json = $ this -> load ( ) ; $ columns = $ json [ $ type ] [ "elements" ] [ $ key ] [ "columns" ] ; unset ( $ json [ $ type ] [ "elements" ] [ $ key ] ) ; if ( is_array ( $ columns ) ) { foreach ( $ columns as $ field ) { $ json = $ this -> re... | Removes Content - Element |
55,696 | public function hide ( $ type , $ key ) { $ json = $ this -> load ( ) ; $ json [ $ type ] [ "elements" ] [ $ key ] [ "hidden" ] = 1 ; $ this -> sortJson ( $ json ) ; $ this -> write ( $ json ) ; } | Hides Content - Element |
55,697 | public function activate ( $ type , $ key ) { $ json = $ this -> load ( ) ; unset ( $ json [ $ type ] [ "elements" ] [ $ key ] [ "hidden" ] ) ; $ this -> sortJson ( $ json ) ; $ this -> write ( $ json ) ; } | Activates Content - Element |
55,698 | private function cleanTable ( $ table , $ json ) { if ( $ json [ $ table ] [ "tca" ] && count ( $ json [ $ table ] [ "tca" ] ) < 1 ) { unset ( $ json [ $ table ] [ "tca" ] ) ; } if ( $ json [ $ table ] [ "sql" ] && count ( $ json [ $ table ] [ "sql" ] ) < 1 ) { unset ( $ json [ $ table ] [ "sql" ] ) ; } if ( $ json [ $... | Deletes all the empty settings of a table |
55,699 | public function update ( $ content ) { $ this -> remove ( $ content [ "type" ] , $ content [ "orgkey" ] , $ content [ "elements" ] [ "columns" ] ) ; $ this -> add ( $ content ) ; } | Updates Content - Element in Storage - Repository |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.