idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
58,200 | protected function buildContentRoute ( Route $ route , $ name ) { $ contentType = $ route -> getContent ( ) ; $ contents = $ this -> app [ 'content_repository' ] -> listContents ( $ contentType ) ; $ this -> logger -> log ( sprintf ( 'Building route <comment>%s</comment> for <info>%s</info> <comment>%s(s)</comment>' , ... | Build content route |
58,201 | protected function buildSitemap ( Sitemap $ sitemap ) { $ content = $ this -> app [ 'twig' ] -> render ( '@phpillip/sitemap.xml.twig' , [ 'sitemap' => $ sitemap ] ) ; $ this -> builder -> write ( '/' , $ content , 'xml' , 'sitemap' ) ; } | Build sitemap xml file from Sitemap |
58,202 | private function authCookie ( Request $ request ) { if ( $ request -> cookies -> has ( self :: COOKIE_TOKEN_NAME ) ) { $ token = $ request -> cookies -> get ( self :: COOKIE_TOKEN_NAME ) ; return $ this -> authToken ( $ token ) ; } return null ; } | Authenticates a user by a token in a cookie |
58,203 | private function authHeader ( Request $ request ) { if ( $ request -> headers -> has ( 'authorization' ) ) { $ auth = $ request -> headers -> get ( 'authorization' ) ; if ( ! empty ( $ auth ) ) { list ( , $ token ) = explode ( ' ' , $ auth ) ; if ( empty ( $ token ) ) { return null ; } return $ this -> authToken ( $ to... | Authenticates a user by an authorization header |
58,204 | private function authBasic ( Request $ request ) { $ user = $ this -> findUser ( $ request -> getUser ( ) ) ; if ( $ user !== null && $ this -> verifyUser ( $ user , $ request -> getPassword ( ) ) ) { $ session = $ this -> findSession ( $ user ) ; if ( $ session === null ) { $ session = $ this -> createSession ( $ user... | Authenticates a user by basic authentication |
58,205 | protected function resolveIdentity ( $ username , $ accountId ) { $ identitySeed = $ this -> getServiceBroker ( ) -> service ( 'User' ) -> resolveIdentity ( $ username ) ; $ accountIds = isset ( $ identitySeed [ 'accountIds' ] ) ? $ identitySeed [ 'accountIds' ] : [ ] ; if ( in_array ( $ accountId , $ accountIds ) ) { ... | Resolve identity based on username |
58,206 | protected function prepareIdentity ( $ identitySeed ) { $ this -> getServiceBroker ( ) -> service ( 'Identity' ) -> setIdentity ( $ identitySeed ) ; $ identity = $ this -> getServiceBroker ( ) -> service ( 'Identity' ) -> getIdentity ( ) ; $ this -> getServiceBroker ( ) -> setDefaultIdentity ( $ identity ) ; return $ i... | Build new identity from identity seed |
58,207 | public static function validateServiceName ( $ serviceName ) { if ( ! in_array ( $ serviceName , self :: getAvailableServices ( ) ) ) { throw new DomainException ( sprintf ( "Notification service '%s' is not supported." , $ serviceName ) ) ; } return $ serviceName ; } | Checks if notification service is supported |
58,208 | protected function _typesNice ( ) { $ enumValues = singleton ( "SilverStripe\SiteConfig\SiteConfig" ) -> dbObject ( "Type" ) -> enumValues ( ) ; $ values = array ( ) ; foreach ( $ enumValues as $ enumValue ) { $ values [ $ enumValue ] = _t ( "SiteInfo.TYPE" . strtoupper ( $ enumValue ) , $ enumValue ) ; } return $ valu... | Add translated labels for the dropdown field |
58,209 | public function incrementByPk ( $ primary_key , $ keys , $ step = 1 ) { if ( $ this -> is_single ) { return $ this -> incrementOrDecrementByPk ( $ primary_key , $ keys , $ step ) ; } return false ; } | Increase key or keys by primary key |
58,210 | public function decrementByPk ( $ primary_key , $ keys , $ step = 1 ) { if ( $ this -> is_single ) { return $ this -> incrementOrDecrementByPk ( $ primary_key , $ keys , $ step , self :: MINUS_NOTIFICATION ) ; } return false ; } | Decrease key or keys by primary key |
58,211 | public function incrementOrDecrementByPk ( $ primary_key , $ keys , $ steps = 1 , $ op = self :: PLUS_NOTIFICATION ) { if ( $ this -> is_single ) { $ values = [ ] ; if ( is_array ( $ keys ) ) { foreach ( $ keys as $ k => $ key ) { if ( is_array ( $ steps ) && isset ( $ steps [ $ k ] ) ) { $ values [ $ key ] = [ $ op =>... | Increase or decrease key or keys by primary key |
58,212 | public function locateAlong ( LinearReferenceOpEvent $ evt ) { $ geometry = $ evt -> getGeometry ( ) ; $ this -> validGeometry ( $ geometry ) ; $ mValue = $ evt [ 'mValue' ] ; $ offset = $ evt [ 'offset' ] ; try { $ results = $ this -> getLocateAlong ( $ geometry , $ mValue , $ offset ) ; $ evt -> setResults ( $ result... | Gets the derived geometry collection with elements that match the specified measure . |
58,213 | public function locateBetween ( LinearReferenceOpEvent $ evt ) { $ geometry = $ evt -> getGeometry ( ) ; $ this -> validGeometry ( $ geometry ) ; $ mStart = $ evt [ 'mStart' ] ; $ mEnd = $ evt [ 'mEnd' ] ; $ offset = $ evt [ 'offset' ] ; try { $ results = $ this -> getLocateBetween ( $ geometry , $ mStart , $ mEnd , $ ... | Gets the derived geometry collection with elements that match the specified range of measured inclusively . |
58,214 | public function apply ( $ testable , array $ config = array ( ) ) { $ tokens = $ testable -> tokens ( ) ; $ message = 'Weak comparison operator {:key} used, try {:value} instead' ; $ filtered = $ testable -> findAll ( array_keys ( $ this -> inspectableTokens ) ) ; foreach ( $ filtered as $ id ) { $ token = $ tokens [ $... | Will iterate over each line checking if any weak comparison operators are used within the code . |
58,215 | protected function addFindersByConfigs ( array $ configs ) : self { foreach ( $ configs as $ package => $ path ) { $ data = @ include $ path ; if ( $ data && isset ( $ data [ 'easy-extend' ] ) ) { $ config = $ data [ 'easy-extend' ] ; if ( $ config ) { if ( isset ( $ config [ 'finder' ] ) ) { $ finder_callbacks = $ con... | Add finders by configs |
58,216 | protected function getConfigFilesByComposer ( ) : array { $ this -> getLogger ( ) -> write ( '<info>Searching for ".apishka" files</info>' ) ; if ( $ this -> getEvent ( ) === null ) throw new \ LogicException ( 'Event not exists' ) ; $ configs = array ( ) ; if ( $ this -> isDependantPackage ( $ this -> getEvent ( ) -> ... | Get config files by composer |
58,217 | protected function getConfigPackagePath ( string $ dir , PackageInterface $ package ) : ? string { $ dir = preg_replace ( '#^(' . preg_quote ( getcwd ( ) . DIRECTORY_SEPARATOR , '#' ) . ')#' , '.' . DIRECTORY_SEPARATOR , $ dir ) ; $ path = $ this -> getConfigPath ( $ dir ) ; if ( file_exists ( $ path ) ) { $ this -> ge... | Get config package file path |
58,218 | protected function boundsCheck ( ) { $ scores = $ this -> bitrank -> getScores ( ) ; if ( $ this -> score > $ scores -> max ) { $ this -> score = $ scores -> max ; } if ( $ this -> score < $ scores -> min ) { $ this -> score = $ scores -> min ; } } | Ensure score is within bounds |
58,219 | public function getFlagsOfType ( $ type ) { if ( $ this -> flags === null ) { return [ ] ; } $ matches = [ ] ; foreach ( $ this -> flags as $ flag ) { if ( $ flag -> type == $ type ) { $ matches [ ] = $ flag ; } } return $ matches ; } | Returns flags of the specified type associated with this address if any . |
58,220 | public function hasFlagsOfType ( $ type ) { if ( $ this -> flags === null ) { return false ; } foreach ( $ this -> flags as $ flag ) { if ( $ flag -> type == $ type ) { return true ; } } return false ; } | Returns whether or not this address has any flags of type . |
58,221 | protected function taskSymlinkFolderFileContents ( $ source , $ destination , Finder $ finder = null ) { return $ this -> task ( SymlinkFolderFileContents :: class , $ source , $ destination , $ finder ) ; } | Creates a SymlinkFolderFileContents task . |
58,222 | public function reset ( ) { $ this -> oosql_limit = null ; $ this -> oosql_order = null ; $ this -> oosql_where = null ; $ this -> oosql_join = null ; $ this -> oosql_stmt = null ; $ this -> oosql_conValues = array ( ) ; $ this -> oosql_numargs = null ; $ this -> oosql_fromFlag = false ; $ this -> oosql_multiFlag = fal... | Resets the class vars to their initial values for a new query |
58,223 | protected function sql ( $ sql = null , $ replace = false ) { if ( null !== $ sql ) { if ( ! isset ( $ this -> oosql_sql [ $ this -> oosql_table ] ) || $ replace ) { $ this -> oosql_sql [ $ this -> oosql_table ] = $ sql ; } else { $ this -> oosql_sql [ $ this -> oosql_table ] .= $ sql ; } return ; } return $ this -> oo... | Append to the query string or return the current one |
58,224 | public function select ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'SELECT ' ) ; if ( $ this -> oosql_distinct ) { $ this -> sql ( 'DISTINCT ' ) ; } $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { $ arg_list = func_get_args ( ) ; $ this -> oosql_fields = $ arg_list ; for ( $ i = 0 ; $ i < $ numargs ;... | Create a select statement |
58,225 | public function getFields ( $ table = null ) { if ( null == $ table ) { $ table = $ this -> oosql_table ; } $ newFields = array ( ) ; foreach ( $ this -> oosql_fields as $ field ) { $ newFields [ ] = $ table . '.' . $ field ; } return $ newFields ; } | Get an array of fields of the current or given table |
58,226 | public function insert ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'INSERT INTO ' . $ this -> oosql_table ) ; $ arg_list = func_get_args ( ) ; $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { $ this -> oosql_numargs = $ numargs ; $ this -> sql ( ' (' ) ; $ this -> sql ( implode ( ',' , $ arg_list ) ) ... | Creates an INSERT query |
58,227 | public function update ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'UPDATE' ) ; $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { $ arg_list = func_get_args ( ) ; $ this -> oosql_multiFlag = true ; $ this -> oosql_multi = $ arg_list ; for ( $ i = 0 ; $ i < $ numargs ; $ i ++ ) { if ( $ i != 0 && $ numa... | Creates an UPDATE query |
58,228 | public function delete ( ) { self :: $ instance -> reset ( ) ; $ this -> sql ( 'DELETE' ) ; $ this -> oosql_where = null ; $ numargs = func_num_args ( ) ; if ( $ numargs > 0 ) { if ( $ numargs > 1 ) { $ this -> oosql_del_multiFlag = true ; $ this -> oosql_del_numargs = $ numargs ; } $ arg_list = func_get_args ( ) ; if ... | Creates a DELETE query |
58,229 | public function deleteRecord ( $ oosql = null , array $ criteria ) { if ( null == $ oosql ) { $ oosql = $ this ; } $ oosql -> delete ( ) -> createWhere ( $ criteria ) -> exe ( ) ; return $ this ; } | Delete a record or more from a table |
58,230 | public function set ( array $ data ) { $ sql = '' ; foreach ( $ data as $ field => $ value ) { $ sql .= $ field . ' = ?,' ; $ this -> oosql_conValues [ ] = $ value ; } $ this -> sql ( rtrim ( $ sql , ',' ) ) ; return $ this ; } | Sets the column value pairs in update queries |
58,231 | public function values ( ) { $ arg_list = func_get_args ( ) ; $ numargs = func_num_args ( ) ; if ( ( $ this -> oosql_numargs !== 0 && $ numargs !== $ this -> oosql_numargs ) || $ numargs === 0 ) { $ msg = 'Insert numargs: ' . $ this -> oosql_numargs . ' | values numargs = ' . $ numargs . ', Columns and passed data do n... | Assembles values part of an insert |
58,232 | public function from ( ) { $ from = '' ; $ numargs = func_num_args ( ) ; if ( $ this -> oosql_del_multiFlag ) { if ( $ numargs < $ this -> oosql_del_numargs ) { $ msg = 'Columns and passed data do not match! ' . $ this -> sql ( ) ; throw new \ Exception ( $ msg , 9810 , null ) ; } } $ from .= ' FROM ' ; $ from .= $ thi... | Assembles the FROM part of the query |
58,233 | public function where ( $ condition , $ value = null , $ type = null ) { switch ( $ type ) { case null : $ clause = 'WHERE' ; break ; case 'or' : $ clause = 'OR' ; break ; case 'and' : $ clause = 'AND' ; break ; default : $ clause = 'WHERE' ; } $ this -> oosql_where .= " $clause $condition" ; if ( $ value instanceof oo... | Assembles a WHERE clause |
58,234 | public function sub ( ) { $ this -> oosql_sub = true ; $ this -> exe ( ) ; $ this -> sql ( '(' . $ this -> getSql ( ) . ')' , true ) ; return $ this ; } | Declares current query as a sub - query |
58,235 | public function prep ( $ values = null ) { $ hash = $ this -> queryHash ( ) ; $ prepOnly = true ; if ( is_array ( $ values ) ) { $ prepOnly = false ; } if ( $ this -> oosql_prepParams ) { $ this -> oosql_stmt = $ this -> prepare ( trim ( $ this -> sql ( ) ) , $ this -> oosql_prepParams ) ; } else { $ this -> oosql_stmt... | Prepare a query statement |
58,236 | public function execBound ( \ PDOStatement $ stmt , array $ values ) { $ ord = 1 ; foreach ( $ values as $ val ) { if ( is_bool ( $ val ) ) { $ stmt -> bindValue ( $ ord , $ val , \ PDO :: PARAM_BOOL ) ; } elseif ( is_resource ( $ val ) ) { $ stmt -> bindValue ( $ ord , $ val , \ PDO :: PARAM_LOB ) ; } elseif ( ( strin... | Executes a prepared statement with parameterized values |
58,237 | public function exe ( ) { if ( $ this -> oosql_fromFlag ) { $ this -> from ( ) ; } if ( null != $ this -> oosql_join ) { $ this -> sql ( $ this -> oosql_join ) ; } if ( null != $ this -> oosql_where ) { $ this -> sql ( $ this -> oosql_where ) ; } if ( null != $ this -> oosql_in ) { $ this -> sql ( $ this -> oosql_in ) ... | Checks flags and clauses then assembles and executes the query |
58,238 | protected function prepFetch ( ) { if ( $ this -> oosql_sub ) { return $ this ; } if ( ! $ this -> oosql_select instanceof oosql ) { $ this -> select ( ) ; } $ this -> oosql_select -> exe ( ) ; if ( ! $ this -> oosql_stmt ) { $ msg = 'Query returned no results! ' . $ this -> sql ( ) ; throw new \ Exception ( $ msg , 98... | Returns the results of a SELECT if any |
58,239 | public function with ( array $ related ) { $ relations = $ this -> getEntityObject ( ) -> getRelations ( ) ; foreach ( $ relations as $ fk => $ target ) { $ table = strstr ( $ target , '.' , true ) ; if ( in_array ( $ table , $ related ) ) { $ this -> sql ( " ,$table.*" ) ; $ this -> join ( $ table , "$this->oosql_tabl... | Creates a join automatically based on the relationships of current entity |
58,240 | public function limit ( $ from , $ size ) { if ( ! $ this -> oosql_multiFlag ) { $ this -> oosql_limit = ' LIMIT ' . $ from . ', ' . $ size ; } return $ this ; } | Creates a limit clause for MySQL |
58,241 | public function orderBy ( $ field , $ dir = 'ASC' ) { if ( ! $ this -> oosql_multiFlag ) { $ this -> oosql_order = ' ORDER BY ' . $ field . ' ' . $ dir ; } return $ this ; } | Creates an ORDER BY clause |
58,242 | public function findOne ( $ arg = null , $ operator = '=' , $ fields = array ( '*' ) ) { return $ this -> find ( $ arg , $ operator , $ fields ) -> limit ( 0 , 1 ) ; } | Find first random value returned by the query |
58,243 | public function findLimited ( $ from , $ to , $ arg = null , $ operator = '=' , $ fields = array ( '*' ) ) { return $ this -> find ( $ arg , $ operator , $ fields ) -> limit ( $ from , $ to ) ; } | Find with limit |
58,244 | public function find ( $ arg = null , $ operator = '=' , $ fields = array ( '*' ) ) { if ( $ fields [ 0 ] == '*' ) { $ this -> select ( ) ; } else { $ select_args = '' ; foreach ( $ fields as $ key => $ field ) { if ( is_array ( $ field ) && is_string ( $ key ) ) { foreach ( $ field as $ part ) { $ select_args .= $ key... | Find records with a filtering condition |
58,245 | public function alias ( $ alias = null ) { if ( null === $ alias ) { $ alias = $ this -> getTableAlias ( ) ; } $ this -> oosql_table_alias = $ alias ; return $ this ; } | Creates or bind provided alias with the current loaded table class |
58,246 | public function notIn ( $ item , array $ list , $ cond = null , $ not = true ) { return $ this -> in ( $ item , $ list , $ cond , $ not ) ; } | Creates a NOT IN clause |
58,247 | public function orIn ( $ item , array $ list , $ cond = 'or' , $ not = false ) { return $ this -> in ( $ item , $ list , $ cond , $ not ) ; } | Creates a OR IN clause |
58,248 | public function orNotIn ( $ item , array $ list , $ cond = 'or' , $ not = true ) { return $ this -> in ( $ item , $ list , $ cond , $ not ) ; } | Creates an OR NOT IN clause |
58,249 | public function in ( $ item , array $ list , $ cond = null , $ not = false ) { $ inClause = '' ; if ( null == $ this -> oosql_where && null == $ this -> oosql_in && null == $ this -> oosql_between ) { $ inClause .= ' WHERE ' ; } else { $ cnd = ' AND ' ; if ( null != $ cond ) { if ( strtolower ( $ cond ) == 'or' ) { $ c... | Creates an IN clause |
58,250 | public function between ( $ item , $ low , $ up , $ cond = null , $ not = false ) { $ bClause = '' ; if ( null == $ this -> oosql_where && null == $ this -> oosql_between && null == $ this -> oosql_in ) { $ bClause .= ' WHERE ' ; } else { $ cnd = ' AND ' ; if ( null != $ cond ) { if ( strtolower ( $ cond ) == 'or' ) { ... | Creates a BETWEEN clause |
58,251 | public static function transactional ( $ fn ) { $ oosql = self :: getInstance ( 'oosql' , 'void' ) ; if ( ! $ oosql -> beginTransaction ( ) ) { $ msg = 'Could not start this transaction. BeginTransaction failed!' ; throw new \ Exception ( $ msg , 9815 , null ) ; } if ( is_callable ( $ fn ) ) { $ ret = $ fn ( $ oosql ) ... | Starts a transaction if current driver supports it |
58,252 | public function getNamedLock ( $ name , $ timeout = 15 ) { $ stmt = $ this -> query ( 'SELECT GET_LOCK("' . $ name . '", ' . $ timeout . ')' ) ; return $ stmt -> fetch ( self :: FETCH_COLUMN ) ; } | Try to obtain a named lock |
58,253 | public function releaseNamedLock ( $ name ) { $ stmt = $ this -> query ( 'SELECT RELEASE_LOCK("' . $ name . '")' ) ; return $ stmt -> fetch ( self :: FETCH_COLUMN ) ; } | releases a named lock |
58,254 | public function packPayload ( $ payload ) { $ payload = JsonEncoder :: jsonEncode ( $ payload ) ; $ message = $ this -> message ; $ recipientId = $ message -> getRecipientDeviceCollection ( ) -> current ( ) -> getIdentifier ( ) ; $ messageRecipientId = $ this -> notificationId . '_' . $ recipientId ; $ packedPayload = ... | Pack message body into binary string |
58,255 | public static function set ( $ uri , $ path = false ) { $ route = new \ Ginger \ Route ( $ uri , $ path ) ; self :: $ routes [ $ route -> route ] = $ route ; } | set function . |
58,256 | public static function detect ( $ uri ) { $ routes = self :: get ( ) ; $ found = false ; foreach ( $ routes as $ key => $ route ) { $ currentLength = strlen ( $ route -> route ) ; if ( substr ( $ uri , 0 , $ currentLength ) == $ route -> route ) { $ found = $ route ; break ; } } return $ found ; } | detect function . |
58,257 | private function _lookUpBy ( $ service , $ data ) { $ batch = false ; $ urlFormat = self :: $ URLS [ $ service ] ; if ( is_array ( $ data ) ) { $ data = implode ( ',' , $ data ) ; $ batch = true ; } $ url = self :: BASE_URL . sprintf ( $ urlFormat , urlencode ( $ data ) ) . sprintf ( self :: API_KEY , $ this -> _apiKey... | Looks up an user using the given service data . |
58,258 | private function _checkdatabase ( $ database ) { if ( count ( $ this -> _collection ) == 0 ) { $ this -> _collection [ $ database ] = new $ database ( ) ; return $ this -> _collection [ $ database ] ; } $ new = false ; foreach ( $ this -> _collection as $ db ) { if ( $ db === $ database ) continue ; $ new = true ; } if... | checks if a database already exists |
58,259 | protected function getPossibleEmails ( ) { $ this -> checkGit ( ) ; $ github_email = null ; $ github_email = str_replace ( array ( "\r" , "\n" ) , '' , shell_exec ( 'git config user.email' ) ) ; if ( filter_var ( $ github_email , FILTER_VALIDATE_EMAIL ) ) { return [ $ github_email ] ; } else { return [ ] ; } } | Get possible emails |
58,260 | protected function createMySQLUser ( ) { $ this -> checkParameters ( ) ; $ this -> url = $ this -> obtainAPIURLEndpoint ( ) ; $ this -> http -> post ( $ this -> url , [ 'form_params' => $ this -> getData ( ) , 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' , 'Authorization' => 'Bearer ' . fp_env ( 'ACACHA_FORGE_... | Create MySQL user . |
58,261 | protected function listMySQLUsers ( ) { $ this -> url = $ this -> obtainAPIURLEndpointForList ( ) ; $ response = $ this -> http -> get ( $ this -> url , [ 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' , 'Authorization' => 'Bearer ' . fp_env ( 'ACACHA_FORGE_ACCESS_TOKEN' ) ] ] ) ; $ users = json_decode ( $ respo... | List MySQL users . |
58,262 | protected function addValueToEnv ( $ key , $ value ) { $ env_path = base_path ( '.env' ) ; $ sed_command = "/bin/sed -i '/^$key=/d' " . $ env_path ; passthru ( $ sed_command ) ; File :: append ( $ env_path , "\n$key=$value\n" ) ; } | Add value to env . |
58,263 | public function Anchor ( ) { if ( $ this -> MenuTitle && $ this -> ShowInMenus ) { return strtolower ( trim ( preg_replace ( '/[^a-zA-Z0-9]+/' , '-' , $ this -> MenuTitle ) , '-' ) ) ; } return false ; } | Applies anchor to section in template . |
58,264 | public function Classes ( ) { $ classes = array ( $ this -> config ( ) -> get ( 'base_class' ) ) ; if ( $ this -> Style ) { $ classes [ ] = strtolower ( $ this -> Style ) . '-' . strtolower ( preg_replace ( '/([a-z]+)([A-Z0-9])/' , '$1-$2' , get_called_class ( ) ) ) ; } else { $ classes [ ] = strtolower ( preg_replace ... | Applies classes to section in template . |
58,265 | static function write_json_file ( $ filename , $ json_array , array $ whitelist = null , $ json_options = null ) { $ stop_snippet = "<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>" ; if ( $ whitelist === null ) { $ result = array_merge ( array ( '_' => null ) , $ json_array ) ; } else { $ header = array_interse... | Encode array to JSON using json_encode but insert PHP snippet to protect sensitive data . |
58,266 | public function filterLoad ( AssetInterface $ asset ) { $ assetRoot = $ asset -> getSourceRoot ( ) ; $ assetPath = $ asset -> getSourcePath ( ) ; $ assetImportDir = dirname ( $ assetRoot . '/' . $ assetPath ) ; $ importDir = $ this -> config -> getBootstrapPath ( ) . '/less' ; $ this -> setupLoadPaths ( $ assetImportDi... | Sets the by - config generated imports on the asset . |
58,267 | protected function extractImports ( $ importsFile ) { $ str = file_get_contents ( $ importsFile ) ; preg_match_all ( '/@import "(?!variables)(?<imports>[\w-_\.]+)";/' , $ str , $ matches ) ; return array_map ( 'trim' , $ matches [ 'imports' ] ) ; } | Extract the imports from the import file . |
58,268 | protected function extractVariables ( $ variablesFile ) { $ str = file_get_contents ( $ variablesFile ) ; $ parts = explode ( ';' , preg_replace ( '/(\/\/.*?\n|\s\n|\s{2,})/' , '' , $ str ) ) ; $ vars = array ( ) ; foreach ( $ parts as $ part ) { $ varMeta = explode ( ':' , $ part ) ; if ( empty ( $ varMeta [ 0 ] ) || ... | Extract the variables from the less file . |
58,269 | protected function filterImportFiles ( array $ imports ) { $ config = $ this -> config ; $ excludedComponents = $ config -> getExcludedComponents ( ) ; $ includedComponents = $ config -> getIncludedComponents ( ) ; if ( ! empty ( $ excludedComponents ) && ! empty ( $ includedComponents ) ) { throw new Exception \ Runti... | Filter the import files needed . |
58,270 | protected function removeImportFiles ( array $ importFiles , array $ config ) { foreach ( $ config as $ item ) { if ( in_array ( $ item , $ importFiles ) ) { unset ( $ importFiles [ array_search ( $ item , $ importFiles ) ] ) ; } } return $ importFiles ; } | Remove import files from the import config . |
58,271 | public static function checkPermission ( $ userId = false ) { $ user = \ Phramework \ Phramework :: getUser ( ) ; if ( ! $ user ) { throw new \ Phramework \ Exceptions \ UnauthorizedException ( ) ; } if ( $ userId !== false && $ user -> id != $ userId ) { throw new PermissionException ( 'Insufficient permissions' ) ; }... | Check if current request is authenticated |
58,272 | public static function requireParameters ( $ parameters , $ required ) { if ( is_object ( $ parameters ) ) { $ parameters = ( array ) $ parameters ; } $ missing = [ ] ; if ( ! is_array ( $ required ) ) { $ required = [ $ required ] ; } foreach ( $ required as $ key ) { if ( ! isset ( $ parameters [ $ key ] ) ) { array_... | Check if required parameters are set |
58,273 | public static function resourceId ( $ parameters , $ UINTEGER = true ) { if ( is_object ( $ parameters ) ) { $ parameters = ( array ) $ parameters ; } if ( isset ( $ parameters [ 'resource_id' ] ) && preg_match ( Validate :: REGEXP_RESOURCE_ID , $ parameters [ 'resource_id' ] ) !== false ) { if ( $ UINTEGER ) { return ... | Require id parameter if it s set else return NULL it uses resource_id or id parameter if available |
58,274 | public static function requireId ( $ parameters , $ UINTEGER = true ) { if ( is_object ( $ parameters ) ) { $ parameters = ( array ) $ parameters ; } if ( isset ( $ parameters [ 'resource_id' ] ) && preg_match ( Validate :: REGEXP_RESOURCE_ID , $ parameters [ 'resource_id' ] ) !== false ) { $ parameters [ 'id' ] = $ pa... | Require id parameter it uses resource_id or id parameter if available |
58,275 | public static function parseModel ( $ parameters , $ model ) { if ( is_object ( $ parameters ) ) { $ parameters = ( array ) $ parameters ; } $ required_fields = [ ] ; foreach ( $ model as $ key => $ value ) { if ( in_array ( 'required' , $ value , true ) === true || in_array ( 'required' , $ value , true ) == true ) { ... | Required required values and parse provided parameters into an array Validate the provided request model and return the |
58,276 | public static function toStudlyCase ( $ input ) { $ input = trim ( $ input , '-_' ) ; return ucfirst ( preg_replace_callback ( '/([A-Z-_][a-z]+)/' , function ( $ matches ) { return ucfirst ( str_replace ( [ '-' , '_' ] , '' , $ matches [ 0 ] ) ) ; } , $ input ) ) ; } | Transforms a given input into StudlyCase |
58,277 | public static function pluralize ( $ input ) { if ( self :: $ pluralizer === null ) { self :: $ pluralizer = new StandardEnglishSingularizer ( ) ; } return self :: $ pluralizer -> getPluralForm ( $ input ) ; } | Returns the plural form of the input |
58,278 | public static function singularize ( $ input ) { if ( self :: $ pluralizer === null ) { self :: $ pluralizer = new StandardEnglishSingularizer ( ) ; } return self :: $ pluralizer -> getSingularForm ( $ input ) ; } | Returns the singular form of the input |
58,279 | public function linkNames ( String $ prev , String $ next , String $ first , String $ last ) : Paginator { $ this -> settings [ 'prevName' ] = $ prev ; $ this -> settings [ 'nextName' ] = $ next ; $ this -> settings [ 'firstName' ] = $ first ; $ this -> settings [ 'lastName' ] = $ last ; return $ this ; } | Change the names of links . |
58,280 | public function settings ( Array $ config = [ ] ) : Paginator { foreach ( $ config as $ key => $ value ) { $ this -> $ key = $ value ; } $ this -> class = array_merge ( $ this -> config [ 'class' ] , $ this -> class ?? [ ] ) ; $ this -> style = array_merge ( $ this -> config [ 'style' ] , $ this -> style ?? [ ] ) ; if ... | Configures all settings of the page . |
58,281 | public function create ( $ start = NULL , Array $ settings = [ ] ) : String { $ settings = array_merge ( $ this -> config , $ this -> settings , $ settings ) ; if ( ! empty ( $ settings ) ) { $ this -> settings ( $ settings ) ; } $ startRowNumber = $ this -> getStartRowNumber ( $ start ) ; $ this -> limit = $ this -> l... | Creates the pagination . |
58,282 | protected function createBasicPaginationBar ( $ startRowNumber ) { if ( $ this -> isPrevLink ( $ startRowNumber ) ) { $ this -> addPrevLink ( $ startRowNumber , $ prevLink ) ; } else { $ this -> removeLinkFromPagingationBar ( $ prevLink ) ; } if ( $ this -> isNextLink ( $ this -> getPerPage ( ) , $ startRowNumber ) ) {... | Protected create basic pagination bar |
58,283 | protected function createAdvancedPaginationBar ( $ startRowNumber ) { if ( $ this -> isAdvancedPrevLink ( $ startRowNumber ) ) { $ this -> addPrevLink ( $ startRowNumber , $ prevLink ) ; } else { $ this -> removeLinkFromPagingationBar ( $ prevLink ) ; } if ( $ this -> isAdvancedNextLink ( $ startRowNumber ) ) { $ this ... | Protected create advanced pagination bar |
58,284 | protected function addLastLink ( & $ lastLink ) { $ lastLink = $ this -> getLink ( $ this -> calculatePageRowNumberForLastLink ( ) , $ this -> getStyleClassAttributes ( 'last' ) , $ this -> lastName ) ; } | Protected get last link |
58,285 | protected function addPrevLink ( $ startRowNumber , & $ prevLink ) { $ prevLink = $ this -> getLink ( $ this -> decrementPageRowNumber ( $ startRowNumber ) , $ this -> getStyleClassAttributes ( 'prev' ) , $ this -> prevName ) ; } | Protected get prev link |
58,286 | protected function addNextLink ( $ startRowNumber , & $ nextLink ) { $ nextLink = $ this -> getLink ( $ this -> incrementPageRowNumber ( $ startRowNumber ) , $ this -> getStyleClassAttributes ( 'next' ) , $ this -> nextName ) ; } | Protected get advanced next link |
58,287 | protected function getStartRowNumber ( $ start ) { if ( $ this -> start !== NULL ) { $ start = ( int ) $ this -> start ; } if ( empty ( $ start ) && ! is_numeric ( $ start ) ) { return ! is_numeric ( $ segment = URI :: segment ( - 1 ) ) ? 0 : $ segment ; } return ! is_numeric ( $ start ) ? 0 : $ start ; } | Protected get start row number |
58,288 | protected function getAdvancedPerPage ( $ pageIndex , & $ nextLink , & $ lastLink ) { $ perPage = $ this -> countLinks + $ pageIndex - 1 ; if ( $ perPage >= ( $ getPerPage = $ this -> getPerPage ( ) ) ) { $ this -> removeLinkFromPagingationBar ( $ nextLink ) ; $ this -> removeLinkFromPagingationBar ( $ lastLink ) ; $ p... | Protected advanced per page . |
58,289 | protected function getNumberLinks ( $ perPage , $ startRowNumber , $ startIndexNumber = 1 ) { $ numberLinks = NULL ; for ( $ i = $ startIndexNumber ; $ i <= $ perPage ; $ i ++ ) { $ page = ( $ i - 1 ) * $ this -> limit ; if ( $ i - 1 == floor ( ( int ) $ startRowNumber / $ this -> limit ) ) { $ currentLink = $ this -> ... | Protected get number links |
58,290 | protected function calculatePageRowNumberForLastLink ( ) { $ mod = $ this -> totalRows % $ this -> limit ; return ( $ this -> totalRows - $ mod ) - ( $ mod == 0 ? $ this -> limit : 0 ) ; } | Protected page row number for last link |
58,291 | protected function checkGetRequest ( $ page ) { $ this -> url .= $ this -> explodeRequestGetValue ( ) ; if ( strstr ( $ this -> url , '?' ) ) { $ urlEx = explode ( '?' , $ this -> url ) ; return Base :: suffix ( $ urlEx [ 0 ] ) . $ page . '?' . rtrim ( $ urlEx [ 1 ] , '/' ) ; } return $ this -> type === 'ajax' ? $ this... | Protected check get request |
58,292 | protected function getLink ( $ var , $ fix , $ val ) { return $ this -> getHtmlLiElement ( $ this -> getHtmlAnchorElement ( $ var , $ fix , $ val ) , $ fix ) ; } | Protected get link |
58,293 | protected function getHtmlAnchorElement ( $ var , $ attr , $ val ) { if ( $ this -> output === 'bootstrap' ) { $ attr = NULL ; } return '<a href="' . $ this -> checkGetRequest ( $ var ) . '"' . $ this -> getAttributesForAjaxProcess ( $ var ) . $ attr . '>' . $ val . '</a>' ; } | Protected get html anchor element |
58,294 | protected function generatePaginationBar ( ... $ numberLinks ) { $ links = $ this -> implodeLinks ( ... $ numberLinks ) ; if ( $ this -> output === 'bootstrap' ) { return '<ul class="pagination">' . $ links . '</ul>' ; } return $ links ; } | Protected get html ul element |
58,295 | protected function getStyleLinkAttribute ( $ var , $ type = 'style' ) { $ getAttribute = ( ! empty ( $ this -> { $ type } [ $ var ] ) ) ? $ this -> { $ type } [ $ var ] . ' ' : '' ; if ( $ type === 'class' ) { $ this -> classAttribute = $ getAttribute ; } else { $ this -> styleAttribute = $ getAttribute ; } return $ th... | Protected get style link attribute |
58,296 | protected function getClassAttribute ( $ var , $ type = 'class' ) { $ status = trim ( ( $ type === 'class' ? $ this -> classAttribute : $ this -> styleAttribute ) . $ this -> { $ type } [ $ var ] ) ; return $ this -> createAttribute ( $ status , $ type ) ; } | Protected get class attribute |
58,297 | protected function createAttribute ( $ condition , $ key , $ value = NULL ) { return ! empty ( $ condition ) ? ' ' . $ key . '="' . trim ( $ value ?? $ condition ) . '"' : '' ; } | Protcted create attribute |
58,298 | final public function finalise ( ) { if ( $ this -> view -> isEnabled ( ) ) { $ this -> view -> setResponse ( $ this -> response ) ; $ this -> view -> render ( ) ; } return true ; } | Called at the end of the process . |
58,299 | final public function urlFor ( $ routeName , array $ params = array ( ) ) { if ( null === $ this -> router ) { return '' ; } return $ this -> router -> urlFor ( $ routeName , $ params ) ; } | Get a route path by a given name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.