PluginProbe
Zotpress / 2.5
Zotpress v2.5
7.4.4 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0 2.1 2.2 2.3 2.4 2.5 2.5.1 2.5.2 2.6 2.6.1 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1 All 138 releases
zotpress / zotpress.php

zotpress.php in Zotpress 2.5, at zotpress.php

643 lines 26.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4
5 Plugin Name: Zotpress
6 Plugin URI: http://katieseaborn.com/plugins
7 Description: Display your Zotero citations on your Wordpress blog.
8 Author: Katie Seaborn
9 Version: 2.5
10 Author URI: http://katieseaborn.com
11
12 */
13
14 define('ZOTPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ));
15
16 // GLOBAL VARS ----------------------------------------------------------------------------------
17
18 $shortcode_displayed = false;
19 global $shortcode_displayed;
20
21 global $Zotpress_main_db_version;
22 $Zotpress_main_db_version = "1.0";
23 if (!get_option("Zotpress_main_db_version"))
24 add_option("Zotpress_main_db_version", $Zotpress_main_db_version);
25
26 global $Zotpress_images_db_version;
27 $Zotpress_images_db_version = "1.0";
28 if (!get_option("Zotpress_images_db_version"))
29 add_option("Zotpress_images_db_version", $Zotpress_images_db_version);
30
31 global $Zotpress_cache_db_version;
32 $Zotpress_cache_db_version = "1.2";
33 if (!get_option("Zotpress_cache_db_version"))
34 add_option("Zotpress_cache_db_version", "1.0");
35
36 // GLOBAL VARS ----------------------------------------------------------------------------------
37
38
39 // INSTALL -----------------------------------------------------------------------------------------
40
41 function Zotpress_install()
42 {
43 global $wpdb;
44 global $Zotpress_main_db_version;
45 global $Zotpress_images_db_version;
46 global $Zotpress_cache_db_version;
47
48
49 // MAIN TABLE
50
51 if (($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."zotpress'") != $wpdb->prefix."zotpress")
52 || (get_option("Zotpress_main_db_version") != $Zotpress_main_db_version))
53 {
54 $structure = "CREATE TABLE ".$wpdb->prefix."zotpress (
55 id INT(9) NOT NULL AUTO_INCREMENT,
56 account_type VARCHAR(10) NOT NULL,
57 api_user_id VARCHAR(10) NOT NULL,
58 public_key VARCHAR(28) default NULL,
59 nickname VARCHAR(200) default NULL,
60 UNIQUE KEY id (id)
61 );";
62
63 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
64 dbDelta($structure);
65
66 if (get_option("Zotpress_main_db_version") != $Zotpress_main_db_version)
67 update_option("Zotpress_main_db_version", $Zotpress_main_db_version);
68 else
69 add_option("Zotpress_main_db_version", $Zotpress_main_db_version);
70 }
71
72
73 // IMAGE TABLE
74
75 if (($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."zotpress_images'") != $wpdb->prefix."zotpress_images")
76 || (get_option("Zotpress_images_db_version") != $Zotpress_images_db_version))
77 {
78 $structure = "CREATE TABLE ".$wpdb->prefix."zotpress_images (
79 id INT(9) NOT NULL AUTO_INCREMENT,
80 citation_id VARCHAR(10) NOT NULL,
81 image VARCHAR(300) NOT NULL,
82 account_type VARCHAR(10) NOT NULL,
83 api_user_id VARCHAR(10) NOT NULL,
84 UNIQUE KEY id (id)
85 );";
86
87 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
88 dbDelta($structure);
89
90 if (get_option("Zotpress_images_db_version") != $Zotpress_images_db_version)
91 update_option("Zotpress_images_db_version", $Zotpress_images_db_version);
92 else
93 add_option("Zotpress_images_db_version", $Zotpress_images_db_version);
94 }
95
96 if (($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."zotpress_cache'") != $wpdb->prefix."zotpress_cache")
97 || (get_option("Zotpress_cache_db_version") != $Zotpress_cache_db_version))
98 {
99 $structure = "CREATE TABLE ".$wpdb->prefix."zotpress_cache (
100 id INT(9) NOT NULL AUTO_INCREMENT,
101 cache_key VARCHAR(100) NOT NULL,
102 xml_data LONGTEXT NOT NULL,
103 cache_time VARCHAR(100),
104 UNIQUE KEY id (id)
105 );";
106
107 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
108 dbDelta($structure);
109
110 if (get_option("Zotpress_cache_db_version") != $Zotpress_cache_db_version)
111 update_option("Zotpress_cache_db_version", $Zotpress_cache_db_version);
112 else
113 add_option("Zotpress_cache_db_version", $Zotpress_cache_db_version);
114 }
115 }
116
117 register_activation_hook(__FILE__, 'Zotpress_install');
118
119 // INSTALL -----------------------------------------------------------------------------------------
120
121
122
123 // ADMIN -----------------------------------------------------------------------------------------
124
125 function Zotpress_admin_footer()
126 {
127 // Connect to database
128 global $wpdb;
129
130 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC");
131
132 $zp_accounts_total = $wpdb->num_rows;
133
134 // INCLUDE FILTER SCRIPT
135
136 if ($zp_accounts_total > 0)
137 {
138 if (!isset($_GET['accounts']) || !isset($_GET['help'])) {
139 ?>
140 <script type="text/javascript">
141
142 jQuery(document).ready(function()
143 {
144 <?php include('zotpress.display.filter.php'); ?>
145
146 /*
147
148 CITATION IMAGE HOVER
149
150 */
151
152 jQuery('div#zp-List').delegate("div.zp-Entry-Image", "hover", function () {
153 jQuery(this).toggleClass("hover");
154 });
155
156 });
157
158 </script>
159 <?php
160 }
161 }
162 }
163
164 function Zotpress_admin_scripts()
165 {
166 wp_enqueue_script( 'jquery' ); // For Wordpress 3.1 - TEST!
167 wp_enqueue_script('media-upload');
168 wp_enqueue_script('thickbox');
169
170 if (isset($_GET['image'])) {
171 wp_register_script('zotpress.image.js', ZOTPRESS_PLUGIN_URL . 'zotpress.image.js', array('jquery','media-upload','thickbox'));
172 wp_enqueue_script('zotpress.image.js');
173 }
174
175 if (isset($_GET['accounts'])) {
176 wp_register_script('zotpress.accounts.js', ZOTPRESS_PLUGIN_URL . 'zotpress.accounts.js', array('jquery','media-upload','thickbox'));
177 wp_enqueue_script('zotpress.accounts.js');
178 }
179
180 wp_register_script('jquery.dotimeout.min.js', ZOTPRESS_PLUGIN_URL . 'jquery.dotimeout.min.js', array('jquery'));
181 wp_enqueue_script('jquery.dotimeout.min.js');
182
183 wp_register_script('jquery.qtip-1.0.0-rc3.js', ZOTPRESS_PLUGIN_URL . 'jquery.qtip-1.0.0-rc3.js', array('jquery'));
184 wp_enqueue_script('jquery.qtip-1.0.0-rc3.js');
185
186 wp_register_script('jquery.livequery.js', ZOTPRESS_PLUGIN_URL . 'jquery.livequery.js', array('jquery'));
187 wp_enqueue_script('jquery.livequery.js');
188 }
189
190 function Zotpress_admin_styles()
191 {
192 wp_enqueue_style('thickbox');
193
194 wp_register_style('zotpress.css', ZOTPRESS_PLUGIN_URL . 'zotpress.css');
195 wp_enqueue_style('zotpress.css');
196 }
197
198 function Zotpress_admin_menu()
199 {
200 add_menu_page("Zotpress", "Zotpress", 3, "Zotpress", "Zotpress_options", ZOTPRESS_PLUGIN_URL."icon.png");
201 }
202
203 function Zotpress_options()
204 {
205 // Keep out those without access!
206 if (!current_user_can('manage_options')) {
207 wp_die( __('You do not have sufficient permissions to access this page.') );
208 }
209
210
211
212 // ADD ZOTERO ACCOUNT
213
214 if (isset($_GET['accounts']))
215 {
216 include('zotpress.accounts.php');
217 }
218
219
220
221 // ADD ZOTERO ACCOUNT
222
223 else if (isset($_GET['image']))
224 {
225 global $wpdb;
226
227 $zp_image = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress_images WHERE citation_id='".trim($_GET['citation_id'])."'");
228
229 include('zotpress.image.php');
230 }
231
232
233
234 // HELP PAGE
235
236 else if (isset($_GET['help']))
237 {
238 include('zotpress.help.php');
239 }
240
241
242
243 // ADMIN VIEW CITATIONS
244
245 else
246 {
247 global $wpdb;
248
249 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC");
250
251 $zp_accounts_total = $wpdb->num_rows;
252
253
254 // FILTER PARAMETERS
255
256 // Account ID
257
258 global $account_id;
259
260 if (isset($_GET['account_id']))
261 if (trim($_GET['account_id']) != "")
262 $account_id = trim($_GET['account_id']);
263 else
264 $account_id = false;
265 else
266 $account_id = false;
267
268 // Collection ID
269
270 global $collection_id;
271
272 if (isset($_GET['collection_id']))
273 if (trim($_GET['collection_id']) != "")
274 $collection_id = trim($_GET['collection_id']);
275 else
276 $collection_id = false;
277 else
278 $collection_id = false;
279
280 // Tag Name
281
282 global $tag_name;
283
284 if (isset($_GET['tag_name']))
285 if (trim($_GET['tag_name']) != "")
286 $tag_name = trim($_GET['tag_name']);
287 else
288 $tag_name = false;
289 else
290 $tag_name = false;
291
292 // Limit
293
294 global $limit;
295
296 if (isset($_GET['limit']))
297 if (trim($_GET['limit']) != "")
298 $limit = trim($_GET['limit']);
299 else
300 $limit = "5";
301 else
302 $limit = "5";
303
304
305 // DISPLAY ADMIN CITATIONS
306
307 include('zotpress.default.php');
308 }
309
310
311 }
312
313 // ADMIN -----------------------------------------------------------------------------------------
314
315
316
317 // SHORTCODE -----------------------------------------------------------------------------------------
318
319 function Zotpress_func($atts) {
320 extract(shortcode_atts(array(
321
322 'api_user_id' => false,
323 'nickname' => false,
324 'author' => false,
325 'year' => false,
326
327 'data_type' => "items",
328
329 'collection_id' => false,
330 'item_key' => false,
331 'tag_name' => false,
332
333 'content' => "bib",
334 'style' => "apa",
335 'order' => false,
336 'sort' => false,
337 'limit' => "50",
338
339 'image' => "no",
340 'download' => "no"
341
342 ), $atts));
343
344 //ini_set('display_errors', 1);
345 //error_reporting(E_ALL);
346
347 // Format attritbutes
348 $api_user_id = str_replace('"','',html_entity_decode($api_user_id));
349 $nickname = str_replace('"','',html_entity_decode($nickname));
350 $author = str_replace('"','',html_entity_decode($author));
351 $year = str_replace('"','',html_entity_decode($year));
352
353 $data_type = str_replace('"','',html_entity_decode($data_type));
354
355 $collection_id = str_replace('"','',html_entity_decode($collection_id));
356 $item_key = str_replace('"','',html_entity_decode($item_key));
357 $tag_name = str_replace('"','',html_entity_decode($tag_name));
358
359 $content = str_replace('"','',html_entity_decode($content));
360 $style = str_replace('"','',html_entity_decode($style));
361 $order = str_replace('"','',html_entity_decode($order));
362 $sort = str_replace('"','',html_entity_decode($sort));
363 $limit = str_replace('"','',html_entity_decode($limit));
364
365 $image = str_replace('"','',html_entity_decode($image));
366 $download = str_replace('"','',html_entity_decode($download));
367
368 // Connect to database
369 global $wpdb;
370
371 if ($api_user_id != false)
372 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'");
373 else if ($nickname != false)
374 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'");
375 else
376 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC");
377
378 $zp_accounts_total = $wpdb->num_rows;
379 $zp_instance_id = "zotpress-".rand(100,999);
380
381 if ($zp_accounts_total > 0)
382 {
383 include('zotpress.shortcode.php');
384 return "<div id='".$zp_instance_id."' class='zp-Zotpress'><span class='zp-Loading'><span>loading</span></span><div class='zp-ZotpressInner'></div></div>\n";
385 }
386
387 $shortcode_displayed = true;
388 }
389
390 // SHORTCODE -----------------------------------------------------------------------------------------
391
392
393
394 // WIDGET ----------------------------------------------------------------------------------------------
395
396 class ZotpressWidget extends WP_Widget {
397
398 function ZotpressWidget()
399 {
400 $widget_ops = array('description' => __('Display your citations on your sidebar', 'zp-ZotpressWidget'));
401 parent::WP_Widget(false, __('Zotpress Widget'), $widget_ops);
402 }
403
404 function widget( $args, $instance )
405 {
406 extract( $args );
407
408 // ARGUMENTS
409 $title = apply_filters('widget_title', $instance['title'] );
410
411 $api_user_id = $instance['api_user_id'];
412 $nickname = isset( $instance['nickname'] ) ? $instance['nickname'] : false;
413 $author = isset( $instance['author'] ) ? $instance['author'] : false;
414
415 $data_type = isset( $instance['data_type'] ) ? $instance['data_type'] : "items";
416 $collection_id = isset( $instance['collection_id'] ) ? $instance['collection_id'] : false;
417 $item_key = isset( $instance['item_key'] ) ? $instance['item_key'] : false;
418 $tag_name = isset( $instance['tag_name'] ) ? $instance['tag_name'] : false;
419
420 $content = isset( $instance['content'] ) ? $instance['content'] : "bib";
421 $style = isset( $instance['style'] ) ? $instance['style'] : "apa";
422 $order = isset( $instance['order'] ) ? $instance['order'] : false;
423 $sort = isset( $instance['sort'] ) ? $instance['sort'] : false;
424 $limit = isset( $instance['limit'] ) ? $instance['limit'] : "5";
425
426 $image = isset( $instance['image'] ) ? $instance['image'] : "no";
427
428 // Required for theme
429 echo $before_widget;
430
431 if ($title)
432 echo $before_title . $title . $after_title;
433
434 // DISPLAY
435
436 if (!$shortcode_displayed)
437 {
438 // Connect to database
439 global $wpdb;
440
441 if ($api_user_id != false)
442 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'");
443 else if ($nickname != false)
444 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'");
445 else
446 $zp_accounts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC");
447 }
448
449 $zp_accounts_total = $wpdb->num_rows;
450 $zp_instance_id = "zotpress-".rand(100,999);
451
452 if ($zp_accounts_total > 0)
453 {
454 include('zotpress.shortcode.php');
455 echo "<div id='".$zp_instance_id."' class='zp-Zotpress zp-ZotpressWidget'><span class='zp-Loading'><span>loading</span></span><div class='zp-ZotpressInner'></div></div>\n";
456 }
457 else
458 {
459 echo "<div id='".$zp_instance_id."' class='zp-Zotpress zp-ZotpressWidget'>Sorry, no citations found.</div>\n";
460 }
461
462 // Required for theme
463 echo $after_widget;
464 }
465
466 function update( $new_instance, $old_instance )
467 {
468 $instance = $old_instance;
469
470 $instance['title'] = strip_tags( $new_instance['title'] );
471
472 $instance['api_user_id'] = strip_tags( $new_instance['api_user_id'] );
473 $instance['nickname'] = strip_tags($new_instance['nickname']);
474 $instance['author'] = str_replace(" ", "+", strip_tags($new_instance['author']));
475
476 $instance['data_type'] = strip_tags( $new_instance['data_type'] );
477 $instance['collection_id'] = strip_tags($new_instance['collection_id']);
478 $instance['item_key'] = strip_tags($new_instance['item_key']);
479 $instance['tag_name'] = str_replace(" ", "+", strip_tags($new_instance['tag_name']));
480
481 $instance['content'] = strip_tags( $new_instance['content'] );
482 $instance['style'] = strip_tags($new_instance['style']);
483 $instance['order'] = strip_tags($new_instance['order']);
484 $instance['sort'] = strip_tags($new_instance['sort']);
485 $instance['limit'] = strip_tags($new_instance['limit']);
486 if (intval($instance['limit']) > 99)
487 $instance['limit'] = "99";
488 if (trim($instance['limit']) == "")
489 $instance['limit'] = "5";
490
491 $instance['image'] = strip_tags($new_instance['image']);
492
493 return $instance;
494 }
495
496 function form( $instance )
497 {
498 $title = esc_attr( $instance['title'] );
499 ?>
500
501 <style type="text/css">
502 <!--
503 span.req {
504 color: #CC0066;
505 font-weight: bold;
506 font-size: 1.4em;
507 vertical-align: -20%;
508 }
509
510 div.zp-ZotpressWidget-Required {
511 border-radius: 10px;
512 -moz-border-radius: 10px;
513 background-color: #fafafa;
514 margin: 0 0 10px 0;
515 padding: 10px 10px 1px 10px;
516 }
517
518 div.zp-ZotpressWidget-Required .widefat {
519 width: 98%;
520 }
521 -->
522 </style>
523
524 <p>
525 <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label>
526 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" class="widefat" />
527 </p>
528
529 <div class="zp-ZotpressWidget-Required">
530
531 <p>
532 Fill in <strong>one</strong> of the below. Req'd.
533 </p>
534
535 <p>
536 <label for="<?php echo $this->get_field_id( 'api_user_id' ); ?>">API User/Group ID: <span class="req">*</span></label>
537 <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" />
538 </p>
539
540 <p>
541 <label for="<?php echo $this->get_field_id( 'nickname' ); ?>">Nickname: <span class="req">*</span></label>
542 <input id="<?php echo $this->get_field_id( 'nickname' ); ?>" name="<?php echo $this->get_field_name( 'nickname' ); ?>" value="<?php echo $instance['nickname']; ?>" class="widefat" />
543 </p>
544
545 </div>
546
547 <p>
548 <label for="<?php echo $this->get_field_id( 'data_type' ); ?>">Data Type:</label>
549 <select id="<?php echo $this->get_field_id( 'data_type' ); ?>" name="<?php echo $this->get_field_name( 'data_type' ); ?>" class="widefat">
550 <option <?php if ( 'items' == $instance['data_type'] ) echo 'selected="selected"'; ?>>items</option>
551 <option <?php if ( 'tags' == $instance['data_type'] ) echo 'selected="selected"'; ?>>tags</option>
552 <option <?php if ( 'collections' == $instance['data_type'] ) echo 'selected="selected"'; ?>>collections</option>
553 </select>
554 </p>
555
556 <p>
557 <label for="<?php echo $this->get_field_id( 'author' ); ?>">Enter Author to List by Author:</label>
558 <input id="<?php echo $this->get_field_id( 'author' ); ?>" name="<?php echo $this->get_field_name( 'author' ); ?>" value="<?php echo $instance['author']; ?>" class="widefat" />
559 </p>
560
561 <p>
562 <label for="<?php echo $this->get_field_id( 'collection_id' ); ?>">Enter Collection ID to List by Collection:</label>
563 <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" />
564 </p>
565
566 <p>
567 <label for="<?php echo $this->get_field_id( 'item_key' ); ?>">Enter Item Key to List by Citation:</label>
568 <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" />
569 </p>
570
571 <p>
572 <label for="<?php echo $this->get_field_id( 'tag_name' ); ?>">Enter Tag Name to List by Tag:</label>
573 <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" />
574 </p>
575
576 <p>
577 <label for="<?php echo $this->get_field_id( 'content' ); ?>">Content:</label>
578 <select id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" class="widefat">
579 <option <?php if ( 'bib' == $instance['content'] ) echo 'selected="selected"'; ?>>bib</option>
580 <option <?php if ( 'html' == $instance['content'] ) echo 'selected="selected"'; ?>>html</option>
581 </select>
582 </p>
583
584 <p>
585 <label for="<?php echo $this->get_field_id( 'style' ); ?>">Style:</label>
586 <input id="<?php echo $this->get_field_id( 'style' ); ?>" name="<?php echo $this->get_field_name( 'style' ); ?>" value="<?php echo $instance['style']; ?>" class="widefat" />
587 </p>
588
589 <p>
590 <label for="<?php echo $this->get_field_id( 'order' ); ?>">Order By:</label>
591 <input id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" value="<?php echo $instance['order']; ?>" class="widefat" />
592 </p>
593
594 <p>
595 <label for="<?php echo $this->get_field_id( 'sort' ); ?>">Sort Order:</label>
596 <select id="<?php echo $this->get_field_id( 'sort' ); ?>" name="<?php echo $this->get_field_name( 'sort' ); ?>" class="widefat">
597 <option <?php if ( 'desc' == $instance['sort'] ) echo 'selected="selected"'; ?>>desc</option>
598 <option <?php if ( 'asc' == $instance['sort'] ) echo 'selected="selected"'; ?>>asc</option>
599 </select>
600 </p>
601
602 <p>
603 <label for="<?php echo $this->get_field_id( 'limit' ); ?>">Limit:</label>
604 <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo $instance['limit']; ?>" class="widefat" />
605 </p>
606
607 <p>
608 <label for="<?php echo $this->get_field_id( 'image' ); ?>">Show Image?:</label>
609 <select id="<?php echo $this->get_field_id( 'image' ); ?>" name="<?php echo $this->get_field_name( 'image' ); ?>" class="widefat">
610 <option <?php if ( 'no' == $instance['image'] ) echo 'selected="selected"'; ?>>no</option>
611 <option <?php if ( 'yes' == $instance['image'] ) echo 'selected="selected"'; ?>>yes</option>
612 </select>
613 </p>
614
615 <?php
616 }
617 }
618
619 function ZotpressWidgetInit() {
620 register_widget( 'ZotpressWidget' );
621 }
622
623 // WIDGET ----------------------------------------------------------------------------------------------
624
625
626
627 // REGISTER ACTIONS ---------------------------------------------------------------------------------
628
629 if (isset($_GET['page']) && $_GET['page'] == 'Zotpress') {
630 add_action('admin_print_scripts', 'Zotpress_admin_scripts');
631 add_action('admin_print_styles', 'Zotpress_admin_styles');
632 add_action('admin_footer', 'Zotpress_admin_footer');
633 }
634
635 add_action('admin_menu', 'Zotpress_admin_menu');
636
637 add_shortcode('zotpress', 'Zotpress_func');
638 add_action( 'widgets_init', 'ZotpressWidgetInit' );
639
640 // REGISTER ACTIONS ---------------------------------------------------------------------------------
641
642
643 ?>