本文整理汇总了PHP中Api::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::init方法的具体用法?PHP Api::init怎么用?PHP Api::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doInit
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:' . Config::$user . '/Run');
Globals::$wl = Api::$q->getpage('Wikipedia:Huggle/Whitelist');
Globals::$optin = Api::$q->getpage('User:' . Config::$user . '/Optin');
Globals::$aoptin = Api::$q->getpage('User:' . Config::$user . '/AngryOptin');
Globals::$stalk = array();
Globals::$edit = array();
$tmp = explode("\n", Api::$q->getpage('User:' . Config::$owner . '/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:' . Config::$owner . '/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";
}
}
}
}
示例2: wp_remote_get
$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();
示例3: define
<?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();