Ejemplo n.º 1
0
 public function __construct()
 {
     if (isset($_GET['id']) || isset($_POST['id'])) {
         GMSiteOption::$blog_id = (int) $_REQUEST['id'];
     }
     add_action('init', array('GMSiteInfo', 'registerScripts'));
     add_action('wp_ajax_googlesites_get_site_address', array('GMSiteInfo', 'getAsyncAddress'));
     if (isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action']) {
         $this->updateAddress();
     }
 }
Ejemplo n.º 2
0
 public function getAsyncSitesAddress()
 {
     $allSites = wp_get_sites();
     $allAddress = [];
     foreach ($allSites as $site) {
         GMSiteOption::$blog_id = $site['blog_id'];
         $address = GMSiteOption::getAddress();
         if (!empty($address)) {
             $allAddress[] = $address;
         }
     }
     echo json_encode($allAddress);
     exit;
 }
Ejemplo n.º 3
0
 public static function getBlogID()
 {
     return self::$blog_id = !is_null(self::$blog_id) ? self::$blog_id : get_current_blog_id();
 }