PHP Class WPDKWordPressPlugin

## Overview The WPDKWordPressPlugin class provides the fundamental startup of plugin. You rarely (never) instantiate WPDKWordPressPlugin object directly. Instead, you instantiate subclasses of the WPDKWordPressPlugin class. ### Subclassing This class **must** be used to extend the main class of your plugin. Its function is to initialize the environment will operate on the plugin itself and record the Plugin for updates from WPX Store. ### Benefits In addition to initializing and recording, WPDKWordPressPlugin class performs for us a whole series of standard procedures in the writing of Plugin, in addition to providing a lot of properties and methods really comfortable. * Gets directly from standard WordPress comments prior information as to the description of the Plugin: plugin name, version, the text and the text domain domain path * Prepare a set of standard properties with paths and urls most commonly used * Provides a lot of hook to wrap (filters and actions) of most used WordPress * Prepare an instance of WPDKWatchDog object for own log ### Useful properties The path propertis are the filesystem unix path. The URL properties are the HTTP protocol URI. See below for detail ### Useful methods See below for detail
Author: =undo= ([email protected])
Inheritance: extends WPDKPlugin
Afficher le fichier Open project: wpxtreme/wpdk Class Usage Examples

Méthodes publiques

Свойство Type Description
$assetsURL string The Plugin URL more assets/. This property is very useful for read style sheet and Javascript file in the 'assets' folder.
$classesPath string The Filesystem plugin path more classes/
$cssURL string The Plugin URL more assets/css/
$databasePath string The Filesystem plugin path more database/
$folderName string The plugin folder, Eg. wpx-smartshop/
$imagesURL string The Plugin URL more assets/css/images/
$javascriptURL string The Plugin URL more assets/js/
$path string Filesystem plugin path
$pluginBasename string The Plugin folder and main file, Eg. wpx-smartshop/main.php This is used as unique code id.
$protocol string The Protocol http:// or https://
$slug string The plugin slug build with WordPress sanitize_title()
$url string The Plugin URL
$urlAjax string The Default WordPress admin Ajax URL gateway
$url_images string The Plugin URL more assets/css/images/
$url_javascript string The Plugin URL more assets/js/

Méthodes publiques

Méthode Description
__construct ( string $file = null ) : WPDKWordPressPlugin Create a WPDKWordPressPlugin instance
activation ( ) Called when a plugin is activate; register_activation_hook()
admin ( ) See _init()
admin_init ( ) Called by action hook 'admin_init'
ajax ( ) This method is to override and it is called when an Ajax request is performed.
autoloadEnvironment ( string $sClassName ) This function performs runtime autoloading of a class specifically related to this instance; this autoloading is based on previous class registering that has to be executed before.
currentURL ( ) : string Return the current complete URL with protocol (http or https), server name, port and URI
deactivation ( ) Called when a plugin is deactivate; register_deactivation_hook()
preferences ( ) Called after load_plugin_textdomain() in _init
protocol ( ) : string Return the current web site protocol. The protocol property is set too.
registerAutoloadClass ( string | array $sLoadingPath, string $mClassName = '' ) This function records a WPX plugin class into autoloading register, joined with its loading path.
reloadTextDomain ( ) Reload the text domain for multilingual. This method is useful when the loading procedure for the text domain (which occurs in plugins_loaded()) is not complete for some reason.
theme ( ) See _init()``
urlAjax ( ) : string Returns the standard URL used by WordPress Ajax request.
widgets ( ) Fires after all default WordPress widgets have been registered.

Method Details

__construct() public méthode

Create a WPDKWordPressPlugin instance
public __construct ( string $file = null ) : WPDKWordPressPlugin
$file string Usually you set it as `__FILE__`, which is the name of main file of plugin
Résultat WPDKWordPressPlugin

activation() public méthode

Called when a plugin is activate; register_activation_hook()
public activation ( )

admin() public méthode

See _init()
public admin ( )

admin_init() public méthode

Called by action hook 'admin_init'
public admin_init ( )

ajax() public méthode

This method is to override and it is called when an Ajax request is performed.
public ajax ( )

autoloadEnvironment() public méthode

NOTE: this SPL autoloading logic is encapsulated in every single plugin instance that extends this class, because it is embedded into an instance of WPDKWordPressPlugin. So any plugin has its own SPL autoloading logic.
Since: 1.0.0.b4
public autoloadEnvironment ( string $sClassName )
$sClassName string - The class that has to be loaded right now

currentURL() public static méthode

Return the current complete URL with protocol (http or https), server name, port and URI
public static currentURL ( ) : string
Résultat string The current complete URL

deactivation() public méthode

Called when a plugin is deactivate; register_deactivation_hook()
public deactivation ( )

preferences() public méthode

Called after load_plugin_textdomain() in _init
public preferences ( )

protocol() public static méthode

Return the current web site protocol. The protocol property is set too.
public static protocol ( ) : string
Résultat string `http` or `https`

registerAutoloadClass() public méthode

The function has some facility in its first param, in order to allow both string and array loading of class names ( useful in case of a group of classes that are defined in a single file ). 1. $this->registerAutoloadClass( 'file.php', 'ClassName' ); 2. $this->registerAutoloadClass( array( 'file.php' => 'ClassName' ) ); 3. $this->registerAutoloadClass( array( 'file.php' => array( 'ClassName', 'ClassName', ... ) ) );
public registerAutoloadClass ( string | array $sLoadingPath, string $mClassName = '' )
$sLoadingPath string | array Path of class when $mClassName is a string
$mClassName string Optional. The single class name or key value pairs array with path => classes

reloadTextDomain() public méthode

Reload the text domain for multilingual. This method is useful when the loading procedure for the text domain (which occurs in plugins_loaded()) is not complete for some reason.
public reloadTextDomain ( )

theme() public méthode

See _init()``
public theme ( )

urlAjax() public static méthode

Returns the standard URL used by WordPress Ajax request.
public static urlAjax ( ) : string
Résultat string Standard URL for Ajax request

widgets() public méthode

Fires after all default WordPress widgets have been registered.
Since: 0.7.5
public widgets ( )

Property Details

$assetsURL public_oe property

The Plugin URL more assets/. This property is very useful for read style sheet and Javascript file in the 'assets' folder.
public string $assetsURL
Résultat string

$classesPath public_oe property

The Filesystem plugin path more classes/
public string $classesPath
Résultat string

$cssURL public_oe property

The Plugin URL more assets/css/
public string $cssURL
Résultat string

$databasePath public_oe property

The Filesystem plugin path more database/
public string $databasePath
Résultat string

$folderName public_oe property

The plugin folder, Eg. wpx-smartshop/
public string $folderName
Résultat string

$imagesURL public_oe property

The Plugin URL more assets/css/images/
public string $imagesURL
Résultat string

$javascriptURL public_oe property

The Plugin URL more assets/js/
public string $javascriptURL
Résultat string

$path public_oe property

Filesystem plugin path
public string $path
Résultat string

$pluginBasename public_oe property

The Plugin folder and main file, Eg. wpx-smartshop/main.php This is used as unique code id.
public string $pluginBasename
Résultat string

$protocol public_oe property

The Protocol http:// or https://
public string $protocol
Résultat string

$slug public_oe property

The plugin slug build with WordPress sanitize_title()
public string $slug
Résultat string

$url public_oe property

The Plugin URL
public string $url
Résultat string

$urlAjax public_oe property

The Default WordPress admin Ajax URL gateway
See also: self::urlAjax() static method
public string $urlAjax
Résultat string

$url_images public_oe property

The Plugin URL more assets/css/images/
Deprecation: Since 0.6.3 - Use `imagesURL` instead
public string $url_images
Résultat string

$url_javascript public_oe property

The Plugin URL more assets/js/
Deprecation: Since 0.6.3 - Use `javascriptURL` instead
public string $url_javascript
Résultat string