|
7 | 7 |
|
8 | 8 | namespace Neve\Admin\Dashboard; |
9 | 9 |
|
10 | | -use Neve\Core\Limited_Offers; |
11 | 10 | use Neve\Core\Settings\Config; |
12 | 11 | use Neve\Core\Theme_Info; |
13 | 12 | use Neve\Core\Tracker; |
@@ -101,6 +100,8 @@ function () use ( $filtered_name ) { |
101 | 100 | ]; |
102 | 101 | } |
103 | 102 | ); |
| 103 | + |
| 104 | + add_filter( 'themeisle_sdk_blackfriday_data', array( $this, 'add_black_friday_data' ) ); |
104 | 105 | } |
105 | 106 |
|
106 | 107 | /** |
@@ -295,8 +296,6 @@ public function enqueue() { |
295 | 296 | */ |
296 | 297 | private function get_localization() { |
297 | 298 |
|
298 | | - $offer = new Limited_Offers(); |
299 | | - |
300 | 299 | $old_about_config = apply_filters( 'ti_about_config_filter', [ 'useful_plugins' => true ] ); |
301 | 300 | $theme_name = apply_filters( 'ti_wl_theme_name', $this->theme_args['name'] ); |
302 | 301 | $plugin_name = apply_filters( 'ti_wl_plugin_name', 'Neve Pro' ); |
@@ -363,7 +362,6 @@ private function get_localization() { |
363 | 362 | 'getPluginStateBaseURL' => esc_url( rest_url( '/nv/v1/dashboard/plugin-state/' ) ), |
364 | 363 | 'canInstallPlugins' => current_user_can( 'install_plugins' ), |
365 | 364 | 'canActivatePlugins' => current_user_can( 'activate_plugins' ), |
366 | | - 'deal' => $offer->get_localized_data(), |
367 | 365 | 'rootUrl' => get_site_url(), |
368 | 366 | 'sparksActive' => defined( 'SPARKS_WC_VERSION' ) ? 'yes' : 'no', |
369 | 367 | ]; |
@@ -1126,4 +1124,57 @@ function( $data, $page_slug ) use ( $dash_data ) { |
1126 | 1124 | 2 |
1127 | 1125 | ); |
1128 | 1126 | } |
| 1127 | + |
| 1128 | + /** |
| 1129 | + * Get the Black Friday config settings. |
| 1130 | + * |
| 1131 | + * @param array $default Optional. The default values. |
| 1132 | + * |
| 1133 | + * @return array The data. |
| 1134 | + */ |
| 1135 | + public static function get_black_friday_data( $default = array() ) { |
| 1136 | + $config = $default; |
| 1137 | + |
| 1138 | + // translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name. |
| 1139 | + $message_template = __( 'Our biggest sale of the year: %1$sup to %2$s OFF%3$s on %4$s. Don\'t miss this limited-time offer.', 'neve' ); |
| 1140 | + $product_label = __( 'Neve', 'neve' ); |
| 1141 | + $discount = '70%'; |
| 1142 | + |
| 1143 | + $plan = apply_filters( 'product_neve_license_plan', 0 ); |
| 1144 | + $is_pro = 0 < $plan; |
| 1145 | + |
| 1146 | + if ( $is_pro ) { |
| 1147 | + // translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name. |
| 1148 | + $message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'neve' ); |
| 1149 | + $product_label = __( 'Neve Pro', 'neve' ); |
| 1150 | + $discount = '30%'; |
| 1151 | + } |
| 1152 | + |
| 1153 | + $product_label = sprintf( '<strong>%s</strong>', $product_label ); |
| 1154 | + $url_params = array( |
| 1155 | + 'utm_term' => $is_pro ? 'plan-' . $plan : 'free', |
| 1156 | + 'lkey' => apply_filters( 'product_neve_license_key', false ), |
| 1157 | + ); |
| 1158 | + |
| 1159 | + $config['message'] = sprintf( $message_template, '<strong>', $discount, '</strong>', $product_label ); |
| 1160 | + $config['sale_url'] = add_query_arg( |
| 1161 | + $url_params, |
| 1162 | + tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/neve-bf', 'bfcm', 'neve' ) ) |
| 1163 | + ); |
| 1164 | + |
| 1165 | + return $config; |
| 1166 | + } |
| 1167 | + |
| 1168 | + /** |
| 1169 | + * Add the Black Friday data. |
| 1170 | + * |
| 1171 | + * @param array $configs An array of configurations. |
| 1172 | + * |
| 1173 | + * @return array The configurations. |
| 1174 | + */ |
| 1175 | + public function add_black_friday_data( $configs ) { |
| 1176 | + $configs['neve'] = self::get_black_friday_data( $configs['default'] ); |
| 1177 | + |
| 1178 | + return $configs; |
| 1179 | + } |
1129 | 1180 | } |
0 commit comments