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 HawkApi

This class treats the interface with the Hawk site, to get the informations from the site database via an Restful API

Namespace: Hawk
Package: Network
Located at HawkApi.php

Methods summary

public array
# getCoreAvailableUpdates( )

Get the available updates of Hawk

Get the available updates of Hawk

Returns

array
The list of available version newer than the current one
public string
# getCoreUpdateArchive( string $version )

Download an update file for the core

Download an update file for the core

Parameters

$version
The version update to get

Returns

string
The filename of the temporary file created by the downloaded content
public array
# searchPlugins( string $search )

Search plugins

Search plugins

Parameters

$search
The search term

Returns

array
The list of found plugins
public string
# downloadPlugin( string $name )

Download a plugin file

Download a plugin file

Parameters

$name
The plugin name to download

Returns

string
The filename of the temporary file created by the downloaded content
public array
# getPluginsAvailableUpdates( array $plugins )

Search for updates on a list of plugins

Search for updates on a list of plugins

Parameters

$plugins

The list of plugins to search available updates for, where keys are plugin names, and values their current version

Returns

array
The list of the available updates on plugins
public array
# searchThemes( string $search )

Search themes

Search themes

Parameters

$search
The search term

Returns

array
The list of found themes
public string
# downloadTheme( string $name )

Download a theme file

Download a theme file

Parameters

$name
The theme name to download

Returns

string
The filename of the temporary file created by the downloaded content
public array
# getThemesAvailableUpdates( array $themes )

Search for updates on a list of themes

Search for updates on a list of themes

Parameters

$themes

The list of themes to search available updates for, where keys are themes names, and values their current version

Returns

array
The list of available updates on themes
public array
# getAllAvailableUpdates( array $plugins, array $themes )

Get all available updates on Hawk, plugins and themes

Get all available updates on Hawk, plugins and themes

Parameters

$plugins

The list of plugins to search available updates for, where keys are plugin names, and values their current version

$themes

The list of themes to search available updates for, where keys are themes names, and values their current version

Returns

array

The available udpates, in an array in the following format :

array(
                      'hawk' => 'v1.0.0',
                      'plugins' => array(
                          'pluginName' => 'v1.2.3.0',
                          ...
                      ),
                      'themes' => array(
                          'themeName' => 'v0.0.5.1',
                          ...
                      )
                  )

Constants summary

string VERSION_PATTERN

The pattern for a plugin / theme version

The pattern for a plugin / theme version

# '/^(\d{1,2}\.){2,3}\d{1,2}$/'
string VERSION_PATTERN_URI

The pattern for a plugin or theme version, in a URI

The pattern for a plugin or theme version, in a URI

# '(?:\d{1,2}\.){2,3}\d{1,2}'

Properties summary

public static array $routes

The callable routes on the API, with their parameters

The callable routes on the API, with their parameters

# array( // Search plugins 'api-search-plugins' => array( 'method' => 'get', 'uri' => '/plugins/search', 'where' => array( 'params' => array( 'search' => array( 'required' => true, ) ) ) ), // Install a plugin 'api-install-plugin' => array( 'method' => 'get', 'uri' => '/plugins/{name}/install', 'where' => array( 'path' => array( 'name' => Plugin::NAME_PATTERN ) ), 'dataType' => 'application/octet-stream' ), // Get the available updates on plugins 'api-plugins-available-updates' => array( 'method' => 'get', 'uri' => '/plugins/available-updates', 'where' => array( 'params' => array( 'plugins' => array( 'required' => true, ) ) ) ), // Search themes 'api-search-themes' => array( 'method' => 'get', 'uri' => '/themes/search', 'where' => array( 'params' => array( 'search' => array( 'required' => true, ) ) ) ), // Install a theme 'api-install-theme' => array( 'method' => 'get', 'uri' => '/themes/{name}/install', 'where' => array( 'path' => array( 'name' => Theme::NAME_PATTERN ) ), 'dataType' => 'application/octet-stream' ), // Get the available updates on themes 'api-themes-available-updates' => array( 'method' => 'get', 'uri' => '/themes/available-updates', 'where' => array( 'params' => array( 'themes' => array( 'required' => true, ) ) ) ), // Search for available updates on the core 'api-core-available-updates' => array( 'method' => 'get', 'uri' => '/hawk/updates', 'where' => array( 'params' => array( 'version' => array( 'required' => true, 'pattern' => self::VERSION_PATTERN ) ) ) ), // Update Hawk 'api-core-update' => array( 'method' => 'get', 'uri' => '/hawk/update/{to}', 'where' => array( 'path' => array( 'to' => self::VERSION_PATTERN_URI ) ), 'dataType' => 'application/octet-stream' ), // Search for updates on Hawk, plugins and theme in one request 'api-all-updates' => array( 'method' => 'post', 'uri' => '/updates', 'where' => array( 'body' => array( 'hawk' => array( 'required' => true, 'pattern' => self::VERSION_PATTERN ), 'plugins' => array( 'required' => true ), 'themes' => array( 'required' => true ) ) ) ) )
Hawk - PHP documentation API documentation generated by ApiGen