PHP Класс 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
Автор: =undo= ([email protected])
Наследование: extends WPDKPlugin
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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/

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

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
Результат WPDKWordPressPlugin

activation() публичный Метод

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

admin() публичный Метод

See _init()
public admin ( )

admin_init() публичный Метод

Called by action hook 'admin_init'
public admin_init ( )

ajax() публичный Метод

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

autoloadEnvironment() публичный Метод

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.
С версии: 1.0.0.b4
public autoloadEnvironment ( string $sClassName )
$sClassName string - The class that has to be loaded right now

currentURL() публичный статический Метод

Return the current complete URL with protocol (http or https), server name, port and URI
public static currentURL ( ) : string
Результат string The current complete URL

deactivation() публичный Метод

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

preferences() публичный Метод

Called after load_plugin_textdomain() in _init
public preferences ( )

protocol() публичный статический Метод

Return the current web site protocol. The protocol property is set too.
public static protocol ( ) : string
Результат string `http` or `https`

registerAutoloadClass() публичный Метод

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() публичный Метод

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() публичный Метод

See _init()``
public theme ( )

urlAjax() публичный статический Метод

Returns the standard URL used by WordPress Ajax request.
public static urlAjax ( ) : string
Результат string Standard URL for Ajax request

widgets() публичный Метод

Fires after all default WordPress widgets have been registered.
С версии: 0.7.5
public widgets ( )

Описание свойств

$assetsURL публичное свойство

The Plugin URL more assets/. This property is very useful for read style sheet and Javascript file in the 'assets' folder.
public string $assetsURL
Результат string

$classesPath публичное свойство

The Filesystem plugin path more classes/
public string $classesPath
Результат string

$cssURL публичное свойство

The Plugin URL more assets/css/
public string $cssURL
Результат string

$databasePath публичное свойство

The Filesystem plugin path more database/
public string $databasePath
Результат string

$folderName публичное свойство

The plugin folder, Eg. wpx-smartshop/
public string $folderName
Результат string

$imagesURL публичное свойство

The Plugin URL more assets/css/images/
public string $imagesURL
Результат string

$javascriptURL публичное свойство

The Plugin URL more assets/js/
public string $javascriptURL
Результат string

$path публичное свойство

Filesystem plugin path
public string $path
Результат string

$pluginBasename публичное свойство

The Plugin folder and main file, Eg. wpx-smartshop/main.php This is used as unique code id.
public string $pluginBasename
Результат string

$protocol публичное свойство

The Protocol http:// or https://
public string $protocol
Результат string

$slug публичное свойство

The plugin slug build with WordPress sanitize_title()
public string $slug
Результат string

$url публичное свойство

The Plugin URL
public string $url
Результат string

$urlAjax публичное свойство

The Default WordPress admin Ajax URL gateway
См. также: self::urlAjax() static method
public string $urlAjax
Результат string

$url_images публичное свойство

The Plugin URL more assets/css/images/
Устаревший: Since 0.6.3 - Use `imagesURL` instead
public string $url_images
Результат string

$url_javascript публичное свойство

The Plugin URL more assets/js/
Устаревший: Since 0.6.3 - Use `javascriptURL` instead
public string $url_javascript
Результат string