-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
98 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,98 @@ | ||
<?php | ||
/* | ||
Plugin Name: Minit | ||
Plugin URI: https://github.com/kasparsd/minit | ||
GitHub URI: https://github.com/kasparsd/minit | ||
Description: Combine JS and CSS files and serve them from the uploads folder. | ||
Version: 1.3-beta | ||
Author: Kaspars Dambis | ||
Author URI: http://kaspars.net | ||
*/ | ||
|
||
add_action( 'plugins_loaded', array( 'Minit_Plugin', 'instance' ) ); | ||
|
||
class Minit_Plugin { | ||
|
||
public $version = 'minit-1.3'; | ||
public $plugin_file; | ||
|
||
|
||
public static function instance() { | ||
|
||
static $instance; | ||
|
||
if ( ! $instance ) | ||
$instance = new self(); | ||
|
||
return $instance; | ||
|
||
} | ||
|
||
|
||
protected function __construct() { | ||
|
||
$this->plugin_file = __FILE__; | ||
|
||
add_action( 'wp', array( $this, 'init' ) ); | ||
add_action( 'init', array( $this, 'admin_init' ) ); | ||
|
||
// This action can used to delete all Minit cache files from cron | ||
add_action( 'minit-cache-purge-delete', array( $this, 'cache_delete' ) ); | ||
|
||
} | ||
|
||
|
||
public function init() { | ||
|
||
if ( is_admin() ) | ||
return; | ||
|
||
include dirname( __FILE__ ) . '/include/minit-assets.php'; | ||
include dirname( __FILE__ ) . '/include/minit-js.php'; | ||
include dirname( __FILE__ ) . '/include/minit-css.php'; | ||
include dirname( __FILE__ ) . '/include/helpers.php'; | ||
|
||
$js = new Minit_Js( $this ); | ||
$css = new Minit_Css( $this ); | ||
|
||
$js->init(); | ||
$css->init(); | ||
|
||
} | ||
|
||
public function admin_init() { | ||
|
||
include dirname( __FILE__ ) . '/include/admin.php'; | ||
|
||
$admin = new Minit_Admin( $this ); | ||
$admin->init(); | ||
|
||
} | ||
|
||
|
||
public static function cache_bump() { | ||
|
||
// Use this as a global cache version number | ||
update_option( 'minit_cache_ver', time() ); | ||
|
||
// Allow other plugins to know that we purged | ||
do_action( 'minit-cache-purged' ); | ||
|
||
} | ||
|
||
|
||
public static function cache_delete() { | ||
|
||
$wp_upload_dir = wp_upload_dir(); | ||
$minit_files = glob( $wp_upload_dir['basedir'] . '/minit/*' ); | ||
|
||
if ( $minit_files ) { | ||
foreach ( $minit_files as $minit_file ) { | ||
unlink( $minit_file ); | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
} | ||
<?php | ||
/* | ||
Plugin Name: Minit | ||
Plugin URI: https://github.com/kasparsd/minit | ||
GitHub URI: https://github.com/kasparsd/minit | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
szepeviktor
Contributor
|
||
Description: Combine JS and CSS files and serve them from the uploads folder. | ||
Version: 1.3-beta.2 | ||
This comment has been minimized.
Sorry, something went wrong.
szepeviktor
Contributor
|
||
Author: Kaspars Dambis | ||
Author URI: http://kaspars.net | ||
*/ | ||
|
||
add_action( 'plugins_loaded', array( 'Minit_Plugin', 'instance' ) ); | ||
|
||
class Minit_Plugin { | ||
|
||
public $revision = '20151214'; | ||
public $plugin_file; | ||
|
||
|
||
public static function instance() { | ||
|
||
static $instance; | ||
|
||
if ( ! $instance ) | ||
$instance = new self(); | ||
|
||
return $instance; | ||
|
||
} | ||
|
||
|
||
protected function __construct() { | ||
|
||
$this->plugin_file = __FILE__; | ||
|
||
add_action( 'wp', array( $this, 'init' ) ); | ||
add_action( 'init', array( $this, 'admin_init' ) ); | ||
|
||
// This action can used to delete all Minit cache files from cron | ||
add_action( 'minit-cache-purge-delete', array( $this, 'cache_delete' ) ); | ||
|
||
} | ||
|
||
|
||
public function init() { | ||
|
||
if ( is_admin() ) | ||
return; | ||
|
||
include dirname( __FILE__ ) . '/include/minit-assets.php'; | ||
include dirname( __FILE__ ) . '/include/minit-js.php'; | ||
include dirname( __FILE__ ) . '/include/minit-css.php'; | ||
include dirname( __FILE__ ) . '/include/helpers.php'; | ||
|
||
$js = new Minit_Js( $this ); | ||
$css = new Minit_Css( $this ); | ||
|
||
$js->init(); | ||
$css->init(); | ||
|
||
} | ||
|
||
public function admin_init() { | ||
|
||
include dirname( __FILE__ ) . '/include/admin.php'; | ||
|
||
$admin = new Minit_Admin( $this ); | ||
$admin->init(); | ||
|
||
} | ||
|
||
|
||
public static function cache_bump() { | ||
|
||
// Use this as a global cache version number | ||
update_option( 'minit_cache_ver', time() ); | ||
|
||
// Allow other plugins to know that we purged | ||
do_action( 'minit-cache-purged' ); | ||
|
||
} | ||
|
||
|
||
public static function cache_delete() { | ||
|
||
$wp_upload_dir = wp_upload_dir(); | ||
$minit_files = glob( $wp_upload_dir['basedir'] . '/minit/*' ); | ||
|
||
if ( $minit_files ) { | ||
foreach ( $minit_files as $minit_file ) { | ||
unlink( $minit_file ); | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
} |
@kasparsd Please consider
GitHub Plugin URI
to make updates possible:https://github.com/afragen/github-updater
and you may enjoy the benefits of https://github.com/szepeviktor/github-link