PluginProbe
AWSM Team – Team Showcase Plugin / 1.0
AWSM Team – Team Showcase Plugin v1.0
trunk 1.0 1.1 1.1.2 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4
awsm-team / awsm-team.php

awsm-team.php in AWSM Team – Team Showcase Plugin 1.0, at awsm-team.php

666 lines 27.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: AWSM Team
4 Plugin URI: http://awsm.in/team-pro-documentation
5 Description: The most versatile plugin to create and manage your Team page. Packed with 8 unique presets and number of styles to choose from.
6 Version: 1.0
7 Author: AWSM Innovations
8 Author URI: http://awsm.in/
9 License: GPL
10 Copyright: AWSM Innovations
11 */
12
13 if (!defined('ABSPATH')) {
14 exit;
15 }
16 // if direct access
17
18 if (!class_exists('Awsm_team_lite')):
19 /**
20 * Team main class
21 * author : AWSM
22 */
23 class Awsm_team_lite
24 {
25 private static $instance = null;
26 private $text_domain = 'awsm-team';
27 private $settings;
28
29 /**
30 * Creates or returns an instance of this class.
31 * @since 1.0.0
32 */
33 public static function get_instance()
34 {
35 // If an instance hasn't been created and set to $instance create an instance and set it to $instance.
36 if (null == self::$instance) {
37 self::$instance = new self;
38 }
39 return self::$instance;
40 }
41
42 public function __construct()
43 {
44 $this->settings = array(
45 'plugin_path' => plugin_dir_path(__FILE__),
46 'plugin_url' => plugin_dir_url(__FILE__),
47 'plugin_base' => dirname(plugin_basename(__FILE__)),
48 'plugin_file' => __FILE__,
49 'plugin_version' => '1.0',
50 'text_domain' => 'awsm-team-pro'
51 );
52 $this->load_plugin_textdomain();
53 $this->run_plugin();
54 $this->adminfunctions();
55 }
56 /**
57 * Localisation
58 * @since: 1.0
59 */
60 public function load_plugin_textdomain()
61 {
62 load_textdomain($this->text_domain, WP_LANG_DIR . "/awsm-team/awsm-team-" . apply_filters('plugin_locale', get_locale(), 'awsm-team-pro') . ".mo");
63 load_plugin_textdomain($this->text_domain, false, $this->settings['plugin_base'] . '/language');
64 }
65 /**
66 * Main plugin function
67 * @since: 1.0
68 */
69 public function run_plugin()
70 {
71 add_action('init', array( $this, 'create_member_support' ));
72 add_action('init', array( $this, 'custom_image_size' ));
73 add_shortcode('awsmteam', array( $this, 'awsmteam_shortcode' ));
74 add_action('wp_enqueue_scripts', array( $this, 'embed_front_script_styles' ));
75 add_action('wp_head', array( $this, 'custom_css' ));
76 }
77 /**
78 * Team custom css on theme head
79 * @since: 1.0
80 */
81 function custom_css(){
82 global $wp_query;
83 $posts = $wp_query->posts;
84 $pattern = '(awsmteam)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)';
85 $snippet = '';
86 $shortcodes = array();
87 if ($posts) {
88 foreach ($posts as $post){
89 $pattern = get_shortcode_regex();
90 preg_match('/\[awsmteam (.+?)\]/', $post->post_content, $matches);
91 if (is_array($matches) && isset($matches[1])) {
92 if(is_array(shortcode_parse_atts($matches[1]))){
93 $shortcodes[] = shortcode_parse_atts($matches[1]);
94 }
95 }
96
97 if(!empty($shortcodes)){
98 foreach ($shortcodes as $shortcode) {
99 if(isset($shortcode['id'])){
100 $custom_css = get_post_meta( $shortcode['id'], 'custom_css', true );
101 if($custom_css){
102 $snippet.= $custom_css;
103 }
104 }
105
106 }
107 }
108 }
109 if($snippet){
110 printf('<style type="text/css">%s</style>',$snippet) ;
111 }
112 }
113 }
114 /**
115 * Custom image size for team memebers
116 * @since 1.0
117 */
118 public function custom_image_size()
119 {
120 if ( function_exists( 'add_image_size' ) ) {
121 add_image_size('awsm_team', 500, 500, true);
122 }
123 }
124 /**
125 * AWSM team shortocde
126 * @since 1.0
127 */
128 public function awsmteam_shortcode($atts)
129 {
130 extract(shortcode_atts(array(
131 'id' => false
132 ), $atts));
133 $options = $this->get_options('awsm_team', $id);
134 if (!$options) {
135 return '<div class="awsm-team-error">' . __('Team not found', $this->text_domain) . '</div>';
136 }
137 if (empty($options['memberlist'])) {
138 return '<div class="awsm-team-error">' . __('No members found', $this->text_domain) . '</div>';
139 }
140 $template = $this->settings['plugin_path'] . 'templates/' . $options['team-style'] . '.php';
141 if (file_exists($template)) {
142 ob_start();
143 $teamargs = array(
144 'orderby' => 'post__in',
145 'post_type' => 'awsm_team_member',
146 'post__in' => $options['memberlist']
147 );
148 $team = new WP_Query($teamargs);
149 include $template;
150 wp_reset_postdata();
151 return ob_get_clean();
152 }
153 }
154 /**
155 * Register front scripts
156 * @since 1.0.0
157 */
158 public function embed_front_script_styles()
159 {
160 wp_enqueue_script('awsm-team', plugins_url('js/team.min.js', $this->settings['plugin_file']), array(
161 'jquery'
162 ), $this->settings['plugin_version'], true);
163 wp_enqueue_style('awsm-team', plugins_url('css/team.min.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
164 }
165 /**
166 * Create custom post type
167 * @since 1.0.0
168 */
169 public function create_member_support()
170 {
171 // Create awsm_team_member post type
172 if (post_type_exists("awsm_team_member")) {
173 return;
174 }
175 $singular = __('Team Member', $this->text_domain);
176 $plural = __('Team Members', $this->text_domain);
177 $labels = array(
178 'name' => $plural,
179 'singular_name' => $singular,
180 'menu_name' => __('AWSM Team', $this->text_domain),
181 'add_new' => __('Add New Member', $this->text_domain),
182 'add_new_item' => sprintf(__('Add %s', $this->text_domain), $singular),
183 'new_item' => sprintf(__('New %s', $this->text_domain), $singular),
184 'edit_item' => sprintf(__('Edit %s', $this->text_domain), $singular),
185 'view_item' => sprintf(__('View %s', $this->text_domain), $singular),
186 'all_items' => sprintf(__('Members', $this->text_domain)),
187 'search_items' => sprintf(__('Search %s', $this->text_domain), $plural),
188 'not_found' => sprintf(__('No %s found', $this->text_domain), $plural),
189 'not_found_in_trash' => sprintf(__('No %s found in trash', $this->text_domain), $plural)
190 );
191 $cp_args = array(
192 'labels' => $labels,
193 'description' => sprintf(__('This is where you can create and manage %s.', $this->text_domain), $plural),
194 'publicly_queryable' => false,
195 'show_ui' => true,
196 'show_in_menu' => true,
197 'capability_type' => 'post',
198 'supports' => array(
199 'title',
200 'editor',
201 'thumbnail'
202 ),
203 'menu_icon' => 'dashicons-admin-users'
204 );
205 register_post_type('awsm_team_member', $cp_args);
206 if (post_type_exists("awsm_team")) {
207 return;
208 }
209 $singular = __('Team', $this->text_domain);
210 $plural = __('Teams', $this->text_domain);
211 $labels = array(
212 'name' => $plural,
213 'singular_name' => $singular,
214 'menu_name' => __('Awsm Team', $this->text_domain),
215 'add_new' => __('Add Team', $this->text_domain),
216 'add_new_item' => sprintf(__('Add %s', $this->text_domain), $singular),
217 'new_item' => sprintf(__('New %s', $this->text_domain), $singular),
218 'edit_item' => sprintf(__('Edit %s', $this->text_domain), $singular),
219 'view_item' => sprintf(__('View %s', $this->text_domain), $singular),
220 'all_items' => sprintf(__('Teams', $this->text_domain)),
221 'search_items' => sprintf(__('Search %s', $this->text_domain), $plural),
222 'not_found' => sprintf(__('No %s found', $this->text_domain), $plural),
223 'not_found_in_trash' => sprintf(__('No %s found in trash', $this->text_domain), $plural)
224 );
225 $cp_args = array(
226 'labels' => $labels,
227 'description' => sprintf(__('This is where you can create and manage %s.', $this->text_domain), $plural),
228 'show_ui' => true,
229 "show_in_menu" => 'edit.php?post_type=awsm_team_member',
230 'capability_type' => 'post',
231 'supports' => array(
232 'title'
233 )
234 );
235 register_post_type('awsm_team', $cp_args);
236 }
237 /**
238 * Initiate admin functions.
239 * @since 1.0
240 */
241 public function adminfunctions()
242 {
243 if (is_admin()) {
244 add_action('add_meta_boxes', array( $this, 'register_metaboxes' ));
245 add_action('save_post', array( $this, 'save_metabox_data' ), 10, 3);
246 add_action('admin_init', array( $this, 'meta_box_scripts' ));
247 add_action('admin_menu', array( $this, 'add_submenu_items' ), 12);
248 add_action('edit_form_after_title', array( $this, 'shortcode_preview' ));
249 add_filter('manage_awsm_team_member_posts_columns' , array( $this, 'custom_columns_member' ));
250 add_action('manage_awsm_team_member_posts_custom_column' , array( $this, 'custom_columns_member_data' ) , 10, 2 );
251 add_filter('manage_awsm_team_posts_columns' , array( $this, 'custom_columns_team' ));
252 add_action('manage_awsm_team_posts_custom_column' , array( $this, 'custom_columns_team_data' ) , 10, 2 );
253 add_filter('admin_post_thumbnail_html', array($this,'image_help'));
254 add_filter('admin_post_thumbnail_size', array($this,'custom_admin_thumb_size'));
255 }
256 }
257 /**
258 * Custom thumbnail size for awsm_team_member
259 * @since 1.0
260 */
261 function custom_admin_thumb_size($thumb_size){
262 global $post_type,$post;
263 if($post_type == 'awsm_team_member'){
264 $thumb_size = "awsm_team";
265 }
266 return $thumb_size;
267 }
268 /**
269 * Image size help text
270 * @since 1.0
271 */
272 function image_help($content){
273 global $post_type,$post;
274 if ($post_type == 'awsm_team_member') {
275 if(!has_post_thumbnail( $post->ID )){
276 $content .= '<p>'.__('Please upload square-cropped photos with a minimum dimension of 500px',$this->text_domain).'</p>';
277 }
278 }
279 return $content;
280 }
281 /**
282 * Custom column on member table.
283 * @since 1.0
284 */
285 function custom_columns_member($columns){
286 $columns = array(
287 'cb' => '<input type="checkbox" />',
288 'title' => __('Name',$this->text_domain),
289 'featured_image' => __('Photo',$this->text_domain),
290 'designation' => __('Designation',$this->text_domain),
291 'date' => 'Date'
292 );
293 return $columns;
294 }
295 /**
296 * Custom member table data.
297 * @since 1.0
298 */
299 function custom_columns_member_data($column,$post_ID){
300 $options = $this->get_options('awsm_team_member',$post_ID );
301 switch ( $column ) {
302 case 'featured_image':
303 echo the_post_thumbnail( 'thumbnail' );
304 break;
305 case 'designation':
306 echo $options['awsm-team-designation'];
307 break;
308 }
309 }
310 /**
311 * Custom member column for team.
312 * @since 1.0
313 */
314 function custom_columns_team($columns){
315 $columns = array(
316 'cb' => '<input type="checkbox" />',
317 'title' => __('Name',$this->text_domain),
318 'members' => __('Members',$this->text_domain),
319 'preset' => __('Preset',$this->text_domain),
320 'style' => __('Style',$this->text_domain),
321 'shortcode' =>__('Shortcode',$this->text_domain)
322 );
323 return $columns;
324 }
325 /**
326 * Custom member column data for team.
327 * @since 1.0
328 */
329 function custom_columns_team_data($column,$post_ID){
330 $options = $this->get_options('awsm_team',$post_ID );
331 $post = get_post( $post_ID );
332 switch ( $column ) {
333 case 'members':
334 echo count($options['memberlist']);
335 break;
336 case 'preset':
337 echo $options['team-style'];
338 break;
339 case 'style':
340 echo $options['preset'];
341 break;
342 case 'shortcode':
343 printf('<code>[awsmteam id="%s"]</code>',$post_ID);
344 break;
345 }
346 }
347 /**
348 * Shortcode preview on team edit page
349 * @since 1.0
350 */
351 public function shortcode_preview($post)
352 {
353 if ('awsm_team' == $post->post_type && 'publish' == $post->post_status) {
354 printf('<p>%1$s: <code>[awsmteam id="%2$s"]</code><button id="copy-awsm" type="button" data-clipboard-text="[awsmteam id=&quot;%2$s&quot;]" class="button">%3$s</button></p>', __("Shortcode", $this->text_domain), $post->ID, __("Copy", $this->text_domain));
355 }
356 return;
357 }
358 /**
359 * Loads meta box helper scripts
360 * since 1.0
361 */
362 public function meta_box_scripts()
363 {
364 global $pagenow, $typenow, $post;
365 if (empty($typenow) && !empty($_GET['post'])) {
366 $post = get_post($_GET['post']);
367 $typenow = $post->post_type;
368 }
369 if (($pagenow == 'post-new.php' or $pagenow == 'post.php') and ($typenow == 'awsm_team_member' or $typenow == 'awsm_team')) {
370 wp_enqueue_style('awsm-team-admin', plugins_url('css/admin.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
371 wp_enqueue_script('team-meta-box', plugins_url('js/team-admin.js', $this->settings['plugin_file']), array( 'jquery', 'jquery-ui-sortable', 'wp-util' ), $this->settings['plugin_version']);
372 wp_enqueue_script('select2', plugins_url('js/select2.min.js', $this->settings['plugin_file']), array( 'jquery' ), $this->settings['plugin_version']);
373 wp_enqueue_style('select2', plugins_url('css/select2.min.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
374 wp_enqueue_style('awsm-team-icomoon-css', plugins_url('css/icomoon.css', $this->settings['plugin_file']), false, $this->settings['plugin_version'], 'all');
375 }
376
377 }
378 /**
379 * Adding submenu items
380 * @since 1.0.0
381 */
382 public function add_submenu_items()
383 {
384 add_submenu_page('edit.php?post_type=awsm_team_member', __('Add Team', $this->text_domain), __('Add Team', $this->text_domain), 'manage_options', 'post-new.php?post_type=awsm_team');
385 }
386 /**
387 * Register meta box
388 * @since 1.0.0
389 */
390 public function register_metaboxes()
391 {
392 add_meta_box('member_details', __('Member Details', $this->text_domain), array( $this, 'member_details_meta' ), 'awsm_team_member');
393 add_meta_box('team_details', __('Team Details', $this->text_domain), array( $this, 'team_details_meta' ), 'awsm_team', 'normal', 'high');
394 add_meta_box('awsm_team_pro', __('Upgrade to AWSM Team Pro', $this->text_domain), array( $this, 'pro_metabox' ), 'awsm_team', 'side', 'default');
395 }
396 public function pro_metabox(){
397 include $this->settings['plugin_path'] . 'includes/pro-features.php';
398 }
399 /**
400 * Meta box display callback - Member details.
401 * @since 1.0.0
402 * @param WP_Post $post Current post object.
403 */
404 public function member_details_meta($post)
405 {
406 wp_nonce_field(basename(__FILE__), 'awsm_meta_details');
407 $awsm_contact = get_post_meta($post->ID, 'awsm_contact', true);
408 $awsm_social = get_post_meta($post->ID, 'awsm_social', true);
409 $socialicons = array('mail', 'link', 'google-plus', 'google-plus2', 'hangouts', 'google-drive', 'facebook', 'facebook2', 'instagram', 'whatsapp', 'twitter', 'youtube', 'vimeo', 'vimeo2', 'flickr', 'flickr2', 'dribbble', 'behance', 'behance2', 'dropbox', 'wordpress', 'blogger', 'tumblr', 'tumblr2', 'skype', 'linkedin2', 'linkedin', 'stackoverflow', 'pinterest2', 'pinterest', 'foursquare','github', 'flattr', 'xing', 'xing2', 'stumbleupon', 'stumbleupon2', 'delicious', 'lastfm', 'lastfm2', 'hackernews', 'reddit', 'soundcloud', 'soundcloud2', 'yahoo', 'blogger2', 'ello', 'wordpress2', 'steam', 'steam2', '500px', 'deviantart', 'twitch', 'feed', 'feed2', 'sina-weibo', 'renren', 'vk', 'vine', 'telegram', 'spotify', 'mail2', 'mail3');
410 include $this->settings['plugin_path'] . 'includes/member-details.php';
411 }
412 /**
413 * Meta box display callback - Team details.
414 * @since 1.0.0
415 * @param WP_Post $post Current post object.
416 */
417 public function team_details_meta($post)
418 {
419 wp_nonce_field(basename(__FILE__), 'awsm_meta_details');
420 $args = array(
421 'post_type' => 'awsm_team_member',
422 'posts_per_page' => -1
423 );
424 $members = new WP_Query($args);
425 $options = $this->get_options('awsm_team', $post->ID);
426 $defaultimage = $this->settings['plugin_url'] . 'images/default-user.png';
427 include $this->settings['plugin_path'] . 'includes/team-details.php';
428 }
429 /**
430 * Save metabox
431 * @param Int $post_id id of the post
432 * @param Object $post Post Object
433 * @since 1.0
434 */
435 public function save_metabox_data($post_id, $post)
436 {
437 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
438 return;
439 }
440 if (!isset($_POST['awsm_meta_details']) || !wp_verify_nonce($_POST['awsm_meta_details'], basename(__FILE__))) {
441 return $post_id;
442 }
443 $post_type = get_post_type_object($post->post_type);
444 if (!current_user_can($post_type->cap->edit_post, $post_id)) {
445 return $post_id;
446 }
447 if ($post->post_type == 'awsm_team_member') {
448 $team_repeater = array(
449 'awsm_contact' => array(
450 'label' => 'awsm-team-label',
451 'content' => 'awsm-team-content'
452 ),
453 'awsm_social' => array(
454 'icon' => 'awsm-team-icon',
455 'link' => 'awsm-team-link'
456 )
457 );
458 $team_meta = array(
459 'awsm-team-designation',
460 'awsm-team-short-desc'
461 );
462 foreach ($team_repeater as $key => $value) {
463 $olddata = get_post_meta($post_id, $key, true);
464 $newdata = $item = array();
465 foreach ($value as $k => $v) {
466 $item[$k] = $_POST[$v];
467 }
468 $count = count(reset($item));
469 for ($i = 0; $i < $count; $i++) {
470 foreach ($value as $k => $v) {
471 if ($item[$k][$i] != '') {
472 $newdata[$i][$k] = stripslashes(strip_tags($item[$k][$i]));
473 }
474 }
475 }
476 if (!empty($newdata) && $newdata != $olddata) {
477 update_post_meta($post_id, $key, $newdata);
478 } elseif (empty($newdata) && $olddata) {
479 delete_post_meta($post_id, $key, $olddata);
480 }
481
482 }
483 } elseif ($post->post_type == 'awsm_team') {
484 $team_meta = array('memberlist', 'team-style', 'preset', 'columns', 'custom_css');
485 }
486 foreach ($team_meta as $meta_key) {
487 $olddata = get_post_meta($post_id, $meta_key, true);
488 $newdata = array();
489 if (isset($_POST[$meta_key])) {
490 if (is_array($_POST[$meta_key])) {
491 $newdata = $_POST[$meta_key];
492 } else {
493 $newdata = stripslashes(strip_tags($_POST[$meta_key]));
494 }
495 if (!empty($newdata) && $newdata != $olddata) {
496 update_post_meta($post_id, $meta_key, $newdata);
497 } elseif (empty($newdata) && $olddata) {
498 delete_post_meta($post_id, $meta_key, $olddata);
499 }
500 } else {
501 delete_post_meta($post_id, $meta_key, $olddata);
502 }
503 }
504 }
505 /**
506 * Dropdown Builder
507 * @since 1.0
508 */
509 public function selectbuilder($name, $options, $selected = "", $selecttext = "", $class = "", $optionvalue = 'value')
510 {
511 if (is_array($options)):
512 $select_html = "<select name=\"$name\" id=\"$name\" class=\"$class\">";
513 if ($selecttext) {
514 $select_html .= '<option value="">' . $selecttext . '</option>';
515 }
516 foreach ($options as $key => $option) {
517 if ($optionvalue == 'value') {
518 $value = $option;
519 } else {
520 $value = $key;
521 }
522 $select_html .= "<option value=\"$value\"";
523 if ($value == $selected) {
524 $select_html .= ' selected="selected"';
525 }
526 $select_html .= ">$option</option>\n";
527 }
528 $select_html .= '</select>';
529 echo $select_html;
530 else:
531 endif;
532 }
533 /**
534 * Get options
535 * @param String $postype Post type slug
536 * @param Int $post_id ID of post
537 * @since 1.0
538 */
539 public function get_options($postype, $post_id)
540 {
541 $post = get_post($post_id);
542
543 if (!$post) {
544 return false;
545 }
546
547 $metakeys['awsm_team_member'] = array(
548 'awsm_contact',
549 'awsm_social',
550 'awsm-team-designation',
551 'awsm-team-short-desc'
552 );
553 $metakeys['awsm_team'] = array(
554 'memberlist',
555 'team-style',
556 'preset',
557 'columns',
558 'custom_css'
559 );
560 $options['awsm_team_member'] = array(
561 'awsm_contact' => array(),
562 'awsm_social' => array(),
563 'awsm-team-designation' => '',
564 'awsm-team-short-desc' => ''
565 );
566 $options['awsm_team'] = array(
567 'memberlist' => array(),
568 'team-style' => 'cards',
569 'preset' => '',
570 'columns' => '',
571 'custom_css' => ''
572 );
573 foreach ($metakeys[$postype] as $key => $value) {
574 $metavalue = get_post_meta($post_id, $value, true);
575 if ($metavalue) {
576 $options[$postype][$value] = $metavalue;
577 }
578 }
579 return $options[$postype];
580 }
581 /**
582 * Get team thumbnail
583 * @param Int $team_id Post id of tram
584 * @param string $thumbnail thumbnail size
585 * @since 1.0
586 */
587 public function team_thumbnail($team_id, $thumbnail = "awsm_team")
588 {
589 $defaultimage = $this->settings['plugin_url'] . 'images/default-user.png';
590 $member_image = get_post_thumbnail_id($team_id);
591 if ($member_image) {
592 $member_image_url = wp_get_attachment_image_src($member_image, $thumbnail, true);
593 $member_image_url = $member_image_url[0];
594 } else {
595 $member_image_url = $defaultimage;
596 }
597 return $member_image_url;
598 }
599 /**
600 * Item stle generator
601 * @since 1.0
602 */
603 public function item_style($options, $custom = "")
604 {
605 $style = array(
606 $options['team-style'] . '-style',
607 $options['preset'],
608 'grid-' . $options['columns'] . '-col',
609 $custom
610 );
611 return implode(' ', $style);
612 }
613 /**
614 * Class generator
615 * @param Array $class classnames
616 * @since 1.0
617 */
618 public function addclass($class)
619 {
620 return implode(' ', $class);
621 }
622 /**
623 * ID generator
624 * @param Array $id
625 * @since 1.0
626 */
627 public function add_id($id)
628 {
629 return implode('-', $id);
630 }
631 /**
632 * Print the meta data after checking it's existence
633 * @since 1.0
634 */
635 public function checkprint($template, $value, $return = false)
636 {
637 if ($value) {
638 if ($return) {
639 return sprintf($template, $value);
640 } else {
641 echo sprintf($template, $value);
642 }
643
644 }
645 }
646 }
647 function awms_team_activation(){
648 if ( !class_exists('Awsm_team') ) {
649 Awsm_team_lite::get_instance();
650 }
651 }
652 function awms_team__disable_self(){
653 if ( class_exists( 'Awsm_team' ) ) {
654 deactivate_plugins( plugin_basename( __FILE__ ) );
655 add_action( 'admin_notices', 'awms_team_disable_notice' );
656 }
657 }
658 function awms_team_disable_notice(){
659 $class = 'notice is-dismissible notice-warning';
660 $message = __( 'Thanks for upgrading AWSM Team Pro! The free version ‘AWSM Team’ has now been deactivated.', 'awsm-team' );
661 printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
662 }
663 // Plugin activation hook
664 add_action( 'plugins_loaded', 'awms_team_activation' );
665 add_action( 'admin_init', 'awms_team__disable_self' );
666 endif;