| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Auto Listings |
| 4 |
* Description: The best car listings and car dealership plugin for WordPress |
| 5 |
* Author: WP Auto Listings |
| 6 |
* Author URI: https://wpautolistings.com |
| 7 |
* Plugin URI: https://wpautolistings.com |
| 8 |
* Version: 2.6.8 |
| 9 |
* Text Domain: auto-listings |
| 10 |
* Domain Path: languages |
| 11 |
* Requires Plugins: meta-box |
| 12 |
*/ |
| 13 |
|
| 14 |
// Exit if accessed directly. |
| 15 |
defined( 'ABSPATH' ) || die; |
| 16 |
|
| 17 |
require __DIR__ . '/vendor/autoload.php'; |
| 18 |
|
| 19 |
new AutoListings\Installer( __FILE__ ); |
| 20 |
|
| 21 |
register_activation_hook( __FILE__, 'auto_listings_check_php_version' ); |
| 22 |
|
| 23 |
/** |
| 24 |
* Display notice for old PHP version. |
| 25 |
*/ |
| 26 |
function auto_listings_check_php_version() { |
| 27 |
if ( version_compare( phpversion(), '7.2', '<' ) ) { |
| 28 |
die( esc_html__( 'Auto listings plugin requires PHP version 7.2+. Please contact your host and ask them to upgrade.', 'auto-listings' ) ); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
add_action( 'plugins_loaded', 'auto_listings_load' ); |
| 33 |
|
| 34 |
function auto_listings_load() { |
| 35 |
// If Meta Box is NOT active. |
| 36 |
if ( ! defined( 'RWMB_VER' ) ) { |
| 37 |
add_action( 'admin_notices', 'auto_listings_admin_notice' ); |
| 38 |
return; |
| 39 |
} |
| 40 |
|
| 41 |
$plugins = [ |
| 42 |
'mb-frontend-submission', |
| 43 |
'mb-settings-page', |
| 44 |
'meta-box-columns', |
| 45 |
'meta-box-geolocation', |
| 46 |
'meta-box-group', |
| 47 |
]; |
| 48 |
foreach ( $plugins as $plugin ) { |
| 49 |
require __DIR__ . "/vendor/meta-box/$plugin/$plugin.php"; |
| 50 |
} |
| 51 |
|
| 52 |
require __DIR__ . '/bootstrap.php'; |
| 53 |
} |
| 54 |
|
| 55 |
function auto_listings_admin_notice() { |
| 56 |
$plugins = get_plugins(); |
| 57 |
$is_installed = isset( $plugins['meta-box/meta-box.php'] ); |
| 58 |
$install_url = wp_nonce_url( admin_url( 'update.php?action=install-plugin&plugin=meta-box' ), 'install-plugin_meta-box' ); |
| 59 |
$activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=meta-box/meta-box.php' ), 'activate-plugin_meta-box/meta-box.php' ); |
| 60 |
$action_url = $is_installed ? $activate_url : $install_url; |
| 61 |
$action = $is_installed ? __( 'activate', 'auto-listings' ) : __( 'install', 'auto-listings' ); |
| 62 |
|
| 63 |
$child = __( 'Auto Listings', 'auto-listings' ); |
| 64 |
$parent = __( 'Meta Box', 'auto-listings' ); |
| 65 |
printf( |
| 66 |
// Translators: %1$s is the plugin name, %2$s is the Meta Box plugin name. |
| 67 |
'<div class="error"><p>' . esc_html__( '%1$s requires %2$s to function correctly. %3$s to %4$s %2$s.', 'auto-listings' ) . '</p></div>', |
| 68 |
'<strong>' . esc_html( $child ) . '</strong>', |
| 69 |
'<strong>' . esc_html( $parent ) . '</strong>', |
| 70 |
'<a href="' . esc_url( $action_url ) . '">' . esc_html__( 'Click here', 'auto-listings' ) . '</a>', |
| 71 |
esc_html( $action ) |
| 72 |
); |
| 73 |
|
| 74 |
if ( isset( $_GET['activate'] ) ) { |
| 75 |
unset( $_GET['activate'] ); |
| 76 |
} |
| 77 |
} |
| 78 |
|