| Total Complexity | 6 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class JQueryPlugin extends \Jaxon\Plugin\Response |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var Config |
||
| 12 | */ |
||
| 13 | protected $xConfig; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * The class constructor |
||
| 17 | * |
||
| 18 | * @param Config $xConfig |
||
| 19 | */ |
||
| 20 | public function __construct(Config $xConfig) |
||
| 21 | { |
||
| 22 | $this->xConfig = $xConfig; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @inheritDoc |
||
| 27 | */ |
||
| 28 | public function getName(): string |
||
| 29 | { |
||
| 30 | return 'jquery'; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @inheritDoc |
||
| 35 | */ |
||
| 36 | public function getHash(): string |
||
| 37 | { |
||
| 38 | // Use the version number as hash |
||
| 39 | return '3.3.0'; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @inheritDoc |
||
| 44 | */ |
||
| 45 | public function getReadyScript(): string |
||
| 46 | { |
||
| 47 | return ' |
||
| 48 | jaxon.command.handler.register("jquery", function(args) { |
||
| 49 | jaxon.cmd.script.execute(args); |
||
| 50 | }); |
||
| 51 | '; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Create a JQueryPlugin Element with a given selector, and link it to the current response. |
||
| 56 | * |
||
| 57 | * Since this element is linked to a response, its code will be automatically sent to the client. |
||
| 58 | * The returned object can be used to call jQuery functions on the selected elements. |
||
| 59 | * |
||
| 60 | * @param string $sSelector The jQuery selector |
||
| 61 | * @param string $sContext A context associated to the selector |
||
| 62 | * |
||
| 63 | * @return Element |
||
| 64 | */ |
||
| 65 | public function element(string $sSelector = '', string $sContext = ''): Element |
||
| 71 | } |
||
| 72 | } |
||
| 73 |