PHPConfig
[ class tree: PHPConfig ] [ index: PHPConfig ] [ all elements ]

Class: Gtk2_PHPConfig

Source Location: /Gtk2_PHPConfig-1.0.0RC1/PHPConfig.php

Class Overview

GtkWindow
   |
   --Gtk2_PHPConfig

Class for GUI-based configuration of a php.ini file


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 34]
Class for GUI-based configuration of a php.ini file

This class is based on the PHP-Gtk2 extension and provides a user-friendly interface for editing php.ini files. All the possible configuration options have been defined in a separate XML file . This allows for easy addition of directives as PHP is developed further.

The class can parse any existing ini file, or create new ones. Parsing of existing files is currently a little inefficient, suggestions for improvement are welcome. New files and files previously generated by Gtk2_PHPConfig are parsed at a good speed though.

The interface displays all available configuration sections on the left pane, and their corresponding options in the top right pane. The bottom right pane displays the description of the option selected and the facility to change the value of that option.

  • Author: Anant Narayanan <anant@php.net>
  • Todo: Clicking Cancel on the File-Open dialog generates a notice
  • Todo: Implement Christian's suggestion of asking for confirmation when a file is overwritten while doing a "save as"
  • Todo: Add facility to add directives, apart from additions to XML
  • License: LGPL License 2.1


[ Top ]


Class Variables

$extensions =

[line 146]

The extension modules loaded/unloaded in the current file parsed.
  • Access: protected

Type:   Array


[ Top ]

$fileName =

[line 86]

The file name of the php.ini file currently open. Will be set to null if a new file is to be generated.
  • Access: protected

Type:   string


[ Top ]

$optionComments =

[line 68]

Comments associated with the currently selected option.
  • Access: protected

Type:   GtkTextBuffer


[ Top ]

$optionDesc =

[line 60]

Description of the currently selected option.
  • Access: protected

Type:   GtkTextBuffer


[ Top ]

$optionEntry =

[line 77]

The entry box that will accept the value of the current option from the user.
  • Access: protected

Type:   GtkEntry


[ Top ]

$optionIndex =

[line 129]

The "buffer" array that stores the current values of all the options.
  • Access: protected

Type:   Array


[ Top ]

$optionTree =

[line 52]

Tree that displays the current section's corresponding options.
  • Access: protected

Type:   GtkTreeView


[ Top ]

$progress =

[line 138]

The progress window that displays the percentage by which a file is parsed.
  • Access: protected

Type:   GtkWindow


[ Top ]

$saveasBuffer =

[line 120]

A buffer used to temporarily store the contents of the currently open file when the save as option is used
  • Access: protected

Type:   Array


[ Top ]

$saved =

[line 111]

A flag that determined whether the current file is saved or not.
  • Access: protected

Type:   bool


[ Top ]

$sectionTree =

[line 44]

Tree that displays the available configuration sections.
  • Access: protected

Type:   GtkTreeView


[ Top ]

$xmlDefs =

[line 95]

The XML definition file holding descriptions of all possible php.ini directives.
  • Access: protected

Type:   DOMDocument


[ Top ]

$xpath =

[line 103]

The XPath object to the XML definition file.
  • Access: protected

Type:   DOMXPath


[ Top ]



Method Detail

__construct (Constructor)   [line 201]

Gtk2_PHPConfig __construct( string $fileName)

Sets the classes' properties and calls the creation of the GUI interface.

Parameters:

string   $fileName   —  Filename of the ini file to be edited. Will be null if a new file is to be created.

[ Top ]

buildDescBox   [line 324]

GtkVBox buildDescBox( )

Creates and the description and comment boxes.
  • Return: The descriptiona and comment boxes.

[ Top ]

buildGUI   [line 223]

void buildGUI( )

Creates the user interface to facilitate editing of the ini files.

Also calls other functions that parse the XML definition file and then displays the configuration options.


[ Top ]

buildMenu   [line 277]

GtkMenuBar buildMenu( )

Creates and returns the menu for the GUI
  • Return: The Menu bar of the GUI

[ Top ]

buildSectionList   [line 402]

GtkTreeView buildSectionList( )

Generates a list of available configuration sections after parsing the XML definition file.

[ Top ]

buildValueBox   [line 361]

GtkVBox buildValueBox( )

Creates and returns the value setting box
  • Return: The Value setting box.

[ Top ]

getOptions   [line 546]

Array getOptions( string $section)

Returns an array of possible configuration options corresponding to a particular configuration section.

Parameters:

string   $section   —  Name of the configuration section for which the configuration options must be returned.

[ Top ]

getSections   [line 524]

Array getSections( )

Returns an array of possible configuration sections after parsing the XML definition file.

[ Top ]

getValues   [line 777]

Array getValues( )

Parses the XML definition file and returns the initial state of the buffer. Additionally, if an existing file is opened, parses that file and modifies the buffer to reflect the current state of that file.

[ Top ]

newFile   [line 975]

void newFile( )

Creates a new file to be edited after prompting for saving of the existing file that is open.

[ Top ]

onOptionSelect   [line 427]

void onOptionSelect( $selected)

Sets the description of the configuration option currently selected and displays it along with comments, if any.

Parameters:

   $selected   — 

[ Top ]

onSaveFile   [line 665]

void onSaveFile( GtkFileSelection $filePrompt, $saveas)

Called in case a new file is to be generated after a filename has been prompted for. Sets the filename property to the filename chosen by the user and calls the saveFile() function.

Parameters:

GtkFileSelection   $filePrompt   —  File selection dialog object that called this function.
   $saveas   — 

[ Top ]

onSaveFileAs   [line 683]

void onSaveFileAs( )

Called in case the "Save As..." option is selected. The function will prompt for a filename to save the file as.

[ Top ]

onSectionSelect   [line 467]

void onSectionSelect( GtkTreeSelection $selected)

Retreives and displays the set of configuration options associated with the currently selected configuration section.

Parameters:

GtkTreeSelection   $selected   —  Selection object corresponding to the currently selected configuration section.

[ Top ]

onValueSubmit   [line 701]

void onValueSubmit( )

Sets the new user-defined value for the configuration option in the buffer.

[ Top ]

onValueUnset   [line 743]

void onValueUnset( )

Unsets the value of the currently selected configuration directive to disabled so that it does not appear in the configuration file.

[ Top ]

openFile   [line 946]

void openFile( )

Prompts for saving of file that is currently opened and opens a dialog that prompts for the next file the user wishes to open.

[ Top ]

quit   [line 1054]

void quit( )

Quits the main Gtk loop after checking whether the current state of the buffer has been saved to a file or not.

[ Top ]

saveFile   [line 578]

void saveFile( [ $saveas = false])

Saves the current state of configuration into a file. Filename will be prompted for if a new file is to be generated.

Parameters:

   $saveas   — 

[ Top ]

savePrompt   [line 994]

bool savePrompt( )

Checks whether the existing open file is saved or not. If not, prompts the user to save it.
  • Return: Returns true if users wants to quit, false otherwise.

[ Top ]

setTitle   [line 1031]

string setTitle( )

Sets the title of the window as required.
  • Return: The title of the window.

[ Top ]

showProgress   [line 898]

void showProgress( )

Creates and displays a progress bar that indicates by what amount a file has been parsed.

[ Top ]

updateProgress   [line 927]

void updateProgress( int $fraction)

Updates the progress by the fraction received as an argument by the function.

Parameters:

int   $fraction   —  The fraction by which the progress bar must be updated.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:36:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.