Example #1
0
 /**
  * Main WP_Rocket_CloudFlareAPI Instance
  *
  * Ensures only one instance of class is loaded or can be loaded.
  *
  * @static
  * @return Main instance
  */
 public static function instance($email, $api_key)
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self($email, $api_key);
     }
     return self::$_instance;
 }
Example #2
0
/**
 * Get a WP_Rocket_CloudFlareAPI instance
 *
 * @since 2.5
 *
 * @return obj WP_Rocket_CloudFlareAPI instance
 */
function get_rocket_cloudflare_instance()
{
    $cf_email = get_rocket_option('cloudflare_email', null);
    $cf_api_key = get_rocket_option('cloudflare_api_key', null);
    if (isset($cf_email, $cf_api_key)) {
        return WP_Rocket_CloudFlareAPI::instance($cf_email, $cf_api_key);
    }
    return false;
}