idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
8,500 | private function extractZip ( ) { $ this -> info ( "Extracting" ) ; $ this -> tmpDirectory = tmpPath ( $ this -> tmpRandomName ) ; Zipper :: make ( $ this -> tmpZipFile ) -> extractTo ( $ this -> tmpDirectory ) ; File :: delete ( $ this -> tmpZipFile ) ; $ directories = File :: directories ( $ this -> tmpDirectory ) ; ... | Read zip file |
8,501 | private function addPluginInDB ( ) { $ configContent = Plugin :: config ( $ this -> pluginNamespace ) ; $ plugin = new Plugin ( ) ; $ plugin -> title = $ configContent -> title ; $ plugin -> namespace = $ configContent -> namespace ; $ plugin -> organization = $ configContent -> organization ; $ plugin -> version = $ c... | Add plugin in database |
8,502 | public function markdownFilter ( $ input , $ parserName = 'default' ) { $ parser = $ this -> parserCollection -> getParser ( $ parserName ) ; return $ parser -> parse ( $ input ) ; } | Render the filter makrdown . |
8,503 | public function store ( Request $ request ) { if ( ! User :: hasAccess ( 'Media' , 'create' ) ) { return $ this -> noPermission ( ) ; } return ( new Media ( ) ) -> upload ( $ request ) ; } | This function uses upload function that is defined in Media model that uploads files . |
8,504 | public function getList ( $ lang , $ pagination ) { if ( ! User :: hasAccess ( 'Media' , 'read' ) ) { return $ this -> noPermission ( ) ; } $ list = Pagination :: infiniteScrollPagination ( 'media' , $ pagination , Media :: $ infinitPaginationShow ) ; $ results = [ 'list' => $ list , 'count' => $ list -> count ( ) , 'p... | Get the list of media files . |
8,505 | public function edit ( Request $ request ) { if ( ! User :: hasAccess ( 'Media' , 'update' ) ) { return $ this -> noPermission ( ) ; } $ media = Media :: find ( $ request -> mediaID ) ; $ media -> title = $ request -> title ; $ media -> description = $ request -> description ; $ media -> credit = $ request -> credit ; ... | Edit a specific media file information . |
8,506 | public function delete ( Request $ request ) { $ isOk = "OK" ; foreach ( $ request -> all ( ) as $ key => $ file ) { if ( $ key === "postTypes" ) { continue ; } if ( ! User :: hasAccess ( 'Media' , 'delete' , $ file [ 'mediaID' ] , true ) ) { return $ this -> noPermission ( ) ; } $ media = Media :: find ( $ file [ 'med... | Delete media file . |
8,507 | private function getWatermak ( ) { $ watermarkMediaID = settings ( "watermark" ) ; if ( ! $ watermarkMediaID ) { return $ this -> response ( "No watermark is available. Go to settings and set a watermark" , 500 ) ; } $ watermarImage = Media :: find ( $ watermarkMediaID ) ; if ( ! $ watermarImage ) { return $ this -> re... | Get watermark . |
8,508 | public function assignWatermark ( Request $ request ) { $ getWatermak = $ this -> getWatermak ( ) ; if ( ! $ getWatermak ) { return $ getWatermak ; } foreach ( $ request -> all ( ) as $ key => $ file ) { $ image = new Media ( $ file ) ; if ( ! User :: hasAccess ( 'Media' , 'update' , $ image -> mediaID , true ) ) { ret... | Assign watermark to media images . |
8,509 | public function cropImage ( Request $ request ) { if ( ! User :: hasAccess ( 'Media' , 'update' ) ) { return $ this -> noPermission ( ) ; } $ inputs = $ request -> all ( ) ; $ app = $ inputs [ 4 ] ; $ mediaID = $ inputs [ 0 ] [ 'mediaID' ] ; if ( ! User :: hasAccess ( 'Media' , 'update' , $ mediaID , true ) ) { return ... | Crop the image with the specific dimensions . |
8,510 | public function method ( $ methodName , $ arg1 ) { $ args = array_slice ( func_get_args ( ) , 1 ) ; return $ this -> func ( function ( $ object ) use ( $ methodName , $ args ) { return call_user_func_array ( [ $ object , $ methodName ] , $ args ) ; } ) ; } | Add a property extractor to the function chain |
8,511 | public static function GetQueryStringFromKeyVals ( string $ url , array $ keyVals ) { if ( $ url == NULL ) { throw new \ InvalidArgumentException ( 'url' ) ; } if ( $ keyVals == NULL ) { throw new \ InvalidArgumentException ( 'keyVals' ) ; } $ anchorIndex = strpos ( $ url , '#' ) ; $ resultUri = $ url ; $ anchorText = ... | Returns the value of a param from a query - string |
8,512 | public function afterNodeCreate ( NodeInterface $ node ) { if ( ! ( $ nodeType = $ node -> getNodeType ( ) ) ) { return ; } $ config = $ this -> getAssistanceConfigForNodeType ( $ nodeType -> getName ( ) ) ; switch ( $ nodeType -> getName ( ) ) { case 'TYPO3.Neos.NodeTypes:Image' : $ this -> configureImage ( $ node , $... | Hooks into afterNodeCreate event dispatched from CR when new node has been created . |
8,513 | protected function setNodeProperties ( NodeInterface $ node , array $ properties , array $ args = [ ] ) { foreach ( $ properties as $ property => $ value ) { $ value = count ( $ args ) && is_string ( $ value ) ? vsprintf ( $ value , $ args ) : $ value ; $ node -> setProperty ( $ property , $ value ) ; } } | Set node properties |
8,514 | protected function configureImage ( NodeInterface $ node , NodeType $ nodeType , array $ config = [ ] ) { $ this -> configureCreateAssistanceChildNodes ( $ node , $ nodeType , $ config ) ; switch ( $ node -> getParent ( ) -> getNodeType ( ) -> getName ( ) ) { case 'M12.Foundation:Orbit' : if ( ! $ node -> getProperty (... | Configure Image node E . g . when Image is inserted inside Orbit slider it will have caption ON by default . |
8,515 | function provideShadowDOM ( ) { return $ this -> shadowDOM ? : ( $ this -> view && $ this -> view -> getEngine ( ) instanceof MatisseEngine ? $ this -> view -> getCompiled ( ) : null ) ; } | When the component s view is a matisse template this returns the root of the parsed template otherwise it returns null . |
8,516 | public function addFilters ( ) { foreach ( func_get_args ( ) as $ filter ) { if ( is_a ( $ filter , 'Rhubarb\Stem\Filters\Filter' ) ) { $ this -> filters [ ] = $ filter ; } else { throw new \ Exception ( 'Non filter object added to Group filter' ) ; } } } | Adds one or more filter objects to the filter collection . |
8,517 | public function parseString ( $ script , array $ tokens = [ ] ) { $ values = array_values ( $ tokens ) ; $ tokens = array_map ( function ( $ token ) { return '{{' . strtolower ( $ token ) . '}}' ; } , array_keys ( $ tokens ) ) ; $ this -> script = str_replace ( $ tokens , $ values , $ script ) ; return $ this ; } | Parse a string to replace the tokens . |
8,518 | public function parseFile ( $ file , array $ tokens = [ ] ) { $ this -> filePath = $ file ; $ template = accioPath ( 'resources/scripts/' . str_replace ( '.' , '/' , $ this -> filePath ) . '.sh' ) ; if ( $ this -> filesystem -> exists ( $ template ) ) { $ this -> parseString ( $ this -> filesystem -> get ( $ template )... | Load a file and parse the the content . |
8,519 | public function setSavePath ( $ savePath ) { if ( empty ( $ savePath ) ) return $ this ; $ this -> savePath = $ savePath ; if ( ! is_dir ( $ this -> savePath ) ) { mkdir ( $ this -> savePath ) ; } return $ this ; } | Set save path |
8,520 | protected function mapRoutes ( ) { if ( ! $ this -> app -> routesAreCached ( ) ) { Route :: group ( [ 'middleware' => [ 'web' ] ] , function ( ) { $ routes = new Routes ( ) ; $ routes -> mapBackendRoutes ( ) -> mapPluginsBackendRoutes ( ) ; $ routes -> mapFrontendBaseRoutes ( ) -> mapFrontendRoutes ( ) -> mapThemeRoute... | Define the web routes for the application .. |
8,521 | private function forceHTTPSScheme ( $ url ) { if ( env ( 'FORCE_HTTPS_SCHEME' ) ) { $ url -> formatScheme ( 'https' ) ; $ this -> app [ 'request' ] -> server -> set ( 'HTTPS' , true ) ; } } | Format https scheme |
8,522 | public function boot ( UrlGenerator $ url ) { if ( $ this -> app -> runningInConsole ( ) ) { $ this -> commands ( $ this -> commands ) ; } $ this -> forceHTTPSScheme ( $ url ) ; $ this -> loadMigrationsFrom ( __DIR__ . '/database/migrations' ) ; if ( self :: isInstalled ( ) ) { $ kernel = $ this -> app [ 'Illuminate\Co... | Boot Accio . |
8,523 | public function tokenAction ( ) { if ( ! $ this -> request instanceof HttpRequest ) { return null ; } $ request = ServerRequestFactory :: fromGlobals ( ) ; $ response = $ this -> authorizationServer -> handleTokenRequest ( $ request ) ; return $ this -> convertToZfResponse ( $ response ) ; } | Handle a token request |
8,524 | public function revokeAction ( ) { if ( ! $ this -> request instanceof HttpRequest ) { return null ; } $ request = ServerRequestFactory :: fromGlobals ( ) ; $ response = $ this -> authorizationServer -> handleRevocationRequest ( $ request ) ; return $ this -> convertToZfResponse ( $ response ) ; } | Handle a token revocation request |
8,525 | public function deleteExpiredTokensAction ( ) { if ( ! $ this -> request instanceof ConsoleRequest ) { throw new RuntimeException ( 'You can only use this action from console' ) ; } $ accessTokenService = $ this -> serviceLocator -> get ( 'ZfrOAuth2\Server\Service\AccessTokenService' ) ; $ accessTokenService -> deleteE... | Delete expired tokens |
8,526 | private function convertToZfResponse ( ResponseInterface $ response ) { $ zfResponse = new HttpResponse ( ) ; $ zfResponse -> setStatusCode ( $ response -> getStatusCode ( ) ) ; $ zfResponse -> setReasonPhrase ( $ response -> getReasonPhrase ( ) ) ; $ zfResponse -> setContent ( ( string ) $ response -> getBody ( ) ) ; ... | Convert a PSR - 7 response to ZF2 response |
8,527 | public static function hasOwnership ( $ app , $ ownershipPostID ) { if ( $ ownershipPostID ) { if ( isPostType ( $ app ) ) { $ checkDB = DB :: table ( $ app ) -> where ( 'postID' , $ ownershipPostID ) -> where ( 'createdByUserID' , Auth :: user ( ) -> userID ) -> count ( ) ; } else { $ class = 'App\\Models\\' . $ app ;... | Checks if user has ownership in a particular post . |
8,528 | public function getPermissions ( ) { if ( Session :: get ( "usersPermission" ) ) { self :: $ permissions = Session :: get ( "usersPermission" ) ; return Session :: get ( "usersPermission" ) ; } if ( self :: $ permissions ) { return self :: $ permissions ; } $ groupIDs = [ ] ; foreach ( Auth :: user ( ) -> roles as $ gr... | Get permissions of the user . |
8,529 | public static function getPermission ( $ app , $ key , $ userID = 0 ) { return ( isset ( self :: $ permissions [ $ app ] [ $ key ] ) ? self :: $ permissions [ $ app ] [ $ key ] : false ) ; } | Get a particular permission . |
8,530 | public function avatar ( $ width = null , $ height = null , $ returnGravatarIfNotFound = false ) { if ( $ this -> profileimage ) { if ( ! $ width && ! $ height ) { return url ( $ this -> profileimage -> url ) ; } else { return $ this -> profileimage -> thumb ( $ width , $ height , $ this -> profileimage ) ; } } if ( $ ... | Get full avatar url . |
8,531 | public function avatarImage ( $ width = null , $ height = null , $ returnGravatarIfNotFound = false ) { return new HtmlString ( view ( ) -> make ( "vendor.user.avatar" , [ 'width' => $ width , 'height' => $ height , 'returnGravatarIfNotFound' => $ returnGravatarIfNotFound , 'imageURL' => $ this -> avatar ( $ width , $ ... | Print Avatar image . |
8,532 | public function gavatarImage ( $ width = null , $ height = null ) { return new HtmlString ( view ( ) -> make ( "vendor.user.avatar" , [ 'width' => $ width , 'height' => $ height , 'returnGravatarIfNotFound' => true , 'imageURL' => asset ( $ this -> gravatar ) , 'user' => $ this ] ) -> render ( ) ) ; } | Print Gravatar image . |
8,533 | public static function isActive ( $ guard = "admin" ) { if ( Auth :: guard ( $ guard ) -> check ( ) ) { return Auth :: user ( ) -> isActive ; } return false ; } | Returns if a logged in user is active or no . |
8,534 | public static function getAnAdmin ( ) { $ permission = new Permission ( ) ; $ getPermission = $ permission -> where ( 'app' , 'global' ) -> where ( 'key' , 'admin' ) -> where ( 'value' , true ) -> get ( ) -> first ( ) ; if ( $ getPermission ) { $ adminRelations = RoleRelation :: where ( 'groupID' , $ getPermission -> g... | Get an admin . |
8,535 | public function assignRoles ( $ groups , $ bypassPermissionCheck = false ) { if ( config ( 'app.env' ) == 'production' && $ bypassPermissionCheck ) { $ bypassPermissionCheck = false ; } if ( ! $ bypassPermissionCheck ) { if ( ! self :: hasAccess ( 'user' , 'update' ) && ! self :: hasAccess ( 'user' , 'create' ) ) { ret... | Assign roles to a user . |
8,536 | public function hasDataInDefaultApps ( ) { $ tables = [ "post_type" , "categories" , "tags" , "languages" , "media" ] ; foreach ( $ tables as $ table ) { $ hasData = DB :: table ( $ table ) -> where ( "createdByUserID" , $ this -> userID ) -> count ( ) ; if ( $ hasData ) { return true ; } } return false ; } | Check if user has a data created by him in default apps . If of the default apps post_type categories tags languages media has the createdByUsID associated with this user . |
8,537 | protected function endpointDiscovery ( ) { $ client = new Client ( ) ; try { $ response = $ client -> get ( $ this -> oAuthDiscoveryUrl , [ 'curl' => $ this -> setDiscoveryCurlopts ( ) , ] ) ; $ this -> parseDiscoveryResponse ( $ response ) ; } catch ( \ GuzzleException $ e ) { $ this -> errorMessage = $ e -> getRespon... | Query discovery endpoint for available resources and capabilities |
8,538 | private function parseDiscoveryResponse ( $ response ) { $ body = json_decode ( $ response -> getBody ( ) , true ) ; $ this -> authorization_endpoint = $ body [ 'authorization_endpoint' ] ; $ this -> token_endpoint = $ body [ 'token_endpoint' ] ; $ this -> end_session_endpoint = $ body [ 'end_session_endpoint' ] ; $ th... | Parse the response from the discovery endpoint and save the URIs |
8,539 | protected function getCongfigParameters ( ) { $ this -> apiEndpoint = getenv ( 'MP_API_ENDPOINT' , null ) ; $ this -> oAuthDiscoveryUrl = getenv ( 'MP_OAUTH_DISCOVERY_ENDPOINT' , null ) ; $ this -> mpClientId = getenv ( 'MP_CLIENT_ID' , null ) ; $ this -> mpClientSecret = getenv ( 'MP_CLIENT_SECRET' , null ) ; $ this -... | Get API configuration parameters . |
8,540 | protected function setDiscoveryCurlopts ( ) { $ curlopts = [ CURLOPT_POST => 0 , CURLOPT_SSL_VERIFYPEER => false , CURLOPT_VERBOSE => false , CURLOPT_RETURNTRANSFER => true ] ; return $ curlopts ; } | CURLOPTS for a discovery request |
8,541 | protected function setOauthCurlopts ( ) { $ curlopts = [ CURLOPT_POST => $ this -> fieldCount , CURLOPT_SSL_VERIFYPEER => false , CURLOPT_VERBOSE => false , CURLOPT_RETURNTRANSFER => true ] ; return $ curlopts ; } | CURLOPTS for an authentication request |
8,542 | public static function fromTable ( $ tableName ) { $ repos = Repository :: getDefaultRepositoryClassName ( ) ; $ row = $ repos :: returnFirstRow ( "SHOW CREATE TABLE $tableName" ) ; $ sql = $ row [ "Create Table" ] ; $ lines = explode ( "\n" , $ sql ) ; $ lines = array_slice ( $ lines , 1 , - 1 ) ; $ comparisonSchema =... | Returns a MySqlComparisonSchema reflecting the schema of a database table . |
8,543 | protected function checkLineLength ( PHP_CodeSniffer_File $ phpcsFile , $ tokens , $ stackPtr ) { if ( isset ( PHP_CodeSniffer_Tokens :: $ commentTokens [ $ tokens [ $ stackPtr - 1 ] [ 'code' ] ] ) === TRUE ) { $ doc_comment_tag = $ phpcsFile -> findFirstOnLine ( T_DOC_COMMENT_TAG , $ stackPtr - 1 ) ; if ( $ doc_commen... | Checks if a line is too long . |
8,544 | public function getLineLength ( PHP_CodeSniffer_File $ phpcsFile , $ currentLine ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ tokenCount = 0 ; $ currentLineContent = '' ; $ trim = ( strlen ( $ phpcsFile -> eolChar ) * - 1 ) ; for ( ; $ tokenCount < $ phpcsFile -> numTokens ; $ tokenCount ++ ) { if ( $ tokens [ $ tok... | Returns the length of a defined line . |
8,545 | protected function isInCodeExample ( PHP_CodeSniffer_File $ phpcs_file , $ stack_ptr ) { $ tokens = $ phpcs_file -> getTokens ( ) ; $ prev_comment = $ stack_ptr ; $ last_comment = $ stack_ptr ; while ( ( $ prev_comment = $ phpcs_file -> findPrevious ( array ( T_COMMENT ) , ( $ last_comment - 1 ) , NULL , FALSE ) ) !== ... | Determines if a comment line is part of an |
8,546 | public function getLineRoutes ( $ externalCoverageId , $ externalNetworkId , $ externalLineId ) { $ query = array ( 'api' => 'coverage' , 'parameters' => array ( 'region' => $ externalCoverageId , 'path_filter' => 'networks/' . $ externalNetworkId . '/lines/' . $ externalLineId , 'action' => 'routes' , ) , ) ; $ respon... | Get line routes . |
8,547 | public function getStopPoints ( $ externalCoverageId , $ externalNetworkId , $ externalLineId , $ externalRouteId ) { return $ this -> navitia_sam -> getStopPoints ( $ externalCoverageId , $ externalNetworkId , $ externalLineId , $ externalRouteId ) ; } | Get route StopPoints . |
8,548 | public function findAllLinesByMode ( $ coverageId , $ networkId ) { $ count = 30 ; $ result = $ this -> navitia_sam -> getLines ( $ coverageId , $ networkId , 1 , $ count ) ; if ( empty ( $ result ) || ! isset ( $ result -> lines ) ) { throw new \ Exception ( $ this -> translator -> trans ( 'services.navitia.no_lines_f... | Returns Lines indexed by modes . |
8,549 | public function getLineTitle ( $ coverageId , $ networkId , $ lineId ) { $ response = $ this -> navitia_sam -> getLine ( $ coverageId , $ networkId , $ lineId ) ; return ( $ response -> lines [ 0 ] -> name ) ; } | Returns line title . |
8,550 | public function getStopPointPois ( $ externalCoverageId , $ stopPointId , $ distance = 400 ) { $ query = array ( 'api' => 'coverage' , 'parameters' => array ( 'region' => $ externalCoverageId , 'action' => 'places_nearby' , 'path_filter' => 'stop_points/' . $ stopPointId , 'parameters' => array ( 'type' => array ( 'poi... | Returns Stop Point pois . |
8,551 | public function getRouteData ( $ routeExternalId , $ externalCoverageId ) { $ response = $ this -> navitia_sam -> getRoute ( $ externalCoverageId , $ routeExternalId , 3 ) ; if ( ! isset ( $ response -> routes ) || empty ( $ response -> routes ) ) { throw new \ Exception ( $ this -> translator -> trans ( 'services.navi... | Returns Stop Point title . |
8,552 | public function getRouteCalendars ( $ externalCoverageId , $ externalRouteId , \ DateTime $ startDate , \ DateTime $ endDate ) { $ query = array ( 'api' => 'coverage' , 'parameters' => array ( 'region' => $ externalCoverageId , 'action' => 'calendars' , 'path_filter' => 'routes/' . $ externalRouteId , 'parameters' => '... | Returns Calendars for a route . |
8,553 | public function getCalendar ( $ externalCoverageId , $ calendarId ) { $ query = array ( 'api' => 'coverage' , 'parameters' => array ( 'region' => $ externalCoverageId , 'action' => $ calendarId , 'path_filter' => 'calendars' ) , ) ; return $ this -> navitia_component -> call ( $ query ) ; } | Returns a Calendar . |
8,554 | public function getStopPointCalendarsData ( $ externalCoverageId , $ externalRouteId , $ externalStopPointId ) { $ query = array ( 'api' => 'coverage' , 'parameters' => array ( 'region' => $ externalCoverageId , 'action' => 'calendars' , 'path_filter' => 'routes/' . $ externalRouteId . '/stop_points/' . $ externalStopP... | Returns Calendars for a stop point and a route |
8,555 | public function getCalendarStopSchedulesByRoute ( $ externalCoverageId , $ externalRouteId , $ externalStopPointId , $ externalCalendarId ) { $ fromdatetime = new \ DateTime ( 'now' ) ; $ fromdatetime -> setTime ( 4 , 0 ) ; $ parameters = [ 'calendar' => $ externalCalendarId , 'show_codes' => true , 'from_datetime' => ... | Returns Schedules for a calendar a stop point and a route . |
8,556 | public function theliaModule ( $ params , \ Smarty_Internal_Template $ parser ) { $ content = null ; $ count = 0 ; if ( false !== $ location = $ this -> getParam ( $ params , 'location' , false ) ) { if ( $ this -> debug === true && $ this -> requestStack -> getCurrentRequest ( ) -> get ( 'SHOW_INCLUDE' ) ) { echo spri... | Process theliaModule template inclusion function |
8,557 | public function getAll ( $ lang = "" ) { if ( ! User :: hasAccess ( 'User' , 'read' ) ) { return $ this -> noPermission ( ) ; } $ orderBy = ( isset ( $ _GET [ 'order' ] ) ) ? $ orderBy = $ _GET [ 'order' ] : 'userID' ; $ orderType = ( isset ( $ _GET [ 'type' ] ) ) ? $ orderType = $ _GET [ 'type' ] : 'DESC' ; return DB ... | Get the list of all users . |
8,558 | public function storeProfileImage ( Request $ request ) { if ( ! User :: hasAccess ( 'user' , 'update' ) ) { return $ this -> noPermission ( ) ; } return $ path = $ request -> file ( 'profileImageID' ) -> storeAs ( 'images' , 'filename.jpg' ) ; } | Change users profile image . |
8,559 | private function deleteUser ( $ id ) { if ( ! User :: hasAccess ( 'user' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ user = User :: find ( $ id ) ; if ( $ user -> hasRelatedData ( ) ) { $ user -> isActive = false ; if ( $ user -> save ( ) ) { return true ; } } $ roles = RoleRelationsModel :: where ( 'userI... | Deletes user called from bulkDelete and delete functions . |
8,560 | public function bulkDelete ( Request $ request ) { foreach ( $ request -> all ( ) as $ id ) { if ( ! $ this -> deleteUser ( $ id ) ) { return $ this -> response ( 'Internal server error. Please try again later' , 500 ) ; } } return $ this -> response ( 'Users are deleted' ) ; } | Bulk Delete users . Delete many users with on requests |
8,561 | public function detailsJSON ( $ lang , $ id ) { if ( \ Illuminate \ Support \ Facades \ Auth :: user ( ) -> userID != $ id ) { if ( ! User :: hasAccess ( 'User' , 'read' ) ) { return $ this -> noPermission ( ) ; } } $ user = App \ Models \ User :: with ( 'roles' , 'profileImage' ) -> find ( $ id ) -> appendLanguageKeys... | JSON object with details for a specific user . |
8,562 | public function resetPassword ( Request $ request ) { if ( ! User :: hasAccess ( 'user' , 'update' ) ) { return $ this -> noPermission ( ) ; } $ validator = Validator :: make ( $ request -> all ( ) , [ 'password' => 'required|same:confpassword' , 'id' => 'required' , ] ) ; if ( $ validator -> fails ( ) ) { return $ thi... | Reset users password . |
8,563 | public function getAdvancedSearchFieldsResults ( Request $ request ) { if ( ! User :: hasAccess ( 'User' , 'read' ) ) { return $ this -> noPermission ( ) ; } $ joins = array ( [ 'table' => 'media' , 'type' => 'left' , 'whereTable1' => "profileImageID" , 'whereTable2' => "mediaID" , ] ) ; return Search :: advanced ( 'us... | Get the result of advanced search . |
8,564 | public function checkAuthFunction ( $ params , & $ smarty ) { $ roles = $ this -> explode ( $ this -> getParam ( $ params , 'role' ) ) ; $ resources = $ this -> explode ( $ this -> getParam ( $ params , 'resource' ) ) ; $ modules = $ this -> explode ( $ this -> getParam ( $ params , 'module' ) ) ; $ accesses = $ this -... | Process security check function |
8,565 | private function runMigration ( ) { $ connection = $ this -> confirmConnectionAndMigration ( ) ; $ migration_class = $ this -> getMigrationClass ( ) ; $ this -> processMigration ( $ connection , $ migration_class ) ; $ this -> createMigrationFile ( $ connection , $ migration_class ) ; } | Load and run migration . |
8,566 | private function confirmConnectionAndMigration ( ) { $ connection = $ this -> verifyConnection ( ) ; if ( $ this -> checkTableExists ( $ this -> argument ( 'dataset' ) , true , $ connection ) ) { $ this -> error ( sprintf ( '\'%s\' table already exists.' , 'data_' . $ this -> argument ( 'dataset' ) ) ) ; $ this -> line... | Confirm migration can occur by checking database . |
8,567 | private function getMigrationClass ( ) { $ config = $ this -> loadConfig ( $ this -> argument ( 'dataset' ) ) ; $ namespace = $ config [ 'namespace' ] ; $ class_name = sprintf ( 'CreateData%sTable' , studly_case ( $ this -> argument ( 'dataset' ) ) ) ; $ class = sprintf ( '%s\\%s' , $ namespace , $ class_name ) ; if ( ... | Get the migration class . |
8,568 | private function processMigration ( $ connection , $ class ) { $ this -> info ( 'Migrating...' ) ; $ this -> line ( '' ) ; $ migration = new $ class ( $ connection ) ; $ migration -> up ( $ connection ) ; } | Process the migration . |
8,569 | private function createMigrationFile ( $ connection , $ class ) { $ next_interation = $ this -> getNextInteration ( ) ; $ alias_file_name = sprintf ( '%s_%s_create_%s_table' , date ( 'Y_m_d' ) , str_pad ( $ next_interation , 3 , '0' , STR_PAD_LEFT ) , $ this -> argument ( 'dataset' ) ) ; $ alias_file = sprintf ( '%s/%s... | Create the migration file . |
8,570 | public static function getNewFilename ( $ dst ) { $ fileexts = explode ( '.' , $ dst ) ; if ( count ( $ fileexts ) > 1 ) { $ filename = implode ( '.' , array_slice ( $ fileexts , 0 , - 1 ) ) ; $ ext = $ fileexts [ count ( $ fileexts ) - 1 ] ; $ dst = $ filename . '.' . $ ext ; } else $ filename = $ dst ; $ i = 1 ; whil... | Get a new unique filename if file exists . |
8,571 | public static function write ( $ dst , $ content , $ mode = null , $ append = false ) { if ( $ mode === null ) $ mode = static :: OVERRIDE ; if ( $ mode & static :: RENAME ) $ dst = static :: getNewFilename ( $ dst ) ; elseif ( $ mode & static :: OVERRIDE ) static :: delete ( $ dst ) ; elseif ( file_exists ( $ dst ) ) ... | Write into a file . |
8,572 | public function create ( $ path , $ files = null , $ recursive = true , $ type = null , $ password = null ) { if ( null === $ type ) { $ type = $ this -> guessAdapterExtension ( $ path ) ; } try { $ adapter = $ this -> getAdapterFor ( $ this -> sanitizeExtension ( $ type ) ) ; if ( method_exists ( $ adapter , 'setPassw... | Creates an archive |
8,573 | public function open ( $ path , $ type = null , $ password = null ) { if ( null === $ type ) { $ type = $ this -> guessAdapterExtension ( $ path ) ; } try { $ adapter = $ this -> getAdapterFor ( $ this -> sanitizeExtension ( $ type ) ) ; if ( method_exists ( $ adapter , 'setPassword' ) && $ password ) { $ adapter -> se... | Opens an archive . |
8,574 | private function guessAdapterExtension ( $ path ) { $ path = strtolower ( trim ( $ path ) ) ; foreach ( $ this -> getStrategies ( ) as $ extension => $ strategy ) { if ( $ extension === substr ( $ path , ( strlen ( $ extension ) * - 1 ) ) ) { return $ extension ; } } return null ; } | Finds an extension that has strategy registered given a file path |
8,575 | public function setWidth ( $ value ) { $ this -> width = intval ( $ value ) ; $ this -> right = null ; return $ this ; } | Set crop width . Will override right offset |
8,576 | public function setHeight ( $ value ) { $ this -> height = intval ( $ value ) ; $ this -> bottom = null ; return $ this ; } | Set crop height . Will override bottom offset |
8,577 | public static function recover ( $ data ) { if ( ! Tilmeld :: $ config [ 'pw_recovery' ] ) { return [ 'result' => false , 'message' => 'Account recovery is not allowed.' ] ; } $ user = User :: factory ( $ data [ 'username' ] ) ; if ( ! isset ( $ user -> guid ) || ! isset ( $ user -> recoverSecret ) || $ data [ 'secret'... | Recover account details . |
8,578 | public function getDescendantGroups ( ) { if ( ! isset ( $ this -> descendantGroups ) ) { $ this -> descendantGroups = [ ] ; if ( isset ( $ this -> group ) ) { $ this -> descendantGroups = ( array ) $ this -> group -> getDescendants ( ) ; } foreach ( $ this -> groups as $ curGroup ) { $ this -> descendantGroups = array... | Get the user s group descendants . |
8,579 | public function getTimezone ( $ returnDateTimeZoneObject = false ) { if ( ! empty ( $ this -> timezone ) ) { return $ returnDateTimeZoneObject ? new DateTimeZone ( $ this -> timezone ) : $ this -> timezone ; } if ( isset ( $ this -> group -> guid ) && ! empty ( $ this -> group -> timezone ) ) { return $ returnDateTimeZ... | Return the user s timezone . |
8,580 | public function gatekeeper ( $ ability = null ) { if ( ! isset ( $ ability ) ) { return self :: current ( true ) -> is ( $ this ) ; } if ( $ this -> gatekeeperCache ) { $ abilities = & $ this -> gatekeeperCache ; } else { $ abilities = $ this -> abilities ; if ( $ this -> inheritAbilities ) { foreach ( $ this -> groups... | Check to see if a user has an ability . |
8,581 | public function checkPassword ( $ password ) { switch ( Tilmeld :: $ config [ 'pw_method' ] ) { case 'plain' : return ( $ this -> password == $ password ) ; case 'digest' : return ( $ this -> password == hash ( 'sha256' , $ password ) ) ; case 'salt' : default : return ( $ this -> password == hash ( 'sha256' , $ passwo... | Check the given password against the user s . |
8,582 | public function isDescendant ( $ group = null ) { if ( is_numeric ( $ group ) ) { $ group = Group :: factory ( ( int ) $ group ) ; } if ( ! isset ( $ group -> guid ) ) { return false ; } if ( isset ( $ this -> group -> guid ) && $ this -> group -> isDescendant ( $ group ) ) { return true ; } foreach ( ( array ) $ this ... | Check whether the user is a descendant of a group . |
8,583 | public function changePassword ( $ data ) { if ( ! isset ( $ data [ 'password' ] ) || ( string ) $ data [ 'password' ] === '' ) { return [ 'result' => false , 'message' => 'Please specify a password.' ] ; } if ( ! $ this -> checkPassword ( $ data [ 'oldPassword' ] ) ) { return [ 'result' => false , 'message' => 'Incorr... | A frontend accessible method to change the user s password . |
8,584 | public function checkUsername ( ) { if ( ! Tilmeld :: $ config [ 'email_usernames' ] ) { if ( empty ( $ this -> username ) ) { return [ 'result' => false , 'message' => 'Please specify a username.' ] ; } if ( Tilmeld :: $ config [ 'max_username_length' ] > 0 && strlen ( $ this -> username ) > Tilmeld :: $ config [ 'max... | Check that a username is valid . |
8,585 | public function checkPhone ( ) { if ( empty ( $ this -> phone ) ) { return [ 'result' => false , 'message' => 'Please specify a phone number.' ] ; } $ stripToDigits = preg_replace ( '/\D/' , '' , $ this -> phone ) ; if ( ! preg_match ( '/\d{10}/' , $ stripToDigits ) ) { return [ 'result' => false , 'message' => 'Phone ... | Check that a phone number is unique . |
8,586 | public function getRequestHandle ( RequestContext $ context ) { $ curlHandle = curl_init ( ) ; $ defaults = $ this -> getDefaultSettings ( $ context ) ; $ defaults += $ this -> getCurlTimeoutSettings ( $ context ) ; $ defaults += $ this -> getCurlSslSettings ( ) ; $ defaults += $ this -> getProxySettings ( $ context ) ... | Get a customized request handler to perform calls |
8,587 | public function executeRequestHandle ( $ curlHandle ) { curl_setopt ( $ curlHandle , CURLOPT_VERBOSE , true ) ; $ verbose = fopen ( 'php://temp' , 'w+' ) ; curl_setopt ( $ curlHandle , CURLOPT_STDERR , $ verbose ) ; @ list ( $ headers , $ response ) = explode ( "\r\n\r\n" , curl_exec ( $ curlHandle ) , 2 ) ; $ error = ... | Execute curl handle |
8,588 | private function getProxySettings ( RequestContext $ context ) : array { $ proxy = [ ] ; if ( ! is_null ( $ context -> getProxy ( ) ) ) { $ proxy [ CURLOPT_PROXY ] = $ context -> getProxy ( ) ; } return $ proxy ; } | Get proxy settings for cURL handle |
8,589 | private function getCurlTimeoutSettings ( RequestContext $ context ) : array { $ timeoutOptions = [ ] ; $ timeout = $ context -> getTimeout ( ) ; $ timeoutOptions += $ this -> fillTimeoutOptions ( $ timeout , CURLOPT_TIMEOUT , CURLOPT_TIMEOUT_MS ) ; $ connectionTimeout = $ context -> getConnectionTimeout ( ) ; $ timeou... | Get timeout settings for CURL handler |
8,590 | private function getDefaultSettings ( RequestContext $ context ) : array { $ defaults = [ CURLOPT_ENCODING => "" , CURLOPT_USERAGENT => "php-nano-rest" , CURLOPT_HEADER => true , CURLOPT_HTTPHEADER => array_values ( $ context -> getRequestHeaders ( ) ) , CURLOPT_RETURNTRANSFER => true , ] ; return $ defaults ; } | Get defaults settings for cURL handle |
8,591 | private function fillTimeoutOptions ( $ timeout , $ optionName , $ optionNameMs ) : array { $ timeoutOptions = [ ] ; if ( is_int ( $ timeout ) ) { $ timeoutOptions [ $ optionName ] = $ timeout ; } elseif ( is_float ( $ timeout ) ) { $ timeoutOptions [ $ optionNameMs ] = $ timeout * 1000 ; $ timeoutOptions [ CURLOPT_NOS... | Fill timeout options |
8,592 | public function required ( ) { if ( isset ( $ this -> params [ 'required' ] ) ) return ! ! $ this -> params [ 'required' ] ; if ( isset ( $ this -> params [ 'validation' ] [ 'required' ] ) ) return ! ! $ this -> params [ 'validation' ] [ 'required' ] ; } | Check if entity is required . |
8,593 | public function getDefault ( $ entity , $ name ) { if ( $ this -> get ( 'many' ) ) return new ManyCollection ( $ entity , $ name ) ; elseif ( isset ( $ this -> params [ 'default' ] ) ) { if ( is_callable ( $ this -> params [ 'default' ] ) ) return $ this -> params [ 'default' ] ( ) ; else return $ this -> params [ 'def... | Return the default value . |
8,594 | public function serialize ( $ val ) { if ( $ this -> get ( 'many' ) ) { if ( ! $ val instanceof ManyCollection ) return serialize ( [ ] ) ; $ r = [ ] ; foreach ( $ val as $ v ) { $ s = $ this -> doSerialize ( $ v ) ; if ( $ s !== null ) $ r [ ] = $ s ; } return serialize ( $ r ) ; } else return $ this -> doSerialize ( ... | Serialize the value . |
8,595 | protected function doSerialize ( $ val ) { if ( is_string ( $ val ) || is_numeric ( $ val ) || is_bool ( $ val ) || is_null ( $ val ) ) return $ val ; else return serialize ( $ val ) ; } | Actually perform serialization for a single element . |
8,596 | public function unserialize ( $ str , $ entity , $ name ) { if ( $ this -> get ( 'many' ) ) { $ r = new ManyCollection ( $ entity , $ name ) ; $ arr = unserialize ( $ str ) ; if ( ! is_array ( $ arr ) ) return $ r ; foreach ( $ arr as $ v ) $ r [ ] = $ this -> doUnserialize ( $ v , $ entity ) ; return $ r ; } else retu... | Unserialize a string . |
8,597 | public function setDecorator ( $ val , Entity $ entity , $ name , $ silentException = false ) { if ( $ this -> get ( 'many' ) ) { if ( $ val instanceof ManyCollection ) return $ val ; if ( is_array ( $ val ) ) { $ res = new ManyCollection ( $ entity , $ name ) ; foreach ( $ val as $ v ) $ res [ ] = $ this -> _doSet ( $... | Pre - process value before passing it to entity . |
8,598 | public function _doSet ( $ val , Entity $ entity , $ name , $ silentException = false ) { if ( $ silentException ) { try { return $ this -> doSet ( $ val , $ entity , $ name ) ; } catch ( \ Exception $ e ) { return null ; } catch ( \ Throwable $ e ) { return null ; } } else return $ this -> doSet ( $ val , $ entity , $... | Catch exceptions of doSet if required . |
8,599 | public function removeMetaTag ( $ name ) { if ( isset ( $ this -> metaList [ $ name ] ) ) { unset ( $ this -> metaList [ $ name ] ) ; } return $ this ; } | Get meta tags |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.