| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: AF Companion |
| 4 |
Plugin URI: https://wordpress.org/plugins/af-companion/ |
| 5 |
Description: The all-in-one performance and growth suite for WordPress. Instantly deploy expert-designed starter sites, optimize site speed with the Speed Booster engine, and scale your audience with integrated growth and diagnostic tools. |
| 6 |
Version: 2.1.2 |
| 7 |
Author: AF themes |
| 8 |
Author URI: https://www.afthemes.com |
| 9 |
License: GPL3 |
| 10 |
License URI: https://www.gnu.org/licenses/gpl.html |
| 11 |
Text Domain: af-companion |
| 12 |
*/ |
| 13 |
|
| 14 |
// Block direct access to the main plugin file. |
| 15 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 16 |
|
| 17 |
/** |
| 18 |
* Display admin error message if PHP version is older than 5.3.2. |
| 19 |
* Otherwise execute the main plugin class. |
| 20 |
*/ |
| 21 |
if (version_compare(phpversion(), '5.3.2', '<')) { |
| 22 |
|
| 23 |
/** |
| 24 |
* Display an admin error notice when PHP is older the version 5.3.2. |
| 25 |
* Hook it to the 'admin_notices' action. |
| 26 |
*/ |
| 27 |
function AFTC_old_php_admin_error_notice() |
| 28 |
{ |
| 29 |
$message = sprintf(esc_html__('The %2$sAF Companion%3$s plugin requires %2$sPHP 5.3.2+%3$s to run properly. Please contact your hosting company and ask them to update the PHP version of your site to at least PHP 5.3.2.%4$s Your current version of PHP: %2$s%1$s%3$s', 'af-companion'), phpversion(), '<strong>', '</strong>', '<br>'); |
| 30 |
|
| 31 |
printf('<div class="notice notice-error"><p>%1$s</p></div>', wp_kses_post($message)); |
| 32 |
} |
| 33 |
add_action('admin_notices', 'AFTC_old_php_admin_error_notice'); |
| 34 |
} else { |
| 35 |
|
| 36 |
// Current version of the plugin. |
| 37 |
define('AFTC_VERSION', '1.2.12'); |
| 38 |
|
| 39 |
// Path/URL to root of this plugin, with trailing slash. |
| 40 |
define('AFTC_PATH', plugin_dir_path(__FILE__)); |
| 41 |
define('AFTC_URL', plugin_dir_url(__FILE__)); |
| 42 |
|
| 43 |
// Require main plugin file. |
| 44 |
require AFTC_PATH . 'inc/class-aftc-main.php'; |
| 45 |
|
| 46 |
/** |
| 47 |
* Freemius. |
| 48 |
*/ |
| 49 |
require_once(AFTC_PATH . '/freemius.php'); |
| 50 |
// Instantiate the main plugin class *Singleton*. |
| 51 |
$AF_Companion = AF_Companion::getInstance(); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Add Quick-Access Solution Links to the Plugin Dashboard |
| 56 |
*/ |
| 57 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'af_companion_action_links' ); |
| 58 |
|
| 59 |
function af_companion_action_links( $links ) { |
| 60 |
// 1. Link to the Build/Import section |
| 61 |
$build_link = '<a href="' . admin_url( 'admin.php?page=af-companion' ) . '">' . esc_html__( 'Demo Import', 'af-companion' ) . '</a>'; |
| 62 |
|
| 63 |
// 2. Link to the Speed Booster tab (assumes you handle these via tab parameters) |
| 64 |
$speed_link = '<a href="' . admin_url( 'admin.php?page=af-speed' ) . '">' . esc_html__( 'Speed Booster', 'af-companion' ) . '</a>'; |
| 65 |
|
| 66 |
// 3. Link to Growth Tools |
| 67 |
$growth_link = '<a href="' . admin_url( 'admin.php?page=af-growth' ) . '">' . esc_html__( 'Growth Tools', 'af-companion' ) . '</a>'; |
| 68 |
|
| 69 |
// 4. Link to System Status (the class we built earlier) |
| 70 |
$status_link = '<a href="' . admin_url( 'admin.php?page=af-status' ) . '" style="font-weight: bold; color: #6366f1;">' . esc_html__( 'System Status', 'af-status' ) . '</a>'; |
| 71 |
|
| 72 |
// Add them to the start of the links array |
| 73 |
$new_links = array( |
| 74 |
'build' => $build_link, |
| 75 |
'speed' => $speed_link, |
| 76 |
'growth' => $growth_link, |
| 77 |
'status' => $status_link, |
| 78 |
); |
| 79 |
|
| 80 |
return array_merge( $new_links, $links ); |
| 81 |
} |