Ejemplo n.º 1
0
 /**
  * Check to see if Wordpress is laoded, throw an exception if it isn't
  * @throws Exception
  */
 private static function _checkWP()
 {
     if (self::$_isWPLoaded) {
         return;
     }
     if (!function_exists('get_option')) {
         throw new Exception('Wordpress must be fully loaded before using ' . __CLASS__);
     }
     self::$_isWPLoaded = TRUE;
 }
Ejemplo n.º 2
0
 /**
  * Force a refresh of the zone cache
  * @return array 
  */
 public static function refreshZoneCache()
 {
     $api_key = self::getOption(Bizyhood_Core::KEY_API_KEY);
     $network_id = self::getOption(Bizyhood_Core::KEY_NETWORK_ID);
     $api = new Bizyhood($api_key);
     try {
         $zones = $api->getNetworkZones($network_id);
         if (is_array($zones)) {
             Bizyhood_Cache::set(self::KEY_ZONE_CACHE, $zones, Bizyhood_Config::get('zone_cache_ttl_seconds'));
         } else {
             $zones = Bizyhood_Cache::get(self::KEY_ZONE_CACHE, FALSE, TRUE);
         }
     } catch (Exception $ex) {
         $zones = Bizyhood_Cache::get(self::KEY_ZONE_CACHE, FALSE, TRUE);
         if (!is_array($zones)) {
             $zones = array();
         }
     }
     $kzones = array();
     foreach ($zones as $zone) {
         $kzones[$zone->id] = $zone;
     }
     return $kzones;
 }