PluginProbe
ShiftController Employee Shift Scheduling / 4.9.66
ShiftController Employee Shift Scheduling v4.9.66
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / _wordpress / promo / boot.php

boot.php in ShiftController Employee Shift Scheduling 4.9.66, at sh4/_wordpress/promo/boot.php

63 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 #[AllowDynamicProperties]
3 class SH4_Promo_Boot
4 {
5 public function __construct(
6 HC3_Ui_Topmenu $topmenu,
7 HC3_Hooks $hooks,
8 HC3_Auth $auth,
9 HC3_IPermission $permission
10 )
11 {
12 if( defined('SH4_PRO_VERSION') && (! defined('SH4_FORCE_PROMO')) ){
13 return;
14 }
15
16 // promo
17 $label = 'ShiftController Pro';
18 $href = 'https://www.shiftcontroller.com/order/';
19
20 // $hooks
21 // ->add( 'sh4/app/html/view/admin::menu::after', function( $return ) use ($label, $href) {
22 // $label = '<div class="hc-border hc-border-olive hc-rounded hc-p2">' . $label . '</div>';
23 // $return['promo'] = array( $href, $label );
24 // return $return;
25 // })
26 // ;
27
28 $currentUser = $auth->getCurrentUser();
29 $isAdmin = $permission->isAdmin($currentUser);
30
31 if( $isAdmin ){
32 $topmenu
33 ->addAfter( 'profile', 'promo', array( $href, $label) )
34 ;
35 }
36
37 $hooks
38 ->add( 'hc3/layout::render::before', function( $args ) use($label, $href, $isAdmin) {
39 if( ! ($isAdmin && is_admin()) ){
40 return $args;
41 }
42
43 $content = $args[0];
44
45 $promo = array();
46 if( is_admin() ){
47 // $promo[] = '<div class="update-nag hc-block hc-fs4 hc-my3">';
48 $promo[] = '<div class="notice notice-success inline hc-block hc-fs4 hc-my3 hc-p3">';
49 }
50 else {
51 $promo[] = '<div class="hc-border hc-border-olive hc-rounded hc-p3 hc-block hc-fs4">';
52 }
53 $promo[] = '<span class="dashicons dashicons-star-filled hc-olive"></span> <a target="_blank" href="' . $href . '"><strong>' . $label . '</strong></a> with nice features like recurring shifts, bulk actions, shifts pickup and more!';
54 $promo[] = '</div>';
55 $promo = join('', $promo);
56
57 $content = $promo . $content;
58 $args[0] = $content;
59 return $args;
60 })
61 ;
62 }
63 }