function doInit()
{
    if (Config::$pass == null) {
        Config::$pass = trim(file_get_contents(getenv('HOME') . '/.cluebotng.password.only'));
    }
    Api::init();
    Api::$a->login(Config::$user, Config::$pass);
    Globals::$tfas = 0;
    Globals::$stdin = fopen('php://stdin', 'r');
    Globals::$run = Api::$q->getpage('User:'******'/Run');
    Globals::$wl = Api::$q->getpage('Wikipedia:Huggle/Whitelist');
    Globals::$optin = Api::$q->getpage('User:'******'/Optin');
    Globals::$aoptin = Api::$q->getpage('User:'******'/AngryOptin');
    Globals::$stalk = array();
    Globals::$edit = array();
    $tmp = explode("\n", Api::$q->getpage('User:'******'/CBAutostalk.js'));
    foreach ($tmp as $tmp2) {
        if (strlen($tmp2) > 0 && substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            if (count($tmp3) == 2) {
                Globals::$stalk[$tmp3[0]] = trim($tmp3[1]);
            } else {
                print "Skipping auto stalk entry: {$tmp2}\n";
            }
        }
    }
    $tmp = explode("\n", Api::$q->getpage('User:'******'/CBAutoedit.js'));
    foreach ($tmp as $tmp2) {
        if (strlen($tmp2) > 0 && substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            if (count($tmp3) == 2) {
                Globals::$edit[$tmp3[0]] = trim($tmp3[1]);
            } else {
                print "Skipping auto edit entry: {$tmp2}\n";
            }
        }
    }
}
Beispiel #2
0
        $response = wp_remote_get($url, ['timeout' => 40, 'body' => ['api_version' => ELEMENTOR_VERSION, 'site_lang' => get_bloginfo('language')]]);
        if (is_wp_error($response) || 200 !== (int) wp_remote_retrieve_response_code($response)) {
            return false;
        }
        $template_content = json_decode(wp_remote_retrieve_body($response), true);
        if (empty($template_content) || !is_array($template_content)) {
            return false;
        }
        if (empty($template_content['data'])) {
            return false;
        }
        return $template_content['data'];
    }
    public static function send_feedback($feedback_key, $feedback_text)
    {
        $response = wp_remote_post(self::$api_feedback_url, ['timeout' => 30, 'body' => ['api_version' => ELEMENTOR_VERSION, 'site_lang' => get_bloginfo('language'), 'feedback_key' => $feedback_key, 'feedback' => $feedback_text]]);
        return true;
    }
    public function ajax_reset_api_data()
    {
        check_ajax_referer('elementor_reset_library', '_nonce');
        self::_get_info_data(true);
        wp_send_json_success();
    }
    public static function init()
    {
        add_action('wp_ajax_elementor_reset_library', [__CLASS__, 'ajax_reset_api_data']);
    }
}
Api::init();
Beispiel #3
0
<?php

//Pass trought index
define("_EXE", 1);
//Configuration
include 'config.php';
//Constants
include 'constants.php';
//Composer autoload
require 'vendor/autoload.php';
// Api definition
Api::init("http://tribo.local/", "dfg34g45gdfgdfg");
//Language init
$language = new Language();
//Registry init
$registry = new Registry();
//Router init
$router = new Router();
//Delegate
$router->delegate();
$config = Registry::getConfig();