idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
7,000 | public function createRoleFiles ( $ inputDir , $ outputDir , $ roleFileDir = null ) { $ roleFileDir = $ roleFileDir ? : $ inputDir ; $ outputDir = realpath ( $ outputDir ) ; $ seenDirs = array ( ) ; $ longPaths = array ( ) ; $ roleFiles = array ( ) ; foreach ( $ this -> getWebRoleNames ( ) as $ roleName ) { $ dir = rea... | Create the role files for this service definition . |
7,001 | private function computeRoleFileContents ( $ dir , $ roleName , $ outputDir , array & $ longPaths ) { $ roleFile = "" ; $ iterator = $ this -> getIterator ( $ dir ) ; if ( file_exists ( $ dir . '/vendor/azureRoleFiles.txt' ) && ! in_array ( "vendor" , $ this -> roleFiles [ 'exclude' ] ) ) { $ roleFile .= file_get_conte... | Compute the roleFiles . txt content that is necessary for a given role . |
7,002 | public function output ( ) { if ( is_array ( $ this -> output ) ) { echo '<div class="qm" id="' . esc_attr ( $ this -> collector -> id ( ) ) . '">' ; echo '<table cellspacing="0"><tbody>' ; foreach ( $ this -> output as & $ single ) { echo "<tr><td>" . $ single . "</td></tr>" ; } echo '</tbody></table>' ; echo '</div>'... | Outputs data in the footer |
7,003 | public function admin_title ( array $ title ) { $ data = $ this -> collector -> get_data ( ) ; if ( isset ( $ data [ 'log' ] ) ) { $ title [ ] = $ this -> title . ' (' . count ( $ data [ 'log' ] ) . ')' ; } return $ title ; } | Adds data to top admin bar |
7,004 | public function setAdditionalCliParams ( ) { $ reservedParams = explode ( ',' , self :: RESERVED_CLI_PARAMS ) ; $ params = [ ] ; $ ac = 1 ; while ( $ ac < ( count ( $ _SERVER [ 'argv' ] ) ) ) { $ paramName = substr ( $ _SERVER [ 'argv' ] [ $ ac ] , 1 ) ; if ( ! in_array ( $ paramName , $ reservedParams ) ) { $ params [... | sets additional parameters from the command line from the arguments |
7,005 | public function send ( ) { $ mappedParams = $ this -> map ( ) ; $ curler = new \ GuzzleHttp \ Client ( [ 'base_uri' => $ this -> tgUrl ] ) ; if ( empty ( $ this -> multipart ) ) { $ response = $ curler -> request ( "POST" , static :: $ method , [ "query" => $ mappedParams ] ) ; } else { $ response = $ curler -> request... | Map the set parameters and send it to Telegram . |
7,006 | public function sendAsync ( ) : Promise { $ mappedParams = $ this -> map ( ) ; $ curler = new \ GuzzleHttp \ Client ( [ 'base_uri' => $ this -> tgUrl ] ) ; if ( empty ( $ this -> multipart ) ) { $ promise = $ curler -> requestAsync ( "POST" , static :: $ method , [ "query" => $ mappedParams ] ) ; } else { $ promise = $... | Map the set parameters and send it to Telegram asynchronously . |
7,007 | public function update ( Evaluation $ evaluation , NodeType $ nodeType ) { if ( $ nodeType == NodeType :: MAX ( ) ) { $ this -> alpha = max ( $ this -> alpha , $ evaluation -> score ) ; } elseif ( $ nodeType == NodeType :: MIN ( ) ) { $ this -> beta = min ( $ this -> beta , $ evaluation -> score ) ; } } | Update the constraint with new information |
7,008 | public static function cleanValues ( QueryBuilder $ qb , $ identifier , array $ values ) { $ entity = current ( $ qb -> getRootEntities ( ) ) ; $ metadata = $ qb -> getEntityManager ( ) -> getClassMetadata ( $ entity ) ; if ( \ in_array ( $ metadata -> getTypeOfField ( $ identifier ) , [ 'integer' , 'bigint' , 'smallin... | Cleaned the values and get the parameter type . |
7,009 | private function provide ( $ target , $ id , $ image , $ dimension ) { return sprintf ( '%s/%s/%s/%s/%s' , $ target , $ this -> path , $ id , $ image , $ dimension ) ; } | Provides a path |
7,010 | public function buildPath ( $ id , $ image , $ dimension ) { return $ this -> provide ( $ this -> baseDir , $ id , $ dimension , $ image ) ; } | Build a path to the image on the filesystem |
7,011 | public function buildUrl ( $ id , $ image , $ dimension ) { $ url = $ this -> provide ( $ this -> baseUrl , $ id , $ dimension , $ image ) ; return $ this -> normalizeUrl ( $ url ) ; } | Builds an URL to the image |
7,012 | public function getTaxID ( ) { $ id = 0 ; $ tax = $ this -> getTaxFromCategory ( ) ; if ( isset ( $ tax ) && $ tax -> exists ( ) ) { $ id = $ tax -> ID ; } return $ id ; } | Get the ID of the relevent tax object for this product |
7,013 | public function getTaxRate ( ) { $ rate = 0 ; $ obj = $ this -> getTaxFromCategory ( ) ; if ( $ obj ) { $ rate = $ obj -> Rate ; } $ this -> extend ( "updateTaxRate" , $ rate ) ; return $ rate ; } | Get the percentage amount of tax applied to this item |
7,014 | public function getTaxAmount ( $ decimal_size = null ) { $ tax = MathsHelper :: round ( ( $ this -> BasePrice / 100 ) * $ this -> TaxRate , 2 ) ; $ this -> extend ( "updateTaxAmount" , $ tax ) ; return $ tax ; } | Get a final tax amount for this product . You can extend this method using UpdateTax allowing third party modules to alter tax amounts dynamically . |
7,015 | public function getTaxString ( ) { $ string = "" ; $ rate = $ this -> getTaxFromCategory ( ) ; $ config = SiteConfig :: current_site_config ( ) ; if ( $ config -> ShowPriceTaxString ) { if ( $ rate && $ this -> IncludesTax ) { $ string = _t ( "CatalogueFrontend.TaxIncludes" , "inc. {title}" , [ "title" => $ rate -> Tit... | Generate a string to go with the the product price . We can overwrite the wording of this by using Silverstripes language files |
7,016 | public function getAncestors ( $ include_parent = false ) { $ ancestors = ArrayList :: create ( ) ; $ object = $ this -> Categories ( ) -> first ( ) ; if ( $ object ) { if ( $ include_parent ) $ ancestors -> push ( $ object ) ; while ( $ object = $ object -> getParent ( ) ) { $ ancestors -> push ( $ object ) ; } } $ th... | We use this to tap into the categories isSection setup essentially adding the product s first category to the list |
7,017 | public function SortedImages ( ) { if ( $ this -> Images ( ) -> exists ( ) ) { return $ this -> Images ( ) -> Sort ( 'SortOrder' ) ; } $ config = SiteConfig :: current_site_config ( ) ; $ default_image = $ config -> DefaultProductImage ( ) ; $ images = ArrayList :: create ( ) ; if ( $ default_image -> exists ( ) ) { $ ... | Return sorted images if no images exist create a new opbject set with a blank product image in it . |
7,018 | public function getCategoriesList ( ) { $ list = [ ] ; foreach ( $ this -> Categories ( ) as $ cat ) { $ list [ ] = $ cat -> FullHierarchy ; } return implode ( ", " , $ list ) ; } | Generate a comma seperated list of category names assigned to this product . |
7,019 | protected function generateStockID ( ) { $ title = "" ; foreach ( explode ( " " , $ this -> Title ) as $ string ) { $ string = substr ( $ string , 0 , 1 ) ; $ title .= $ string ; } return $ title . "-" . $ this -> ID ; } | Generate a stock ID based on the title and ID of this product |
7,020 | public function canCreateTags ( $ member = null ) { if ( empty ( $ member ) ) { $ member = Security :: getCurrentUser ( ) ; } return Permission :: checkMember ( $ member , [ "ADMIN" , "CATALOGUE_ADD_TAGS" ] ) ; } | Determine whether user can create new tags . |
7,021 | function pathObject ( $ entity , $ type = LinkGeneratorService :: TYPE_LINK_DEFAULT , array $ parameters = array ( ) ) { if ( $ entity === null ) { return "" ; } return $ this -> linkGeneratorService -> generate ( $ entity , $ type , $ parameters ) ; } | Genera un link completo para mostrar el objeto |
7,022 | function pathObjectUrl ( $ entity , $ type = LinkGeneratorService :: TYPE_LINK_DEFAULT , array $ parameters = array ( ) ) { if ( $ entity === null ) { return "" ; } return $ this -> linkGeneratorService -> generateOnlyUrl ( $ entity , $ type , $ parameters ) ; } | Genera solo la url de el objeto |
7,023 | public function send ( string $ templatePath , array $ context = [ ] , array $ to = [ ] , array $ cc = [ ] , array $ bcc = [ ] ) { if ( ! $ this -> isDeliveryEnabled ) { return ; } $ message = $ this -> templateEngineAdapter -> createMessage ( $ templatePath , $ context ) ; $ this -> mailerAdapter -> sendMessage ( $ me... | Send a new e - mail message based on the given template . |
7,024 | public function Total ( $ decimal_size = null ) { if ( $ this -> Cost && $ this -> Tax ) { $ cost = $ this -> Cost + ( ( $ this -> Cost / 100 ) * $ this -> Tax ) ; } else { $ cost = $ this -> Cost ; } if ( $ decimal_size ) { $ cost = number_format ( $ cost , $ decimal_size ) ; } return $ cost ; } | Get the total cost including tax |
7,025 | public function getWebClient ( ) { if ( $ this -> objClient == null ) { $ this -> objClient = new Client ( ) ; $ objWssePlugin = $ this -> generateWSSEHeader ( $ this -> strUsername , $ this -> strApiToken ) ; $ this -> objClient -> addSubscriber ( $ objWssePlugin ) ; $ this -> objClient -> setSslVerification ( false )... | Get the Guzzle HTTP client object . |
7,026 | public function getRoot ( ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/' ; $ arrHeaders = $ this -> getHeaders ( ) ; $ objRequest = $ objWebClient -> get ( $ strUri , $ arrHeaders ) ; $ this -> objResponse = $ objRequest -> send ( ) ; $ strResponse = $ this -> objResponse -> ... | Welcome to Genius Referral Core API . |
7,027 | public function putAdvocatePaymentMethod ( $ strAccountSlug , $ strAdvocateToken , $ intAdvocatePaymentMethodId , array $ arrParams ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/accounts/' . $ strAccountSlug . '/advocates/' . $ strAdvocateToken . '/payment-methods/' . $ intAdv... | Update a payment method . |
7,028 | public function deleteReferral ( $ strAccountSlug , $ strAdvocateToken , $ intReferralId ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/accounts/' . $ strAccountSlug . '/advocates/' . $ strAdvocateToken . '/referrals/' . $ intReferralId ; $ arrHeaders = $ this -> getHeaders ( )... | Delete a referral . |
7,029 | public function getCampaigns ( $ strAccountSlug , $ intPage = 1 , $ intLimit = 10 , $ strFilter = null , $ strSort = null ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/accounts/' . $ strAccountSlug . '/campaigns' ; $ arrHeaders = $ this -> getHeaders ( ) ; $ strFilter = array ... | Get the list of campaings . |
7,030 | public function postRedemptionRequest ( $ strAccountSlug , array $ arrParams ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/accounts/' . $ strAccountSlug . '/redemption-requests' ; $ arrHeaders = $ this -> getHeaders ( ) ; $ objRequest = $ objWebClient -> post ( $ strUri , $ ar... | Create a redemption request . |
7,031 | public function patchRedemptionRequestRedemption ( $ strAccountSlug , $ intRedemptionRequestId ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/accounts/' . $ strAccountSlug . '/redemption-requests/' . $ intRedemptionRequestId . '/redemption' ; $ arrHeaders = $ this -> getHeaders... | Redeem a redemption request . After the redemption request is created it needs to be redeemed . This will deduct the amount of the advocate unclaimed balance and move the request to the completed state . |
7,032 | public function getReportsBonusesDailyGiven ( $ strAccountSlug = '' , $ strCampaignSlug = '' , $ strAdvocateToken = '' , $ strFrom = '' , $ strTo = '' ) { $ objWebClient = $ this -> getWebClient ( ) ; $ strUri = $ this -> getApiUrl ( ) . '/reports/bonuses-daily-given' ; $ arrHeaders = $ this -> getHeaders ( ) ; $ objRe... | Get bonuses daily given . |
7,033 | private function hasAtLeastOneFilter ( ) { $ columns = $ this -> options [ self :: GRID_PARAM_COLUMNS ] ; foreach ( $ columns as $ column ) { if ( isset ( $ column [ self :: GRID_PARAM_FILTER ] ) && $ column [ self :: GRID_PARAM_FILTER ] == true ) { return true ; } } return false ; } | Determines whether current configuration has at least one defined filter |
7,034 | public function render ( ) { $ columns = $ this -> options [ self :: GRID_PARAM_COLUMNS ] ; if ( $ this -> hasAtLeastOneFilter ( ) ) { $ head = $ this -> createTableHeader ( array ( $ this -> createTopHeadingRow ( $ columns ) , $ this -> createBottomHeadingRow ( $ columns ) ) ) ; } else { $ head = $ this -> createTable... | Renders the grid |
7,035 | private function hasColumnConfiguration ( $ column ) { $ columns = $ this -> options [ self :: GRID_PARAM_COLUMNS ] ; foreach ( $ columns as $ configuration ) { if ( ! isset ( $ configuration [ self :: GRID_PARAM_HIDDEN ] ) ) { $ configuration [ self :: GRID_PARAM_HIDDEN ] = false ; } if ( $ column == $ configuration [... | Checks whether a column has corresponding configuration |
7,036 | private function createTopHeadingRow ( array $ rows ) { $ elements = array ( ) ; if ( $ this -> options [ self :: GRID_PARAM_BATCH ] === true ) { $ checkbox = Element :: checkbox ( null , false , array ( ) , false ) ; $ elements [ ] = $ this -> createColumn ( null , $ checkbox ) ; } foreach ( $ rows as $ row ) { if ( !... | Creates table header |
7,037 | private function createBottomHeadingRow ( array $ rows ) { $ elements = array ( ) ; if ( $ this -> options [ self :: GRID_PARAM_BATCH ] === true ) { $ elements [ ] = $ this -> createColumn ( null , null ) ; } foreach ( $ rows as $ row ) { if ( ! $ this -> hasColumnConfiguration ( $ row [ self :: GRID_PARAM_COLUMN ] ) )... | Creates filtering row right after column captions |
7,038 | private function createBodyRows ( $ columns , array $ data ) { $ rows = array ( ) ; foreach ( $ data as $ row ) { $ rows [ ] = $ this -> createBodyRow ( $ columns , $ row ) ; } return $ rows ; } | Create many body rows elements |
7,039 | private function findOptionByColumn ( $ column , $ key ) { $ options = $ this -> findOptionsByColumn ( $ column ) ; return isset ( $ options [ $ key ] ) ? $ options [ $ key ] : null ; } | Find options by particular column |
7,040 | private function findOptionsByColumn ( $ column ) { foreach ( $ this -> options as $ collection ) { if ( is_array ( $ collection ) ) { foreach ( $ collection as $ row ) { if ( is_array ( $ row ) && $ row [ self :: GRID_PARAM_COLUMN ] == $ column ) { return $ row ; } } } } return false ; } | Find column options by its associated column name |
7,041 | private function getPkColumn ( ) { if ( isset ( $ this -> options [ self :: GRID_PARAM_PK ] ) ) { return $ this -> options [ self :: GRID_PARAM_PK ] ; } else { return false ; } } | Returns PK column name |
7,042 | private function createInput ( $ method , $ column , $ name , $ value , array $ extra = array ( ) ) { $ options = $ this -> findOptionsByColumn ( $ column ) ; $ type = isset ( $ options [ self :: GRID_PARAM_TYPE ] ) ? $ options [ self :: GRID_PARAM_TYPE ] : 'text' ; $ text = Element :: dynamic ( $ type , $ name , $ val... | Creates input element |
7,043 | private function createElement ( $ type , $ children = array ( ) , array $ attributes = array ( ) , $ text = null ) { $ element = new NodeElement ( ) ; $ element -> openTag ( $ type ) ; if ( ! empty ( $ attributes ) ) { $ element -> addAttributes ( $ attributes ) ; } if ( ! empty ( $ children ) ) { if ( $ children inst... | Shared element builder abstraction |
7,044 | private function createHeader ( $ children = array ( ) , $ text = null ) { return $ this -> createElement ( 'th' , $ children , array ( 'class' => $ this -> options [ 'tableHeaderClass' ] ) , $ text ) ; } | Creates table heading tag |
7,045 | private function createColumn ( $ children = array ( ) , $ text = null , array $ attributes = array ( ) ) { $ attributes = array_merge ( array ( 'class' => $ this -> options [ 'tableDataClass' ] ) , $ attributes ) ; return $ this -> createElement ( 'td' , $ children , $ attributes , $ text ) ; } | Creates table data tag |
7,046 | private function createHeaderLink ( $ column , $ text ) { $ a = new NodeElement ( ) ; $ a -> openTag ( 'a' ) ; if ( $ this -> filter -> isSortedBy ( $ column ) ) { $ a -> setClass ( 'text-info' ) ; } $ a -> addAttribute ( 'href' , $ this -> filter -> getColumnSortingUrl ( $ column ) ) -> appendChildWithText ( $ this ->... | Creates a link for table header |
7,047 | private function createHeaderLinkIcon ( $ column ) { $ class = $ this -> filter -> isSortedByDesc ( $ column ) ? $ this -> options [ 'arrowDownIcon' ] : $ this -> options [ 'arrowUpIcon' ] ; return $ this -> createIcon ( $ class ) ; } | Creates header link icon |
7,048 | public function findResources ( $ resourceName ) { $ request = get_request ( ) ; $ resource = Resources :: get ( $ resourceName ) ; if ( $ request -> has ( "rawQuery" ) ) { $ query = unserialize ( $ request -> get ( "rawQuery" ) ) ; $ resource -> limit ( $ query -> getLimit ( ) ) ; $ resource -> offset ( $ query -> get... | Busca recursos en el sistema |
7,049 | public function insertResource ( $ resourceName ) { $ request = get_request ( ) ; $ resource = Resources :: get ( $ resourceName ) ; if ( $ request -> has ( "rawQuery" ) ) { $ query = unserialize ( $ request -> get ( "rawQuery" ) ) ; $ resource -> fields ( $ query -> getFields ( ) ) ; } return $ resource -> insert ( ) ... | Inserta un nuevo recurso |
7,050 | public function paginate ( $ limit = 25 , $ page = 0 ) { if ( $ limit > 0 ) { $ this -> queryBuilder -> setMaxResults ( $ limit ) ; } if ( $ page > 0 ) { $ this -> queryBuilder -> setFirstResult ( $ page * $ limit ) ; } return $ this ; } | Set the page with paginate attribute . |
7,051 | public function andWhere ( $ field , $ operation , $ value = null , $ alias = self :: DEFAULT_TABLE_ALIAS ) { if ( strpos ( $ field , '.' ) > 0 ) { $ this -> fieldValue = [ 'value' => $ value , 'operation' => $ operation , ] ; $ newAliasField = $ this -> associationQueryFields ( $ field ) ; $ alias = $ newAliasField [ ... | Add a and where filter . |
7,052 | private function makeExpressions ( $ conditions , $ alias = self :: DEFAULT_TABLE_ALIAS ) { $ expressions = [ ] ; foreach ( $ conditions as $ attr ) { $ field = $ attr [ 'field' ] ; if ( strpos ( $ field , '.' ) > 0 ) { $ newAliasField = $ this -> associationQueryFields ( $ field ) ; $ alias = $ newAliasField [ 'alias'... | Create an array of expressions . |
7,053 | public function addGroupBy ( $ field ) { $ alias = self :: DEFAULT_TABLE_ALIAS ; if ( strpos ( $ field , '.' ) > 0 ) { $ newAliasField = $ this -> associationQueryFields ( $ field ) ; } if ( count ( $ this -> queryFields ) > 0 ) { foreach ( $ this -> queryFields as $ item ) { $ parts = [ ] ; if ( strpos ( $ item , ' AS... | Add a group by key . |
7,054 | public function select ( $ fields ) { foreach ( $ fields as $ key => $ value ) { if ( is_int ( $ key ) ) { $ this -> associationQueryFields ( $ value ) ; } elseif ( is_array ( $ value ) ) { $ alias = $ this -> tableAlias ( ) ; $ this -> queryBuilder -> join ( $ this -> getFullFieldName ( $ key , self :: DEFAULT_TABLE_A... | Add a select statement . |
7,055 | private function getMetaAndAliases ( ) { $ arr = explode ( '.' , $ this -> field ) ; $ meta = $ this -> getClassMetadata ( ) ; $ metaAnterior = [ ] ; $ parent = '' ; $ alias = '' ; for ( $ i = 0 ; $ i <= $ this -> position ; $ i ++ ) { $ metaAnterior = $ meta ; if ( $ meta -> hasAssociation ( $ arr [ $ i ] ) ) { $ clas... | Get the classMetadata and alias from the current position in the field . |
7,056 | private function setJoin ( $ table , $ field , $ parentField , $ alias , $ parentAlias ) { if ( ! in_array ( $ alias , $ this -> tables ) ) { $ condition = $ this -> getFullFieldName ( $ field , $ alias ) . ' = ' . $ this -> getFullFieldName ( $ parentField , $ parentAlias ) ; $ this -> queryBuilder -> join ( $ table ,... | Create a join . |
7,057 | private function setLeftJoin ( $ table , $ field , $ parentField , $ alias , $ parentAlias , $ withWhere = false ) { if ( ! in_array ( $ alias , $ this -> tables ) ) { $ condition = $ this -> getFullFieldName ( $ field , $ alias ) . ' = ' . $ this -> getFullFieldName ( $ parentField , $ parentAlias ) ; $ this -> queryB... | Create a left join with optional where . |
7,058 | private function setManyToManyValuedCondition ( $ association , $ alias , $ arr ) { if ( empty ( $ this -> fieldValue [ 'value' ] ) || $ this -> position < count ( $ arr ) - 2 ) { return null ; } $ targetField = $ this -> position == count ( $ arr ) - 1 ? $ association [ 'joinTable' ] [ 'joinColumns' ] [ 0 ] [ 'referen... | Create a condition with the value . |
7,059 | private function setManyToManyJoin ( $ table , $ alias , $ condition = null ) { if ( ! in_array ( $ alias , $ this -> tables ) ) { if ( $ condition ) { $ this -> queryBuilder -> join ( $ table , $ alias , 'WITH' , $ condition ) ; } else { $ this -> queryBuilder -> join ( $ table , $ alias ) ; } $ this -> tables [ ] = $... | Create a manyToMany join . |
7,060 | private function setQueryField ( $ meta , $ value , $ alias ) { $ campo = $ this -> getFullFieldName ( $ value , $ alias ) ; if ( $ meta -> isSingleValuedAssociation ( $ value ) && $ value != $ alias ) { $ targetField = $ meta -> getAssociationMapping ( $ value ) [ 'joinColumns' ] [ 0 ] [ 'referencedColumnName' ] ; $ a... | Add the field in the select field list . |
7,061 | private function getSubClassFields ( $ meta , $ value ) { foreach ( $ meta -> subClasses as $ subClass ) { $ delimiter = strpos ( $ subClass , '/' ) > 0 ? '/' : '\\' ; $ temp = explode ( $ delimiter , $ subClass ) ; $ tempMeta = $ this -> em -> getClassMetadata ( $ subClass ) ; if ( end ( $ temp ) == $ value ) { return... | Get the fields to create a join with a subClass . |
7,062 | private function getTargetField ( $ meta , $ parentMeta , $ value ) { if ( count ( $ parentMeta -> parentClasses ) > 0 ) { foreach ( $ parentMeta -> parentClasses as $ classe ) { $ associationsByTargetClass = $ meta -> getAssociationsByTargetClass ( $ classe ) ; if ( count ( $ associationsByTargetClass ) > 0 ) { $ pare... | Get the target field . |
7,063 | private function searchAssociationField ( $ associationsByTargetClass , $ parentTable , $ value ) { foreach ( $ associationsByTargetClass as $ table => $ association ) { if ( $ table == $ parentTable && $ association [ 'inversedBy' ] == $ value ) { return $ association [ 'fieldName' ] ; } } } | Search the field in the associations list . |
7,064 | public static function getJsFormat ( $ locale = null , $ timezone = null , $ date = true , $ time = true , $ seconds = false ) { $ pattern = static :: getPattern ( $ locale , $ timezone , $ date , $ time , $ seconds ) ; return static :: convertToJsFormat ( $ pattern ) ; } | Get the pattern of localized datetime format for javascript . |
7,065 | public static function getPattern ( $ locale = null , $ timezone = null , $ date = true , $ time = true , $ seconds = false ) { $ formatter = static :: getFormatter ( $ locale , $ timezone , $ date , $ time , $ seconds ) ; $ pattern = $ formatter -> getPattern ( ) ; return $ pattern ; } | Get the pattern of localized datetime format . |
7,066 | public static function getFormatter ( $ locale = null , $ timezone = null , $ date = true , $ time = true , $ seconds = false ) { $ locale = null === $ locale ? \ Locale :: getDefault ( ) : $ locale ; $ date_format = \ IntlDateFormatter :: NONE ; $ time_format = \ IntlDateFormatter :: NONE ; if ( $ date ) { $ date_form... | Get the intl date formatter with the localized configuration . |
7,067 | public static function convertToJsFormat ( $ pattern ) { if ( false === strpos ( $ pattern , 'yyyy' ) ) { if ( false !== strpos ( $ pattern , 'yy' ) ) { $ pattern = str_replace ( 'yy' , 'yyyy' , $ pattern ) ; } elseif ( false !== strpos ( $ pattern , 'y' ) ) { $ pattern = str_replace ( 'y' , 'yyyy' , $ pattern ) ; } } ... | Convert the php pattern to javascript pattern . |
7,068 | private function quoteMany ( array $ values ) { foreach ( $ values as & $ value ) { $ value = $ this -> quote ( $ value ) ; } return $ values ; } | Quotes a collection of strings |
7,069 | protected function createBlockView ( FormView $ view ) { $ bView = new BlockView ( ) ; $ bView -> vars = $ view -> vars ; $ bView -> vars [ 'block' ] = $ bView ; unset ( $ bView -> vars [ 'form' ] ) ; return $ bView ; } | Create the block view with the form view . |
7,070 | public function getMessages ( ) { $ messages = array ( ) ; foreach ( $ this -> _fields as $ fieldName => $ values ) { if ( ! $ values [ 'isValid' ] ) { $ invalidators = array ( ) ; foreach ( $ values [ 'validators' ] as $ validatorName => $ validatorValue ) { if ( ! $ validatorValue ) { $ invalidators [ ] = $ validator... | Returns every incorrect field and the corresponding validator |
7,071 | public function getFilteredFields ( ) { $ filteredFields = array ( ) ; foreach ( $ this -> _fields as $ fieldName => $ data ) { $ filteredFields [ $ fieldName ] = $ data [ 'value' ] ; } return $ filteredFields ; } | Returns every input parameter after content filtering |
7,072 | private function setField ( $ paramName , $ value = false , $ isValid = null , $ validators = null ) { if ( ! isset ( $ this -> _fields [ $ paramName ] ) ) { $ this -> _fields [ $ paramName ] = array ( 'originalValue' => ( isset ( $ this -> _params [ $ paramName ] ) ) ? $ this -> _params [ $ paramName ] : null , 'value... | After filtering or validating updates the field with additional data |
7,073 | public static function validateMatches ( $ value , $ compareField , $ instance ) { if ( isset ( $ instance -> _fields [ $ compareField ] ) ) { return ( $ value == $ instance -> _fields [ $ compareField ] [ 'value' ] ) ; } } | Validates that the input value matches another input parameter |
7,074 | public static function validateUrl ( $ value ) { if ( ( $ url = parse_url ( $ value ) ) && ! empty ( $ url [ 'scheme' ] ) && ! empty ( $ url [ 'host' ] ) ) { return true ; } return false ; } | Validates that the input value is an url |
7,075 | private static function fromRamseyUuid ( \ Ramsey \ Uuid \ Uuid $ uuid ) { return new self ( $ uuid -> getFieldsHex ( ) , $ uuid -> getNumberConverter ( ) , \ Ramsey \ Uuid \ Uuid :: getFactory ( ) -> getCodec ( ) ) ; } | Make sure the returned instance is a Rhumsaa \ Uuid \ Uuid which inherit from the Ramsey namespace . |
7,076 | public static function get ( Bookboon $ bookboon , string $ examId ) : BookboonResponse { if ( Entity :: isValidUUID ( $ examId ) === false ) { throw new BadUUIDException ( ) ; } $ bResponse = $ bookboon -> rawRequest ( "/exams/$examId" ) ; $ bResponse -> setEntityStore ( new EntityStore ( [ new static ( $ bResponse ->... | Get Exam . |
7,077 | public static function getAll ( Bookboon $ bookboon ) : BookboonResponse { $ bResponse = $ bookboon -> rawRequest ( "/exams" ) ; $ bResponse -> setEntityStore ( new EntityStore ( static :: getEntitiesFromArray ( $ bResponse -> getReturnArray ( ) ) ) ) ; return $ bResponse ; } | Get many exams |
7,078 | public function getConfigTreeBuilder ( ) { $ treeBuilder = new TreeBuilder ( ) ; $ rootNode = $ treeBuilder -> root ( 'vm_pro_api' ) ; $ rootNode -> children ( ) -> scalarNode ( 'base_url' ) -> defaultValue ( self :: DEFAULT_API_BASE_URL ) -> end ( ) -> scalarNode ( 'oauth_url' ) -> defaultValue ( self :: DEFAULT_OAUTH... | Build the configuration structure for this bundle . |
7,079 | public function generateCMSFields ( FieldList $ fields ) { $ owner = $ this -> owner ; $ siteConfig = SiteConfig :: current_site_config ( ) ; $ this -> type_array = array ( 'news' => _t ( 'News.NEWSITEMTYPE' , 'Newsitem' ) , ) ; $ this -> defaultFields ( ) ; $ this -> multipleNewsHolderPages ( ) ; $ this -> siteConfigF... | Create the fieldlist in the admin |
7,080 | private function defaultFields ( ) { $ owner = $ this -> owner ; $ this -> field_list = array ( 'Root.Main' => array ( 0 => TextField :: create ( 'Title' , $ owner -> fieldLabel ( 'Title' ) ) , 6 => HTMLEditorField :: create ( 'Content' , $ owner -> fieldLabel ( 'Content' ) ) , 8 => TextField :: create ( 'Author' , $ o... | Setup the default fields that are always available . |
7,081 | private function siteConfigFields ( News $ owner , SiteConfig $ siteConfig ) { if ( $ siteConfig -> UseAbstract ) { $ this -> field_list [ 'Root.Main' ] [ 4 ] = TextareaField :: create ( 'Synopsis' , $ owner -> fieldLabel ( 'Synopsis' ) ) ; } if ( $ siteConfig -> AllowExternals ) { $ this -> type_array [ 'external' ] =... | Create the fields based on the SiteConfig settings . |
7,082 | private function multipleNewsHolderPages ( ) { $ enabled = false ; if ( class_exists ( 'Translatable' ) ) { $ enabled = Translatable :: disable_locale_filter ( ) ; } $ pages = Versioned :: get_by_stage ( 'NewsHolderPage' , 'Live' ) ; if ( $ pages -> count ( ) > 1 ) { $ pagelist = array ( ) ; if ( class_exists ( 'Transl... | If there are multiple |
7,083 | private function existingItem ( News $ owner , SiteConfig $ siteConfig ) { if ( ! $ owner -> ID ) { $ member = Member :: currentUser ( ) ; $ this -> field_list [ 'Root.Main' ] [ 13 ] = ReadonlyField :: create ( 'Tags' , $ owner -> fieldLabel ( 'Tags' ) , _t ( 'News.TAGAFTERID' , 'Tags can be added after the item has be... | Setup the fields that are visible ONLY when the item exists already . |
7,084 | private function displayLogic ( ) { if ( class_exists ( 'DisplayLogicFormField' ) && count ( $ this -> type_array ) > 1 ) { $ this -> field_list [ 'Root.Main' ] [ 5 ] -> hideUnless ( 'Type' ) -> isEqualTo ( 'external' ) ; $ this -> field_list [ 'Root.Main' ] [ 6 ] -> hideUnless ( 'Type' ) -> isEqualTo ( 'news' ) ; $ th... | If UncleCheese s module Display Logic is available upgrade the visible fields! |
7,085 | private function setupFields ( News $ owner , FieldList $ fields ) { $ fields -> removeByName ( array_keys ( $ owner -> db ( ) ) ) ; $ fields -> removeByName ( array_keys ( $ owner -> has_one ( ) ) ) ; $ fields -> removeByName ( array_keys ( $ owner -> has_many ( ) ) ) ; $ fields -> removeByName ( array_keys ( $ owner ... | Setup the actual fieldlists and tabs . |
7,086 | private function decode ( $ json ) { if ( BaseClient :: $ flags & BaseClient :: FLAG_ATTEMPT_UTF8_RECOVERY ) if ( ! preg_match ( "//u" , $ json ) ) $ json = utf8_encode ( utf8_decode ( $ json ) ) ; $ response = json_decode ( $ json ) ; $ errorCode = json_last_error ( ) ; switch ( $ errorCode ) { case JSON_ERROR_DEPTH :... | Decodes the supplied JSON string throwing an exception if decoding fails |
7,087 | public function providePermissions ( ) { $ permissions = array ( ) ; $ config = Config :: inst ( ) -> get ( 'PublishProvider' , 'classes' ) ; foreach ( $ config as $ class ) { $ subClasses = array_keys ( ClassInfo :: subclassesFor ( $ class ) ) ; foreach ( $ subClasses as $ subClass ) { foreach ( array ( 'publish' , 'u... | Get a complete list of all the permissions this class uses . |
7,088 | function filter_call ( $ instance , $ method , ... $ args ) { if ( is_object ( $ instance ) ) { if ( is_object ( $ instance ) && method_exists ( $ instance , $ method ) ) return $ instance -> $ method ( ... $ args ) ; if ( isset ( $ instance [ $ method ] ) && is_callable ( $ instance [ $ method ] ) ) { $ m = $ instance... | Calls a method on an object with the given arguments . |
7,089 | function filter_assetUrl ( $ v ) { $ viewService = $ this -> injector -> make ( ViewServiceInterface :: class ) ; $ view = $ viewService -> currentView ( ) ; $ path = $ viewService -> getModuleOfPath ( $ view -> getPath ( ) ) ; return "modules/$path/$v" ; } | Converts an asset file path which is relative to the current module s public directory to an URL path relative to the application s root . |
7,090 | function filter_extract ( $ v , $ field = 'id' ) { return map ( $ v , function ( $ e ) use ( $ field ) { return getField ( $ e , $ field ) ; } ) ; } | Extracts a field from a list of arrays or objects and returns an array with the same cardinality containing that field s values . |
7,091 | function filter_fileUrl ( $ v ) { $ repo = $ this -> injector -> make ( ContentRepositoryInterface :: class ) ; return $ repo -> getFileUrl ( $ v ) ; } | Converts a repository asset s file path to a full relative URL . |
7,092 | private function subtag_check ( $ tagName ) { $ propName = lcfirst ( $ tagName ) ; if ( $ this -> current instanceof Metadata ) { switch ( $ this -> current -> type ) { case type :: metadata : return true ; } return false ; } return $ this -> current -> supportsProperties ( ) && $ this -> current -> props -> defines ( ... | Checks if a tag is a subtag of the current component or it is a child component . |
7,093 | private function text_optimize ( Component $ c ) { $ o = [ ] ; $ prev = null ; if ( $ c -> hasChildren ( ) ) foreach ( $ c -> getChildren ( ) as $ child ) { if ( $ prev && $ prev instanceof Text && ! $ prev -> getBindings ( ) && $ child instanceof Text && ! $ child -> getBindings ( ) ) { $ prev -> props -> value .= $ c... | Merges adjacent Text children of the specified container whenever that merge can be safely done . |
7,094 | protected function computeRollover ( $ currentTime ) { if ( $ this -> when == 'MIDNIGHT' ) { return strtotime ( "midnight + 1 day" , $ currentTime ) ; } if ( substr ( $ this -> when , 0 , 1 ) == 'W' ) { return strtotime ( "next " . self :: $ dayNames [ $ this -> dayOfWeek ] , $ currentTime ) ; } return $ currentTime + ... | Determine when the next log rotation should take place . |
7,095 | protected function getFilesToDelete ( ) { $ dirName = dirname ( $ this -> baseFilename ) ; $ baseName = basename ( $ this -> baseFilename ) ; $ fileNames = scandir ( $ dirName ) ; $ result = array ( ) ; $ prefix = $ baseName . '.' ; $ plen = strlen ( $ prefix ) ; foreach ( $ fileNames as $ fileName ) { if ( $ fileName ... | Return a list of old log files to delete . |
7,096 | public function resolvePackage ( $ name ) { $ packages = $ this -> getPackages ( ) ; foreach ( $ packages as $ instance ) { $ class = get_class ( $ instance ) ; $ classParts = explode ( '\\' , $ class ) ; $ className = $ classParts [ count ( $ classParts ) - 1 ] ; if ( $ name == $ className || 'SupraPackage' . $ name =... | This function uses woodoo magic to resolve package class name |
7,097 | protected function buildTemplating ( $ container ) { $ container [ 'templating.global' ] = function ( ) { return new SupraGlobal ( ) ; } ; $ container [ 'templating.templating' ] = function ( ) use ( $ container ) { $ templating = new TwigTemplating ( ) ; $ templating -> addGlobal ( 'supra' , $ container [ 'templating.... | Builds templating currently only twig |
7,098 | public function engine ( $ engineIdent = null ) { if ( $ engineIdent === null ) { $ engineIdent = $ this -> defaultEngine ( ) ; } if ( ! is_string ( $ engineIdent ) ) { throw new InvalidArgumentException ( 'Invalid engine identifier (must be a string)' ) ; } if ( ! isset ( $ this -> engines [ $ engineIdent ] ) ) { thro... | Get an engine s configuration . |
7,099 | public function setPythonLike ( $ pythonLike ) { if ( ! is_bool ( $ pythonLike ) ) { throw new \ Plop \ Exception ( 'Invalid value' ) ; } $ this -> pythonLike = $ pythonLike ; return $ this ; } | Set the format used to render exceptions . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.