C:\xampp\htdocs\landing\wp-content\plugins\totalpoll\modules\extensions\RestAPI\Extension.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

namespace TotalPoll\Modules\Extensions\RestAPI;
defined'ABSPATH' ) && exit();


/**
 * Class Extension
 * @package TotalPoll\Modules\Extensions\RestAPI
 */
class Extension extends \TotalPoll\Modules\Extension {
    protected 
$root __FILE__;

    
/**
     * Run the extension.
     *
     * @return mixed
     */
    
public function run() {
        
add_filter'totalpoll/filters/admin/editor/integration/tabs', [ $this'tab' ] );
        
add_action'rest_api_init', [ $this'bootstrapRestAPI' ] );

        
$container = \TotalPoll()->container();
        
$container->share'polls.restApi', function () use ( $container ) {
            return new 
PollRestAPI$container->get'http.request' ), $container->get'polls.repository' ), $container->get'env' ) );
        } );
    }

    public function 
bootstrapRestAPI() {
        \
TotalPoll'polls.restApi' )->registerRoutes();
    }

    public function 
tab$tabs ) {
        
$tabs['rest-api'] = [
            
'label'       => __'REST API''totalpoll' ),
            
'description' => __'Advanced''totalpoll' ),
            
'icon'        => 'cloud',
            
'file'        => $this->getPath'views/tab.php' ),
        ];

        return 
$tabs;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586