-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
146 lines (132 loc) · 4.6 KB
/
index.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/**
* @Author Jonathon byrd
* @link http://www.5twentystudios.com
* @Package Wordpress
* @SubPackage Category Filter Widget
* @copyright Proprietary Software, Copyright Byrd Incorporated. All Rights Reserved
* @Since 1.0.0
*
*
* Plugin Name: Category Filter Widget
* Plugin URI: http://www.5twentystudios.com
* Description: This widget creates a list of categories, allowing your users to create their own filter of posts to view. <a href="http://www.5twentystudios.com" target="_blank">Author Website</a>
* Version: 1.0.0
* Author: 5Twenty Studios
* Author URI: http://www.5twentystudios.com
*
*
*/
defined('ABSPATH') or die("Cannot access pages directly.");
/**
* Initializing
*
* The directory separator is different between linux and microsoft servers.
* Thankfully php sets the DIRECTORY_SEPARATOR constant so that we know what
* to use.
*/
defined("DS") or define("DS", DIRECTORY_SEPARATOR);
defined("CFW_VERSION") or define("CFW_VERSION", '1.0.0');
/**
* Startup
*
* This block of functions is only preloading a set of functions that I've prebuilt
* and that I use throughout my websites.
*
* @copyright Proprietary Software, Copyright Byrd Incorporated. All Rights Reserved
* @since 1.0
*/
require_once ABSPATH.WPINC.DS."pluggable.php";
require_once dirname(__file__).DS."bootstrap.php";
require_once dirname(__file__).DS."helper.php";
require_once dirname(__file__).DS."template-codes.php";
/**
* Initialize Localization
*
* @tutorial http://codex.wordpress.org/I18n_for_WordPress_Developers
* function call loads the localization files from the current folder
*/
if (function_exists('load_theme_textdomain')) load_theme_textdomain('cfw');
/**
* User Control Level
*
* Allows the developer to hook into this system and set the access level for this plugin.
* If the user does not have the capability to view this plguin, they may still be
* able to view the default widget area. This will not cause problems with the script,
* however the editing user will not be able to add or delete viewable pages to the
* widget.
*
* @TODO need to set this to call get_option from the db
* @TODO need to add this as a security check to every file
*/
defined("FIVETS_CURRENT_USER_CANNOT") or define("FIVETS_CURRENT_USER_CANNOT", (!current_user_can("edit_theme_options")) );
/**
* Initialize the Framework
*
*/
set_controller_path( dirname( __FILE__ ) );
//register assets
wp_register_script( 'fivets_default_js', plugin_dir_url(__file__).'js/default.js', array(), CFW_VERSION, true);
wp_register_style( 'fivets_default_css', plugin_dir_url(__file__).'css/default.css', array(), CFW_VERSION, 'all');
//load the scripts into the theme
wp_enqueue_style('fivets_default_css');
wp_enqueue_script('fivets_default_js');
//shortcodes
//add_shortcode('widget', 'cfw_shortcode_widget');
//actions for bootstrap
add_action('init', 'fivets_show_ajax', 100);
//add_action('admin_notices', 'fivets_read_520_rss', 1);
//actions for helper
add_action('activate_'.plugin_basename(dirname(__file__)).DS.'index.php', 'cfw_activate_plugin');
add_action('deactivate_'.plugin_basename(dirname(__file__)).DS.'index.php', 'cfw_deactivate_plugin');
add_action('wp_head', 'cfw_document_head');
add_action('wp_footer', 'cfw_document_footer');
register_multiwidget(array(
'id' => 'category-filter-widget', // Must be slug compatible, and unique, it's used a lot
'title' => __('Category Filter Widget'),
'description' => __('Allows your users to select multiple categories and then view a list of all posts within those categories.'),
'classname' => 'st-custom-wi',
'show_view' => 'category-filter-widget', //This is the unique filename within the views folder, the theme is checked first, then defaults to the plugin
'fields' => array(
/*
array(
'name' => 'Text box',
'desc' => 'Enter something here',
'id' => 'text',
'type' => 'text',
'std' => 'Default value 1'
),
array(
'type' => 'custom',
'std' => '<hr/>'
),
array(
'name' => 'Textarea',
'desc' => 'Enter big text here',
'id' => 'textarea',
'type' => 'textarea',
'std' => 'Default value 2'
),
array(
'name' => 'Select box',
'id' => 'select',
'type' => 'select',
'options' => array('Option 1', 'Option 2', 'Option 3')
),
array(
'name' => 'Radio',
'id' => 'radio',
'type' => 'radio',
'options' => array(
array('name' => 'Name 1', 'value' => 'Value 1'),
array('name' => 'Name 2', 'value' => 'Value 2')
)
),
array(
'name' => 'Checkbox',
'id' => 'checkbox',
'type' => 'checkbox'
),
*/
)
));