"", "cdn_domain_name" => "", "excluded" => FIVECENTSCDN_DEFAULT_EXCLUDED, "directories" => FIVECENTSCDN_DEFAULT_DIRECTORIES, "site_url" => get_option('home'), "web_site_url"=> $wp_filtered_site_url, "serviceid" => "", "api_key" => "", "wp_disble_cdn" => 0, "disable_admin" => 0, "asset_acceleration"=>0, "https" => false, ]); } public static function getOption($option) { $options = FivecentsCDN::getOptions(); return $options[$option]; } public static function validateSettings($data) { $cdn_domain_name = FivecentsCDN::cleanHostname($data['cdn_domain_name']); $pull_zone = $data['pull_zone']; $siteUrl = get_option('home'); while (substr($siteUrl, -1) == '/') { $siteUrl = substr($siteUrl, 0, -1); } if ($cdn_domain_name) { $cdn_domain_name = $cdn_domain_name.parse_url($siteUrl, PHP_URL_PATH); } return [ "pull_zone" => $pull_zone, "cdn_domain_name" => $cdn_domain_name, "excluded" => esc_attr($data['excluded']), "directories" => esc_attr($data['directories']), "site_url" => $siteUrl, "web_site_url" => esc_attr($data['web_site_url']), "serviceid" => (int)($data['serviceid']), "api_key" => $data['api_key'], "wp_disble_cdn" => (int)($data['wp_disble_cdn']), "disable_admin" => (int)($data['disable_admin']), "asset_acceleration" => (int)($data['asset_acceleration']), "https" => (bool)($data['https']), ]; } public static function cleanHostname($hostname) { $hostname = str_replace("http://", "", $hostname); $hostname = str_replace("https://", "", $hostname); return str_replace("/", "", $hostname); } public static function startsWith($haystack, $needle) { $length = strlen($needle); return (substr($haystack, 0, $length) === $needle); } public static function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } } class FivecentsCDNSettings { public static function initialize() { $myicon = plugins_url('/menu-icon.png', __FILE__ ); add_menu_page( "5centsCDN", "5centsCDN", "manage_options", "5centscdn", array( 'FivecentsCDNSettings', 'outputSettingsPage' ), $myicon ); add_filter( 'plugin_action_links_' .FIVECENTSCDN_PLUGIN_BASE, array( __CLASS__, 'add_action_link' ) ); wp_enqueue_script('5centscdn-backend', plugins_url('assets/js/5centscdn-backend.js?v=2.0', dirname(__FILE__)), array('jquery'), '1.1.3', true); wp_register_script('5centscdn_lottieanimation', 'https://unpkg.com/@lottiefiles/lottie-player@0.4.0/dist/lottie-player.js'); wp_enqueue_script('5centscdn_lottieanimation'); wp_register_script('5centscdn_sweetalert', 'https://cdn.jsdelivr.net/npm/sweetalert2@11'); wp_enqueue_script('5centscdn_sweetalert'); register_setting('5centscdn', '5centscdn', array("FivecentsCDN", "validateSettings")); } public static function add_action_link($data) { // check permission if ( ! current_user_can('manage_options') ) { return $data; } return array_merge( $data, array( sprintf( '%s', add_query_arg(['page' => '5centscdn'], admin_url('admin.php')), __("Settings") ) ) ); } public static function outputSettingsPage() { $fivecent_logo=plugins_url( 'assets/fivecent_logo.png', dirname(__FILE__) ); $info_img=plugins_url( 'assets/info.svg', dirname(__FILE__) ); $clean_img=plugins_url( 'assets/clean.svg', dirname(__FILE__) ); $zone = ''; $http2 = ''; $http = ''; $redirect = ''; $warning = ''; $ssl_warning = ''; $cnames = ''; $zone_name = ''; $zoneArr = []; $error = ''; $cdn_domain_name = ''; $options = FivecentsCDN::getOptions(); $api = new FivecentsCDNApi(); $trimed_apikey=trim($options['api_key'] ?? ''); $serviceid = $options['serviceid']; $dashboard_url = (trim($options["pull_zone"])) ? FIVECENTSCDN_DOMAIN.'/'.$options['serviceid'] : FIVECENTSCDN_DOMAIN; if ($options['cdn_domain_name']) { $cdn_domain_name = explode('/', $options['cdn_domain_name']); } if ($options['pull_zone']) { $zone_id = $options['pull_zone']; try { $zone = $api->getPullZones($zone_id, $options["api_key"]); if ($zone['result'] == 'error') { $error = $zone['message']; } else { $zone_name = $zone['zone']['name'] ?? ''; $http2 = $zone['zone']['ssl']['http2'] ?? ''; $http = $zone['zone']['ssl']['enabled'] ?? ''; $redirect = $zone['zone']['ssl']['redirect']?? ''; $warning=$zone['warnings'] ?? ''; $ssl_warning = $zone['zone']['ssl']['warning'] ?? 0; if (isset($zone['zone']['cnames']) && isset($zone['zone']['fqdn'])) { $cnames = $zone['zone']['cnames'].",".$zone['zone']['fqdn']; } $zoneArr = $api->listPullZones($options["api_key"]); if ($zoneArr['result'] == 'error') { $error = $zone['message']; } } } catch (\Exception $e) { $error = 'Failed to fetch data, Please refresh the page.'; } } ?>

Follow these simple steps to Connect Your CDN Account

  • Login to your 5centsCDN account. Scroll to account in the sidebar and select API
  • Click on manage and copy the API key.
  • Paste the copied key in the required field to connect your CDN Network.

Connect Your CDN


Your WP site is accessible using the following URL . Create a pull zone under 5centsCDN control panel and point the origin URL to WP !

5centsCDN API key is required to pull the zone details and Enable features such as cache purging. Access your API key on the 5centsCDN Control Panel

CDN
style="display:none" />
">

WP Site URL Your WP site is accessible using the following URL . Create a pull zone under 5centsCDN control panel and point the origin URL to WP !
API Key 5centsCDN API key is required to pull the zone details and will enable features such as cache purging. You can access your API key on the 5centsCDN control panel!

>
>
HTTPS    ;" class="https_status_locker fa fa-lock lock_icon">
/>
HTTP2
/>
HTTPS Redirect
/>

Purging clears the zone or file cache on the edge servers and gets rebuilt from the origin on the next request.

/>