| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: WP Job Manager |
| 4 |
Plugin URI: http://mikejolley.com/projects/wp-job-manager/ |
| 5 |
Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site. |
| 6 |
Version: 1.0.2 |
| 7 |
Author: Mike Jolley |
| 8 |
Author URI: http://mikejolley.com |
| 9 |
Requires at least: 3.5 |
| 10 |
Tested up to: 3.5 |
| 11 |
|
| 12 |
Copyright: 2013 Mike Jolley |
| 13 |
License: GNU General Public License v3.0 |
| 14 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 15 |
*/ |
| 16 |
|
| 17 |
// Exit if accessed directly |
| 18 |
if ( ! defined( 'ABSPATH' ) ) |
| 19 |
exit; |
| 20 |
|
| 21 |
/** |
| 22 |
* WP_Job_Manager class. |
| 23 |
*/ |
| 24 |
class WP_Job_Manager { |
| 25 |
|
| 26 |
/** |
| 27 |
* __construct function. |
| 28 |
*/ |
| 29 |
public function __construct() { |
| 30 |
// Define constants |
| 31 |
define( 'JOB_MANAGER_VERSION', '1.0.2' ); |
| 32 |
define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
| 33 |
define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); |
| 34 |
|
| 35 |
// Includes |
| 36 |
include( 'wp-job-manager-functions.php' ); |
| 37 |
include( 'wp-job-manager-template.php' ); |
| 38 |
include( 'includes/class-wp-job-manager-post-types.php' ); |
| 39 |
include( 'includes/class-wp-job-manager-ajax.php' ); |
| 40 |
include( 'includes/class-wp-job-manager-shortcodes.php' ); |
| 41 |
include( 'includes/class-wp-job-manager-api.php' ); |
| 42 |
include( 'includes/class-wp-job-manager-forms.php' ); |
| 43 |
|
| 44 |
if ( is_admin() ) |
| 45 |
include( 'includes/admin/class-wp-job-manager-admin.php' ); |
| 46 |
|
| 47 |
// Init classes |
| 48 |
$this->forms = new WP_Job_Manager_Forms(); |
| 49 |
$this->post_types = new WP_Job_Manager_Post_Types(); |
| 50 |
|
| 51 |
// Activation - works with symlinks |
| 52 |
register_activation_hook( basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), array( $this->post_types, 'register_post_types' ), 10 ); |
| 53 |
register_activation_hook( basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), create_function( "", "include( 'includes/class-wp-job-manager-install.php' );" ), 10 ); |
| 54 |
register_activation_hook( basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), 'flush_rewrite_rules', 15 ); |
| 55 |
|
| 56 |
// Actions |
| 57 |
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) ); |
| 58 |
add_action( 'switch_theme', array( $this->post_types, 'register_post_types' ), 10 ); |
| 59 |
add_action( 'switch_theme', 'flush_rewrite_rules', 15 ); |
| 60 |
add_action( 'widgets_init', create_function( "", "include_once( 'includes/class-wp-job-manager-widgets.php' );" ) ); |
| 61 |
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) ); |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Localisation |
| 66 |
* |
| 67 |
* @access private |
| 68 |
* @return void |
| 69 |
*/ |
| 70 |
public function load_plugin_textdomain() { |
| 71 |
load_plugin_textdomain( 'job_manager', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* frontend_scripts function. |
| 76 |
* |
| 77 |
* @access public |
| 78 |
* @return void |
| 79 |
*/ |
| 80 |
public function frontend_scripts() { |
| 81 |
wp_register_script( 'wp-job-manager-ajax-filters', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-filters.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true ); |
| 82 |
wp_register_script( 'wp-job-manager-job-dashboard', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-dashboard.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true ); |
| 83 |
wp_register_script( 'wp-job-manager-job-application', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-application.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true ); |
| 84 |
|
| 85 |
wp_localize_script( 'wp-job-manager-ajax-filters', 'job_manager_ajax_filters', array( |
| 86 |
'ajax_url' => admin_url('admin-ajax.php') |
| 87 |
) ); |
| 88 |
wp_localize_script( 'wp-job-manager-job-dashboard', 'job_manager_job_dashboard', array( |
| 89 |
'i18n_confirm_delete' => __( 'Are you sure you want to delete this job?', 'job_manager' ) |
| 90 |
) ); |
| 91 |
|
| 92 |
wp_enqueue_style( 'wp-job-manager-frontend', JOB_MANAGER_PLUGIN_URL . '/assets/css/frontend.css' ); |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
$GLOBALS['job_manager'] = new WP_Job_Manager(); |