|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Sentry.php - Upload Trait |
|
5
|
|
|
* |
|
6
|
|
|
* The Jaxon class uses a modular plug-in system to facilitate the processing |
|
7
|
|
|
* of special Ajax requests made by a PHP page. |
|
8
|
|
|
* It generates Javascript that the page must include in order to make requests. |
|
9
|
|
|
* It handles the output of response commands (see <Jaxon\Response\Response>). |
|
10
|
|
|
* Many flags and settings can be adjusted to effect the behavior of the Jaxon class |
|
11
|
|
|
* as well as the client-side javascript. |
|
12
|
|
|
* |
|
13
|
|
|
* @package jaxon-core |
|
14
|
|
|
* @author Thierry Feuzeu <[email protected]> |
|
15
|
|
|
* @copyright 2017 Thierry Feuzeu <[email protected]> |
|
16
|
|
|
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License |
|
17
|
|
|
* @link https://github.com/jaxon-php/jaxon-core |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace Jaxon\Traits; |
|
21
|
|
|
|
|
22
|
|
|
use Jaxon\Utils\Container; |
|
23
|
|
|
|
|
24
|
|
|
trait Plugin |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* Register a plugin |
|
28
|
|
|
* |
|
29
|
|
|
* Below is a table for priorities and their description: |
|
30
|
|
|
* - 0 thru 999: Plugins that are part of or extensions to the jaxon core |
|
31
|
|
|
* - 1000 thru 8999: User created plugins, typically, these plugins don't care about order |
|
32
|
|
|
* - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list |
|
33
|
|
|
* |
|
34
|
|
|
* @param Plugin $xPlugin An instance of a plugin |
|
|
|
|
|
|
35
|
|
|
* @param integer $nPriority The plugin priority, used to order the plugins |
|
36
|
|
|
* |
|
37
|
|
|
* @return void |
|
38
|
|
|
*/ |
|
39
|
|
|
public function registerPlugin(\Jaxon\Plugin\Plugin $xPlugin, $nPriority = 1000) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->getPluginManager()->registerPlugin($xPlugin, $nPriority); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Register the Jaxon request plugins |
|
46
|
|
|
* |
|
47
|
|
|
* @return void |
|
48
|
|
|
*/ |
|
49
|
|
|
public function registerRequestPlugins() |
|
50
|
|
|
{ |
|
51
|
|
|
$this->registerPlugin(new \Jaxon\Request\Plugin\CallableObject(), 101); |
|
52
|
|
|
$this->registerPlugin(new \Jaxon\Request\Plugin\UserFunction(), 102); |
|
53
|
|
|
$this->registerPlugin(new \Jaxon\Request\Plugin\BrowserEvent(), 103); |
|
54
|
|
|
$this->registerPlugin(new \Jaxon\Request\Plugin\FileUpload(), 104); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Register the Jaxon response plugins |
|
59
|
|
|
* |
|
60
|
|
|
* @return void |
|
61
|
|
|
*/ |
|
62
|
|
|
public function registerResponsePlugins() |
|
63
|
|
|
{ |
|
64
|
|
|
// Register an instance of the JQuery plugin |
|
65
|
|
|
$this->registerPlugin(new \Jaxon\JQuery\Plugin(), 700); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|