Esempio n. 1
0
 /**
  * Initialize the plugin by setting localization, filters, and administration functions.
  *
  * @since 0.0.1
  *
  * @access private
  */
 private function __construct()
 {
     // Load plugin text domain
     add_action('init', array($this, 'load_plugin_textdomain'));
     // Activate plugin when new blog is added
     add_action('wpmu_new_blog', array($this, 'activate_new_site'));
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_stylescripts'));
     //register scripts/styles used in both front-end and back-end
     add_action('wp_enqueue_scripts', array($this, 'register_common'), 5);
     add_action('admin_enqueue_scripts', array($this, 'register_common'), 5);
     //load settings class in admin
     if (is_admin()) {
         new settings();
         new end_points();
     } else {
         //boot API
         new end_points();
         new api_route();
         //load the front-end if on single post
         add_action('parse_query', array($this, 'boot_epoch_front'));
         // inner comment
         add_action('template_redirect', array($this, 'boot_epoch_front_comment'));
     }
     //flush permalinks if not on an API call and hasn't been done this version.
     add_action('init', function () {
         if (!isset($_REQUEST[vars::$nonce_field]) && EPOCH_VER != get_option('epoch_ver')) {
             epoch_fix_rewrites();
         }
     });
 }
Esempio n. 2
0
/**
 * Flush permalinks on activation
 */
function epoch_activate()
{
    if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
        if (file_exists(EPOCH_PATH . 'vendor/autoload.php')) {
            require_once EPOCH_PATH . 'vendor/autoload.php';
            epoch_fix_rewrites();
        }
    }
}