Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class PluginManager

Plugin manager. Handles installing/uninstalling plugins through their respective plugin handlers.

Model
Extended by AppModel
Extended by PluginManager
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/plugin_manager.php

Methods summary

public
# __construct( )

Initialize Plugin Manager

Initialize Plugin Manager

Overrides

AppModel::__construct
public array
# getAll( integer $company_id, array $order = array('name'=>"asc") )

Lists all installed plugins

Lists all installed plugins

Parameters

$company_id
integer
$company_id The company ID
$order
string
$sort_by The field to sort by

Returns

array
An array of stdClass objects representing installed plugins
public array
# getInstalled( )

Fetches all plugins installed in the system

Fetches all plugins installed in the system

Returns

array
An array of stdClass objects, each representing an installed plugin record
public array
# getByDir( string $plugin_dir, integer $company_id = null )

Fetches a plugin for a given company, or all plugins installed in the system for the given plugin directory

Fetches a plugin for a given company, or all plugins installed in the system for the given plugin directory

Parameters

$plugin_dir
string
$plugin_dir The directory name of the plugin to return results for
$company_id
integer
$company_id The ID of the company to fetch plugins for

Returns

array
An array of stdClass objects, each representing an installed plugin record
public mixed
# get( integer $plugin_id, boolean $detailed = false )

Fetches a single installed plugin.

Fetches a single installed plugin.

Parameters

$plugin_id
integer
$plugin_id The plugin ID to fetch
$detailed
boolean
$detailed True to return detailed information about the plugin, false otherwise

Returns

mixed
A stdClass object representing the installed plugin, false if no such plugin exists or is not installed
public array
# getAvailable( integer $company_id = null )

Lists all available plugins (those that exist on the file system)

Lists all available plugins (those that exist on the file system)

Parameters

$company_id
integer
$company_id The ID of the company to get available plugins for

Returns

array
An array of stdClass objects representing available plugins
public boolean
# isInstalled( string $dir, integer $company_id = null )

Checks whether the given plugin is installed for the specified company

Checks whether the given plugin is installed for the specified company

Parameters

$dir
string
$dir The plugin dir (in file_case)
$company_id
integer
$company_id The ID of the company to fetch for (null checks if the plugin is installed across any company)

Returns

boolean
True if the plugin is installed, false otherwise
public boolean
# isLastInstance( string $dir )

Checks whether the given plugin is the last instance installed

Checks whether the given plugin is the last instance installed

Parameters

$dir
string
$dir The plugin dir (in file_case)

Returns

boolean
True if the plugin is the last instance, false otherwise
public integer
# add( array $vars )

Adds the plugin to the system

Adds the plugin to the system

Parameters

$vars
array
$vars An array of plugin information including: - dir The dir name for the plugin to be installed - company_id The ID of the company the plugin should be installed for - staff_group_id The ID of the staff group to grant access to all permissions created by this plugin (optional)

Returns

integer
The ID of the plugin installed, void on error
public
# upgrade( integer $plugin_id )

Runs the plugin's upgrade method to upgrade the plugin to match that of the plugin's file version. Sets errors in PluginManager::errors() if any errors are set by the plugin's upgrade method.

Runs the plugin's upgrade method to upgrade the plugin to match that of the plugin's file version. Sets errors in PluginManager::errors() if any errors are set by the plugin's upgrade method.

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to upgrade
public
# delete( integer $plugin_id )

Permanently and completely removes the plugin specified by $plugin_id

Permanently and completely removes the plugin specified by $plugin_id

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to permanently remove
public
# enable( integer $plugin_id )

Enables a plugin

Enables a plugin

Parameters

$plugin_id
integer
$plugin_id
public
# disable( integer $plugin_id )

Disables a plugin

Disables a plugin

Parameters

$plugin_id
integer
$plugin_id
protected
# clearNavCache( integer $company_id )

Clears the nav cache for the given company ID

Clears the nav cache for the given company ID

Parameters

$company_id
integer
$company_id The ID of the company to clear nav cache for
public
# addEvent( array $plugin_id, array $vars )

Adds an event to the system with a callback to be invoked when the event is triggered

Adds an event to the system with a callback to be invoked when the event is triggered

Parameters

$plugin_id
array
$vars An array of event info including: - plugin_id The ID of the plugin to register the event under - event The event to register the callback under - callback The public static callback to invoke.
$vars
public
# deleteEvent( integer $plugin_id, string $event )

Removes the event from the plugin so the event will no longer be triggered

Removes the event from the plugin so the event will no longer be triggered

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to remove the event from
$event
string
$event The event to remove from the plugin
public
# addAction( integer $plugin_id, array $vars )

Adds an action to the system that may be used to access a particular view

Adds an action to the system that may be used to access a particular view

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to register the action under
$vars
array
$vars An array of action fields including: - action The action to register the uri under - uri The URI that represents this action - name The language definition naming this action - options An array of key/value pairs to set for the given action (if necessary)
public
# deleteAction( integer $plugin_id, string $action )

Removes the action from the plugin

Removes the action from the plugin

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to remove the action from
$action
string
$action The action to remove from the plugin
public array
# getEvents( integer $company_id, string $event, boolean $enabled = null )

Retrieves all callbacks that are registered for a particular event and company

Retrieves all callbacks that are registered for a particular event and company

Parameters

$company_id
integer
$company_id The ID of the company the event is registered under
$event
string
$event The event being requested
$enabled
boolean
$enabled True for only enabled plugins, false for disabled, null for both

Returns

array
An array of stdClass objects representing the registered callback events
public mixed
# getEvent( integer $plugin_id, string $event )

Retrieves the specified event of the given plugin

Retrieves the specified event of the given plugin

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to fetch the event under
$event
string
$event The event to fetch

Returns

mixed
A stdClass object representing the plugin event, false if not such plugin event exists.
public array
# getActions( integer $company_id, string $action, boolean $enabled = null )

Retrieves all actions that are registered for a particular action and company

Retrieves all actions that are registered for a particular action and company

Parameters

$company_id
integer
$company_id The ID of the company the action is registered under
$action
string
$action The action being requested
$enabled
boolean
$enabled True for only enabled plugins, false for disabled, null for both

Returns

array
An array of stdClass objects representing registered actions
public mixed
# getAction( integer $plugin_id, string $action )

Retrieves the specified action from the given plugin

Retrieves the specified action from the given plugin

Parameters

$plugin_id
integer
$plugin_id The ID of the plugin to fetch the action under
$action
string
$action The action to fetch

Returns

mixed
A stdClass object representing the plugin action, false if not such plugin action exists.
public EventObject
# invokeEvents( integer $company_id, EventObject $event )

Invoke a specific event for all plugins

Invoke a specific event for all plugins

Parameters

$company_id
integer
$company_id The ID of the company to fetch plugin events for
$event
EventObject
$event An event object

Returns

EventObject
The processed event object

Methods inherited from AppModel

_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()

Methods inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0