Skip to content

Commit

Permalink
Release for v1.0.1 (#5)
Browse files Browse the repository at this point in the history
* Initial commit

* Added phpcs

* Added lint config

* Updated config file

* Added gitignore

* Fixed phpcs errors

* Ignore composer.lock

* Added tests

* Added patchwork config

* Updated composer packages and script

* Updated method

* Updated namespace

* Updated namespace and methods

* Added test workflow

* Remove test cache

* Ignore test cache

* Updated README

* Updated README

* Updated README

* Updated README

* Updated test

* Updated README

* Updated namespace

* Added phpstan

* Fixed phpstan errors

* Updated composer.json

* Added phpstan config

* Added workflow file for phpstan

* Updated namespace

* use defined var

* Updated README

* Updated tests

* Make wp rocket referrer dynamic

* Updated data

* Updated tests

* Added git attribute file

* Fixed phpcs
  • Loading branch information
jeawhanlee authored Oct 21, 2024
1 parent aa7206c commit df30824
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.github export-ignore
tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
patchwork.json export-ignore
phpcs.xml export-ignore
phpstan.neon.dist export-ignore
README.md export-ignore

20 changes: 19 additions & 1 deletion src/Model/PluginFamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
* Handles the data to be passed to the frontend.
*/
class PluginFamily {

/**
* An array of referrers for wp rocket.
*
* @var array
*/
protected $wp_rocket_referrer = [
'imagify-plugin' => 'imagify',
'seo-by-rank-math' => '',
'backwpup' => '',
'uk-cookie-consent' => '',
];

/**
* Get filtered plugins.
*
Expand Down Expand Up @@ -40,6 +53,7 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi
$plugin_path = $plugin . '.php';
$plugin_slug = dirname( $plugin );
$main_plugin_slug = dirname( $main_plugin );
$wpr_referrer = 'wp-rocket' !== $main_plugin_slug ? $this->wp_rocket_referrer[ $main_plugin_slug ] : '';

/**
* Check for activated plugins and pop them out of the array
Expand Down Expand Up @@ -96,10 +110,14 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi

// Create unique CTA data for WP Rocket.
if ( 'wp-rocket/wp-rocket' === $plugin ) {
$url = 'https://wp-rocket.me/?utm_source=' . $wpr_referrer . '-coupon&utm_medium=plugin&utm_campaign=' . $wpr_referrer;

$plugins[ $cat ]['plugins'][ $plugin ]['cta'] = [
'text' => 'Get it Now',
'url' => 'https://wp-rocket.me/?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify',
'url' => $url,
];

$plugins[ $cat ]['plugins'][ $plugin ]['link'] = $url;
}

// Set activation text.
Expand Down
2 changes: 1 addition & 1 deletion src/Model/wp_media_plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
'title' => 'Speed Up Your Website, Instantly',
'desc' => 'WP Rocket is the easiest way to make your WordPress website faster and boost your Google PageSpeed score. Get more traffic, better engagement, and higher conversions effortlessly.',
'link' => 'https://wp-rocket.me/?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify',
'link' => '',
],
'imagify-plugin/imagify' => [
'logo' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
],
'title' => 'Speed Up Your Website, Instantly',
'desc' => 'WP Rocket is the easiest way to make your WordPress website faster and boost your Google PageSpeed score. Get more traffic, better engagement, and higher conversions effortlessly.',
'link' => 'https://wp-rocket.me/?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify',
'link' => 'https://wp-rocket.me/?utm_source=-coupon&utm_medium=plugin&utm_campaign=',
'cta' => [
'text' => 'Activate',
'url' => 'http://example.org/wp-admin/admin-post.php?action=plugin_family_install_wp-rocket&_wpnonce=9a68f00b8d&plugin_to_install=wp-rocket%2Fwp-rocket'
Expand Down Expand Up @@ -251,10 +251,10 @@
],
'title' => 'Speed Up Your Website, Instantly',
'desc' => 'WP Rocket is the easiest way to make your WordPress website faster and boost your Google PageSpeed score. Get more traffic, better engagement, and higher conversions effortlessly.',
'link' => 'https://wp-rocket.me/?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify',
'link' => 'https://wp-rocket.me/?utm_source=-coupon&utm_medium=plugin&utm_campaign=',
'cta' => [
'text' => 'Get it Now',
'url' => 'https://wp-rocket.me/?utm_source=imagify-coupon&utm_medium=plugin&utm_campaign=imagify'
'url' => 'https://wp-rocket.me/?utm_source=-coupon&utm_medium=plugin&utm_campaign='
],
],
'imagify-plugin/imagify' => [
Expand Down

0 comments on commit df30824

Please sign in to comment.