Esempio n. 1
0
 public static function init($config = [])
 {
     static::$config = array_merge(static::$config, $config);
     // Added possibility to use outside of Wordpress
     if (defined('ABSPATH')) {
         // Install CSS + JS
         wp_enqueue_script('aeria.social', AERIA_URL . 'resources/js/aeria.social.js', ['jquery']);
         wp_enqueue_style('aeria.social', AERIA_URL . 'resources/css/aeria.social.css');
         if (isset(static::$config['apiurl'])) {
             wp_localize_script('aeria.social', 'AERIA_SOCIAL', ['URL' => static::$config['apiurl']]);
         }
         // Install AJAX handler
         AeriaAJAX::register('aeriasocial.get', function () {
             if (!isset($_REQUEST['uri'])) {
                 echo json_encode(['error' => 'Please provide a URI']);
                 exit(1);
             }
             echo json_encode(AeriaSocial::getCount($_REQUEST['uri']));
             exit;
         });
     }
 }
Esempio n. 2
0
<?php

define('AERIA', 'vTest');
define('AERIA_URL', '');
define('WPINC', __DIR__);
require_once __DIR__ . '/wp-includes-functions.php';
require_once __DIR__ . '/../classes/AeriaNetwork.php';
require_once __DIR__ . '/../classes/AeriaCache.php';
require_once __DIR__ . '/../classes/AeriaSocial.php';
AeriaCache::setDriver('Redis');
AeriaSocial::init();
print_r(AeriaSocial::getCount(['http://google.it', 'http://google.com', 'http://facebook.com']));