Skip to content

Instantly share code, notes, and snippets.

@bordoni
Created October 23, 2011 17:43
Show Gist options
  • Save bordoni/1307630 to your computer and use it in GitHub Desktop.
Save bordoni/1307630 to your computer and use it in GitHub Desktop.
Plugins Start Code
<?php
/*
Plugin Name:
Plugin URI:
Version:
Description:
Author:
Author URI:
Text Domain:
Domain Path:
License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html
*/
if ( version_compare(PHP_VERSION, '5.2', '<') ) {
if ( is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX) ) {
require_once ABSPATH.'/wp-admin/includes/plugin.php';
deactivate_plugins( __FILE__ );
wp_die( __('To use this plugin on your WordPress installation, your server must have at least PHP version 5.2, as WordPress 3.2 does.') );
} else {
return;
}
}
$pluginurl = plugins_url() . "/" . basename( dirname(__FILE__) ) . "/";
if ( preg_match( '/^https/', $pluginurl ) && !preg_match( '/^https/', get_bloginfo('url') ) )
$pluginurl = preg_replace( '/^https/', 'http', $pluginurl );
//Thanks to Yoast really good ideas on this code above
define( 'PFIX_VERSION', '0.1' );
define( 'PFIX_PREFIX', 'prefix' );
define( 'PFIX_URL', $pluginurl );
define( 'PFIX_PATH', plugin_dir_path(__FILE__) );
define( 'PFIX_BASENAME', basename( dirname(__FILE__) ) );
define( 'PFIX_INC_PATH', PFIX_PATH.'inc/' );
define( 'PFIX_INC_URL', PFIX_URL . 'inc/' );
define( 'PFIX_JS_PATH', PFIX_PATH . 'js/' );
define( 'PFIX_JS_URL', PFIX_URL . 'js/' );
define( 'PFIX_CSS_PATH', PFIX_PATH . 'css/' );
define( 'PFIX_CSS_URL', PFIX_URL . 'css/' );
define( 'PFIX_IMG_PATH', PFIX_PATH . 'img/' );
define( 'PFIX_IMG_URL', PFIX_URL . 'img/' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment