|
1 | | -<?php |
2 | | -/** |
3 | | - * Plugin Name: DropHTML |
4 | | - * Description: Simply drop static HTML zip files and see the magic! |
5 | | - * Version: 1.0.0 |
6 | | - * Requires at least: 5.2 |
7 | | - * License: GPL v2 or later |
8 | | - * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
9 | | - * Text Domain: drop |
10 | | - **/ |
11 | | - |
12 | | -if ( ! defined( 'ABSPATH' ) ) { |
13 | | - exit; |
14 | | -} // Exit if accessed directly |
15 | | - |
16 | | -define( 'DROPHTML__FILE__', __FILE__ ); |
17 | | - |
18 | | -/** |
19 | | - * DropHtml check PHP version. |
20 | | - * |
21 | | - * Check when the site doesn't have the minimum required PHP version. |
22 | | - * |
23 | | - * @since 1.3.1 |
24 | | - * |
25 | | - * @return void |
26 | | - */ |
27 | | -function drop_html_is_php_version_compatible() { |
28 | | - if ( ! version_compare( PHP_VERSION, '5.4', '>=' ) ) { |
29 | | - return false; |
30 | | - } |
31 | | - return true; |
32 | | -} |
33 | | - |
34 | | -if ( ! drop_html_is_php_version_compatible() ) { |
35 | | - add_action( 'admin_notices', 'drop_html_fail_php_version' ); |
36 | | -} else { |
37 | | - require plugin_dir_path( DROPHTML__FILE__ ) . 'includes/plugin.php'; |
38 | | -} |
39 | | - |
40 | | -/** |
41 | | - * Show in WP Dashboard notice about the plugin is not activated. |
42 | | - * |
43 | | - * @since 1.0.0 |
44 | | - * |
45 | | - * @return void |
46 | | - */ |
47 | | -function drop_html_fail_php_version() { |
48 | | - $message = esc_html__( 'DropHtml requires PHP version 5.4+, plugin is currently NOT ACTIVE.', 'drop_html' ); |
49 | | - $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); |
50 | | - echo wp_kses_post( $html_message ); |
51 | | -} |
52 | | - |
53 | | -/** |
54 | | - * Helper function for writing to log file. |
55 | | - * |
56 | | - * @since 1.0.0 |
57 | | - * |
58 | | - * @param log data to log |
59 | | - * @param type log or export |
60 | | - */ |
61 | | -function drop_html_write_log( $log, $type = '1' ) { |
62 | | - if ( true === WP_DEBUG ) { |
63 | | - if ( is_array( $log ) || is_object( $log ) ) { |
64 | | - if ( $type === '1' ) { |
65 | | - error_log( print_r( $log, true ) ); |
66 | | - } else { |
67 | | - error_log( var_export( $log, true ) ); |
68 | | - } |
69 | | - } else { |
70 | | - error_log( $log ); |
71 | | - } |
72 | | - } |
73 | | -} |
74 | | - |
75 | | -/** |
76 | | - * The main function responsible for returning the one true DropHtml Instance |
77 | | - * to functions everywhere. |
78 | | - * |
79 | | - * Use this function like you would a global variable, except without needing |
80 | | - * to declare the global. |
81 | | - * |
82 | | - * Example: <?php $drop_html = drop_html(); ?> |
83 | | - * |
84 | | - * @since 1.0.0 |
85 | | - * |
86 | | - * @return The one true DropHtml Instance |
87 | | - */ |
88 | | -function drop_html() { |
89 | | - if ( ! drop_html_is_php_version_compatible() ) { |
90 | | - return; |
91 | | - } |
92 | | - // In tests we run the instance manually. |
93 | | - return DropHtml\Plugin::instance(); |
94 | | -} |
95 | | - |
96 | | -if ( ! defined( 'QAZANA_TESTS' ) ) { |
97 | | - drop_html(); |
98 | | -} |
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Plugin Name: DropHTML |
| 4 | + * Description: Simply drop static HTML zip files and see the magic! |
| 5 | + * Version: 1.0.0 |
| 6 | + * Requires at least: 4.8 |
| 7 | + * License: GPL v2 or later |
| 8 | + * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 9 | + * Text Domain: drop |
| 10 | + * Author URI: https://expresstech.io/ |
| 11 | + * Plugin URI: https://expresstech.io/ |
| 12 | + **/ |
| 13 | + |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { |
| 15 | + exit; |
| 16 | +} // Exit if accessed directly |
| 17 | + |
| 18 | +define( 'DROPHTML__FILE__', __FILE__ ); |
| 19 | + |
| 20 | +/** |
| 21 | + * DropHtml check PHP version. |
| 22 | + * |
| 23 | + * Check when the site doesn't have the minimum required PHP version. |
| 24 | + * |
| 25 | + * @since 1.3.1 |
| 26 | + * |
| 27 | + * @return void |
| 28 | + */ |
| 29 | +function drop_html_is_php_version_compatible() { |
| 30 | + if ( ! version_compare( PHP_VERSION, '5.4', '>=' ) ) { |
| 31 | + return false; |
| 32 | + } |
| 33 | + return true; |
| 34 | +} |
| 35 | + |
| 36 | +if ( ! drop_html_is_php_version_compatible() ) { |
| 37 | + add_action( 'admin_notices', 'drop_html_fail_php_version' ); |
| 38 | +} else { |
| 39 | + require plugin_dir_path( DROPHTML__FILE__ ) . 'includes/plugin.php'; |
| 40 | +} |
| 41 | + |
| 42 | +/** |
| 43 | + * Show in WP Dashboard notice about the plugin is not activated. |
| 44 | + * |
| 45 | + * @since 1.0.0 |
| 46 | + * |
| 47 | + * @return void |
| 48 | + */ |
| 49 | +function drop_html_fail_php_version() { |
| 50 | + $message = esc_html__( 'DropHtml requires PHP version 5.4+, plugin is currently NOT ACTIVE.', 'drophtml' ); |
| 51 | + $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); |
| 52 | + echo wp_kses_post( $html_message ); |
| 53 | +} |
| 54 | + |
| 55 | +/** |
| 56 | + * Helper function for writing to log file. |
| 57 | + * |
| 58 | + * @since 1.0.0 |
| 59 | + * |
| 60 | + * @param log data to log |
| 61 | + * @param type log or export |
| 62 | + */ |
| 63 | +function drop_html_write_log( $log, $type = '1' ) { |
| 64 | + if ( true === WP_DEBUG ) { |
| 65 | + if ( is_array( $log ) || is_object( $log ) ) { |
| 66 | + if ( $type === '1' ) { |
| 67 | + error_log( print_r( $log, true ) ); |
| 68 | + } else { |
| 69 | + error_log( var_export( $log, true ) ); |
| 70 | + } |
| 71 | + } else { |
| 72 | + error_log( $log ); |
| 73 | + } |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +/** |
| 78 | + * The main function responsible for returning the one true DropHtml Instance |
| 79 | + * to functions everywhere. |
| 80 | + * |
| 81 | + * Use this function like you would a global variable, except without needing |
| 82 | + * to declare the global. |
| 83 | + * |
| 84 | + * Example: <?php $drop_html = drop_html(); ?> |
| 85 | + * |
| 86 | + * @since 1.0.0 |
| 87 | + * |
| 88 | + * @return The one true DropHtml Instance |
| 89 | + */ |
| 90 | +function drop_html() { |
| 91 | + if ( ! drop_html_is_php_version_compatible() ) { |
| 92 | + return; |
| 93 | + } |
| 94 | + // In tests we run the instance manually. |
| 95 | + return DropHtml\Plugin::instance(); |
| 96 | +} |
| 97 | + |
| 98 | +if ( ! defined('DROPHTML_TESTS' ) ) { |
| 99 | + drop_html(); |
| 100 | +} |
0 commit comments