idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
1,200
public function getUrl ( $ revision = null ) { if ( ! isset ( $ revision ) ) { return $ this -> info [ 'url' ] ; } if ( ( $ info = $ this -> getRevision ( $ revision ) ) === null ) { return null ; } return $ info [ 'url' ] ; }
Returns the URL of this file or of its specified revision .
1,201
public function getUser ( $ revision = null ) { if ( ! isset ( $ revision ) ) { return $ this -> info [ 'user' ] ; } if ( ( $ info = $ this -> getRevision ( $ revision ) ) === null ) { return null ; } return $ info [ 'user' ] ; }
Returns the user who uploaded this file or of its specified revision .
1,202
public function getUserId ( $ revision = null ) { if ( ! isset ( $ revision ) ) { return ( int ) $ this -> info [ 'userid' ] ; } if ( ( $ info = $ this -> getRevision ( $ revision ) ) === null ) { return - 1 ; } return ( int ) $ info [ 'userid' ] ; }
Returns the ID of the user who uploaded this file or of its specified revision .
1,203
public function getWidth ( $ revision = null ) { if ( ! isset ( $ revision ) ) { return ( int ) $ this -> info [ 'width' ] ; } if ( ( $ info = $ this -> getRevision ( $ revision ) ) === null ) { return - 1 ; } return ( int ) $ info [ 'width' ] ; }
Returns the width of this file or of its specified revision .
1,204
public function getRevision ( $ revision ) { if ( is_int ( $ revision ) ) { if ( isset ( $ this -> history [ $ revision ] ) ) { return $ this -> history [ $ revision ] ; } } else { foreach ( $ this -> history as $ history ) { if ( $ history [ 'timestamp' ] == $ revision ) { return $ history ; } } } $ this -> error = ar...
Returns the properties of the specified file revision .
1,205
public function getArchivename ( $ revision ) { if ( ( $ info = $ this -> getRevision ( $ revision ) ) === null ) { return null ; } if ( ! isset ( $ info [ 'archivename' ] ) ) { $ this -> error = array ( ) ; $ this -> error [ 'file' ] = 'This revision contains no archive name' ; return null ; } return $ info [ 'archive...
Returns the archive name of the specified file revision .
1,206
public function downloadData ( ) { $ data = $ this -> wikimate -> download ( $ this -> getUrl ( ) ) ; if ( $ data === null ) { $ this -> error = $ this -> wikimate -> getError ( ) ; } else { $ this -> error = null ; } return $ data ; }
Downloads and returns the current file s contents or null if an error occurs .
1,207
public function downloadFile ( $ path ) { if ( ( $ data = $ this -> downloadData ( ) ) === null ) { return false ; } if ( @ file_put_contents ( $ path , $ data ) === false ) { $ this -> error = array ( ) ; $ this -> error [ 'file' ] = "Unable to write file '$path'" ; return false ; } return true ; }
Downloads the current file s contents and writes it to the given path .
1,208
public function setId ( int $ objectId ) : int { if ( $ this -> objectId !== 0 ) { throw new UnexpectedValueException ( 'ObjectId property is immutable.' ) ; } $ this -> objectId = $ objectId ; $ this -> rId = $ objectId ; return $ objectId ; }
Set the id for the object .
1,209
protected static function getSetting ( array $ settings , bool $ mandatory , string $ sectionName , string $ settingName ) { if ( ! array_key_exists ( $ sectionName , $ settings ) ) { if ( $ mandatory ) { throw new RuntimeException ( "Section '%s' not found in configuration file." , $ sectionName ) ; } else { return nu...
Returns the value of a setting .
1,210
protected function writeTwoPhases ( string $ filename , string $ data ) : void { $ write_flag = true ; if ( file_exists ( $ filename ) ) { $ old_data = file_get_contents ( $ filename ) ; if ( $ data == $ old_data ) $ write_flag = false ; } if ( $ write_flag ) { $ tmp_filename = $ filename . '.tmp' ; file_put_contents (...
Writes a file in two phase to the filesystem .
1,211
private function detectNameConflicts ( ) : void { list ( $ sources_by_path , $ sources_by_method ) = $ this -> getDuplicates ( ) ; foreach ( $ sources_by_path as $ source ) { $ this -> errorFilenames [ ] = $ source [ 'path_name' ] ; } foreach ( $ sources_by_method as $ method => $ sources ) { $ tmp = [ ] ; foreach ( $ ...
Detects stored routines that would result in duplicate wrapper method name .
1,212
private function findSourceFiles ( ) : void { $ helper = new SourceFinderHelper ( dirname ( $ this -> configFilename ) ) ; $ filenames = $ helper -> findSources ( $ this -> sourcePattern ) ; foreach ( $ filenames as $ filename ) { $ routineName = pathinfo ( $ filename , PATHINFO_FILENAME ) ; $ this -> sources [ ] = [ '...
Searches recursively for all source files .
1,213
private function findSourceFilesFromList ( array $ filenames ) : void { foreach ( $ filenames as $ filename ) { if ( ! file_exists ( $ filename ) ) { $ this -> io -> error ( sprintf ( "File not exists: '%s'" , $ filename ) ) ; $ this -> errorFilenames [ ] = $ filename ; } else { $ routineName = pathinfo ( $ filename , ...
Finds all source files that actually exists from a list of file names .
1,214
private function getColumnTypes ( ) : void { $ rows = DataLayer :: getAllTableColumns ( ) ; foreach ( $ rows as $ row ) { $ key = '@' . $ row [ 'table_name' ] . '.' . $ row [ 'column_name' ] . '%type@' ; $ key = strtoupper ( $ key ) ; $ value = $ row [ 'column_type' ] ; if ( isset ( $ row [ 'character_set_name' ] ) ) $...
Selects schema table column names and the column type from MySQL and saves them as replace pairs .
1,215
private function getConstants ( ) : void { if ( ! isset ( $ this -> constantClassName ) ) return ; $ reflection = new \ ReflectionClass ( $ this -> constantClassName ) ; $ constants = $ reflection -> getConstants ( ) ; foreach ( $ constants as $ name => $ value ) { if ( ! is_numeric ( $ value ) ) $ value = "'" . $ valu...
Reads constants set the PHP configuration file and adds them to the replace pairs .
1,216
private function getOldStoredRoutinesInfo ( ) : void { $ this -> rdbmsOldMetadata = [ ] ; $ routines = DataLayer :: getRoutines ( ) ; foreach ( $ routines as $ routine ) { $ this -> rdbmsOldMetadata [ $ routine [ 'routine_name' ] ] = $ routine ; } }
Retrieves information about all stored routines in the current schema .
1,217
private function loadAll ( ) : void { $ this -> findSourceFiles ( ) ; $ this -> detectNameConflicts ( ) ; $ this -> getColumnTypes ( ) ; $ this -> readStoredRoutineMetadata ( ) ; $ this -> getConstants ( ) ; $ this -> getOldStoredRoutinesInfo ( ) ; $ this -> getCorrectSqlMode ( ) ; $ this -> loadStoredRoutines ( ) ; $ ...
Loads all stored routines into MySQL .
1,218
private function loadList ( array $ fileNames ) : void { $ this -> findSourceFilesFromList ( $ fileNames ) ; $ this -> detectNameConflicts ( ) ; $ this -> getColumnTypes ( ) ; $ this -> readStoredRoutineMetadata ( ) ; $ this -> getConstants ( ) ; $ this -> getOldStoredRoutinesInfo ( ) ; $ this -> getCorrectSqlMode ( ) ...
Loads all stored routines in a list into MySQL .
1,219
private function loadStoredRoutines ( ) : void { $ this -> io -> writeln ( '' ) ; usort ( $ this -> sources , function ( $ a , $ b ) { return strcmp ( $ a [ 'routine_name' ] , $ b [ 'routine_name' ] ) ; } ) ; foreach ( $ this -> sources as $ filename ) { $ routineName = $ filename [ 'routine_name' ] ; $ helper = new Ro...
Loads all stored routines .
1,220
private function logOverviewErrors ( ) : void { if ( ! empty ( $ this -> errorFilenames ) ) { $ this -> io -> warning ( 'Routines in the files below are not loaded:' ) ; $ this -> io -> listing ( $ this -> errorFilenames ) ; } }
Logs the source files that were not successfully loaded into MySQL .
1,221
private function methodName ( string $ routineName ) : ? string { if ( $ this -> nameMangler !== null ) { $ mangler = $ this -> nameMangler ; return $ mangler :: getMethodName ( $ routineName ) ; } return null ; }
Returns the method name in the wrapper for a stored routine . Returns null when name mangler is not set .
1,222
private function readStoredRoutineMetadata ( ) : void { if ( file_exists ( $ this -> phpStratumMetadataFilename ) ) { $ this -> phpStratumMetadata = ( array ) json_decode ( file_get_contents ( $ this -> phpStratumMetadataFilename ) , true ) ; if ( json_last_error ( ) != JSON_ERROR_NONE ) { throw new RuntimeException ( ...
Reads the metadata of stored routines from the metadata file .
1,223
private function removeObsoleteMetadata ( ) : void { $ clean = [ ] ; foreach ( $ this -> sources as $ source ) { $ routine_name = $ source [ 'routine_name' ] ; if ( isset ( $ this -> phpStratumMetadata [ $ routine_name ] ) ) { $ clean [ $ routine_name ] = $ this -> phpStratumMetadata [ $ routine_name ] ; } } $ this -> ...
Removes obsolete entries from the metadata of all stored routines .
1,224
private function writeStoredRoutineMetadata ( ) : void { $ json_data = json_encode ( $ this -> phpStratumMetadata , JSON_PRETTY_PRINT ) ; if ( json_last_error ( ) != JSON_ERROR_NONE ) { throw new RuntimeException ( "Error of encoding to JSON: '%s'." , json_last_error_msg ( ) ) ; } $ this -> writeTwoPhases ( $ this -> p...
Writes the metadata of all stored routines to the metadata file .
1,225
public static function canComment ( $ hook , $ type , $ permission , $ params ) { $ entity = elgg_extract ( 'entity' , $ params ) ; if ( ! $ entity instanceof Comment ) { return $ permission ; } if ( $ entity -> getDepthToOriginalContainer ( ) >= ( int ) elgg_get_plugin_setting ( 'max_comment_depth' , 'hypeInteractions...
Disallows commenting on comments once a certain depth has been reached
1,226
public static function canEditAnnotation ( $ hook , $ type , $ permission , $ params ) { $ annotation = elgg_extract ( 'annotation' , $ params ) ; $ user = elgg_extract ( 'user' , $ params ) ; if ( $ annotation instanceof ElggAnnotation && $ annotation -> name == 'likes' ) { $ ann_owner = $ annotation -> getOwnerEntity...
Fixes editing permissions on likes
1,227
public function transform ( ) { $ object = $ this -> resource ; $ data = $ object instanceof Collection || $ object instanceof AbstractPaginator ? $ object -> map ( [ $ this , 'transformResource' ] ) -> toArray ( ) : $ this -> transformResource ( $ object ) ; if ( $ object instanceof AbstractPaginator ) { $ this -> wit...
Get a displayable API output for the given object .
1,228
public function toResponse ( $ status = 200 , array $ headers = [ ] , $ options = 0 ) { return new JsonResponse ( $ this -> transform ( ) , $ status , $ headers , $ options ) ; }
Get the instance as a json response object .
1,229
public static function riverMenuSetup ( $ hook , $ type , $ return , $ params ) { if ( ! elgg_is_logged_in ( ) ) { return $ return ; } $ remove = array ( 'comment' ) ; foreach ( $ return as $ key => $ item ) { if ( $ item instanceof ElggMenuItem && in_array ( $ item -> getName ( ) , $ remove ) ) { unset ( $ return [ $ ...
Filters river menu
1,230
public static function interactionsMenuSetup ( $ hook , $ type , $ menu , $ params ) { $ entity = elgg_extract ( 'entity' , $ params , false ) ; if ( ! elgg_instanceof ( $ entity ) ) { return $ menu ; } $ active_tab = elgg_extract ( 'active_tab' , $ params ) ; $ comments_count = $ entity -> countComments ( ) ; $ can_co...
Setups entity interactions menu
1,231
public static function entityMenuSetup ( $ hook , $ type , $ menu , $ params ) { $ entity = elgg_extract ( 'entity' , $ params ) ; if ( ! $ entity instanceof Comment ) { return ; } if ( $ entity -> canEdit ( ) ) { $ menu [ ] = ElggMenuItem :: factory ( array ( 'name' => 'edit' , 'text' => elgg_echo ( 'edit' ) , 'href' ...
Setups comment menu
1,232
protected function generateBody ( array $ params , array $ columns ) : void { $ uniqueColumns = $ this -> checkUniqueKeys ( $ columns ) ; $ limit = ( $ uniqueColumns == null ) ; $ this -> codeStore -> append ( sprintf ( 'delete from %s' , $ this -> tableName ) ) ; $ this -> codeStore -> append ( 'where' ) ; $ first = t...
Generate body part .
1,233
public static function createNewAccessToken ( int $ ttl , TokenOwnerInterface $ owner = null , Client $ client = null , $ scopes = null ) : AccessToken { return static :: createNew ( $ ttl , $ owner , $ client , $ scopes ) ; }
Create a new AccessToken
1,234
public function map ( array $ options , Banner $ banner ) { $ bannerOptions = get_object_vars ( $ banner ) ; $ validatedOptions = array ( ) ; foreach ( $ bannerOptions as $ name => $ value ) { $ validatedOptions [ $ name ] = empty ( $ options [ $ name ] ) ? $ value : $ options [ $ name ] ; } return $ validatedOptions ;...
Map additional options used by Banner object .
1,235
private function registerApiMiddleware ( ) { $ config = $ this -> app [ 'config' ] ; foreach ( $ config -> get ( 'api-helper.middleware' , [ ] ) as $ name => $ class ) { $ this -> aliasMiddleware ( $ name , $ class ) ; } ; }
Register the API route Middleware .
1,236
protected function prepareTokenResponse ( AccessToken $ accessToken , RefreshToken $ refreshToken = null , bool $ useRefreshTokenScopes = false ) : ResponseInterface { $ owner = $ accessToken -> getOwner ( ) ; $ scopes = $ useRefreshTokenScopes ? $ refreshToken -> getScopes ( ) : $ accessToken -> getScopes ( ) ; $ resp...
Prepare the actual HttpResponse for the token
1,237
protected static function parseButton ( ButtonInterface $ button , array $ args ) { $ button -> setActive ( ArrayHelper :: get ( $ args , "active" , false ) ) ; $ button -> setBlock ( ArrayHelper :: get ( $ args , "block" , false ) ) ; $ button -> setContent ( ArrayHelper :: get ( $ args , "content" ) ) ; $ button -> s...
Parses a button .
1,238
protected function getSyntaxHighlighterConfig ( ) { $ provider = $ this -> get ( SyntaxHighlighterStringsProvider :: SERVICE_NAME ) ; $ config = new SyntaxHighlighterConfig ( ) ; $ config -> setStrings ( $ provider -> getSyntaxHighlighterStrings ( ) ) ; return $ config ; }
Get the Syntax Highlighter config .
1,239
public static function setup_theme ( ) { global $ pagenow ; if ( ( is_admin ( ) && 'themes.php' == $ pagenow ) || ! self :: can_switch_themes ( ) ) { return ; } self :: check_reset ( ) ; self :: load_cookie ( ) ; if ( empty ( self :: $ theme ) ) { return ; } add_filter ( 'pre_option_template' , array ( self :: $ theme ...
Loads cookie and sets up theme filters .
1,240
public static function check_reset ( ) { if ( ! empty ( filter_input ( INPUT_GET , 'tts_reset' ) ) ) { setcookie ( self :: get_cookie_name ( ) , '' , 1 ) ; nocache_headers ( ) ; wp_safe_redirect ( home_url ( ) ) ; die ; } }
Clear theme choice if reset variable is present in request .
1,241
public static function load_cookie ( ) { $ theme_name = filter_input ( INPUT_COOKIE , self :: get_cookie_name ( ) ) ; if ( ! $ theme_name ) { return ; } $ theme = wp_get_theme ( $ theme_name ) ; if ( $ theme -> exists ( ) && $ theme -> get ( 'Name' ) !== get_option ( 'current_theme' ) && $ theme -> is_allowed ( ) ) { s...
Sets if cookie is defined to non - default theme .
1,242
public static function get_allowed_themes ( ) { static $ themes ; if ( isset ( $ themes ) ) { return $ themes ; } $ wp_themes = wp_get_themes ( array ( 'allowed' => true ) ) ; foreach ( $ wp_themes as $ theme ) { $ themes [ $ theme -> get ( 'Name' ) ] = $ theme ; } $ themes = apply_filters ( 'tts_allowed_themes' , $ th...
Retrieves allowed themes .
1,243
public static function init ( ) { if ( self :: can_switch_themes ( ) ) { add_action ( 'admin_bar_menu' , array ( __CLASS__ , 'admin_bar_menu' ) , 90 ) ; add_action ( 'wp_ajax_tts_set_theme' , array ( __CLASS__ , 'set_theme' ) ) ; } load_plugin_textdomain ( 'toolbar-theme-switcher' , false , dirname ( dirname ( plugin_b...
Sets up hooks that doesn t need to happen early .
1,244
public static function admin_bar_menu ( $ wp_admin_bar ) { $ themes = self :: get_allowed_themes ( ) ; $ current = empty ( self :: $ theme ) ? wp_get_theme ( ) : self :: $ theme ; unset ( $ themes [ $ current -> get ( 'Name' ) ] ) ; uksort ( $ themes , array ( __CLASS__ , 'sort_core_themes' ) ) ; $ title = apply_filter...
Creates menu in toolbar .
1,245
public static function sort_core_themes ( $ theme_a , $ theme_b ) { static $ twenties = array ( 'Twenty Ten' , 'Twenty Eleven' , 'Twenty Twelve' , 'Twenty Thirteen' , 'Twenty Fourteen' , 'Twenty Fifteen' , 'Twenty Sixteen' , 'Twenty Seventeen' , 'Twenty Eighteen' , 'Twenty Nineteen' , 'Twenty Twenty' , ) ; if ( 0 === s...
Callback to sort theme array with core themes in numerical order by year .
1,246
public static function set_theme ( ) { $ stylesheet = filter_input ( INPUT_GET , 'theme' ) ; $ theme = wp_get_theme ( $ stylesheet ) ; if ( $ theme -> exists ( ) && $ theme -> is_allowed ( ) ) { setcookie ( self :: get_cookie_name ( ) , $ theme -> get_stylesheet ( ) , strtotime ( '+1 year' ) , COOKIEPATH ) ; } wp_safe_...
Saves selected theme in cookie if valid .
1,247
public static function get_theme_field ( $ field_name , $ default = false ) { if ( ! empty ( self :: $ theme ) ) { return self :: $ theme -> get ( $ field_name ) ; } return $ default ; }
Returns field from theme data if cookie is set to valid theme .
1,248
public function getGrant ( string $ grantType ) : GrantInterface { if ( $ this -> hasGrant ( $ grantType ) ) { return $ this -> grants [ $ grantType ] ; } throw OAuth2Exception :: unsupportedGrantType ( sprintf ( 'Grant type "%s" is not supported by this server' , $ grantType ) ) ; }
Get the grant by its name
1,249
public function getResponseType ( string $ responseType ) : GrantInterface { if ( $ this -> hasResponseType ( $ responseType ) ) { return $ this -> responseTypes [ $ responseType ] ; } throw OAuth2Exception :: unsupportedResponseType ( sprintf ( 'Response type "%s" is not supported by this server' , $ responseType ) ) ...
Get the response type by its name
1,250
private function createResponseFromOAuthException ( OAuth2Exception $ exception ) : ResponseInterface { $ payload = [ 'error' => $ exception -> getCode ( ) , 'error_description' => $ exception -> getMessage ( ) , ] ; return new Response \ JsonResponse ( $ payload , 400 ) ; }
Create a response from the exception using the format of the spec
1,251
private function extractClientCredentials ( ServerRequestInterface $ request ) : array { if ( $ request -> hasHeader ( 'Authorization' ) ) { $ parts = explode ( ' ' , $ request -> getHeaderLine ( 'Authorization' ) ) ; $ value = base64_decode ( end ( $ parts ) ) ; list ( $ id , $ secret ) = explode ( ':' , $ value ) ; }...
Extract the client credentials from Authorization header or POST data
1,252
public function getDigitalOcean ( $ file = self :: DEFAULT_CREDENTIALS_FILE ) { if ( ! file_exists ( $ file ) ) { throw new \ RuntimeException ( sprintf ( 'Impossible to get credentials informations in %s' , $ file ) ) ; } $ credentials = Yaml :: parse ( $ file ) ; return new DigitalOcean ( new Credentials ( $ credenti...
Returns an instance of DigitalOcean
1,253
private static function getLeadingDir ( string $ pattern ) : string { $ dir = $ pattern ; $ pos = strpos ( $ dir , '*' ) ; if ( $ pos !== false ) $ dir = substr ( $ dir , 0 , $ pos ) ; $ pos = strpos ( $ dir , '?' ) ; if ( $ pos !== false ) $ dir = substr ( $ dir , 0 , $ pos ) ; $ pos = strrpos ( $ dir , '/' ) ; if ( $...
Returns the leading directory without wild cards of a pattern .
1,254
public function findSources ( string $ sources ) : array { $ patterns = $ this -> sourcesToPatterns ( $ sources ) ; $ sources = [ ] ; foreach ( $ patterns as $ pattern ) { $ tmp = $ this -> findSourcesInPattern ( $ pattern ) ; $ sources = array_merge ( $ sources , $ tmp ) ; } $ sources = array_unique ( $ sources ) ; so...
Finds sources of stored routines .
1,255
private function findSourcesInPattern ( string $ pattern ) : array { $ sources = [ ] ; $ directory = new RecursiveDirectoryIterator ( self :: getLeadingDir ( $ pattern ) ) ; $ directory -> setFlags ( RecursiveDirectoryIterator :: FOLLOW_SYMLINKS ) ; $ files = new RecursiveIteratorIterator ( $ directory ) ; foreach ( $ ...
Finds sources of stored routines in a pattern .
1,256
private function readPatterns ( string $ filename ) : array { $ path = $ this -> basedir . '/' . $ filename ; $ lines = explode ( PHP_EOL , file_get_contents ( $ path ) ) ; $ patterns = [ ] ; foreach ( $ lines as $ line ) { $ line = trim ( $ line ) ; if ( $ line <> '' ) { $ patterns [ ] = $ line ; } } return $ patterns...
Reads a list of patterns from a file .
1,257
private function sourcesToPatterns ( string $ sources ) : array { if ( substr ( $ sources , 0 , 5 ) == 'file:' ) { $ patterns = $ this -> readPatterns ( substr ( $ sources , 5 ) ) ; } else { $ patterns = [ $ sources ] ; } return $ patterns ; }
Converts the sources parameter to a list a patterns .
1,258
protected function bootstrapButtonGroup ( $ class , $ role , array $ buttons ) { $ attributes = [ ] ; $ attributes [ "class" ] = $ class ; $ attributes [ "role" ] = $ role ; $ innerHTML = "\n" . implode ( "\n" , $ buttons ) . "\n" ; return static :: coreHTMLElement ( "div" , $ innerHTML , $ attributes ) ; }
Displays a Bootstrap button group .
1,259
public static function createNewAuthorizationCode ( int $ ttl , string $ redirectUri = null , TokenOwnerInterface $ owner = null , Client $ client = null , $ scopes = null ) : AuthorizationCode { $ token = static :: createNew ( $ ttl , $ owner , $ client , $ scopes ) ; $ token -> redirectUri = $ redirectUri ?? '' ; ret...
Create a new AuthorizationCode
1,260
public static function getCSSClassname ( $ size , $ value , $ suffix , $ min = 1 , $ max = 12 ) { if ( $ value < $ min || $ max < $ value ) { return null ; } $ sizes = [ "lg" , "md" , "sm" , "xs" ] ; $ suffixes = [ "offset" , "pull" , "push" , "" ] ; if ( false === in_array ( $ size , $ sizes ) || false === in_array ( ...
Get a CSS classname .
1,261
public function getGuidFromRiverId ( $ river_id = 0 ) { $ river_id = ( int ) $ river_id ; $ guid = $ this -> id_cache -> get ( $ river_id ) ; if ( $ guid ) { return $ guid ; } $ objects = elgg_get_entities_from_metadata ( [ 'types' => RiverObject :: TYPE , 'subtypes' => [ RiverObject :: SUBTYPE , 'hjstream' ] , 'metada...
Return value of the entity guid that corresponds to river_id
1,262
public static function getWikiViews ( ) { $ tableContents = [ ] ; $ tableContents [ ] = new WikiView ( "Twig-extension" , "CSS" , "button" , "Button" ) ; $ tableContents [ ] = new WikiView ( "twig-extension" , "CSS" , "code" , "Code" ) ; $ tableContents [ ] = new WikiView ( "Twig-extension" , "CSS" , "grid" , "Grid" ) ...
Get the wiki views .
1,263
public function indexAction ( $ category , $ package , $ page ) { $ wikiViews = self :: getWikiViews ( ) ; $ wikiView = WikiView :: find ( $ wikiViews , $ category , $ package , $ page ) ; if ( null === $ wikiView ) { $ wikiView = $ wikiViews [ 0 ] ; $ this -> notifyDanger ( "The requested page was not found" ) ; $ thi...
Displays a wiki page .
1,264
public function bootstrapButtonDangerFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parseDangerButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Danger .
1,265
public function bootstrapButtonDefaultFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parseDefaultButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Default .
1,266
public function bootstrapButtonInfoFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parseInfoButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Info .
1,267
public function bootstrapButtonLinkFilter ( $ button , $ href = self :: DEFAULT_HREF , $ target = null ) { if ( 1 === preg_match ( "/disabled=\"disabled\"/" , $ button ) ) { $ searches = [ " disabled=\"disabled\"" , "class=\"" ] ; $ replaces = [ "" , "class=\"disabled " ] ; $ button = StringHelper :: replace ( $ button...
Transforms a Bootstrap button into an anchor .
1,268
public function bootstrapButtonLinkFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parseLinkButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Link .
1,269
public function bootstrapButtonPrimaryFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parsePrimaryButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Primary .
1,270
public function bootstrapButtonSuccessFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parseSuccessButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Success .
1,271
public function bootstrapButtonWarningFunction ( array $ args = [ ] ) { return $ this -> bootstrapButton ( ButtonFactory :: parseWarningButton ( $ args ) , ArrayHelper :: get ( $ args , "icon" ) ) ; }
Displays a Bootstrap button Warning .
1,272
protected function validateTokenScopes ( array $ scopes ) { $ scopes = array_map ( function ( $ scope ) { return ( string ) $ scope ; } , $ scopes ) ; $ registeredScopes = $ this -> scopeService -> getAll ( ) ; $ registeredScopes = array_map ( function ( $ scope ) { return ( string ) $ scope ; } , $ registeredScopes ) ...
Validate the token scopes against the registered scope
1,273
public function save ( DomainObjectInterface & $ domainObject ) : void { if ( $ domainObject -> getId ( ) === 0 ) { $ this -> concreteInsert ( $ domainObject ) ; } $ this -> concreteUpdate ( $ domainObject ) ; }
Store the DomainObject in persistent storage . Either insert or update the store as required .
1,274
public function gc ( $ maxlifetime ) { $ this -> pdo -> queryWithParam ( 'DELETE FROM session WHERE last_update < DATE_SUB(NOW(), INTERVAL :maxlifetime SECOND)' , [ [ ':maxlifetime' , $ maxlifetime , \ PDO :: PARAM_INT ] ] ) ; return $ this -> pdo -> getLastOperationStatus ( ) ; }
Delete old sessions from storage .
1,275
public function read ( $ session_id ) { return ( string ) $ this -> pdo -> queryWithParam ( 'SELECT session_data FROM session WHERE session_id = :session_id' , [ [ ':session_id' , $ session_id , \ PDO :: PARAM_STR ] ] ) -> fetchColumn ( ) ; }
Read session data from storage .
1,276
public function bootstrapAlertDangerFunction ( array $ args = [ ] ) { return $ this -> bootstrapAlert ( ArrayHelper :: get ( $ args , "content" ) , ArrayHelper :: get ( $ args , "dismissible" ) , "alert-" . BootstrapInterface :: BOOTSTRAP_DANGER ) ; }
Displays a Bootstrap alert Danger .
1,277
public function bootstrapAlertInfoFunction ( array $ args = [ ] ) { return $ this -> bootstrapAlert ( ArrayHelper :: get ( $ args , "content" ) , ArrayHelper :: get ( $ args , "dismissible" ) , "alert-" . BootstrapInterface :: BOOTSTRAP_INFO ) ; }
Displays a Bootstrap alert Info .
1,278
public function bootstrapAlertLinkFunction ( array $ args = [ ] ) { $ attributes = [ ] ; $ attributes [ "href" ] = ArrayHelper :: get ( $ args , "href" , NavigationInterface :: NAVIGATION_HREF_DEFAULT ) ; $ innerHTML = ArrayHelper :: get ( $ args , "content" ) ; return static :: coreHTMLElement ( "a" , $ innerHTML , $ ...
Displays a Bootstrap alert Link .
1,279
public function bootstrapAlertSuccessFunction ( array $ args = [ ] ) { return $ this -> bootstrapAlert ( ArrayHelper :: get ( $ args , "content" ) , ArrayHelper :: get ( $ args , "dismissible" ) , "alert-" . BootstrapInterface :: BOOTSTRAP_SUCCESS ) ; }
Displays a Bootstrap alert Success .
1,280
public function bootstrapAlertWarningFunction ( array $ args = [ ] ) { return $ this -> bootstrapAlert ( ArrayHelper :: get ( $ args , "content" ) , ArrayHelper :: get ( $ args , "dismissible" ) , "alert-" . BootstrapInterface :: BOOTSTRAP_WARNING ) ; }
Displays a Bootstrap alert Warning .
1,281
private function getTopologyGroup ( string $ char ) : string { $ groups = $ this -> chars ; if ( \ strpos ( $ groups [ 0 ] , $ char ) !== false ) { return 'u' ; } if ( \ strpos ( $ groups [ 1 ] , $ char ) !== false ) { return 'l' ; } if ( \ strpos ( $ groups [ 2 ] , $ char ) !== false ) { return 'd' ; } if ( \ strpos (...
Return topology group for the given char .
1,282
private function getRandomChar ( string $ interval ) : string { $ size = \ strlen ( $ interval ) - 1 ; $ int = \ random_int ( 0 , $ size ) ; return $ interval [ $ int ] ; }
Get random char between .
1,283
public function executeLog ( string $ queries ) : int { $ n = 0 ; $ this -> multiQuery ( $ queries ) ; do { $ result = $ this -> mysqli -> store_result ( ) ; if ( $ this -> mysqli -> errno ) $ this -> mySqlError ( 'mysqli::store_result' ) ; if ( $ result ) { $ fields = $ result -> fetch_fields ( ) ; while ( ( $ row = $...
Executes a query and logs the result set .
1,284
public function getRowInRowSet ( string $ columnName , $ value , array $ rowSet ) : array { if ( is_array ( $ rowSet ) ) { foreach ( $ rowSet as $ row ) { if ( ( string ) $ row [ $ columnName ] == ( string ) $ value ) { return $ row ; } } } throw new RuntimeException ( "Value '%s' for column '%s' not found in row set."...
Returns the first row in a row set for which a column has a specific value .
1,285
public function quoteListOfInt ( $ list , string $ delimiter , string $ enclosure , string $ escape ) : string { if ( $ list === null || $ list === false || $ list === '' || $ list === [ ] ) { return 'null' ; } $ ret = '' ; if ( is_scalar ( $ list ) ) { $ list = str_getcsv ( $ list , $ delimiter , $ enclosure , $ escap...
Returns a literal for an expression with a separated list of integers that can be safely used in SQL statements . Throws an exception if the value is a list of integers .
1,286
public function searchInRowSet ( string $ columnName , $ value , array $ rowSet ) { if ( is_array ( $ rowSet ) ) { foreach ( $ rowSet as $ key => $ row ) { if ( ( string ) $ row [ $ columnName ] === ( string ) $ value ) { return $ key ; } } } return null ; }
Returns the key of the first row in a row set for which a column has a specific value . Returns null if no row is found .
1,287
protected function sendLongData ( mysqli_stmt $ statement , int $ paramNr , ? string $ data ) : void { if ( $ data !== null ) { $ n = strlen ( $ data ) ; $ p = 0 ; while ( $ p < $ n ) { $ b = $ statement -> send_long_data ( $ paramNr , substr ( $ data , $ p , $ this -> chunkSize ) ) ; if ( ! $ b ) $ this -> mySqlError ...
Send data in blocks to the MySQL server .
1,288
private function executeTableShowFooter ( array $ columns ) : void { $ separator = '+' ; foreach ( $ columns as $ column ) { $ separator .= str_repeat ( '-' , $ column [ 'length' ] + 2 ) . '+' ; } echo $ separator , "\n" ; }
Helper method for method executeTable . Shows table footer .
1,289
private function executeTableShowHeader ( array $ columns ) : void { $ separator = '+' ; $ header = '|' ; foreach ( $ columns as $ column ) { $ separator .= str_repeat ( '-' , $ column [ 'length' ] + 2 ) . '+' ; $ spaces = ( $ column [ 'length' ] + 2 ) - mb_strlen ( ( string ) $ column [ 'header' ] ) ; $ spacesLeft = (...
Helper method for method executeTable . Shows table header .
1,290
public static function staticToStatic ( string $ sourceName , string $ targetName ) : void { $ source = file_get_contents ( $ sourceName ) ; $ sourceClass = basename ( $ sourceName , '.php' ) ; $ targetClass = basename ( $ targetName , '.php' ) ; $ source = NonStatic :: nonStatic ( $ source , $ sourceClass , $ targetCl...
Makes non static implementation of a static class .
1,291
protected function getCookieExpirationDate ( ) { if ( ! empty ( $ this -> config [ 'expire_on_close' ] ) ) { $ expirationDate = 0 ; } else { $ expirationDate = Carbon :: now ( ) -> addMinutes ( 5 * 60 ) ; } return $ expirationDate ; }
Get the session lifetime in seconds .
1,292
public function updateAverageNote ( ) { $ commentTableName = $ this -> em -> getClassMetadata ( $ this -> commentManager -> getClass ( ) ) -> table [ 'name' ] ; $ threadTableName = $ this -> em -> getClassMetadata ( $ this -> getClass ( ) ) -> table [ 'name' ] ; $ this -> em -> getConnection ( ) -> beginTransaction ( )...
Updates the threads average note from comments notes .
1,293
private function format_trace_flags ( ) { $ flags = array ( ) ; if ( ! $ this -> already_invoked ) { $ flags [ ] = 'first_time' ; } if ( ! $ this -> is_needed ( ) ) { $ flags [ ] = 'not_needed' ; } return ( count ( $ flags ) ) ? '(' . join ( ', ' , $ flags ) . ')' : '' ; }
Format the trace flags for display .
1,294
protected function doRequest ( $ method , $ apiMethod , array $ data = [ ] ) { $ url = $ this -> config [ 'endpoint' ] . $ apiMethod ; $ data = $ this -> mergeData ( $ this -> createAuthData ( ) , $ data ) ; $ response = $ this -> getGuzzleClient ( ) -> request ( $ method , $ url , [ 'json' => $ data ] ) ; $ responseCo...
Send request to SalesManago API .
1,295
protected function createAuthData ( ) { return [ 'clientId' => $ this -> config [ 'client_id' ] , 'apiKey' => $ this -> config [ 'api_key' ] , 'requestTime' => time ( ) , 'sha' => sha1 ( $ this -> config [ 'api_key' ] . $ this -> config [ 'client_id' ] . $ this -> config [ 'api_secret' ] ) ] ; }
Returns an array of authentication data .
1,296
private function mergeData ( array $ base , array $ replacements ) { return array_filter ( array_merge ( $ base , $ replacements ) , function ( $ value ) { return $ value !== null ; } ) ; }
Merge data and removing null values .
1,297
public function set ( $ domain , $ key , $ value = null ) { $ this -> validateDomain ( $ domain ) ; if ( null !== $ value ) { $ this -> profile [ $ domain ] [ $ key ] = $ value ; } else { $ this -> profile [ $ domain ] = $ key ; } }
Set a domain configuration .
1,298
public function get ( $ domain , $ key = null ) { $ this -> validateDomain ( $ domain ) ; if ( null === $ key ) { return new Config ( $ this -> profile [ $ domain ] ) ; } if ( ! isset ( $ this -> profile [ $ domain ] [ $ key ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown key "%s" for profile domain "...
Get a domain configuration .
1,299
protected function getFieldNames ( Criterion $ criterion ) { $ fieldDefinitionIdentifier = $ criterion -> target ; $ fieldMap = $ this -> contentTypeHandler -> getSearchableFieldMap ( ) ; $ fieldNames = [ ] ; foreach ( $ fieldMap as $ contentTypeIdentifier => $ fieldIdentifierMap ) { if ( ! isset ( $ fieldIdentifierMap...
Return all field names for the given criterion .