| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
|
| 5 |
Plugin Name: Zotpress |
| 6 |
Plugin URI: http://katieseaborn.com/plugins |
| 7 |
Description: Display your Zotero collection on your Wordpress blog. |
| 8 |
Author: Katie Seaborn |
| 9 |
Version: 1.3 |
| 10 |
Author URI: http://katieseaborn.com |
| 11 |
|
| 12 |
*/ |
| 13 |
|
| 14 |
define('ZOTPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ )); |
| 15 |
|
| 16 |
$shortcode_displayed = false; |
| 17 |
global $shortcode_displayed; |
| 18 |
|
| 19 |
|
| 20 |
// INSTALL ----------------------------------------------------------------------------------------- |
| 21 |
|
| 22 |
function Zotpress_activate() |
| 23 |
{ |
| 24 |
global $wpdb; |
| 25 |
|
| 26 |
$structure = "CREATE TABLE " . $wpdb->prefix . "zotpress ( |
| 27 |
id INT(9) NOT NULL AUTO_INCREMENT, |
| 28 |
account_type VARCHAR(10) NOT NULL, |
| 29 |
api_user_id VARCHAR(10) NOT NULL, |
| 30 |
public_key VARCHAR(28) default NULL, |
| 31 |
nickname VARCHAR(200) default NULL, |
| 32 |
UNIQUE KEY id (id) |
| 33 |
);"; |
| 34 |
$wpdb->query($structure); |
| 35 |
|
| 36 |
$structure = "CREATE TABLE " . $wpdb->prefix . "zotpress_images ( |
| 37 |
id INT(9) NOT NULL AUTO_INCREMENT, |
| 38 |
citation_id VARCHAR(10) NOT NULL, |
| 39 |
image VARCHAR(300) NOT NULL, |
| 40 |
account_type VARCHAR(10) NOT NULL, |
| 41 |
api_user_id VARCHAR(10) NOT NULL, |
| 42 |
UNIQUE KEY id (id) |
| 43 |
);"; |
| 44 |
$wpdb->query($structure); |
| 45 |
} |
| 46 |
|
| 47 |
register_activation_hook(__FILE__, 'Zotpress_activate'); |
| 48 |
|
| 49 |
// INSTALL ----------------------------------------------------------------------------------------- |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
// ADMIN ----------------------------------------------------------------------------------------- |
| 54 |
|
| 55 |
function Zotpress_admin_footer() |
| 56 |
{ |
| 57 |
// Connect to database |
| 58 |
global $wpdb; |
| 59 |
|
| 60 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC"); |
| 61 |
|
| 62 |
$zp_accounts_total = $wpdb->num_rows; |
| 63 |
|
| 64 |
if ($zp_accounts_total > 0) |
| 65 |
{ |
| 66 |
?> |
| 67 |
<script type="text/javascript"> |
| 68 |
|
| 69 |
jQuery(document).ready(function() |
| 70 |
{ |
| 71 |
<?php |
| 72 |
include('zotpress.display.essentials.php'); |
| 73 |
|
| 74 |
if (!isset($_GET['accounts']) || !isset($_GET['help'])) |
| 75 |
include('zotpress.display.php'); |
| 76 |
?> |
| 77 |
}); |
| 78 |
|
| 79 |
</script> |
| 80 |
<?php |
| 81 |
|
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
function Zotpress_admin_scripts() { |
| 86 |
wp_enqueue_script('media-upload'); |
| 87 |
wp_enqueue_script('thickbox'); |
| 88 |
wp_register_script('zotpress.actions.js', ZOTPRESS_PLUGIN_URL . 'zotpress.actions.js', array('jquery','media-upload','thickbox')); |
| 89 |
wp_enqueue_script('zotpress.actions.js'); |
| 90 |
wp_register_script('jquery.dotimeout.min.js', ZOTPRESS_PLUGIN_URL . 'jquery.dotimeout.min.js', array('jquery')); |
| 91 |
wp_enqueue_script('jquery.dotimeout.min.js'); |
| 92 |
wp_register_script('jquery.qtip-1.0.0-rc3.js', ZOTPRESS_PLUGIN_URL . 'jquery.qtip-1.0.0-rc3.js', array('jquery')); |
| 93 |
wp_enqueue_script('jquery.qtip-1.0.0-rc3.js'); |
| 94 |
wp_register_script('jquery.livequery.js', ZOTPRESS_PLUGIN_URL . 'jquery.livequery.js', array('jquery')); |
| 95 |
wp_enqueue_script('jquery.livequery.js'); |
| 96 |
} |
| 97 |
|
| 98 |
function Zotpress_admin_styles() { |
| 99 |
wp_enqueue_style('thickbox'); |
| 100 |
wp_register_style('zotpress.css', ZOTPRESS_PLUGIN_URL . 'zotpress.css'); |
| 101 |
wp_enqueue_style('zotpress.css'); |
| 102 |
} |
| 103 |
|
| 104 |
function Zotpress_admin_menu() |
| 105 |
{ |
| 106 |
add_menu_page("Zotpress", "Zotpress", 3, "Zotpress", "Zotpress_options", ZOTPRESS_PLUGIN_URL."icon.png"); |
| 107 |
} |
| 108 |
|
| 109 |
function Zotpress_options() |
| 110 |
{ |
| 111 |
// Keep out those without access! |
| 112 |
if (!current_user_can('manage_options')) { |
| 113 |
wp_die( __('You do not have sufficient permissions to access this page.') ); |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
// ADD ZOTERO ACCOUNT |
| 118 |
|
| 119 |
if (isset($_GET['accounts'])) |
| 120 |
{ |
| 121 |
include('zotpress.accounts.php'); |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
// ADD ZOTERO ACCOUNT |
| 127 |
|
| 128 |
else if (isset($_GET['image'])) |
| 129 |
{ |
| 130 |
include('zotpress.image.php'); |
| 131 |
} |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
// HELP PAGE |
| 136 |
|
| 137 |
else if (isset($_GET['help'])) |
| 138 |
{ |
| 139 |
include('zotpress.help.php'); |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
// VIEW CITATIONS |
| 145 |
|
| 146 |
else |
| 147 |
{ |
| 148 |
global $wpdb; |
| 149 |
|
| 150 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC"); |
| 151 |
|
| 152 |
$zp_accounts_total = $wpdb->num_rows; |
| 153 |
include('zotpress.default.php'); |
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
} |
| 158 |
|
| 159 |
// ADMIN ----------------------------------------------------------------------------------------- |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
// SHORTCODE ----------------------------------------------------------------------------------------- |
| 164 |
|
| 165 |
function Zotpress_func($atts) { |
| 166 |
extract(shortcode_atts(array( |
| 167 |
|
| 168 |
'api_user_id' => false, |
| 169 |
'nickname' => false, |
| 170 |
'author' => false, |
| 171 |
|
| 172 |
'data_type' => "items", |
| 173 |
|
| 174 |
'collection_id' => false, |
| 175 |
'item_key' => false, |
| 176 |
'tag_name' => false, |
| 177 |
|
| 178 |
'content' => "bib", |
| 179 |
'style' => "apa", |
| 180 |
'order' => false, |
| 181 |
'sort' => false, |
| 182 |
'limit' => "50", |
| 183 |
|
| 184 |
'image' => "no" |
| 185 |
|
| 186 |
), $atts)); |
| 187 |
|
| 188 |
// Format attritbutes |
| 189 |
$api_user_id = str_replace('"','',html_entity_decode($api_user_id)); |
| 190 |
$nickname = str_replace('"','',html_entity_decode($nickname)); |
| 191 |
$author = str_replace('"','',html_entity_decode($author)); |
| 192 |
|
| 193 |
$data_type = str_replace('"','',html_entity_decode($data_type)); |
| 194 |
|
| 195 |
$collection_id = str_replace('"','',html_entity_decode($collection_id)); |
| 196 |
$item_key = str_replace('"','',html_entity_decode($item_key)); |
| 197 |
$tag_name = str_replace('"','',html_entity_decode($tag_name)); |
| 198 |
|
| 199 |
$content = str_replace('"','',html_entity_decode($content)); |
| 200 |
$style = str_replace('"','',html_entity_decode($style)); |
| 201 |
$order = str_replace('"','',html_entity_decode($order)); |
| 202 |
$sort = str_replace('"','',html_entity_decode($sort)); |
| 203 |
$limit = str_replace('"','',html_entity_decode($limit)); |
| 204 |
|
| 205 |
$image = str_replace('"','',html_entity_decode($image)); |
| 206 |
|
| 207 |
// Connect to database |
| 208 |
global $wpdb; |
| 209 |
|
| 210 |
if ($api_user_id != false) |
| 211 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'"); |
| 212 |
else if ($nickname != false) |
| 213 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'"); |
| 214 |
else |
| 215 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC"); |
| 216 |
|
| 217 |
$zp_accounts_total = $wpdb->num_rows; |
| 218 |
$zp_instance_id = "zotpress-".rand(100,999); |
| 219 |
|
| 220 |
if ($zp_accounts_total > 0) |
| 221 |
{ |
| 222 |
include('zotpress.shortcode.php'); |
| 223 |
return "<div id='".$zp_instance_id."' class='zp-Zotpress'><span class='zp-Loading'><span>loading</span></span></div>\n"; |
| 224 |
} |
| 225 |
|
| 226 |
$shortcode_displayed = true; |
| 227 |
} |
| 228 |
|
| 229 |
// SHORTCODE ----------------------------------------------------------------------------------------- |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
// WIDGET ---------------------------------------------------------------------------------------------- |
| 234 |
|
| 235 |
class ZotpressWidget extends WP_Widget { |
| 236 |
|
| 237 |
function ZotpressWidget() |
| 238 |
{ |
| 239 |
$widget_ops = array('description' => __('Display your citations on your sidebar', 'zp-ZotpressWidget')); |
| 240 |
parent::WP_Widget(false, __('Zotpress Widget'), $widget_ops); |
| 241 |
//parent::WP_Widget( false, $name = 'Zotpress Widget' ); |
| 242 |
} |
| 243 |
|
| 244 |
function widget( $args, $instance ) |
| 245 |
{ |
| 246 |
extract( $args ); |
| 247 |
|
| 248 |
// ARGUMENTS |
| 249 |
$title = apply_filters('widget_title', $instance['title'] ); |
| 250 |
|
| 251 |
$api_user_id = $instance['api_user_id']; |
| 252 |
$nickname = isset( $instance['nickname'] ) ? $instance['nickname'] : false; |
| 253 |
$author = isset( $instance['author'] ) ? $instance['author'] : false; |
| 254 |
|
| 255 |
$data_type = isset( $instance['data_type'] ) ? $instance['data_type'] : "items"; |
| 256 |
$collection_id = isset( $instance['collection_id'] ) ? $instance['collection_id'] : false; |
| 257 |
$item_key = isset( $instance['item_key'] ) ? $instance['item_key'] : false; |
| 258 |
$tag_name = isset( $instance['tag_name'] ) ? $instance['tag_name'] : false; |
| 259 |
|
| 260 |
$content = isset( $instance['content'] ) ? $instance['content'] : "bib"; |
| 261 |
$style = isset( $instance['style'] ) ? $instance['style'] : "apa"; |
| 262 |
$order = isset( $instance['order'] ) ? $instance['order'] : false; |
| 263 |
$sort = isset( $instance['sort'] ) ? $instance['sort'] : false; |
| 264 |
$limit = isset( $instance['limit'] ) ? $instance['limit'] : "5"; |
| 265 |
|
| 266 |
$image = isset( $instance['image'] ) ? $instance['image'] : "no"; |
| 267 |
|
| 268 |
// Required for theme |
| 269 |
echo $before_widget; |
| 270 |
|
| 271 |
if ($title) |
| 272 |
echo $before_title . $title . $after_title; |
| 273 |
|
| 274 |
// DISPLAY |
| 275 |
|
| 276 |
if (!$shortcode_displayed) |
| 277 |
{ |
| 278 |
// Connect to database |
| 279 |
global $wpdb; |
| 280 |
|
| 281 |
if ($api_user_id != false) |
| 282 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'"); |
| 283 |
else if ($nickname != false) |
| 284 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'"); |
| 285 |
else |
| 286 |
$zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC"); |
| 287 |
} |
| 288 |
|
| 289 |
$zp_accounts_total = $wpdb->num_rows; |
| 290 |
$zp_instance_id = "zotpress-".rand(100,999); |
| 291 |
|
| 292 |
if ($zp_accounts_total > 0) |
| 293 |
{ |
| 294 |
include('zotpress.shortcode.php'); |
| 295 |
echo "<div id='".$zp_instance_id."' class='zp-Zotpress zp-ZotpressWidget'><span class='zp-Loading'><span>loading</span></span></div>\n"; |
| 296 |
} |
| 297 |
else |
| 298 |
{ |
| 299 |
echo "<div id='".$zp_instance_id."' class='zp-Zotpress zp-ZotpressWidget'>Sorry, no citations found.</div>\n"; |
| 300 |
} |
| 301 |
|
| 302 |
// Required for theme |
| 303 |
echo $after_widget; |
| 304 |
} |
| 305 |
|
| 306 |
function update( $new_instance, $old_instance ) |
| 307 |
{ |
| 308 |
$instance = $old_instance; |
| 309 |
|
| 310 |
$instance['title'] = strip_tags( $new_instance['title'] ); |
| 311 |
|
| 312 |
$instance['api_user_id'] = strip_tags( $new_instance['api_user_id'] ); |
| 313 |
$instance['nickname'] = strip_tags($new_instance['nickname']); |
| 314 |
$instance['author'] = str_replace(" ", "+", strip_tags($new_instance['author'])); |
| 315 |
|
| 316 |
$instance['data_type'] = strip_tags( $new_instance['data_type'] ); |
| 317 |
$instance['collection_id'] = strip_tags($new_instance['collection_id']); |
| 318 |
$instance['item_key'] = strip_tags($new_instance['item_key']); |
| 319 |
$instance['tag_name'] = str_replace(" ", "+", strip_tags($new_instance['tag_name'])); |
| 320 |
|
| 321 |
$instance['content'] = strip_tags( $new_instance['content'] ); |
| 322 |
$instance['style'] = strip_tags($new_instance['style']); |
| 323 |
$instance['order'] = strip_tags($new_instance['order']); |
| 324 |
$instance['sort'] = strip_tags($new_instance['sort']); |
| 325 |
$instance['limit'] = strip_tags($new_instance['limit']); |
| 326 |
if (intval($instance['limit']) > 99) |
| 327 |
$instance['limit'] = "99"; |
| 328 |
if (trim($instance['limit']) == "") |
| 329 |
$instance['limit'] = "5"; |
| 330 |
|
| 331 |
$instance['image'] = strip_tags($new_instance['image']); |
| 332 |
|
| 333 |
return $instance; |
| 334 |
} |
| 335 |
|
| 336 |
function form( $instance ) |
| 337 |
{ |
| 338 |
$title = esc_attr( $instance['title'] ); |
| 339 |
?> |
| 340 |
|
| 341 |
<style type="text/css"> |
| 342 |
<!-- |
| 343 |
span.req { |
| 344 |
color: #CC0066; |
| 345 |
font-weight: bold; |
| 346 |
font-size: 1.4em; |
| 347 |
vertical-align: -20%; |
| 348 |
} |
| 349 |
|
| 350 |
div.zp-ZotpressWidget-Required { |
| 351 |
border-radius: 10px; |
| 352 |
-moz-border-radius: 10px; |
| 353 |
background-color: #fafafa; |
| 354 |
margin: 0 0 10px 0; |
| 355 |
padding: 10px 10px 1px 10px; |
| 356 |
} |
| 357 |
|
| 358 |
div.zp-ZotpressWidget-Required .widefat { |
| 359 |
width: 98%; |
| 360 |
} |
| 361 |
--> |
| 362 |
</style> |
| 363 |
|
| 364 |
<p> |
| 365 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> |
| 366 |
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" class="widefat" /> |
| 367 |
</p> |
| 368 |
|
| 369 |
<div class="zp-ZotpressWidget-Required"> |
| 370 |
|
| 371 |
<p> |
| 372 |
Fill in <strong>one</strong> of the below. Req'd. |
| 373 |
</p> |
| 374 |
|
| 375 |
<p> |
| 376 |
<label for="<?php echo $this->get_field_id( 'api_user_id' ); ?>">API User/Group ID: <span class="req">*</span></label> |
| 377 |
<input id="<?php echo $this->get_field_id( 'api_user_id' ); ?>" name="<?php echo $this->get_field_name( 'api_user_id' ); ?>" value="<?php echo $instance['api_user_id']; ?>" class="widefat" /> |
| 378 |
</p> |
| 379 |
|
| 380 |
<p> |
| 381 |
<label for="<?php echo $this->get_field_id( 'nickname' ); ?>">Nickname: <span class="req">*</span></label> |
| 382 |
<input id="<?php echo $this->get_field_id( 'nickname' ); ?>" name="<?php echo $this->get_field_name( 'nickname' ); ?>" value="<?php echo $instance['nickname']; ?>" class="widefat" /> |
| 383 |
</p> |
| 384 |
|
| 385 |
</div> |
| 386 |
|
| 387 |
<p> |
| 388 |
<label for="<?php echo $this->get_field_id( 'data_type' ); ?>">Data Type:</label> |
| 389 |
<select id="<?php echo $this->get_field_id( 'data_type' ); ?>" name="<?php echo $this->get_field_name( 'data_type' ); ?>" class="widefat"> |
| 390 |
<option <?php if ( 'items' == $instance['data_type'] ) echo 'selected="selected"'; ?>>items</option> |
| 391 |
<option <?php if ( 'tags' == $instance['data_type'] ) echo 'selected="selected"'; ?>>tags</option> |
| 392 |
<option <?php if ( 'collections' == $instance['data_type'] ) echo 'selected="selected"'; ?>>collections</option> |
| 393 |
</select> |
| 394 |
</p> |
| 395 |
|
| 396 |
<p> |
| 397 |
<label for="<?php echo $this->get_field_id( 'author' ); ?>">Enter Author to List by Author:</label> |
| 398 |
<input id="<?php echo $this->get_field_id( 'author' ); ?>" name="<?php echo $this->get_field_name( 'author' ); ?>" value="<?php echo $instance['author']; ?>" class="widefat" /> |
| 399 |
</p> |
| 400 |
|
| 401 |
<p> |
| 402 |
<label for="<?php echo $this->get_field_id( 'collection_id' ); ?>">Enter Collection ID to List by Collection:</label> |
| 403 |
<input id="<?php echo $this->get_field_id( 'collection_id' ); ?>" name="<?php echo $this->get_field_name( 'collection_id' ); ?>" value="<?php echo $instance['collection_id']; ?>" class="widefat" /> |
| 404 |
</p> |
| 405 |
|
| 406 |
<p> |
| 407 |
<label for="<?php echo $this->get_field_id( 'item_key' ); ?>">Enter Item Key to List by Citation:</label> |
| 408 |
<input id="<?php echo $this->get_field_id( 'item_key' ); ?>" name="<?php echo $this->get_field_name( 'item_key' ); ?>" value="<?php echo $instance['item_key']; ?>" class="widefat" /> |
| 409 |
</p> |
| 410 |
|
| 411 |
<p> |
| 412 |
<label for="<?php echo $this->get_field_id( 'tag_name' ); ?>">Enter Tag Name to List by Tag:</label> |
| 413 |
<input id="<?php echo $this->get_field_id( 'tag_name' ); ?>" name="<?php echo $this->get_field_name( 'tag_name' ); ?>" value="<?php echo $instance['tag_name']; ?>" class="widefat" /> |
| 414 |
</p> |
| 415 |
|
| 416 |
<p> |
| 417 |
<label for="<?php echo $this->get_field_id( 'content' ); ?>">Content:</label> |
| 418 |
<select id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" class="widefat"> |
| 419 |
<option <?php if ( 'bib' == $instance['content'] ) echo 'selected="selected"'; ?>>bib</option> |
| 420 |
<option <?php if ( 'html' == $instance['content'] ) echo 'selected="selected"'; ?>>html</option> |
| 421 |
</select> |
| 422 |
</p> |
| 423 |
|
| 424 |
<p> |
| 425 |
<label for="<?php echo $this->get_field_id( 'style' ); ?>">Style:</label> |
| 426 |
<input id="<?php echo $this->get_field_id( 'style' ); ?>" name="<?php echo $this->get_field_name( 'style' ); ?>" value="<?php echo $instance['style']; ?>" class="widefat" /> |
| 427 |
</p> |
| 428 |
|
| 429 |
<p> |
| 430 |
<label for="<?php echo $this->get_field_id( 'order' ); ?>">Order By:</label> |
| 431 |
<input id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" value="<?php echo $instance['order']; ?>" class="widefat" /> |
| 432 |
</p> |
| 433 |
|
| 434 |
<p> |
| 435 |
<label for="<?php echo $this->get_field_id( 'sort' ); ?>">Sort Order:</label> |
| 436 |
<select id="<?php echo $this->get_field_id( 'sort' ); ?>" name="<?php echo $this->get_field_name( 'sort' ); ?>" class="widefat"> |
| 437 |
<option <?php if ( 'desc' == $instance['sort'] ) echo 'selected="selected"'; ?>>desc</option> |
| 438 |
<option <?php if ( 'asc' == $instance['sort'] ) echo 'selected="selected"'; ?>>asc</option> |
| 439 |
</select> |
| 440 |
</p> |
| 441 |
|
| 442 |
<p> |
| 443 |
<label for="<?php echo $this->get_field_id( 'limit' ); ?>">Limit:</label> |
| 444 |
<input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo $instance['limit']; ?>" class="widefat" /> |
| 445 |
</p> |
| 446 |
|
| 447 |
<p> |
| 448 |
<label for="<?php echo $this->get_field_id( 'image' ); ?>">Show Image?:</label> |
| 449 |
<select id="<?php echo $this->get_field_id( 'image' ); ?>" name="<?php echo $this->get_field_name( 'image' ); ?>" class="widefat"> |
| 450 |
<option <?php if ( 'no' == $instance['image'] ) echo 'selected="selected"'; ?>>no</option> |
| 451 |
<option <?php if ( 'yes' == $instance['image'] ) echo 'selected="selected"'; ?>>yes</option> |
| 452 |
</select> |
| 453 |
</p> |
| 454 |
|
| 455 |
<?php |
| 456 |
} |
| 457 |
} |
| 458 |
|
| 459 |
function ZotpressWidgetInit() { |
| 460 |
register_widget( 'ZotpressWidget' ); |
| 461 |
} |
| 462 |
|
| 463 |
// WIDGET ---------------------------------------------------------------------------------------------- |
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
// REGISTER ACTIONS --------------------------------------------------------------------------------- |
| 468 |
|
| 469 |
if (isset($_GET['page']) && $_GET['page'] == 'Zotpress') { |
| 470 |
add_action('admin_print_scripts', 'Zotpress_admin_scripts'); |
| 471 |
add_action('admin_print_styles', 'Zotpress_admin_styles'); |
| 472 |
add_action('admin_footer', 'Zotpress_admin_footer'); |
| 473 |
} |
| 474 |
|
| 475 |
add_action('admin_menu', 'Zotpress_admin_menu'); |
| 476 |
|
| 477 |
add_shortcode('zotpress', 'Zotpress_func'); |
| 478 |
add_action( 'widgets_init', 'ZotpressWidgetInit' ); |
| 479 |
|
| 480 |
// REGISTER ACTIONS --------------------------------------------------------------------------------- |
| 481 |
|
| 482 |
|
| 483 |
?> |