Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class Plugin

This class describes the behavior of the application plugins

Namespace: Hawk
Package: Core\Plugin
Located at Plugin.php

Methods summary

public static Hawk\Plugin
# get( string $name )

Get a plugin instance from it name

Get a plugin instance from it name

Parameters

$name
The plugin name to instance

Returns

Hawk\Plugin
The instance of the wanted plugin
public static Hawk\Plugin
# current( )

Get the plugin containing the file where this function is called

Get the plugin containing the file where this function is called

Returns

Hawk\Plugin
The current plugin
public static Hawk\Plugin
# getFilePlugin( string $file )

Get the plugin contaning a given filename

Get the plugin contaning a given filename

Parameters

$file
The filename to get the containing plugin of

Returns

Hawk\Plugin
The found plugin
public static array
# getAll( boolean $includeMain = true, boolean $loadConf = false )

Get all the plugins

Get all the plugins

Parameters

$includeMain
If true, include main plugins to the returned list
$loadConf
If set to true, load the plugins conf in the database

Returns

array
The list of plugin instances
public static array
# getActivePlugins( boolean $includeMain = true )

Get all the active plugins

Get all the active plugins

Parameters

$includeMain
If set to true, include main plugins in the returned array

Returns

array
The list of plugin instances
public static array
# getMainPlugins( )

Get the main plugins

Get the main plugins

Returns

array
The list of plugin instances
public string
# getName( )

Get the plugin name

Get the plugin name

Returns

string
The plugin name
public boolean
# isMainPlugin( )

Check if the plugin is a main plugin

Check if the plugin is a main plugin

Returns

boolean
True if the plugin is a main plugin (main, install or admin), else False
public array
# getOptions( )

Get the plugin options

Get the plugin options

Returns

array
The plugin options, where keys are the options names, and values, the values for each option
public mixed
# getDefinition( string $prop = null )

Get the plugin data from the manifest

Get the plugin data from the manifest

Parameters

$prop

If set, the method will return the value of the definition property $prop. If not set, it will return the whole definition array

Returns

mixed

The plugin definition property if $prop is set, or the whole plugin definition if $prop is not set

public string
# getRootDir( )

Return the root directory of the plugin

Return the root directory of the plugin

Returns

string
the root directory of the plugin
public string
# getStartFile( )

Returns the start file of the plugin. The start file is the file start.php, at the root of the plugin directory, that defines the routes, widgets, and event listenter of the plugin.

Returns the start file of the plugin. The start file is the file start.php, at the root of the plugin directory, that defines the routes, widgets, and event listenter of the plugin.

Returns

string
The file path of the plugin start file
public string
# getControllersDir( )

Returns the directory of the plugin containing the controllers

Returns the directory of the plugin containing the controllers

Returns

string
The directory containing controllers classes of the plugin
public string
# getLangDir( )

Return the directory containing the plugin language files

Return the directory containing the plugin language files

Returns

string
The directory contaning the plugin language files
public string
# getModelsDir( )

Return the directory containing the plugin models

Return the directory containing the plugin models

Returns

string
The directory containing models classes of the plugin
public string
# getWidgetsDir( )

Return the directory containing the plugin widgets

Return the directory containing the plugin widgets

Returns

string
The directory containing the widgets classes of the plugin
public string
# getViewsDir( )

Return the directory containing the plugin views

Return the directory containing the plugin views

Returns

string
The directory contaning the plugin views
public string
# getView( string $view )

Return the full path of a view in the plugin

Return the full path of a view in the plugin

Parameters

$view
The basename of the view file to get in the plugin

Returns

string
The full path of the view file
public string
# getStaticDir( )

Return the directory containing the plugin static files (js, css, images)

Return the directory containing the plugin static files (js, css, images)

Returns

string
The directory path
public string
# getPublicStaticDir( )

Return the directory containing the plugin public static files (acessible by HTTP requests)

Return the directory containing the plugin public static files (acessible by HTTP requests)

Returns

string
The directory path
public string
# getStaticUrl( string $basename = '' )

Return the url of a static file in the plugin, or the directory containing static files if $basename is empty

Return the url of a static file in the plugin, or the directory containing static files if $basename is empty

Parameters

$basename
The file to get the URL of

Returns

string
The URL
public string
# getJsDir( )

Return the directory containing the plugin JavaScript files

Return the directory containing the plugin JavaScript files

Returns

string
The directory path
public string
# getPublicJsDir( )

Return the directory containing the plugin public JavaScript files (accessible by HTTP requests)

Return the directory containing the plugin public JavaScript files (accessible by HTTP requests)

Returns

string
The directory path
public string
# getJsUrl( string $basename = '' )

Return the URL of a public javascript file, or the URL of the directory containing public javascript files if $basename is empty

Return the URL of a public javascript file, or the URL of the directory containing public javascript files if $basename is empty

Parameters

$basename
The Javascript file basename

Returns

string
The URL
public string
# getLessDir( )

Return the directory containing the plugin CSS files

Return the directory containing the plugin CSS files

Returns

string
The directory contaning the plugin CSS files
public string
# getPublicCssDir( )

Return the directory containing the plugin public CSS files (accessible by HTTP requests)

Return the directory containing the plugin public CSS files (accessible by HTTP requests)

Returns

string
The directory path
public string
# getCssUrl( string $basename = "" )

Return the URL of a public CSS file, or the URL of the directory containing public CSS files if $basename is empty

Return the URL of a public CSS file, or the URL of the directory containing public CSS files if $basename is empty

Parameters

$basename
The Less file basename

Returns

string
The URL
public string
# getUserfilesDir( )

Return the directory containing the plugin files due to user actions

Return the directory containing the plugin files due to user actions

Returns

string
The directory contaning the user files of the plugin
public string
# getPublicUserfilesDir( )

Return the directory containing the public (accessible by HTTP requests) plugin files due to user actions

Return the directory containing the public (accessible by HTTP requests) plugin files due to user actions

Returns

string
The directory contaning the user files of the plugin
public string
# getUserfilesUrl( string $basename = '' )

Return the URL of a static userfile, or the URL of the directory contaning the userfiles, if $basename is empty

Return the URL of a static userfile, or the URL of the directory contaning the userfiles, if $basename is empty

Parameters

$basename
The basename of the file to get the access URL

Returns

string
The URL
public boolean
# isInstalled( )

Check if the plugin is installed. The plugin is installed if it appears in the database

Check if the plugin is installed. The plugin is installed if it appears in the database

Returns

boolean
True if the plugin is installed, False else
public static
# getNamespaceByName( string $name )

Get a plugin namespace by it name

Get a plugin namespace by it name

Parameters

$name
The plugin name
public string
# getNamespace( )

Get the namespace used for all files in the plugin. The namespace is generated from the plugin name

Get the namespace used for all files in the plugin. The namespace is generated from the plugin name

Returns

string
The plugin namespace
public Hawk\PluginInstaller
# getInstallerInstance( )

Instance the plugin installer

Instance the plugin installer

Returns

Hawk\PluginInstaller
The instance of the plugin installer
public
# install( )

Install the plugin

Install the plugin

public
# uninstall( )

Uninstall the plugin

Uninstall the plugin

public boolean
# isActive( )

Check if the plugin is active

Check if the plugin is active

Returns

boolean
True if the plugin is active, False else
public
# activate( )

Activate the plugin in the database

Activate the plugin in the database

public
# deactivate( )

Deactive the plugin

Deactive the plugin

public
# update( string $version )

Update the plugin to a given version

Update the plugin to a given version

Parameters

$version
The version to update the plugin
public
# delete( )

Compelete deletion of plugin

Compelete deletion of plugin

Constants summary

string TABLE

The table in the database where the plugins data are registered

The table in the database where the plugins data are registered

# 'Plugin'
string MANIFEST_BASENAME

The basename of the file containing the plugin definition

The basename of the file containing the plugin definition

# 'manifest.json'
string NAME_PATTERN

The pattern for a plugin name

The pattern for a plugin name

# '[a-zA-Z0-9\-_.]+'

Properties summary

public static array $mainPlugins

The application main plugins, not removable or editable, used for the application core

The application main plugins, not removable or editable, used for the application core

# array('main', 'install', 'admin')
public static array $forbiddenNames

Forbidden plugin names

Forbidden plugin names

# array('custom')
Hawk - PHP documentation API documentation generated by ApiGen