| 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.7.4 |
| 9 |
* Text Domain: auto-listings |
| 10 |
* License: GPLv3 |
| 11 |
* |
| 12 |
* Copyright (C) 2010-2025 Tran Ngoc Tuan Anh. All rights reserved. |
| 13 |
* |
| 14 |
* This program is free software: you can redistribute it and/or modify |
| 15 |
* it under the terms of the GNU General Public License as published by |
| 16 |
* the Free Software Foundation, either version 2 of the License, or |
| 17 |
* (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 26 |
*/ |
| 27 |
|
| 28 |
// Exit if accessed directly. |
| 29 |
defined( 'ABSPATH' ) || die; |
| 30 |
|
| 31 |
require __DIR__ . '/vendor/autoload.php'; |
| 32 |
|
| 33 |
new AutoListings\Installer( __FILE__ ); |
| 34 |
|
| 35 |
add_action( 'plugins_loaded', 'auto_listings_load' ); |
| 36 |
|
| 37 |
function auto_listings_load() { |
| 38 |
// If Meta Box is NOT active. |
| 39 |
if ( ! defined( 'RWMB_VER' ) ) { |
| 40 |
add_action( 'admin_notices', 'auto_listings_admin_notice' ); |
| 41 |
return; |
| 42 |
} |
| 43 |
|
| 44 |
$plugins = [ |
| 45 |
'mb-frontend-submission', |
| 46 |
'mb-settings-page', |
| 47 |
'meta-box-columns', |
| 48 |
'meta-box-geolocation', |
| 49 |
'meta-box-group', |
| 50 |
]; |
| 51 |
foreach ( $plugins as $plugin ) { |
| 52 |
require __DIR__ . "/vendor/meta-box/$plugin/$plugin.php"; |
| 53 |
} |
| 54 |
|
| 55 |
require __DIR__ . '/bootstrap.php'; |
| 56 |
} |
| 57 |
|
| 58 |
function auto_listings_admin_notice() { |
| 59 |
$plugins = get_plugins(); |
| 60 |
$is_installed = isset( $plugins['meta-box/meta-box.php'] ); |
| 61 |
$install_url = wp_nonce_url( admin_url( 'update.php?action=install-plugin&plugin=meta-box' ), 'install-plugin_meta-box' ); |
| 62 |
$activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=meta-box/meta-box.php' ), 'activate-plugin_meta-box/meta-box.php' ); |
| 63 |
$action_url = $is_installed ? $activate_url : $install_url; |
| 64 |
$action = $is_installed ? __( 'activate', 'auto-listings' ) : __( 'install', 'auto-listings' ); |
| 65 |
|
| 66 |
$child = __( 'Auto Listings', 'auto-listings' ); |
| 67 |
$parent = __( 'Meta Box', 'auto-listings' ); |
| 68 |
printf( |
| 69 |
// Translators: %1$s is the plugin name, %2$s is the Meta Box plugin name. |
| 70 |
'<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>', |
| 71 |
'<strong>' . esc_html( $child ) . '</strong>', |
| 72 |
'<strong>' . esc_html( $parent ) . '</strong>', |
| 73 |
'<a href="' . esc_url( $action_url ) . '">' . esc_html__( 'Click here', 'auto-listings' ) . '</a>', |
| 74 |
esc_html( $action ) |
| 75 |
); |
| 76 |
|
| 77 |
if ( isset( $_GET['activate'] ) ) { |
| 78 |
unset( $_GET['activate'] ); |
| 79 |
} |
| 80 |
} |
| 81 |
|