| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: FakerPress |
| 4 |
* Plugin URI: https://github.com/iryz/fakerpress |
| 5 |
* Description: FakerPress is a clean way to generate fake data to your WordPress instalation, great for developers who need testing |
| 6 |
* Version: 0.1.2 |
| 7 |
* Author: Iryz |
| 8 |
* Author URI: http://iryz.org |
| 9 |
* Text Domain: fakerpress |
| 10 |
* License: GPL-2.0+ |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 12 |
* Domain Path: /l10n |
| 13 |
* GitHub Plugin URI: https://github.com/iryz/fakerpress |
| 14 |
*/ |
| 15 |
|
| 16 |
// If this file is called directly, abort. |
| 17 |
if ( ! defined( 'WPINC' ) ){ |
| 18 |
die; |
| 19 |
} |
| 20 |
|
| 21 |
// Need to store this variable before leaving this file |
| 22 |
define( '__FP_FILE__', __FILE__ ); |
| 23 |
|
| 24 |
/** |
| 25 |
* To allow internacionalization for the errors strings the text domain is |
| 26 |
* loaded in a 5.2 way, no Fatal Errors, only a message to the user. |
| 27 |
* @return null; |
| 28 |
*/ |
| 29 |
|
| 30 |
function _fp_l10n() { |
| 31 |
load_plugin_textdomain( 'fakerpress', false, 'fakerpress' . DIRECTORY_SEPARATOR . 'l10n' ); |
| 32 |
} |
| 33 |
add_action( 'plugins_loaded', '_fp_l10n' ); |
| 34 |
|
| 35 |
/** |
| 36 |
* Version compare to PHP 5.3, so we can use Namespaces, anonymous functions |
| 37 |
* and a lot of packages require 5.3, so... |
| 38 |
* |
| 39 |
* For now 3.8 or bigger is needed for the admin interface, later on the |
| 40 |
* intention is to bring this number lower |
| 41 |
*/ |
| 42 |
|
| 43 |
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { |
| 44 |
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { |
| 45 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 46 |
|
| 47 |
if ( ! is_plugin_active( plugin_basename( __FP_FILE__ ) ) ){ |
| 48 |
wp_print_styles( 'open-sans' ); |
| 49 |
echo "<style>body{margin: 0 2px;font-family: 'Open Sans',sans-serif;font-size: 13px;line-height: 1.5em;}</style>"; |
| 50 |
echo wp_kses_post( __( '<b>FakerPress</b> requires PHP 5.3 or higher, and the plugin has now disabled itself.', 'fakerpress' ) ) . |
| 51 |
'<br />' . |
| 52 |
esc_attr__( 'To allow better control over dates, advanced security improvements and performance gain.', 'fakerpress' ) . |
| 53 |
'<br />' . |
| 54 |
esc_attr__( 'Contact your Hosting or your system administrator and ask for this Upgrade to version 5.3 of PHP.', 'vsh' ); |
| 55 |
exit(); |
| 56 |
} |
| 57 |
|
| 58 |
deactivate_plugins( __FP_FILE__ ); |
| 59 |
} |
| 60 |
} else { |
| 61 |
require_once plugin_dir_path( __FP_FILE__ ) . 'inc' . DIRECTORY_SEPARATOR . 'load.php'; |
| 62 |
} |