Skip to content

Commit 26fefb3

Browse files
Merge pull request #1042 from Codeinwp/refactor/black-friday
refactor: load Black Friday with the new hooks
2 parents 1fbfd1e + ed7f8e2 commit 26fefb3

4 files changed

Lines changed: 70 additions & 16 deletions

File tree

assets/css/rop_core.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ a.active {
382382
font-size: 1.4rem;
383383
}
384384

385-
#rop_core h4,
385+
#rop_core h4:not(.themeisle-sale-title),
386386
#rop_core .h4 {
387387
font-size: 1.2rem;
388388
}

includes/admin/class-rop-admin.php

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function() use ( $global_settings ) {
6969
return $global_settings->license_type();
7070
}
7171
);
72+
73+
add_filter( 'themeisle_sdk_blackfriday_data', array( $this, 'add_black_friday_data' ) );
7274
}
7375

7476

@@ -444,10 +446,6 @@ function( $data, $page_slug ) use ( $accounts_count, $is_post_sharing_active ) {
444446
);
445447
}
446448
do_action( 'themeisle_internal_page', ROP_PRODUCT_SLUG, 'dashboard' );
447-
448-
if ( ! defined( 'ROP_PRO_VERSION' ) ) {
449-
do_action( 'themeisle_sdk_load_banner', 'rop' );
450-
}
451449
}
452450

453451
/**
@@ -682,7 +680,7 @@ public function menu_pages() {
682680
)
683681
);
684682
if ( ! defined( 'REVIVE_NETWORK_VERSION' ) ) {
685-
$rss_to_social = __( 'RSS to Social', 'wpcf7-redirect' ) . '<span id="rop-rn-menu" class="dashicons dashicons-external" style="font-size:initial;"></span>';
683+
$rss_to_social = __( 'RSS to Social', 'tweet-old-post' ) . '<span id="rop-rn-menu" class="dashicons dashicons-external" style="font-size:initial;"></span>';
686684
add_action(
687685
'admin_footer',
688686
function () {
@@ -1845,4 +1843,47 @@ public function get_languages() {
18451843
}
18461844
return apply_filters( 'wpml_active_languages', null, array( 'skip_missing' => 1 ) );
18471845
}
1846+
1847+
/**
1848+
* Add the Black Friday configuration.
1849+
*
1850+
* @param array $configs An array of configurations.
1851+
*
1852+
* @return array The configurations.
1853+
*/
1854+
public static function add_black_friday_data( $configs ) {
1855+
$config = $configs['default'];
1856+
1857+
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1858+
$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.', 'tweet-old-post' );
1859+
$product_label = __( 'Revive Social', 'tweet-old-post' );
1860+
$discount = '50%';
1861+
1862+
$plan = apply_filters( 'product_rop_license_plan', 0 );
1863+
$license = apply_filters( 'product_rop_license_key', false );
1864+
$is_pro = 0 < $plan;
1865+
1866+
if ( $is_pro ) {
1867+
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
1868+
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'tweet-old-post' );
1869+
$product_label = __( 'Revive Social Pro', 'tweet-old-post' );
1870+
$discount = '20%';
1871+
}
1872+
1873+
$product_label = sprintf( '<strong>%s</strong>', $product_label );
1874+
$url_params = array(
1875+
'utm_term' => $is_pro ? 'plan-' . $plan : 'free',
1876+
'lkey' => ! empty( $license ) ? $license : false,
1877+
);
1878+
1879+
$config['message'] = sprintf( $message_template, '<strong>', $discount, '</strong>', $product_label );
1880+
$config['sale_url'] = add_query_arg(
1881+
$url_params,
1882+
tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/rs-bf', 'bfcm', 'revive' ) )
1883+
);
1884+
1885+
$configs[ ROP_PRODUCT_SLUG ] = $config;
1886+
1887+
return $configs;
1888+
}
18481889
}

phpcs.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<exclude-pattern>vue/*</exclude-pattern>
1313
<exclude-pattern>dist/*</exclude-pattern>
1414

15-
<arg name="extensions" value="php"/>
15+
<arg name="extensions" value="php" />
1616

1717
<rule ref="WordPress-Core">
1818
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
@@ -51,9 +51,16 @@
5151
<rule ref="WordPress-Docs">
5252

5353
</rule>
54+
<rule ref="WordPress.WP.I18n">
55+
<properties>
56+
<property name="text_domain" type="array">
57+
<element value="tweet-old-post" />
58+
</property>
59+
</properties>
60+
</rule>
5461

5562
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
5663
<severity>0</severity>
5764
</rule>
5865

59-
</ruleset>
66+
</ruleset>

vue/src/vue-elements/main-page-panel.vue

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
</h1>
1616
</div>
1717
</div>
18-
<div
19-
id="tsdk_banner"
20-
class="rop-banner"
21-
/>
2218
<toast />
2319
<div
2420
v-if=" is_rest_api_error "
@@ -64,6 +60,11 @@
6460
</div>
6561
</div>
6662

63+
<div
64+
id="tsdk_banner"
65+
class="rop-banner"
66+
/>
67+
6768
<div class="columns">
6869
<div class="panel column col-9 col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
6970
<div
@@ -384,8 +385,10 @@
384385
}, 1000);
385386
386387
this.get_toast_message(false);
387-
388-
document.dispatchEvent(new Event('themeisle:banner:init'));
388+
389+
if ( window.tsdk_reposition_notice ) {
390+
window.tsdk_reposition_notice?.();
391+
}
389392
},
390393
created() {
391394
this.$root.$refs.main_page = this;
@@ -574,9 +577,12 @@
574577
text-decoration: underline;
575578
}
576579
577-
.rop-banner:has(.tsdk-banner-cta) {
580+
.rop-banner:has(.themeisle-sale) {
578581
width: 100%;
579-
margin-top: 15px;
580582
margin-bottom: 30px;
581583
}
584+
585+
#tsdk_banner :is(.themeisle-sale, p) {
586+
margin: 0;
587+
}
582588
</style>

0 commit comments

Comments
 (0)