diff --git a/_tools/build.sh b/_tools/build.sh index e4b908b..aa89c41 100755 --- a/_tools/build.sh +++ b/_tools/build.sh @@ -12,7 +12,7 @@ cp -t dist/img img/fn-wysiwyg.png img/main-menu.png echo "Copying files..." cp -t dist features.txt license.txt readme.txt includes.php wpml-config.xml customized-documentation-schema.txt customized-template-stack.txt CONTRIBUTING.md README.md SECURITY.md echo "Setting production flag..." -sed "s/'C_BOOL_CSS_PRODUCTION_MODE', false/'C_BOOL_CSS_PRODUCTION_MODE', true/g" footnotes.php > dist/footnotes.php +sed "s/'PRODUCTION_ENV', false/'PRODUCTION_ENV', true/g" footnotes.php > dist/footnotes.php echo "Production flag set." # TODO: once automatic minification is implemented, this should handle that. diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index 840410a..16d492e 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -211,33 +211,16 @@ abstract class MCI_Footnotes_Layout_Engine { * automated update of version number for cache busting. * No need to use '-styles' in the handle, as '-css' is appended automatically. */ - if ( C_BOOL_CSS_PRODUCTION_MODE ) { - - wp_register_style( - 'mci-footnotes-admin', - plugins_url( 'footnotes/css/settings.min.css' ), - array(), - filemtime( - plugin_dir_path( - dirname( __FILE__ ) - ) . 'css/settings.min.css' - ) - ); - - } else { - - wp_register_style( - 'mci-footnotes-admin', - plugins_url( 'footnotes/css/settings.css' ), - array(), - filemtime( - plugin_dir_path( - dirname( __FILE__, 2 ) - ) . 'css/settings.css' - ) - ); - - } + wp_register_style( + 'mci-footnotes-admin', + plugins_url( 'footnotes/css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css' ), + array(), + ( PRODUCTION_ENV ) ? C_STR_PACKAGE_VERSION : filemtime( + plugin_dir_path( + dirname( __FILE__, 2 ) + ) . 'css/settings' . ( ( PRODUCTION_ENV ) ? '.min' : '' ) . '.css' + ) + ); wp_enqueue_style( 'mci-footnotes-admin' ); } diff --git a/class/init.php b/class/init.php index af20d85..ce57b02 100644 --- a/class/init.php +++ b/class/init.php @@ -339,7 +339,7 @@ class MCI_Footnotes { * The Boolean may be set at the bottom of the plugin’s main PHP file. * @see footnotes.php */ - if ( C_BOOL_CSS_PRODUCTION_MODE ) { + if ( PRODUCTION_ENV ) { /** * Enqueues a minified united external stylesheet in production. @@ -416,11 +416,7 @@ class MCI_Footnotes { MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'brpl' . $l_str_layout_mode . '.min.css' ), array(), - filemtime( - plugin_dir_path( - dirname( __FILE__ ) - ) . 'css/footnotes-' . $l_str_tooltip_mode_short . 'ttbrpl' . $l_str_layout_mode . '.min.css' - ), + C_STR_PACKAGE_VERSION, 'all' ); @@ -440,7 +436,7 @@ class MCI_Footnotes { array(), filemtime( plugin_dir_path( - dirname( __FILE__ ) + dirname( __FILE__, 1 ) ) . 'css/dev-common.css' ) ); @@ -450,7 +446,7 @@ class MCI_Footnotes { array(), filemtime( plugin_dir_path( - dirname( __FILE__ ) + dirname( __FILE__, 1 ) ) . 'css/dev-tooltips.css' ) ); @@ -462,7 +458,7 @@ class MCI_Footnotes { array(), filemtime( plugin_dir_path( - dirname( __FILE__ ) + dirname( __FILE__, 1 ) ) . 'css/dev-amp-tooltips.css' ) ); @@ -475,7 +471,7 @@ class MCI_Footnotes { array(), filemtime( plugin_dir_path( - dirname( __FILE__ ) + dirname( __FILE__, 1 ) ) . 'css/dev-tooltips-alternative.css' ) ); @@ -491,7 +487,7 @@ class MCI_Footnotes { array(), filemtime( plugin_dir_path( - dirname( __FILE__ ) + dirname( __FILE__, 1 ) ) . 'css/dev-layout-' . $l_str_page_layout_option . '.css' ), 'all' diff --git a/class/layout/abstract-engine.php b/class/layout/abstract-engine.php index 143ad96..b1826e6 100644 --- a/class/layout/abstract-engine.php +++ b/class/layout/abstract-engine.php @@ -211,7 +211,7 @@ abstract class MCI_Footnotes_Layout_Engine { * automated update of version number for cache busting. * No need to use '-styles' in the handle, as '-css' is appended automatically. */ - if ( true === C_BOOL_CSS_PRODUCTION_MODE ) { + if ( true === PRODUCTION_ENV ) { wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_PACKAGE_VERSION ); diff --git a/footnotes.php b/footnotes.php index 5917208..b6ab661 100755 --- a/footnotes.php +++ b/footnotes.php @@ -103,4 +103,4 @@ $g_obj_mci_footnotes->run(); * Developing stylesheets is meant to be easier when this is set to false. * WARNING: This facility designed for development must NOT be used in production. */ -define( 'C_BOOL_CSS_PRODUCTION_MODE', false ); +define( 'PRODUCTION_ENV', false );