-
Notifications
You must be signed in to change notification settings - Fork 1
/
recipress.php
87 lines (74 loc) · 3.14 KB
/
recipress.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/*
Plugin Name: ReciPress
Plugin URI: http://www.recipress.com
Description: Create recipes in your posts with a clean interface and layout that are easy to organize.
Version: 1.9.4
Author: Tammy Hart
Author URI: http://tammyhartdesigns.com
*/
/*
Copyright (c) 2011, Tammy Hart
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Localization
load_plugin_textdomain( 'recipress', false, basename( dirname( __FILE__ ) ) . '/lang' );
// The full path to the plugin directory
define( 'RECIPRESS_DIR', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) . '/' );
define( 'RECIPRESS_URL', WP_PLUGIN_URL . '/' . basename( dirname( __FILE__ ) ) . '/' );
function get_recipress_url() { return RECIPRESS_URL; }
// Load plugin files
include_once(RECIPRESS_DIR.'php/functions.php');
include_once(RECIPRESS_DIR.'php/options.php');
include_once(RECIPRESS_DIR.'php/meta_box.php');
include_once(RECIPRESS_DIR.'php/taxonomies.php');
include_once(RECIPRESS_DIR.'php/output.php');
include_once(RECIPRESS_DIR.'php/widgets.php');
// Styles and Scripts
add_action('admin_enqueue_scripts', 'recipress_admin_enqueue');
function recipress_admin_enqueue() {
wp_enqueue_script('recipress_back', RECIPRESS_URL.'js/back.js', array('jquery', 'jquery-ui-sortable'));
wp_enqueue_style('recipress_back', RECIPRESS_URL.'css/back.css');
}
add_action('wp_enqueue_scripts', 'recipress_wp_enqueue');
function recipress_wp_enqueue() {
wp_enqueue_script('jquery');
wp_enqueue_style('recipress_front', RECIPRESS_URL.'css/front.css');
}
// Admin Head Script
add_action('admin_head', 'add_recipress_script_config');
function add_recipress_script_config() {
?>
<script type="text/javascript" >
// Function to add auto suggest
function setSuggest(id) {
jQuery('#' + id).suggest("<?php echo get_bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=ingredient");
}
var pluginDir = '<?php echo get_recipress_url() ?>';
</script>
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="<?php echo get_recipress_url() ?>css/ie.css" />
<![endif]-->
<?php
}
// Register taxonomies and insert terms on plugin activation
add_action('init', 'register_recipress_taxonomies');
register_activation_hook( __FILE__, 'activate_recipress_taxonomies' );
function activate_recipress_taxonomies() {
// activate taxonomies
register_recipress_taxonomies();
// insert terms
recipress_default_taxonomies();
$GLOBALS['wp_rewrite']->flush_rules();
}
?>