Plugin Directory

Changeset 2160513

Timestamp:
09/21/2019 08:24:52 AM (5 years ago)
Author:
zaheer01
Message:

Updated Main File

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bp-event-manager/trunk/bp-event-manager.php

    r2144937 r2160513  
    11<?php
    22
     3
     4
    35/*
    46
     7
     8
    59Plugin Name: BP Event Manager
    610
     11
     12
    713Plugin URI: http://wordpresswithzaheer.blogspot.com/p/plugin.html
    814
     15
     16
    917Description: Plug and Play Plugin Development. A person can create events for buddypress groups.
    1018
     19
     20
    1121Version: 1.0.0
    1222
     23
     24
    1325Author: Zaheer Abbas Aghani
    1426
     27
     28
    1529Author URI: https://profiles.wordpress.org/zaheer01/
    1630
     31
     32
    1733License: GPLv3 or later
    1834
     35
     36
    1937Text Domain: bp-event-manager
    2038
     39
     40
    2141Domain Path: /languages
    2242
     43
     44
    2345 */
    2446
     47
     48
    2549defined("ABSPATH") or die('You can\t access!');
    2650
     51
     52
    2753class BPEventManager {
    2854
     55
     56
    2957// check if buddypress is installed
    3058
    31     function bpem_if_buddypress_not_active($message) {
    32 
    33         if (!is_plugin_active('buddypress/bp-loader.php')) {
    34 
    35             echo $message .= "<div class='notice notice-error is-dismissible'><h4> Buddypress Plugin Activation Required for BP Event Manager Plugin.</h4></div>";
    36 
    37             deactivate_plugins('/bp-event-manager/bp-event-manager.php');
    38 
    39             wp_die();
     59
     60
     61function bpem_if_buddypress_not_active($message) {
     62    if (!is_plugin_active('buddypress/bp-loader.php')) {
     63    echo $message .= "<div class='notice notice-error is-dismissible'><h4> Buddypress Plugin Activation Required for BP Event Manager Plugin.</h4>
     64        <a href='".get_site_url().'/wp-admin/plugins.php'."'> Go Back</a>
     65    </div>";
     66    deactivate_plugins('/bp-event-manager/bp-event-manager.php');
     67    wp_die();
     68    }
     69}
     70
     71
     72
     73    function __construct() {
     74
     75
     76
     77        add_action('init', array($this, 'bpem_enqueue_script_front'));
     78
     79
     80
     81        add_action('init', array($this, 'bpem_start_from_here'));
     82
     83
     84
     85        add_action('init', array($this, 'bpem_register_dashboard_post_page'));
     86
     87
     88
     89        add_action('admin_enqueue_scripts', array($this, 'bpem_admin_enqueue_scripts'));
     90
     91
     92
     93        add_action('admin_menu', array($this, 'bpem_cpt_ui_for_admin_only'));
     94
     95
     96
     97        add_action('add_meta_boxes', array($this, 'bpem_attendees_add_meta_boxes'));
     98
     99
     100
     101        add_action('plugins_loaded', array($this, 'load_textdomain'));
     102
     103        add_action( 'admin_init', array($this,'bpem_if_buddypress_not_active' ));
     104
     105        add_action('admin_footer', array($this, 'bpem_deactivate_scripts'));
     106
     107
     108
     109        add_action('widgets_init', array($this, 'bpem_all_events_in_calendar'));
     110
     111
     112
     113        add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'bpem_plugin_action_links'));
     114
     115
     116
     117        /*add_filter('bp_blogs_record_post_post_types', array($this, 'activity_publish_custom_post_types'), 1, 1);
     118
     119
     120
     121        add_filter('bp_blogs_activity_new_post_action', array($this, 'record_cpt_activity_action'), 1, 3);*/
     122
     123
     124
     125    }
     126
     127
     128
     129// Activate plugin
     130
     131
     132
     133    function bpem_activate() {
     134
     135
     136
     137        flush_rewrite_rules();
     138
     139        add_post_type_support('bpem_event', 'buddypress-activity');
     140
     141    }
     142
     143
     144
     145    public function load_textdomain() {
     146
     147
     148
     149        load_plugin_textdomain('bpem-plugin', false, basename(dirname(__FILE__)) . '/languages/');
     150
     151
     152
     153    }
     154
     155
     156
     157//All Plugin files
     158
     159
     160
     161    function bpem_start_from_here() {
     162
     163
     164
     165        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-form.php';
     166
     167        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-form-response.php';
     168
     169        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_persons_who_attend_event.php';
     170
     171        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-list-of-attendees.php';
     172
     173        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-calendar.php';
     174
     175        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-further-details.php';
     176
     177        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_leave_event.php';
     178
     179        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-list-events.php';
     180
     181        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_event_update_response.php';
     182
     183        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_event_delete_response.php';
     184
     185        require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_event_info.php';
     186
     187
     188
     189    }
     190
     191
     192
     193// Enqueue Style and Scripts
     194
     195
     196
     197    function bpem_enqueue_script_front() {
     198
     199
     200
     201//Style
     202
     203
     204
     205        wp_enqueue_style('bpem-style', plugins_url('inc/css/bpem-style.css', __FILE__), '1.0.0', 'all');
     206
     207
     208
     209        wp_enqueue_style('bpem-jquery-ui', plugins_url('inc/css/jquery-ui.css', __FILE__), false, "1.9.0", false);
     210
     211
     212
     213        wp_enqueue_style('bpem-timepicker', plugins_url('inc/css/jquery.timepicker.min.css', __FILE__), '1.14.11', 'all');
     214
     215
     216
     217        wp_enqueue_style('font-awesome', plugins_url('inc/css/font-awesome-4.7.0/css/font-awesome.min.css', __FILE__), '4.7.0', 'all');
     218
     219
     220
     221        wp_enqueue_style('bpem-fc', plugins_url('inc/css/fullcalendar.min.css', __FILE__), '2.3.2', 'all');
     222
     223
     224
     225        wp_enqueue_style('bpem-pagination', plugins_url('inc/css/simplePagination.min.css', __FILE__), '1.6', 'all');
     226
     227
     228
     229// JS Scripts
     230
     231
     232
     233        wp_enqueue_script('fd-validate', 'https://cdn.jsdelivr.net/npm/jquery-validation@1.19.0/dist/jquery.validate.min.js', array('jquery'), '', true);
     234
     235
     236
     237        wp_enqueue_script('bpem-timepicker', plugins_url('inc/js/jquery.timepicker.min.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '1.11.14', true);
     238
     239
     240
     241        wp_enqueue_script('bpem-script', plugins_url('inc/js/bpem_script.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '1.0.0', true);
     242
     243
     244
     245        wp_localize_script('bpem-script', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
     246
     247
     248
     249        wp_enqueue_style('jquery-ui-datepicker');
     250
     251
     252
     253        wp_enqueue_style('wp-color-picker');
     254
     255
     256
     257        wp_enqueue_script('wp-color-picker');
     258
     259
     260
     261        wp_enqueue_media();
     262
     263
     264
     265        wp_enqueue_script('moments', plugins_url('inc/js/moment.min.js', __FILE__), array('jquery'), '2.10.6', true);
     266
     267
     268
     269        wp_enqueue_script('bpem-clndr', plugins_url('inc/js/fullcalendar.min.js', __FILE__), array('jquery'), '2.3.2', true);
     270
     271
     272
     273        wp_enqueue_script('bpem-pagination', plugins_url('inc/js/jquery.simplePagination.js', __FILE__), array('jquery'), '1.6', true);
     274
     275
     276
     277    }
     278
     279
     280
     281//Enqueue style and script for admin
     282
     283
     284
     285    function bpem_admin_enqueue_scripts() {
     286
     287
     288
     289        wp_enqueue_style('bpem-admin', plugins_url('inc/css/admin-style.css', __FILE__), '1.0.0', 'all');
     290
     291
     292
     293    }
     294
     295
     296
     297// Register post type
     298
     299
     300
     301    function bpem_register_dashboard_post_page() {
     302
     303
     304
     305        require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem-post-type.php';
     306
     307
     308
     309        require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem-admin-settings-page.php';
     310
     311
     312
     313        require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem_remove_attendy.php';
     314
     315
     316
     317    }
     318
     319
     320
     321// Remove events tab if user is not admin
     322
     323
     324
     325    function bpem_cpt_ui_for_admin_only() {
     326
     327
     328
     329        if (!current_user_can('administrator')):
     330
     331
     332
     333            remove_menu_page('edit.php?post_type=bpem_event');
     334
     335
     336
     337        endif;
     338
     339
     340
     341    }
     342
     343
     344
     345//List of attendees in dashboard
     346
     347
     348
     349    function bpem_attendees_add_meta_boxes() {
     350
     351
     352
     353        add_meta_box('bpem_meta_box_attendees', 'Event Attendees', array($this, 'bpem_list_display_attendees'), 'bpem_event', 'side', 'low');
     354
     355
     356
     357    } //bpem_attendees_add_meta_boxes
     358
     359
     360
     361//List of attendees in dashboard
     362
     363
     364
     365    function bpem_list_display_attendees() {
     366
     367
     368
     369        global $post;
     370
     371
     372
     373        $user_ids = get_post_meta($post->ID, 'event_attend_id');
     374
     375
     376
     377        $count = count(array_filter($user_ids));
     378
     379
     380
     381        echo "<h4 class='attandees'> Attandees(" . $count . ")</h4> ";
     382
     383
     384
     385        sprintf(__('You can visit the page by clicking <a href="%s">here</a>.', 'bp-event-manager'), 'http://www.google.com');
     386
     387
     388
     389        $i = 0;
     390
     391
     392
     393        echo "<div class='wrap_bx'>";
     394
     395
     396
     397        foreach ($user_ids as $user_id) {
     398
     399
     400
     401            $avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'width' => 100, 'height' => 100, 'class' => 'avatar', 'html' => false));
     402
     403
     404
     405            echo "<div class='box'><a href='#' class='remove_attendy' user-id='" . $user_id . "' event-id='" . $post->ID . "'>x</a > <a href='" . bp_core_get_user_domain($user_id) . "' class='box_attendee' target='_blank'>";
     406
     407
     408
     409            echo "<img src='" . $avatar . "' alt=" . bp_core_get_username($user_id) . " title=" . bp_core_get_username($user_id) . ">";
     410
     411
     412
     413            echo "</a></div>";
     414
     415
     416
     417            $i++;
     418
     419
    40420
    41421        }
    42422
    43     }
    44 
    45     function __construct() {
    46 
    47         add_action('init', array($this, 'bpem_enqueue_script_front'));
    48 
    49         add_action('init', array($this, 'bpem_start_from_here'));
    50 
    51         add_action('init', array($this, 'bpem_register_dashboard_post_page'));
    52 
    53         add_action('admin_enqueue_scripts', array($this, 'bpem_admin_enqueue_scripts'));
    54 
    55         add_action('admin_menu', array($this, 'bpem_cpt_ui_for_admin_only'));
    56 
    57         add_action('add_meta_boxes', array($this, 'bpem_attendees_add_meta_boxes'));
    58 
    59         add_action('plugins_loaded', array($this, 'load_textdomain'));
    60 
    61         add_action('admin_footer', array($this, 'bpem_deactivate_scripts'));
    62 
    63         add_action('widgets_init', array($this, 'bpem_all_events_in_calendar'));
    64 
    65         add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'bpem_plugin_action_links'));
    66 
    67         /*add_filter('bp_blogs_record_post_post_types', array($this, 'activity_publish_custom_post_types'), 1, 1);
    68 
    69         add_filter('bp_blogs_activity_new_post_action', array($this, 'record_cpt_activity_action'), 1, 3);*/
    70 
    71     }
    72 
    73 // Activate plugin
    74 
    75     function bpem_activate() {
    76 
    77         flush_rewrite_rules();
    78         add_post_type_support('bpem_event', 'buddypress-activity');
    79     }
    80 
    81     public function load_textdomain() {
    82 
    83         load_plugin_textdomain('bpem-plugin', false, basename(dirname(__FILE__)) . '/languages/');
    84 
    85     }
    86 
    87 //All Plugin files
    88 
    89     function bpem_start_from_here() {
    90 
    91         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-form.php';
    92         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-form-response.php';
    93         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_persons_who_attend_event.php';
    94         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-list-of-attendees.php';
    95         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-calendar.php';
    96         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-event-further-details.php';
    97         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_leave_event.php';
    98         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem-list-events.php';
    99         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_event_update_response.php';
    100         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_event_delete_response.php';
    101         require_once plugin_dir_path(__FILE__) . 'bpem-front/bpem_event_info.php';
    102 
    103     }
    104 
    105 // Enqueue Style and Scripts
    106 
    107     function bpem_enqueue_script_front() {
    108 
    109 //Style
    110 
    111         wp_enqueue_style('bpem-style', plugins_url('inc/css/bpem-style.css', __FILE__), '1.0.0', 'all');
    112 
    113         wp_enqueue_style('bpem-jquery-ui', plugins_url('inc/css/jquery-ui.css', __FILE__), false, "1.9.0", false);
    114 
    115         wp_enqueue_style('bpem-timepicker', plugins_url('inc/css/jquery.timepicker.min.css', __FILE__), '1.14.11', 'all');
    116 
    117         wp_enqueue_style('font-awesome', plugins_url('inc/css/font-awesome-4.7.0/css/font-awesome.min.css', __FILE__), '4.7.0', 'all');
    118 
    119         wp_enqueue_style('bpem-fc', plugins_url('inc/css/fullcalendar.min.css', __FILE__), '2.3.2', 'all');
    120 
    121         wp_enqueue_style('bpem-pagination', plugins_url('inc/css/simplePagination.min.css', __FILE__), '1.6', 'all');
    122 
    123 // JS Scripts
    124 
    125         wp_enqueue_script('fd-validate', 'https://cdn.jsdelivr.net/npm/jquery-validation@1.19.0/dist/jquery.validate.min.js', array('jquery'), '', true);
    126 
    127         wp_enqueue_script('bpem-timepicker', plugins_url('inc/js/jquery.timepicker.min.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '1.11.14', true);
    128 
    129         wp_enqueue_script('bpem-script', plugins_url('inc/js/bpem_script.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '1.0.0', true);
    130 
    131         wp_localize_script('bpem-script', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
    132 
    133         wp_enqueue_style('jquery-ui-datepicker');
    134 
    135         wp_enqueue_style('wp-color-picker');
    136 
    137         wp_enqueue_script('wp-color-picker');
    138 
    139         wp_enqueue_media();
    140 
    141         wp_enqueue_script('moments', plugins_url('inc/js/moment.min.js', __FILE__), array('jquery'), '2.10.6', true);
    142 
    143         wp_enqueue_script('bpem-clndr', plugins_url('inc/js/fullcalendar.min.js', __FILE__), array('jquery'), '2.3.2', true);
    144 
    145         wp_enqueue_script('bpem-pagination', plugins_url('inc/js/jquery.simplePagination.js', __FILE__), array('jquery'), '1.6', true);
    146 
    147     }
    148 
    149 //Enqueue style and script for admin
    150 
    151     function bpem_admin_enqueue_scripts() {
    152 
    153         wp_enqueue_style('bpem-admin', plugins_url('inc/css/admin-style.css', __FILE__), '1.0.0', 'all');
    154 
    155     }
    156 
    157 // Register post type
    158 
    159     function bpem_register_dashboard_post_page() {
    160 
    161         require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem-post-type.php';
    162 
    163         require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem-admin-settings-page.php';
    164 
    165         require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem_remove_attendy.php';
    166 
    167     }
    168 
    169 // Remove events tab if user is not admin
    170 
    171     function bpem_cpt_ui_for_admin_only() {
    172 
    173         if (!current_user_can('administrator')):
    174 
    175             remove_menu_page('edit.php?post_type=bpem_event');
    176 
    177         endif;
    178 
    179     }
    180 
    181 //List of attendees in dashboard
    182 
    183     function bpem_attendees_add_meta_boxes() {
    184 
    185         add_meta_box('bpem_meta_box_attendees', 'Event Attendees', array($this, 'bpem_list_display_attendees'), 'bpem_event', 'side', 'low');
    186 
    187     } //bpem_attendees_add_meta_boxes
    188 
    189 //List of attendees in dashboard
    190 
    191     function bpem_list_display_attendees() {
    192 
    193         global $post;
    194 
    195         $user_ids = get_post_meta($post->ID, 'event_attend_id');
    196 
    197         $count = count(array_filter($user_ids));
    198 
    199         echo "<h4 class='attandees'> Attandees(" . $count . ")</h4> ";
    200 
    201         sprintf(__('You can visit the page by clicking <a href="%s">here</a>.', 'bp-event-manager'), 'http://www.google.com');
    202 
    203         $i = 0;
    204 
    205         echo "<div class='wrap_bx'>";
    206 
    207         foreach ($user_ids as $user_id) {
    208 
    209             $avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'width' => 100, 'height' => 100, 'class' => 'avatar', 'html' => false));
    210 
    211             echo "<div class='box'><a href='#' class='remove_attendy' user-id='" . $user_id . "' event-id='" . $post->ID . "'>x</a > <a href='" . bp_core_get_user_domain($user_id) . "' class='box_attendee' target='_blank'>";
    212 
    213             echo "<img src='" . $avatar . "' alt=" . bp_core_get_username($user_id) . " title=" . bp_core_get_username($user_id) . ">";
    214 
    215             echo "</a></div>";
    216 
    217             $i++;
     423
     424
     425        echo "</div>";
     426
     427
     428
     429    }
     430
     431
     432
     433    //bpem_list_display_attendees
     434
     435
     436
     437    public function bpem_plugin_action_links($links) {
     438
     439
     440
     441        $plugin_links = array(
     442
     443
     444
     445            '<a href="' . admin_url('edit.php?post_type=bpem_event&page=bp_event_manager_settings') . '">' . __('Settings', 'bp-event-manager') . '</a>',
     446
     447
     448
     449            '<a target="_blank" href="https://wordpress.org/support/plugin/bp-event-manager/">' . __('Support', 'bp-event-manager') . '</a>',
     450
     451
     452
     453        );
     454
     455
     456
     457        if (array_key_exists('deactivate', $links)) {
     458
     459
     460
     461            $links['deactivate'] = str_replace('<a', '<a class="bpem-deactivate-link"', $links['deactivate']);
     462
     463
    218464
    219465        }
    220466
    221         echo "</div>";
    222 
    223     }
    224 
    225     //bpem_list_display_attendees
    226 
    227     public function bpem_plugin_action_links($links) {
    228 
    229         $plugin_links = array(
    230 
    231             '<a href="' . admin_url('edit.php?post_type=bpem_event&page=bp_event_manager_settings') . '">' . __('Settings', 'bp-event-manager') . '</a>',
    232 
    233             '<a target="_blank" href="https://wordpress.org/support/plugin/bp-event-manager/">' . __('Support', 'bp-event-manager') . '</a>',
     467
     468
     469        return array_merge($plugin_links, $links);
     470
     471
     472
     473    }
     474
     475
     476
     477    private function bepm_get_uninstall_comments() {
     478
     479
     480
     481        $reasons = array(
     482
     483
     484
     485            array(
     486
     487
     488
     489                'id' => 'used-it',
     490
     491
     492
     493                'text' => __('Can You Please Review ?  because  we want to improve our plugin.', 'bp-event-manager'),
     494
     495
     496
     497                'type' => 'reviewhtml',
     498
     499
     500
     501            ),
     502
     503
    234504
    235505        );
    236506
    237         if (array_key_exists('deactivate', $links)) {
    238 
    239             $links['deactivate'] = str_replace('<a', '<a class="bpem-deactivate-link"', $links['deactivate']);
     507
     508
     509        return $reasons;
     510
     511
     512
     513    }
     514
     515
     516
     517    public function bpem_deactivate_scripts() {
     518
     519
     520
     521        global $pagenow;
     522
     523
     524
     525        if ('plugins.php' != $pagenow) {
     526
     527
     528
     529            return;
     530
     531
    240532
    241533        }
    242534
    243         return array_merge($plugin_links, $links);
    244 
    245     }
    246 
    247     private function bepm_get_uninstall_comments() {
    248 
    249         $reasons = array(
    250 
    251             array(
    252 
    253                 'id' => 'used-it',
    254 
    255                 'text' => __('Can You Please Review ?  because  we want to improve our plugin.', 'bp-event-manager'),
    256 
    257                 'type' => 'reviewhtml',
    258 
    259             ),
    260 
    261         );
    262 
    263         return $reasons;
    264 
    265     }
    266 
    267     public function bpem_deactivate_scripts() {
    268 
    269         global $pagenow;
    270 
    271         if ('plugins.php' != $pagenow) {
    272 
    273             return;
    274 
    275         }
     535
    276536
    277537        $reasons = $this->bepm_get_uninstall_comments();
    278538
     539
     540
    279541        ?>
    280542
    281543
    282544
     545
     546
     547
     548
    283549<div class="bpem-review-box" id="bpem-review-boxx">
    284550
    285551
    286552
     553
     554
     555
     556
    287557    <div class="bpem-modal-wrap">
    288558
    289559
    290560
     561
     562
     563
     564
    291565        <div class="bpem-modal-header">
    292566
    293567
    294568
     569
     570
     571
     572
    295573            <h3><?php _e('Help Us:', 'bp-event-manager');?></h3>
    296574
    297575
    298576
     577
     578
     579
     580
    299581        </div>
    300582
    301583
    302584
     585
     586
     587
     588
    303589        <div class="bpem-modal-body">
    304590
    305591
    306592
     593
     594
    ��595
     596
    307597            <ul class="reasons">
    308598
    309599
    310600
     601
     602
     603
     604
    311605                <?php foreach ($reasons as $reason) {?>
    312606
    313607
    314608
     609
     610
     611
     612
    315613                    <li data-type="<?php echo esc_attr($reason['type']); ?>" data-placeholder="<?php echo esc_attr($reason['placeholder']); ?>">
    316614
    317615
    318616
     617
     618
     619
     620
    319621                        <label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
    320622
    321623
    322624
     625
     626
     627
     628
    323629                    </li>
    324630
    325631
    326632
     633
     634
     635
     636
    327637                <?php }?>
    328638
    329639
    330640
     641
     642
     643
     644
    331645            </ul>
    332646
    333647
    334648
     649
     650
     651
     652
    335653        </div>
    336654
    337655
    338656
     657
     658
     659
     660
    339661        <div class="bpem-modal-footer">
    340662
    341663
    342664
     665
     666
     667
     668
    343669            <button class="button-primary bpem-model-submit"><?php _e('No Deactivate', 'bp-event-manager');?></button>
    344670
    345671
    346672
     673
     674
     675
     676
    347677            <button class="button-secondary bpem-model-cancel"><?php _e('Cancel', 'bp-event-manager');?></button>
    348678
    349679
    350680
     681
     682
     683
     684
    351685        </div>
    352686
    353687
    354688
     689
     690
     691
     692
    355693    </div>
    356694
    357695
    358696
     697
     698
     699
     700
    359701</div>
    360702
     
    365707
    366708
     709
     710
     711
     712
     713
     714
     715
     716
    367717<script type="text/javascript">
    368718
    369719
    370720
     721
     722
     723
     724
    371725    (function ($) {
     726
    372727        $(function () {
     728
    373729        var modal = $('#bpem-review-boxx');
     730
    374731        var deactivateLink = '';
    375732
     733
     734
    376735        $('#the-list').on('click', 'a.bpem-deactivate-link', function (e) {
     736
    377737            e.preventDefault();
     738
    378739            modal.addClass('modal-active');
     740
    379741            deactivateLink = $(this).attr('href');
     742
    380743            modal.find('a.dont-bother-me').attr('href', deactivateLink).css('float', 'left');
     744
    381745        });
    382746
     747
     748
    383749    $('#bpem-review-boxx').on('click', 'a.review-and-deactivate', function (e) {
     750
    384751        e.preventDefault();
     752
    385753            window.open("https://wordpress.org/support/plugin/bp-event-manager/reviews/#new-post");
     754
    386755        window.location.href = deactivateLink;
     756
    387757    });
    388758
    389759
    390760
     761
     762
     763
     764
    391765            modal.on('click', 'button.bpem-model-cancel', function (e) {
    392766
    393767
    394768
     769
     770
     771
     772
    395773                e.preventDefault();
    396774
    397775
    398776
     777
     778
     779
     780
    399781                modal.removeClass('modal-active');
    400782
    401783
    402784
     785
     786
     787
     788
    403789            });
    404790
    405791
    406792
     793
     794
     795
     796
    407797            modal.on('click', 'input[type="radio"]', function () {
    408798
    409799
    410800
     801
     802
     803
     804
    411805                var parent = $(this).parents('li:first');
    412806
    413807
    414808
     809
     810
     811
     812
    415813                modal.find('.reason-input').remove();
    416814
    417815
    418816
     817
     818
     819
     820
    419821                var inputType = parent.data('type'),
    420822
    421823
    422824
     825
     826
     827
     828
    423829                        inputPlaceholder = parent.data('placeholder');
    424830
    425831
    426832
     833
     834
     835
     836
    427837                if ('reviewhtml' === inputType) {
    428838
    429839
    430840
     841
     842
     843
     844
    431845                    var reasonInputHtml = '<div class="reviewlink"><a href="#" target="_blank" class="review-and-deactivate"><?php _e('Deactivate and leave a review', 'bp-event-manager');?> <span class="xa-bpem-rating-link"> &#9733;&#9733;&#9733;&#9733;&#9733; </span></a></div>';
    432846
    433847
    434848
     849
     850
     851
     852
    435853                } else {
    436854
    437855
    438856
     857
     858
     859
     860
    439861                    var reasonInputHtml = '<div class="reason-input">' + (('text' === inputType) ? '<input type="text" class="input-text" size="40" />' : '<textarea rows="5" cols="45"></textarea>') + '</div>';
    440862
    441863
    442864
     865
     866
     867
     868
    443869                }
    444870
    445871
    446872
     873
     874
     875
     876
    447877                if (inputType !== '') {
    448878
    449879
    450880
     881
     882
     883
     884
    451885                    parent.append($(reasonInputHtml));
    452886
    453887
    454888
     889
     890
     891
     892
    455893                    parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
    456894
    457895
    458896
     897
     898
     899
     900
    459901                }
    460902
    461903
    462904
     905
     906
     907
     908
    463909            });
    464910
     
    469915
    470916
     917
     918
     919
     920
     921
     922
     923
     924
    471925            modal.on('click', 'button.bpem-model-submit', function (e) {
    472926
    473927
    474928
     929
     930
     931
     932
    475933                e.preventDefault();
    476934
    477935
    478936
     937
     938
     939
     940
    479941                var button = $(this);
    480942
    481943
    482944
     945
     946
     947
     948
    483949                if (button.hasClass('disabled')) {
    484950
    485951
    486952
     953
     954
     955
     956
    487957                    return;
    488958
    489959
    490960
     961
     962
     963
     964
    491965                }
    492966
    493967
    494968
     969
     970
     971
     972
    495973                var $radio = $('input[type="radio"]:checked', modal);
    496974
    497975
    498976
     977
     978
     979
     980
    499981                var $selected_reason = $radio.parents('li:first'),
    500982
    501983
    502984
     985
     986
     987
     988
    503989                $input = $selected_reason.find('textarea, input[type="text"]');
    504990
    505991
    506992
     993
     994
     995
     996
    507997                button.addClass('disabled');
    508998
    509999
    5101000
     1001
     1002
     1003
     1004
    5111005                button.text('Processing...');
    5121006
    5131007
    5141008
     1009
     1010
     1011
     1012
    5151013                window.location.href = deactivateLink;
    5161014
     
    5251023
    5261024
     1025
     1026
     1027
     1028
     1029
     1030
     1031
     1032
     1033
     1034
     1035
     1036
    5271037            });
    5281038
    5291039
    5301040
     1041
     1042
     1043
     1044
    5311045        });
    5321046
    5331047
    5341048
     1049
     1050
     1051
     1052
    5351053    }(jQuery));
    5361054
    5371055
    5381056
     1057
     1058
     1059
     1060
    5391061</script>
    5401062
    5411063
    5421064
     1065
     1066
     1067
     1068
    5431069<?php
    5441070
    545     }
     1071
     1072
     1073    }
     1074
     1075
    5461076
    5471077// register All Events widget
    5481078
     1079
     1080
    5491081    function bpem_all_events_in_calendar() {
    5501082
     1083
     1084
    5511085        register_widget('ALLEVENTS');
    5521086
    553     }
     1087
     1088
     1089    }
     1090
     1091
    5541092
    5551093} // class ends
    5561094
     1095
     1096
    5571097// CHECK WETHER CLASS EXISTS OR NOT.
    5581098
     1099
     1100
    5591101if (class_exists('BPEventManager')) {
    5601102
     1103
     1104
    5611105    $obj = new BPEventManager();
    5621106
     1107
     1108
    5631109    require_once plugin_dir_path(__FILE__) . 'bpem-dash/bpem_showing_all_events.php';
    5641110
     1111
     1112
    5651113}
    5661114
     1115
     1116
    5671117//activate plugin hook
    5681118
     1119
     1120
    5691121register_activation_hook(__FILE__, array($obj, 'bpem_activate'));
Note: See TracChangeset for help on using the changeset viewer.