| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* Single source of truth for every pro add-on: which plugin file activates |
| 8 |
* it, where its extension point normally lives, and the copy used to |
| 9 |
* advertise it when it isn't installed yet. |
| 10 |
*/ |
| 11 |
if ( ! function_exists( 'wppm_get_pro_addons' ) ) { |
| 12 |
function wppm_get_pro_addons() { |
| 13 |
return array( |
| 14 |
'calendar' => array( |
| 15 |
'label' => __( 'Calendar', 'taskbuilder' ), |
| 16 |
'plugin' => 'taskbuilder-calendar/taskbuilder-calendar.php', |
| 17 |
'icon' => 'calendar.svg', |
| 18 |
'placement' => 'menu', |
| 19 |
'details_url' => 'https://taskbuilder.net/task-calendar/', |
| 20 |
'description' => __( 'Calendar can help to schedule tasks to gain control over your work and keep your day organized.', 'taskbuilder' ), |
| 21 |
), |
| 22 |
'email_piping' => array( |
| 23 |
'label' => __( 'Email Piping', 'taskbuilder' ), |
| 24 |
'plugin' => 'taskbuilder-email-piping/wppm-email-piping.php', |
| 25 |
'icon' => 'email-piping.svg', |
| 26 |
'placement' => 'settings', |
| 27 |
'details_url' => 'https://taskbuilder.net/email-piping/', |
| 28 |
'description' => __( 'Email Piping converts incoming emails directly into actionable tasks within your project management system.', 'taskbuilder' ), |
| 29 |
), |
| 30 |
'custom_fields' => array( |
| 31 |
'label' => __( 'Custom Fields', 'taskbuilder' ), |
| 32 |
'plugin' => 'taskbuilder-custom-field/taskbuildet-custom-field.php', |
| 33 |
'icon' => 'cf.svg', |
| 34 |
'placement' => 'menu', |
| 35 |
'details_url' => 'https://taskbuilder.net/custom-fields/', |
| 36 |
'description' => __( 'Custom Fields lets you collect extra information for your tasks and projects beyond the built-in fields.', 'taskbuilder' ), |
| 37 |
), |
| 38 |
'time_tracker' => array( |
| 39 |
'label' => __( 'Time Tracker', 'taskbuilder' ), |
| 40 |
'plugin' => 'taskbuilder-timer/wppm-timer.php', |
| 41 |
'icon' => 'time-tracker.svg', |
| 42 |
'placement' => 'none', |
| 43 |
'details_url' => 'https://taskbuilder.net/time-tracker/', |
| 44 |
'description' => __( 'Time Tracker records and tracks the time spent on each individual task, like a stop-watch for a task.', 'taskbuilder' ), |
| 45 |
), |
| 46 |
'gantt_chart' => array( |
| 47 |
'label' => __( 'Gantt Chart', 'taskbuilder' ), |
| 48 |
'plugin' => 'taskbuilder-gantt-chart/wppm-gantt-chart.php', |
| 49 |
'icon' => 'gantt_chart.svg', |
| 50 |
'placement' => 'toolbar', |
| 51 |
'details_url' => 'https://taskbuilder.net/gantt-chart/', |
| 52 |
'description' => __( 'Gantt Chart helps you visualize upcoming deadlines and keep a bird\'s-eye view of the whole project.', 'taskbuilder' ), |
| 53 |
), |
| 54 |
'duplicate_project' => array( |
| 55 |
'label' => __( 'Duplicate Project', 'taskbuilder' ), |
| 56 |
'plugin' => 'taskbuilder_clone_project/wppm-clone-project.php', |
| 57 |
'icon' => 'clone_project.svg', |
| 58 |
'placement' => 'toolbar', |
| 59 |
'details_url' => 'https://taskbuilder.net/duplicate-project/', |
| 60 |
'description' => __( 'Duplicate Project lets you clone an existing project with its tasks and checklists in one click.', 'taskbuilder' ), |
| 61 |
), |
| 62 |
'reports' => array( |
| 63 |
'label' => __( 'Reports', 'taskbuilder' ), |
| 64 |
'plugin' => 'taskbuilder-reports/wppm-reports.php', |
| 65 |
'icon' => 'reports-icon.svg', |
| 66 |
'placement' => 'menu', |
| 67 |
'details_url' => 'https://taskbuilder.net/report/', |
| 68 |
'description' => __( 'Reports lets you create detailed project progress reports to view, print, or download as PDF/CSV.', 'taskbuilder' ), |
| 69 |
), |
| 70 |
'buddypress' => array( |
| 71 |
'label' => __( 'Buddypress Integration', 'taskbuilder' ), |
| 72 |
'plugin' => 'taskbuilder-buddypress-integration/taskbuilder-buddypress-integration.php', |
| 73 |
'icon' => 'user_group.svg', |
| 74 |
'placement' => 'settings', |
| 75 |
'details_url' => 'https://taskbuilder.net/buddypress/', |
| 76 |
'description' => __( 'Buddypress Integration lets you manage projects by department, giving groups frontend access to their tasks.', 'taskbuilder' ), |
| 77 |
), |
| 78 |
'woocommerce' => array( |
| 79 |
'label' => __( 'WooCommerce Integration', 'taskbuilder' ), |
| 80 |
'plugin' => 'taskbuilder-woocommerce-integration/taskbuilder-woocommerce-integration.php', |
| 81 |
'icon' => 'taskbuilder_wc.svg', |
| 82 |
'placement' => 'settings', |
| 83 |
'details_url' => 'https://taskbuilder.net/woocommerce/', |
| 84 |
'description' => __( 'WooCommerce Integration automatically creates a task with order details after an order is received.', 'taskbuilder' ), |
| 85 |
), |
| 86 |
'due_date_reminder' => array( |
| 87 |
'label' => __( 'Due Date Reminder', 'taskbuilder' ), |
| 88 |
'plugin' => 'taskbuilder_due_date_reminder/wppm-due-date-reminder.php', |
| 89 |
'icon' => 'due_date_reminder_icon.svg', |
| 90 |
'placement' => 'settings', |
| 91 |
'details_url' => 'https://taskbuilder.net/due-date-reminder/', |
| 92 |
'description' => __( 'Due Date Reminder emails your team before a task\'s due date so deadlines never slip.', 'taskbuilder' ), |
| 93 |
), |
| 94 |
'users_group' => array( |
| 95 |
'label' => __( 'Users Group', 'taskbuilder' ), |
| 96 |
'plugin' => 'taskbuilder-usergroup/taskbuilder-usergrop.php', |
| 97 |
'icon' => 'user_group.svg', |
| 98 |
'placement' => 'menu', |
| 99 |
'details_url' => 'https://taskbuilder.net/usergroup/', |
| 100 |
'description' => __( 'Users Group lets you assign groups of users to a project and its tasks, just like individual users.', 'taskbuilder' ), |
| 101 |
), |
| 102 |
'recurrent_task' => array( |
| 103 |
'label' => __( 'Recurrent Task', 'taskbuilder' ), |
| 104 |
'plugin' => 'taskbuilder-recurrent-task/taskbuilder-recurrent-task.php', |
| 105 |
'icon' => 'recurrent_task.svg', |
| 106 |
'placement' => 'settings', |
| 107 |
'details_url' => 'https://taskbuilder.net/recurrent-task/', |
| 108 |
'description' => __( 'Recurrent Task automates repeating tasks on daily, weekly, or monthly intervals so nothing is re-entered by hand.', 'taskbuilder' ), |
| 109 |
), |
| 110 |
'overdue_notifier' => array( |
| 111 |
'label' => __( 'Overdue Notifier', 'taskbuilder' ), |
| 112 |
'plugin' => 'taskbuilder_overdue_notifier/wppm-overdue-notifier.php', |
| 113 |
'icon' => 'overdue.svg', |
| 114 |
'placement' => 'settings', |
| 115 |
'details_url' => 'https://taskbuilder.net/overdue-notifier/', |
| 116 |
'description' => __( 'Overdue Notifier automatically emails assigned users the moment a task becomes overdue.', 'taskbuilder' ), |
| 117 |
), |
| 118 |
); |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
if ( ! function_exists( 'wppm_is_pro_addon_active' ) ) { |
| 123 |
function wppm_is_pro_addon_active( $addon_key ) { |
| 124 |
$addons = wppm_get_pro_addons(); |
| 125 |
if ( empty( $addons[ $addon_key ]['plugin'] ) ) { |
| 126 |
return true; |
| 127 |
} |
| 128 |
if ( ! function_exists( 'is_plugin_active' ) ) { |
| 129 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 130 |
} |
| 131 |
return is_plugin_active( $addons[ $addon_key ]['plugin'] ); |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
if ( ! function_exists( 'wppm_pro_upgrade_url' ) ) { |
| 136 |
function wppm_pro_upgrade_url() { |
| 137 |
return 'https://taskbuilder.net/pricing/'; |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* Small gold "Pro" crown icon used in place of a text badge, wherever a |
| 143 |
* locked pro addon is advertised (sidebar menu, settings pills, toolbar |
| 144 |
* buttons, teaser pages). Kept as raw markup so PHP and JS-built strings |
| 145 |
* can share the exact same icon. |
| 146 |
*/ |
| 147 |
if ( ! function_exists( 'wppm_pro_badge_svg' ) ) { |
| 148 |
function wppm_pro_badge_svg( $size = 14 ) { |
| 149 |
$size = (int) $size; |
| 150 |
return '<svg width="' . $size . '" height="' . $size . '" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.72019 5.88024L7.50019 8.40025L11.2676 3.12625C11.3508 3.00958 11.4608 2.91448 11.5882 2.84887C11.7156 2.78325 11.8569 2.74902 12.0002 2.74902C12.1435 2.74902 12.2848 2.78325 12.4122 2.84887C12.5396 2.91448 12.6495 3.00958 12.7328 3.12625L16.5002 8.40025L20.2802 5.88024C20.4232 5.78507 20.5906 5.73283 20.7624 5.72971C20.9342 5.72658 21.1033 5.77271 21.2497 5.86262C21.3961 5.95254 21.5137 6.08249 21.5887 6.23713C21.6636 6.39176 21.6927 6.56461 21.6725 6.73525L20.1938 19.3055C20.168 19.5245 20.0628 19.7263 19.898 19.8728C19.7333 20.0193 19.5205 20.1002 19.3001 20.1002H4.70029C4.47985 20.1002 4.26709 20.0193 4.10236 19.8728C3.93762 19.7263 3.83238 19.5245 3.80659 19.3055L2.32789 6.73435C2.30791 6.56378 2.33715 6.39106 2.41215 6.23657C2.48715 6.08208 2.60479 5.95228 2.75117 5.86248C2.89755 5.77268 3.06657 5.72664 3.23828 5.72979C3.40998 5.73293 3.5772 5.78514 3.72019 5.88024ZM12.0002 14.7002C12.4776 14.7002 12.9354 14.5106 13.273 14.173C13.6105 13.8355 13.8002 13.3776 13.8002 12.9002C13.8002 12.4229 13.6105 11.965 13.273 11.6275C12.9354 11.2899 12.4776 11.1002 12.0002 11.1002C11.5228 11.1002 11.065 11.2899 10.7274 11.6275C10.3898 11.965 10.2002 12.4229 10.2002 12.9002C10.2002 13.3776 10.3898 13.8355 10.7274 14.173C11.065 14.5106 11.5228 14.7002 12.0002 14.7002Z" fill="#F6B51E"></path></svg>'; |
| 151 |
} |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* Pro addons that still need advertising for a given placement |
| 156 |
* ('menu', 'settings', 'toolbar'), keyed the same as wppm_get_pro_addons(). |
| 157 |
*/ |
| 158 |
/** |
| 159 |
* Small inline padlock icon, used wherever a locked pro addon needs a lock |
| 160 |
* glyph. Kept as an SVG (rather than a Font Awesome class) because this |
| 161 |
* plugin never enqueues Font Awesome itself - on pages where no other |
| 162 |
* active plugin happens to load it, the "fa-lock" class rendered no glyph |
| 163 |
* at all, leaving only the CSS-drawn circle behind it. |
| 164 |
*/ |
| 165 |
if ( ! function_exists( 'wppm_pro_lock_svg' ) ) { |
| 166 |
function wppm_pro_lock_svg( $size = 14, $color = '#ffffff' ) { |
| 167 |
$size = (int) $size; |
| 168 |
$color = esc_attr( $color ); |
| 169 |
return '<svg width="' . $size . '" height="' . $size . '" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 1a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-1V6a5 5 0 0 0-5-5Zm3 8V6a3 3 0 1 0-6 0v3h6Z" fill="' . $color . '"></path></svg>'; |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
if ( ! function_exists( 'wppm_get_locked_pro_addons_by_placement' ) ) { |
| 174 |
function wppm_get_locked_pro_addons_by_placement( $placement ) { |
| 175 |
$locked = array(); |
| 176 |
foreach ( wppm_get_pro_addons() as $key => $addon ) { |
| 177 |
if ( $addon['placement'] === $placement && ! wppm_is_pro_addon_active( $key ) ) { |
| 178 |
$locked[ $key ] = $addon; |
| 179 |
} |
| 180 |
} |
| 181 |
return $locked; |
| 182 |
} |
| 183 |
} |
| 184 |
|