PluginProbe
IdeaPush / 8.72
IdeaPush v8.72
trunk 1.11 1.13 1.14 1.15 1.16 1.2 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.3 1.4 1.5 1.6 1.7 2.0 2.2 2.4 3.0 3.10 3.11 All 78 releases
ideapush / ideapush.php

ideapush.php in IdeaPush 8.72, at ideapush.php

1,386 lines 43.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Plugin Name: IdeaPush - Feature Request Manager
4 * Plugin URI: https://www.northernbeacheswebsites.com.au
5 * Description: IdeaPush is a feature request management system for WordPress
6 * Version: 8.72
7 * Author: Martin Gibson
8 * Text Domain: ideapush
9 * Support: https://www.northernbeacheswebsites.com.au/contact
10 * Licence: GPL2
11 */
12
13 // Assign global variables
14 global $ideapush_is_pro;
15
16 if(file_exists(dirname( __FILE__ ).'/inc/pro-ip')){
17 $ideapush_is_pro = "YES";
18 } else {
19 $ideapush_is_pro = "NO";
20 }
21
22 //the first YES/NO in the array is if the feature is pro, the second YES/NO in the array is if a save settings button is necessary
23 global $ideapush_pro_features;
24 $ideapush_pro_features = array('Boards' => array('NO','YES'),'Notifications' => array('NO','YES'), 'Statuses' => array('NO','YES'), 'Design' => array('NO','YES'), 'Idea Form' => array('NO','YES'), 'Tag Page' => array('NO','YES'), 'IdeaPush Support' => array('NO','NO'),'IdeaPush Pro' => array('YES','YES'),'Integrations' => array('YES','YES'));
25
26 //get plugin version number
27 function idea_push_plugin_get_version() {
28 if ( ! function_exists( 'get_plugins' ) )
29 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
30 $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) );
31 $plugin_file = basename( ( __FILE__ ) );
32 return $plugin_folder[$plugin_file]['Version'];
33 }
34
35
36 function idea_push_create_custom_post_type() {
37
38 //SVG of the icon
39 $menu_icon_svg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIyLjAuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMiIgYmFzZVByb2ZpbGU9InRpbnkiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIgoJIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjNzhDMTQ4IiBkPSJNMTAsMEM0LjUsMCwwLDQuNSwwLDEwczQuNSwxMCwxMCwxMHMxMC00LjUsMTAtMTBTMTUuNSwwLDEwLDB6IE04LjEsMTIuMWwtMS42LDEuNQoJYy0wLjIsMC4yLTAuNCwwLjMtMC43LDAuM2MtMC4zLDAtMC41LTAuMS0wLjctMC4zbC0xLjYtMS41Yy0wLjItMC4yLTAuMi0wLjYsMC0wLjljMC4yLTAuMiwwLjYtMC4yLDAuOSwwbDEuNCwxLjRsMS40LTEuNAoJQzcuMywxMS4xLDcuNSwxMSw3LjYsMTFzMC4zLDAuMSwwLjQsMC4yQzguMywxMS40LDguMywxMS44LDguMSwxMi4xeiBNOC4xLDlDNy45LDkuMSw3LjgsOS4yLDcuNiw5LjJTNy4zLDkuMSw3LjIsOUw1LjgsNy42TDQuNCw5CglDNC4yLDkuMiwzLjgsOS4yLDMuNiw5Yy0wLjItMC4yLTAuMi0wLjYsMC0wLjlsMS42LTEuNWMwLjItMC4yLDAuNC0wLjMsMC43LTAuM2MwLjMsMCwwLjUsMC4xLDAuNywwLjNsMS42LDEuNQoJQzguMyw4LjQsOC4zLDguOCw4LjEsOXogTTE1LjIsMTRoLTQuNmMtMC44LDAtMS40LTAuNi0xLjQtMS40YzAtMC44LDAuNi0xLjQsMS40LTEuNGg0LjZjMC44LDAsMS40LDAuNiwxLjQsMS40CglDMTYuNiwxMy4zLDE2LDE0LDE1LjIsMTR6IE0xNS4yLDkuMmgtNC42Yy0wLjgsMC0xLjQtMC42LTEuNC0xLjRjMC0wLjgsMC42LTEuNCwxLjQtMS40aDQuNmMwLjgsMCwxLjQsMC42LDEuNCwxLjQKCUMxNi42LDguNSwxNiw5LjIsMTUuMiw5LjJ6Ii8+Cjwvc3ZnPgo=';
40
41 // Set UI labels for Custom Post Type
42 $labels = array(
43 'name' => _x( 'Ideas', 'Post Type General Name', 'ideapush' ),
44 'singular_name' => _x( 'Idea', 'Post Type Singular Name', 'ideapush' ),
45 'menu_name' => __( 'IdeaPush', 'ideapush' ),
46 'parent_item_colon' => __( 'Parent Idea', 'ideapush' ),
47 'all_items' => __( 'All Ideas', 'ideapush' ),
48 'view_item' => __( 'View Idea', 'ideapush' ),
49 'add_new_item' => __( 'Add New Idea', 'ideapush' ),
50 'add_new' => __( 'Add New', 'ideapush' ),
51 'edit_item' => __( 'Edit Idea', 'ideapush' ),
52 'update_item' => __( 'Update Idea', 'ideapush' ),
53 'search_items' => __( 'Search Idea', 'ideapush' ),
54 'not_found' => __( 'Not Found', 'ideapush' ),
55 'not_found_in_trash' => __( 'Not found in Trash', 'ideapush' ),
56 );
57
58 // Set other options for Custom Post Type
59 $args = array(
60 'label' => __( 'ideas', 'ideapush' ),
61 'description' => __( 'IdeaPush ideas', 'ideapush' ),
62 'labels' => $labels,
63 // Features this CPT supports in Post Editor
64 // 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields',),
65 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'revisions','excerpt'),
66
67 // You can associate this CPT with a taxonomy or custom taxonomy.
68 'taxonomies' => array( 'idea-boards' ),
69 /* A hierarchical CPT is like Pages and can have
70 * Parent and child items. A non-hierarchical CPT
71 * is like Posts.
72 */
73 'hierarchical' => false,
74 'public' => true,
75 'show_ui' => true,
76 'show_in_menu' => true,
77 'show_in_nav_menus' => true,
78 'show_in_admin_bar' => true,
79 'menu_position' => 5,
80 'menu_icon' => $menu_icon_svg,
81 'can_export' => true,
82 'has_archive' => false,
83 'exclude_from_search' => false,
84 'publicly_queryable' => apply_filters( 'ideapush_display_single_ideas', true ),
85 'capability_type' => array('ip_idea','ip_ideas'),
86 'map_meta_cap' => true,
87 'show_in_rest' => true,
88 );
89
90 // Registering your Custom Post Type
91 register_post_type( 'idea', $args );
92
93 }
94
95 /* Hook into the 'init' action so that the function
96 * Containing our post type registration is not
97 * unnecessarily executed.
98 */
99
100 add_action( 'init', 'idea_push_create_custom_post_type', 0 );
101
102
103 //when activating or deactivating the plugin lets fluch the rewrite rules because otherwise the single post pages may produce an error
104
105 register_activation_hook( __FILE__, 'idea_push_flush_rewrites' );
106 function idea_push_flush_rewrites() {
107 // call your CPT registration function here (it should also be hooked into 'init')
108 idea_push_create_custom_post_type();
109 }
110
111
112
113
114
115
116
117
118
119 //run on activating the plugin
120 function idea_push_plugin_activate() {
121
122 // remove_role( 'idea_push_guest' );
123 add_role( 'idea_push_guest', 'IdeaPush Guest', array('read' => true, 'level_1' => true ));
124 add_role( 'idea_push_manager', 'IdeaPush Manager', array('read' => true, 'level_1' => true,'manage_idea_push_settings' => true ));
125 }
126 register_activation_hook( __FILE__, 'idea_push_plugin_activate' );
127
128
129 //adds new role to wordpress
130 //this is poorly implemented but I don't know a nicer way to do it because adding the role upon updating was not working
131 function idea_push_check_if_manager_role_exists(){
132 if(get_role("idea_push_manager") == null){
133 add_role( 'idea_push_manager', 'IdeaPush Manager', array('read' => true, 'level_1' => true,'manage_idea_push_settings' => true ));
134 }
135 }
136 add_action( 'admin_init', 'idea_push_check_if_manager_role_exists' );
137
138
139
140
141 //add role capabilities for custom post type
142 add_action('admin_init','idea_push_role_capabilities',999);
143 function idea_push_role_capabilities() {
144
145 // Add the roles you'd like to administer the custom post types
146 $roles = array('idea_push_manager','editor','administrator');
147 $capability_normal = 'ip_idea';
148 $capability_plural = 'ip_ideas';
149
150 // Loop through each role and assign capabilities
151 foreach($roles as $the_role) {
152
153 $role = get_role($the_role);
154
155 if($role){
156 $role->add_cap( 'read' );
157 $role->add_cap( 'manage_tags' );
158 $role->add_cap( 'edit_tags' );
159 $role->add_cap( 'read_'.$capability_normal);
160 $role->add_cap( 'delete_'.$capability_normal );
161 $role->add_cap( 'read_private_'.$capability_plural );
162 $role->add_cap( 'edit_'.$capability_normal );
163 $role->add_cap( 'edit_'.$capability_plural );
164 $role->add_cap( 'edit_others_'.$capability_plural );
165 $role->add_cap( 'edit_published_'.$capability_plural );
166 $role->add_cap( 'edit_private_'.$capability_plural );
167 $role->add_cap( 'publish_'.$capability_plural );
168 $role->add_cap( 'delete_others_'.$capability_plural );
169 $role->add_cap( 'delete_private_'.$capability_plural );
170 $role->add_cap( 'delete_published_'.$capability_plural );
171 $role->add_cap( 'delete_'.$capability_plural );
172 $role->add_cap( 'manage_idea_push_settings');
173 }
174
175
176 }
177 }
178
179
180
181
182
183 //run on deactivating the plugin
184 function idea_push_plugin_deactivate(){
185 remove_role( 'idea_push_guest' );
186 remove_role( 'idea_push_manager' );
187 }
188 register_deactivation_hook( __FILE__, 'idea_push_plugin_deactivate' );
189
190
191 //enable idea push managers to save the settings
192 function idea_push_manager_save_settings(){
193 return 'manage_idea_push_settings';
194 }
195 add_filter( 'option_page_capability_ip_notifications', 'idea_push_manager_save_settings');
196 add_filter( 'option_page_capability_ip_statuses', 'idea_push_manager_save_settings');
197 add_filter( 'option_page_capability_ip_design', 'idea_push_manager_save_settings');
198 add_filter( 'option_page_capability_ip_idea_form', 'idea_push_manager_save_settings');
199 add_filter( 'option_page_capability_ip_boards', 'idea_push_manager_save_settings');
200 add_filter( 'option_page_capability_ip_licence', 'idea_push_manager_save_settings');
201 add_filter( 'option_page_capability_ip_ideapush_support', 'idea_push_manager_save_settings');
202 add_filter( 'option_page_capability_ip_ideapush_pro', 'idea_push_manager_save_settings');
203 add_filter( 'option_page_capability_ip_integrations', 'idea_push_manager_save_settings');
204
205
206
207 //add a settings link on the plugin page
208 function idea_push_add_settings_link( $links ) {
209 $settings_link = '<a href="edit.php?post_type=idea&page=idea_push_settings">' . __( 'Settings','ideapush' ) . '</a>';
210 $ideas_link = '<a href="edit.php?post_type=idea">' . __( 'All Ideas','ideapush' ) . '</a>';
211 array_unshift( $links, $settings_link );
212 array_unshift( $links, $ideas_link );
213
214
215 return $links;
216 }
217 $plugin = plugin_basename( __FILE__ );
218 add_filter( "plugin_action_links_$plugin", 'idea_push_add_settings_link' );
219
220
221
222 //create boards taxonomy
223 add_action( 'init', 'idea_push_create_taxonomy_boards', 0 );
224
225 function idea_push_create_taxonomy_boards() {
226
227 // Labels part for the GUI
228
229 $labels = array(
230 'name' => _x( 'Boards', 'taxonomy general name' ),
231 'singular_name' => _x( 'Board', 'taxonomy singular name' ),
232 'search_items' => __( 'Search Boards' ),
233 'popular_items' => __( 'Popular Boards' ),
234 'all_items' => __( 'All Boards' ),
235 'parent_item' => null,
236 'parent_item_colon' => null,
237 'edit_item' => __( 'Edit Board' ),
238 'update_item' => __( 'Update Board' ),
239 'add_new_item' => __( 'Add New Board' ),
240 'new_item_name' => __( 'New Board Name' ),
241 'separate_items_with_commas' => __( 'Separate boards with commas' ),
242 'add_or_remove_items' => __( 'Add or remove boards' ),
243 'choose_from_most_used' => __( 'Choose from the most used boards' ),
244 'menu_name' => __( 'Boards' ),
245 );
246
247 // Now register the non-hierarchical taxonomy like tag
248
249 register_taxonomy('boards','idea',array(
250 'hierarchical' => true,
251 'labels' => $labels,
252 'show_ui' => true,
253 'show_in_menu' => false,
254 'show_in_nav_menus' => false,
255 'show_admin_column' => true,
256 'update_count_callback' => '_update_post_term_count',
257 'query_var' => true,
258 'rewrite' => array( 'slug' => 'ip-board' ),
259 'meta_box_cb' => 'idea_push_taxonomy_radio_meta_box',
260 'capabilities' => array (
261 'manage_terms' => 'read', //by default only admin
262 'edit_terms' => 'manage_tags',
263 'delete_terms' => 'manage_tags',
264 'assign_terms' => 'edit_tags'
265 ),
266 ));
267
268 }
269
270
271 //create tags taxonomy
272 add_action( 'init', 'idea_push_create_taxonomy_tags', 0 );
273
274 function idea_push_create_taxonomy_tags() {
275
276 // Labels part for the GUI
277
278 $labels = array(
279 'name' => _x( 'Tags', 'taxonomy general name' ),
280 'singular_name' => _x( 'Tag', 'taxonomy singular name' ),
281 'search_items' => __( 'Search tags' ),
282 'popular_items' => __( 'Popular Tags' ),
283 'all_items' => __( 'All Tags' ),
284 'parent_item' => null,
285 'parent_item_colon' => null,
286 'edit_item' => __( 'Edit Tag' ),
287 'update_item' => __( 'Update Tag' ),
288 'add_new_item' => __( 'Add New Tag' ),
289 'new_item_name' => __( 'New Tag Name' ),
290 'separate_items_with_commas' => __( 'Separate tags with commas' ),
291 'add_or_remove_items' => __( 'Add or remove tags' ),
292 'choose_from_most_used' => __( 'Choose from the most used tags' ),
293 'menu_name' => __( 'Tags' ),
294 );
295
296 // Now register the non-hierarchical taxonomy like tag
297
298 register_taxonomy('tags','idea',array(
299 'hierarchical' => false,
300 'labels' => $labels,
301 'show_ui' => true,
302 'show_in_menu' => true,
303 'show_in_nav_menus' => false,
304 'show_admin_column' => true,
305 'update_count_callback' => '_update_post_term_count',
306 'query_var' => true,
307 'rewrite' => array( 'slug' => 'ip-tag' ),
308 'capabilities' => array (
309 'manage_terms' => 'read', //by default only admin
310 'edit_terms' => 'manage_tags',
311 'delete_terms' => 'manage_tags',
312 'assign_terms' => 'edit_tags'
313 ),
314 ));
315
316 }
317
318
319
320 //create status taxonomy
321 add_action( 'init', 'idea_push_create_taxonomy_status', 0 );
322
323 function idea_push_create_taxonomy_status() {
324
325 // Labels part for the GUI
326
327 $labels = array(
328 'name' => _x( 'Status', 'taxonomy general name' ),
329 'singular_name' => _x( 'Status', 'taxonomy singular name' ),
330 'search_items' => __( 'Search Statuses' ),
331 'popular_items' => __( 'Popular Statuses' ),
332 'all_items' => __( 'All Statuses' ),
333 'parent_item' => null,
334 'parent_item_colon' => null,
335 'edit_item' => __( 'Edit Status' ),
336 'update_item' => __( 'Update Status' ),
337 'add_new_item' => __( 'Add New Status' ),
338 'new_item_name' => __( 'New Status Name' ),
339 'separate_items_with_commas' => __( 'Separate statuses with commas' ),
340 'add_or_remove_items' => __( 'Add or remove statuses' ),
341 'choose_from_most_used' => __( 'Choose from the most used statuses' ),
342 'menu_name' => __( 'Statuses' ),
343 );
344
345 // Now register the non-hierarchical taxonomy like tag
346
347 register_taxonomy('status','idea',array(
348 'hierarchical' => true,
349 'labels' => $labels,
350 'show_ui' => true,
351 'show_in_quick_edit' => true,
352 'show_in_menu' => true,
353 'show_in_nav_menus' => false,
354 'show_admin_column' => true,
355 'update_count_callback' => '_update_post_term_count',
356 'query_var' => true,
357 'rewrite' => array( 'slug' => 'ip-status' ),
358 'meta_box_cb' => 'idea_push_taxonomy_radio_meta_box_status',
359 'capabilities' => array (
360 'manage_terms' => 'read', //by default only admin
361 'edit_terms' => 'manage_tags',
362 'delete_terms' => 'manage_tags',
363 'assign_terms' => 'edit_tags'
364 ),
365 ));
366
367 }
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383 //create predefined statuses
384 add_action( 'init', 'idea_push_create_predefined_statuses', 0 );
385
386 function idea_push_create_predefined_statuses() {
387
388 if(get_term_by('name', 'Open', 'status') == false){
389 wp_insert_term(
390 'Open', // the term
391 'status', // the taxonomy
392 array(
393 'description'=> '',
394 'slug' => 'open'
395 )
396 );
397 }
398
399 if(get_term_by('name', 'Reviewed', 'status') == false){
400 wp_insert_term(
401 'Reviewed', // the term
402 'status', // the taxonomy
403 array(
404 'description'=> '',
405 'slug' => 'reviewed'
406 )
407 );
408 }
409
410 if(get_term_by('name', 'Approved', 'status') == false){
411 wp_insert_term(
412 'Approved', // the term
413 'status', // the taxonomy
414 array(
415 'description'=> '',
416 'slug' => 'approved'
417 )
418 );
419 }
420
421 if(get_term_by('name', 'Declined', 'status') == false){
422 wp_insert_term(
423 'Declined', // the term
424 'status', // the taxonomy
425 array(
426 'description'=> '',
427 'slug' => 'declined'
428 )
429 );
430 }
431
432 if(get_term_by('name', 'In Progress', 'status') == false){
433 wp_insert_term(
434 'In Progress', // the term
435 'status', // the taxonomy
436 array(
437 'description'=> '',
438 'slug' => 'in-progress'
439 )
440 );
441 }
442
443 if(get_term_by('name', 'Completed', 'status') == false){
444 wp_insert_term(
445 'Completed', // the term
446 'status', // the taxonomy
447 array(
448 'description'=> '',
449 'slug' => 'completed'
450 )
451 );
452 }
453
454 if(get_term_by('name', 'Duplicate', 'status') == false){
455 wp_insert_term(
456 'Duplicate', // the term
457 'status', // the taxonomy
458 array(
459 'description'=> '',
460 'slug' => 'duplicate'
461 )
462 );
463 }
464
465
466
467
468 }
469
470
471
472
473
474
475
476
477
478
479 //lets add our settings page
480 add_action( 'admin_menu', 'idea_push_add_settings_page' );
481 add_action( 'admin_init', 'idea_push_settings_init' );
482
483 function idea_push_add_settings_page() {
484
485 global $idea_push_wp_settings_page;
486
487 $idea_push_wp_settings_page = add_submenu_page('edit.php?post_type=idea', __('Settings','ideapush'), __('Settings','ideapush'),'manage_idea_push_settings', 'idea_push_settings', 'idea_push_settings_page_content');
488
489 }
490
491 //callback function of setting page
492 function idea_push_settings_page_content(){
493 require('inc/options/options-page-wrapper.php');
494 }
495
496 //Gets, sets and renders options
497 require('inc/options/options-output.php');
498
499 //Renders the board
500 require('inc/options/options-board-render.php');
501
502 //produces the shortcode
503 require('inc/shortcode/ideaboard-shortcode.php');
504
505 //function that generates list items
506 require('inc/shortcode/idea-list-items.php');
507
508 //function that creates the idea form
509 require('inc/shortcode/create-idea-form.php');
510
511 //function that creates the idea table header
512 require('inc/shortcode/idea-table-header.php');
513
514 //function that creates ideas
515 require('inc/functions/create-idea.php');
516
517 //function that creates votes
518 require('inc/functions/create-vote.php');
519
520 //function that changes the status
521 require('inc/functions/status-change.php');
522
523 //common functions that assist other functions run
524 require('inc/functions/helper-functions.php');
525
526 //function that creates a user
527 require('inc/functions/create-user.php');
528
529 //function that updates a user
530 require('inc/functions/update-user.php');
531
532 //function puts idea stuff on the single idea page
533 require('inc/functions/single-idea.php');
534
535 //function that adds our metabox
536 require('inc/functions/create-metaboxes.php');
537
538 //function that creates user profile image and votes remaining
539 require('inc/functions/user-profile-meta.php');
540
541
542
543 //get pro options
544 if($ideapush_is_pro=="YES"){
545 require('inc/pro-ip/idea-push-pro.php');
546 }
547
548
549
550
551 // Load admin style and scripts
552 function idea_push_register_admin_styles($hook)
553 {
554
555 global $pagenow;
556
557 global $idea_push_wp_settings_page;
558 global $idea_push_wp_reports_page;
559
560 if('profile.php' == $pagenow || 'user-edit.php' == $pagenow){
561 //display on user profile page
562 wp_enqueue_media();
563 wp_enqueue_script( 'user-profile-script-ideapush', plugins_url( '/inc/js/userprofile.js', __FILE__ ), array( 'jquery' ),idea_push_plugin_get_version());
564 }
565
566
567 if($hook != $idea_push_wp_reports_page && $hook != $idea_push_wp_settings_page ){
568 return;
569
570 } else {
571 //css
572 wp_enqueue_style( 'wp-color-picker' );
573 wp_enqueue_style( 'custom-admin-style-ideapush', plugins_url( '/inc/css/adminstyle.css', __FILE__ ),array(),idea_push_plugin_get_version());
574 wp_enqueue_style( 'font-awesome', plugins_url( '/inc/css/font-awesome.min.css', __FILE__ ));
575 wp_enqueue_style('tippy', plugins_url('/inc/css/tippy.css', __FILE__ ));
576
577 //js
578 wp_enqueue_script( 'custom-admin-script-ideapush', plugins_url( '/inc/js/adminscript.js', __FILE__ ), array( 'jquery','wp-color-picker' ),idea_push_plugin_get_version());
579 wp_enqueue_script('jquery-ui-dialog');
580 wp_enqueue_script('jquery-ui-accordion');
581 wp_enqueue_script('jquery-ui-tabs');
582 wp_enqueue_script('jquery-ui-datepicker');
583 wp_enqueue_script('jquery-ui-sortable');
584 wp_enqueue_script('jquery-form');
585
586 wp_enqueue_script('alertify', plugins_url('/inc/js/alertify.js', __FILE__ ), array( 'jquery'),null,true);
587 wp_enqueue_script('clipboard', plugins_url('/inc/js/clipboard.min.js', __FILE__ ), array( 'jquery'),'2.0.4');
588 wp_enqueue_script('tippy', plugins_url('/inc/js/tippy.min.js', __FILE__ ), array( 'jquery'),'1.0');
589
590 }
591
592
593
594
595
596
597
598
599 }
600 add_action( 'admin_enqueue_scripts', 'idea_push_register_admin_styles' );
601
602
603
604 // Load styles and scripts for the single idea page
605 function idea_push_register_admin_styles_single(){
606
607 global $post_type;
608
609 if('idea' != $post_type)
610 return;
611
612 //css
613
614 //js
615 wp_enqueue_script( 'custom-frontend-script-single-idea', plugins_url( '/inc/js/singleideascript.js', __FILE__ ), array( 'jquery'), idea_push_plugin_get_version());
616
617 }
618 add_action( 'admin_enqueue_scripts', 'idea_push_register_admin_styles_single' );
619
620
621
622
623
624
625
626
627
628
629
630
631
632 // Load frontend style and scripts
633 function idea_push_register_frontend_styles()
634 {
635 //get settings
636 $options = get_option('idea_push_settings');
637
638 //css
639 wp_register_style( 'custom-frontend-style-ideapush', plugins_url( '/inc/css/frontendstyle.css', __FILE__ ),array(),idea_push_plugin_get_version());
640 wp_register_style( 'ideapush-font', plugins_url( '/inc/css/ideapush-font.css', __FILE__ ));
641
642
643 //js
644 wp_register_script( 'custom-frontend-script-ideapush', plugins_url( '/inc/js/frontendscript.js', __FILE__ ), array( 'jquery'), idea_push_plugin_get_version());
645
646 wp_localize_script('custom-frontend-script-ideapush','get_new_ideas', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
647 wp_localize_script('custom-frontend-script-ideapush','submit_vote', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
648 wp_localize_script('custom-frontend-script-ideapush','create_user', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
649 wp_localize_script('custom-frontend-script-ideapush','header_render', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
650 wp_localize_script('custom-frontend-script-ideapush','form_render', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
651 wp_localize_script('custom-frontend-script-ideapush','create_idea', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
652 wp_localize_script('custom-frontend-script-ideapush','delete_idea', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
653 wp_localize_script('custom-frontend-script-ideapush','change_status', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
654 wp_localize_script('custom-frontend-script-ideapush','update_vote_counter', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
655 wp_localize_script('custom-frontend-script-ideapush','below_title_header', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
656 wp_localize_script('custom-frontend-script-ideapush','is_person_able_to_add_tag', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
657 wp_localize_script('custom-frontend-script-ideapush','update_user_profile', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
658
659
660 wp_register_script('alertify', plugins_url('/inc/js/alertify.js', __FILE__ ), array( 'jquery'),null,true);
661 wp_register_script('scroll-reveal', plugins_url('/inc/js/scrollreveal.min.js', __FILE__ ), array( 'jquery'));
662 wp_register_script('read-more', plugins_url('/inc/js/readmore.min.js', __FILE__ ), array( 'jquery'));
663 // wp_register_script('jquery-ui-dialog');
664
665
666
667 }
668 add_action( 'wp_enqueue_scripts', 'idea_push_register_frontend_styles' );
669
670
671
672
673
674
675
676 //create taxonomy item
677 //this is used to create a taxonomy for the board when the user creates a board from the plugin settings
678 function idea_push_add_taxonomy_item() {
679
680 //add better protection of this function
681 //check if user is admin or manager
682 $nonce = $_POST['nonce'];
683
684 if( wp_verify_nonce( $nonce, 'ideapush_create_board' ) ){
685
686 if(current_user_can('administrator') || current_user_can('idea_push_manager')){
687
688
689 //get options
690 $options = get_option('idea_push_settings');
691
692 //get is pro
693 global $ideapush_is_pro;
694
695 //get board name from ajax call
696 $boardName = idea_push_sanitization_validation($_POST['boardName'],'boardname');
697
698 if($boardName == false){
699 wp_die();
700 }
701
702
703
704
705 //lets first check if the board already exists
706 if(get_term_by('name', $boardName, 'boards') == false){
707
708 //lets check if licenced
709 if(($ideapush_is_pro == 'YES' && strlen($options['idea_push_purchase_email'])>0 && strlen($options['idea_push_order_id'])>0) || wp_count_terms('boards',array( "hide_empty" => 0 )) == 0){
710
711 idea_push_create_taxonomy_boards();
712
713 $boardNameSlug = strtolower($boardName);
714 $boardNameSlug = preg_replace('/\s+/', '-', $boardNameSlug);
715
716 wp_insert_term(
717 $boardName, // the term
718 'boards', // the taxonomy
719 array(
720 'description'=> '',
721 'slug' => $boardNameSlug
722 )
723 );
724
725 //lets return the item id
726
727 $getTermId = get_term_by('name', $boardName, 'boards');
728 $termId = $getTermId->term_id;
729
730 //return board html
731 echo idea_push_render_board('',$termId,$boardName);
732
733
734 } else {
735 echo 'NOT-PRO';
736 }
737
738
739
740
741 } else {
742
743 echo 'TERM-EXISTS';
744
745 }
746
747 } //end manager/admin check
748 } //end nonce check
749
750 //die
751 wp_die();
752
753
754 }
755 add_action( 'wp_ajax_add_taxonomy_item', 'idea_push_add_taxonomy_item' );
756
757
758
759
760
761
762
763
764
765 //lets delete existing taxonomies and rename others where necessary
766 add_action( 'wp_ajax_taxonomy_save_routine', 'idea_push_taxonomy_save_routine' );
767 function idea_push_taxonomy_save_routine() {
768
769
770 if(isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'taxonomy_save_routine')){
771 if (current_user_can('administrator') || current_user_can('manage_idea_push_settings')) {
772
773 //get board name from ajax call
774 $comparisonData = $_POST['comparisonData'];
775 $explodeTheData = explode("^^^", $comparisonData);
776
777 $boardIdArray = array();
778
779 foreach($explodeTheData as $board){
780
781 $anotherExplosion = explode("|", $board);
782 $boardId = $anotherExplosion[0];
783 $boardName = $anotherExplosion[1];
784
785 array_push($boardIdArray,$boardId);
786
787 //now lets change the name of existing taxonomies
788 $termObject = get_term($boardId,'boards');
789
790 //if the there's a match lets update the name if it has changed
791 if(!is_wp_error($termObject)){
792
793 $termName = $termObject->name;
794
795 if($boardName !== $termName){
796 //they don't match so lets update this term name with the new board name
797 wp_update_term($boardId,'boards',array('name' => $boardName));
798 }
799 }
800
801 }
802
803
804 //lets cycle through the existing terms in the taxonomy
805 $existingTerms = get_terms('boards',array( "hide_empty" => 0 ));
806
807 foreach($existingTerms as $term){
808
809 $termId = $term->term_id;
810
811 if(!in_array($termId,$boardIdArray)){
812 //if the term is not in our array delete it because it's not authorised to exist and it will cause confusion
813 wp_delete_term($termId,'boards');
814
815 }
816 }
817 }
818 }
819
820
821 //die
822 wp_die();
823
824
825 }
826
827
828
829
830
831
832
833
834
835 //add additional body class to the shortcode page for good measure
836 function idea_push_add_body_class($class) {
837
838 global $post;
839
840 if( isset($post->post_content) && has_shortcode( $post->post_content, 'ideapush' ) ) {
841 $class[] = 'idea-push';
842 }
843 return $class;
844 }
845 add_filter( 'body_class', 'idea_push_add_body_class' );
846
847
848
849 //add notification icon to menu item
850
851 add_action( 'admin_menu', 'idea_push_menu_bubble' );
852
853 function idea_push_menu_bubble() {
854 global $menu;
855
856 $count = idea_push_count_pending_ideas() + idea_push_count_ideas_review_status();
857
858
859 if ($count > 0) {
860
861 foreach ( $menu as $key => $value ) {
862
863 if ( $menu[$key][2] == 'edit.php?post_type=idea' ) {
864
865 $menu[$key][0] .= ' <span class="update-plugins"><span class="plugin-count">' . $count . '</span></span>';
866
867 return;
868 }
869 }
870 }
871 }
872
873
874 function idea_push_above_all_ideas_table() {
875
876 $screen = get_current_screen();
877
878 if ( $screen->id == 'edit-idea' ) {
879
880 echo '<style>
881
882 .idea-tasks div {
883 display: inline-block;
884 background: #fff;
885 padding: 10px;
886 border: 1px solid #e5e5e5;
887 border-radius: 6px;
888 margin-right: 10px;
889 margin-top: 10px;
890 margin-bottom: -10px;
891
892 }
893
894 .idea-tasks a {
895 text-decoration: none;
896
897 }
898
899 .pending-count, .reviewed-count {
900 display: inline-block;
901 vertical-align: top;
902 margin: 1px 0 0 5px;
903 padding: 0 5px;
904 min-width: 7px;
905 height: 17px;
906 border-radius: 11px;
907 background-color: #ca4a1f;
908 color: #fff;
909 font-size: 9px;
910 line-height: 17px;
911 text-align: center;
912 z-index: 26;
913
914 }
915
916 .column-status .open {
917 background-color: #4eb5e1;
918 color: #fff !important;
919 }
920
921 .column-status .in-progress {
922 background-color: #a7a9ac;
923 color: #fff !important;
924 }
925
926
927 .column-status .completed {
928 background-color: #414042;
929 color: #fff !important;
930 }
931
932 .column-status .reviewed {
933 background-color: #fbbf67;
934 color: #fff !important;
935 }
936
937 .column-status .approved {
938 background-color: #5eb46a;
939 color: #fff !important;
940 }
941
942 .column-status .declined {
943 background-color: #f05d55;
944 color: #fff !important;
945 }
946
947 .column-status .duplicate {
948 background-color: #e2e0e0;
949 color: #fff !important;
950 }
951
952
953 .column-status a {
954
955 text-transform: uppercase;
956 padding: 3px 6px;
957 border-radius: 3px;
958 font-weight: 600;
959 font-size: smaller;
960 }
961
962 </style>';
963
964 $pendingEditPage = get_admin_url().'edit.php?post_status=pending&post_type=idea';
965 $reviewEditPage = get_admin_url().'edit.php?post_type=idea&status=reviewed';
966
967 $countPendingIdeas = idea_push_count_pending_ideas();
968 $countReviewStatus = idea_push_count_ideas_review_status();
969
970
971 echo '<div class="idea-tasks">';
972
973 if($countPendingIdeas > 0){
974 echo '<div class="pending-approval">';
975 echo '<a href="'.$pendingEditPage.'" class="pending-count-description">'.__( 'Ideas Pending Release', 'ideapush' ).'</a>';
976 echo '<span class="pending-count">'.$countPendingIdeas.'</span>';
977 echo '</div>';
978 }
979
980 if($countReviewStatus > 0){
981 echo '<div class="reviewed-status">';
982 echo '<a href="'.$reviewEditPage.'" class="reviewed-count-description">'.__( 'Ideas Needing Review', 'ideapush' ).'</a>';
983 echo '<span class="reviewed-count">'.$countReviewStatus.'</span>';
984 echo '</div>';
985 }
986
987 echo '</div>';
988
989
990 }
991
992
993 }
994 add_action( 'admin_notices', 'idea_push_above_all_ideas_table' );
995
996
997
998
999
1000 add_filter( 'manage_edit-idea_columns', 'mycustomposttype_columns_definition' ) ;
1001
1002
1003 function mycustomposttype_columns_definition( $columns ) {
1004
1005 $new = array();
1006
1007 $columns['votes'] = __( 'Votes','ideapush');
1008 unset( $new['taxonomy-status'] );
1009 $columns['status'] = __( 'Status','ideapush');
1010
1011 $customOrder = array('cb','title', 'author','taxonomy-boards' ,'status','taxonomy-tags','votes', 'comments','date');
1012
1013
1014 foreach ($customOrder as $colname)
1015 $new[$colname] = $columns[$colname];
1016 return $new;
1017 }
1018
1019
1020
1021
1022 add_action( 'manage_idea_posts_custom_column' , 'idea_push_vote_column_content', 10, 2 );
1023
1024 function idea_push_vote_column_content( $column, $post_id ) {
1025 switch ( $column ) {
1026
1027 // display a thumbnail photo
1028 case 'votes' :
1029
1030 echo get_post_meta( $post_id , 'votes' , true );
1031 break;
1032
1033 case 'status' :
1034
1035 $getTerms = get_the_terms( $post_id, 'status' );
1036
1037 if($getTerms !== false){
1038 foreach($getTerms as $term) {
1039 $status = $term->name;
1040 }
1041
1042 $className = strtolower($status);
1043 $className = str_replace(" ","-",$className);
1044
1045 echo '<a class="'.$className.'" href="'.get_admin_url().'edit.php?post_type=idea&status='.$className.'">'.idea_push_translate_status($status).'</a>';
1046
1047 }
1048
1049 break;
1050
1051 }
1052 }
1053
1054
1055 add_filter( 'manage_edit-idea_sortable_columns', 'idea_push_sortable_vote_column' );
1056
1057 function idea_push_sortable_vote_column( $columns ) {
1058 $columns['votes'] = 'votes';
1059 return $columns;
1060 }
1061
1062
1063 add_action( 'pre_get_posts', 'idea_push_custom_orderby' );
1064
1065 function idea_push_custom_orderby( $query ) {
1066 if ( ! is_admin() )
1067 return;
1068
1069 $orderby = $query->get( 'orderby');
1070
1071 if ( 'votes' == $orderby ) {
1072 $query->set( 'meta_key', 'votes' );
1073 $query->set( 'orderby', 'meta_value_num' );
1074 }
1075
1076 }
1077
1078
1079
1080
1081 add_filter( 'template_include', 'idea_push_ip_tag_template', 99 );
1082
1083 function idea_push_ip_tag_template( $template ) {
1084
1085
1086
1087 if ( is_tax( 'tags' )) {
1088 $template = dirname( __FILE__ ) . '/inc/templates/ip-tag.php';
1089 return $template;
1090 } elseif( is_author() && is_post_type_archive( array( 'idea' ) ) ){
1091 $template = dirname( __FILE__ ) . '/inc/templates/ip-tag.php';
1092 return $template;
1093
1094 } else {
1095 return $template;
1096 }
1097
1098
1099 }
1100
1101
1102 function idea_push_languages() {
1103 load_plugin_textdomain( 'ideapush', false, 'ideapush/inc/languages' );
1104 }
1105 add_action('init', 'idea_push_languages');
1106
1107
1108
1109
1110
1111 //hides boards from WordPress search
1112 add_action( 'pre_get_posts', function ( $query ) {
1113
1114 if(get_option('idea_push_settings') && array_key_exists('idea_push_board_configuration',get_option('idea_push_settings'))){
1115
1116 //get options
1117 $options = get_option('idea_push_settings');
1118
1119 //get board configuration
1120 $boardConfiguration = $options['idea_push_board_configuration'];
1121
1122 if(isset($boardConfiguration) && strlen($boardConfiguration)>0){
1123
1124
1125 //split board configuration
1126 $splitBoardConfiguration = explode('^^^',$boardConfiguration);
1127
1128 $boardsToHide = array();
1129
1130 //cycle through boards
1131 foreach($splitBoardConfiguration as $boardConfig){
1132
1133 if( !empty($boardConfig) && strlen($boardConfig)>0){
1134
1135 $furtherSplitBoardConfiguration = explode('|',$boardConfig);
1136
1137 if(isset($furtherSplitBoardConfiguration[13]) && $furtherSplitBoardConfiguration[13] == 'Yes'){
1138
1139 $term = get_term($furtherSplitBoardConfiguration[0], 'boards' );
1140
1141 if( ! is_null($term) && ! is_wp_error($term) ){
1142 $slug = $term->slug;
1143 array_push($boardsToHide,$slug);
1144 }
1145 }
1146 }
1147
1148 }
1149
1150
1151 global $wp_the_query;
1152 if($query === $wp_the_query && $query->is_search() && !is_admin()) {
1153 $tax_query = array(
1154 array(
1155 'taxonomy' => 'boards',
1156 'field' => 'slug',
1157 'terms' => $boardsToHide,
1158 'operator' => 'NOT IN',
1159 )
1160 );
1161 $query->set( 'tax_query', $tax_query );
1162 }
1163
1164 }
1165 }
1166
1167 });
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181 //add custom css to the frontend
1182 function idea_push_custom_css() {
1183
1184 //get options
1185 $options = get_option('idea_push_settings');
1186
1187
1188 if(isset($options['idea_push_custom_css']) && strlen($options['idea_push_custom_css'])>0){
1189 wp_register_style( 'custom-frontend-style-ideapush', plugins_url( '/inc/css/frontendstyle.css', __FILE__ ),array(),idea_push_plugin_get_version());
1190 wp_add_inline_style( 'custom-frontend-style-ideapush', $options['idea_push_custom_css'] );
1191
1192 }
1193
1194 }
1195 add_action( 'wp_enqueue_scripts', 'idea_push_custom_css', 999 );
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213 //do pro updates
1214 //initialise the update check
1215 if($ideapush_is_pro == 'YES'){
1216
1217 require 'inc/pro-ip/plugin-update-checker/plugin-update-checker.php';
1218
1219 global $plugin_update_checker_ideapush;
1220 $plugin_update_checker_ideapush = Puc_v4_Factory::buildUpdateChecker(
1221 'https://northernbeacheswebsites.com.au/?update_action=get_metadata&update_slug=ideapush', //Metadata URL.
1222 __FILE__, //Full path to the main plugin file.
1223 'ideapush' //Plugin slug. Usually it's the same as the name of the directory.
1224 );
1225
1226
1227 //add queries to the update call
1228 $plugin_update_checker_ideapush->addQueryArgFilter('filter_update_checks_ideapush');
1229 function filter_update_checks_ideapush($queryArgs) {
1230
1231
1232 $pluginSettings = get_option('idea_push_settings');
1233
1234 if(isset($pluginSettings['idea_push_purchase_email']) && isset($pluginSettings['idea_push_order_id'])){
1235
1236 $purchaseEmailAddress = $pluginSettings['idea_push_purchase_email'];
1237 $orderId = $pluginSettings['idea_push_order_id'];
1238 $siteUrl = get_site_url();
1239 $siteUrl = parse_url($siteUrl);
1240 $siteUrl = $siteUrl['host'];
1241
1242 if (!empty($purchaseEmailAddress) && !empty($orderId)) {
1243 $queryArgs['purchaseEmailAddress'] = $purchaseEmailAddress;
1244 $queryArgs['orderId'] = $orderId;
1245 $queryArgs['siteUrl'] = $siteUrl;
1246 $queryArgs['productId'] = '9719';
1247 }
1248
1249 }
1250
1251 return $queryArgs;
1252 }
1253
1254
1255
1256 // define the puc_request_info_result-<slug> callback
1257 $plugin_update_checker_ideapush->addFilter(
1258 'request_info_result', 'filter_puc_request_info_result_slug_ideapush', 10, 2
1259 );
1260 function filter_puc_request_info_result_slug_ideapush( $plugininfo, $result ) {
1261 //get the message from the server and set as transient
1262 set_transient('ideapush-update',$plugininfo->{'message'},YEAR_IN_SECONDS * 1);
1263
1264 return $plugininfo;
1265 };
1266
1267
1268
1269
1270
1271
1272 $path = plugin_basename( __FILE__ );
1273
1274 add_action("after_plugin_row_{$path}", function( $plugin_file, $plugin_data, $status ) {
1275
1276 //get plugin settings
1277 $pluginSettings = get_option('idea_push_settings');
1278
1279
1280 if (!empty($pluginSettings['idea_push_purchase_email']) && !empty($pluginSettings['idea_push_order_id'])) {
1281
1282 $order_id = $pluginSettings['idea_push_order_id'];
1283
1284 //get transient
1285 $message = get_transient('ideapush-update');
1286
1287 if($message !== 'Yes' && $message !== false){
1288
1289 $purchaseLink = 'https://northernbeacheswebsites.com.au/ideapush-pro/';
1290
1291 if($message == 'Incorrect Details'){
1292 $displayMessage = 'The Order ID and Purchase ID you entered is not correct. Please double check the details you entered to receive product updates.';
1293 } elseif ($message == 'Licence Expired'){
1294 $displayMessage = 'Your licence has expired. Please <a href="'.$purchaseLink.'" target="_blank">purchase a new licence</a> to receive further updates for this plugin.';
1295 } elseif ($message == 'Website Mismatch') {
1296 $displayMessage = 'This plugin has already been registered on another website using your details. Under the licence terms this plugin can only be used on one website. Please <a href="'.$purchaseLink.'" target="_blank">click here</a> to purchase an additional licence. To change the website assigned to your licence, please click <a href="https://northernbeacheswebsites.com.au/my-account/view-order/'.$order_id.'/" target="_blank">here</a>.';
1297 } else {
1298 $displayMessage = '';
1299 }
1300
1301 echo '<tr class="plugin-update-tr active"><td colspan="3" class="plugin-update colspanchange"><div class="update-message notice inline notice-error notice-alt"><p class="installer-q-icon">'.$displayMessage.'</p></div></td></tr>';
1302
1303 }
1304
1305 } else {
1306
1307 echo '<tr class="plugin-update-tr active"><td colspan="3" class="plugin-update colspanchange"><div class="update-message notice inline notice-error notice-alt"><p class="installer-q-icon">Please enter your Order ID and Purchase ID in the plugin settings to receive automatics updates.</p></div></td></tr>';
1308
1309 }
1310
1311
1312 }, 10, 3 );
1313
1314 /**
1315 *
1316 *
1317 *
1318 * Force check for updates
1319 */
1320 function idea_push_force_check_for_updates(){
1321 global $plugin_update_checker_ideapush;
1322
1323 $plugin_update_checker_ideapush->checkForUpdates();
1324 }
1325
1326
1327 }
1328 /**
1329 *
1330 *
1331 *
1332 * Add custom links to plugin on plugins page
1333 */
1334 function idea_push_plugin_links( $links, $file ) {
1335 if ( strpos( $file, 'ideapush.php' ) !== false ) {
1336 $new_links = array(
1337 '<a href="https://northernbeacheswebsites.com.au/product/donate-to-northern-beaches-websites/" target="_blank">' . __('Donate') . '</a>',
1338 '<a href="https://wordpress.org/support/plugin/ideapush" target="_blank">' . __('Support Forum') . '</a>',
1339 );
1340 $links = array_merge( $links, $new_links );
1341 }
1342 return $links;
1343 }
1344 add_filter( 'plugin_row_meta', 'idea_push_plugin_links', 10, 2 );
1345 /**
1346 *
1347 *
1348 *
1349 * save tab memory
1350 */
1351 function idea_push_save_tab_memory() {
1352
1353 //get board name from ajax call
1354 $tabName = sanitize_text_field($_POST['tab']);
1355
1356 //set a transient for the tab memory
1357 set_transient('ideapush-tab-memory',$tabName,WEEK_IN_SECONDS*1);
1358
1359 echo 'SUCCESS';
1360
1361 //die
1362 wp_die();
1363
1364
1365 }
1366 add_action( 'wp_ajax_save_tab_memory', 'idea_push_save_tab_memory' );
1367 /**
1368 *
1369 *
1370 *
1371 * Change archive title for tag archives which have board text
1372 */
1373 add_filter( 'get_the_archive_title', 'idea_push_change_the_tag_title');
1374
1375 function idea_push_change_the_tag_title( $title ) {
1376
1377 if (strpos($title, 'BoardTag') !== false) {
1378 $title_exploded = explode('-',$title);
1379 $title = $title_exploded[2];
1380 }
1381
1382 return $title;
1383
1384 }
1385
1386 ?>