Skip to content

Commit

Permalink
Merge branch 'develop' into feature/3.18
Browse files Browse the repository at this point in the history
# Conflicts:
#	assets/css/wpr-admin.min.css
#	assets/js/wpr-admin.js
#	assets/js/wpr-admin.min.js
#	assets/js/wpr-admin.min.js.map
#	src/js/global/fields.js
#	wp-rocket.php
  • Loading branch information
wordpressfan committed Jan 1, 2025
2 parents d27d28b + dfe5a7a commit e819232
Show file tree
Hide file tree
Showing 52 changed files with 1,935 additions and 820 deletions.
154 changes: 143 additions & 11 deletions assets/css/wpr-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,9 @@ a:focus, button:focus {

.wpr-Popin-Upgrade .wpr-Popin-flex {
justify-content: space-between;
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 15px;
}

.wpr-Popin-Upgrade .wpr-Popin-flex > div {
Expand All @@ -1016,13 +1019,10 @@ a:focus, button:focus {
border-radius: 24px;
display: flex;
flex-direction: column;
margin: 0 16px 0 0;
padding: 24px;
text-align: center;
width: 50%;
}
.wpr-Popin-Upgrade .wpr-Popin-flex > div:last-child {
margin-right: 0;
flex: 0.5;
margin: 0;
}
@media (max-width: 783px) {
.wpr-Popin-Upgrade .wpr-Popin-flex > div {
Expand All @@ -1031,7 +1031,7 @@ a:focus, button:focus {
}
}

.wpr-Upgrade-Plus .wpr-upgrade-title::before {
.wpr-upgrade-item:first-child .wpr-upgrade-title::before {
content: url(../img/plus.svg);
display: block;
width: 117px;
Expand All @@ -1042,7 +1042,7 @@ a:focus, button:focus {
transform: translateX(-50%);
}

.wpr-Upgrade-Infinite .wpr-upgrade-title::before {
.wpr-upgrade-item:nth-child(2) .wpr-upgrade-title::before {
content: url(../img/infinite.svg);
display: block;
width: 48px;
Expand Down Expand Up @@ -1099,14 +1099,20 @@ div.wpr-upgrade-websites {
line-height: 1;
font-weight: bold;
margin: 0 0 24px 0;
width: 100%;
}
div.wpr-upgrade-websites.notstacked {
padding: 16px 0;
margin: 0 0 16px;
}

.wpr-upgrade-link {
background: #fff;
border: 1px solid #F56F46;
border-radius: 800px;
color: #F56F46;
display: block;
display: flex;
align-items: center;
font-size: 1rem;
line-height: 1.125;
font-weight: bold;
Expand All @@ -1117,10 +1123,17 @@ div.wpr-upgrade-websites {
background: #F56F46;
color: #fff;
}
.wpr-upgrade-link:hover:after {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M11.2 2.8a.8.8 0 00-1.3 1L12.6 7h-11a.8.8 0 100 1.7h11L10 12a.8.8 0 101.3 1L15 8.6a.8.8 0 000-1.2l-3.8-4.5z'/%3E%3C/svg%3E");
}
.wpr-upgrade-link::after {
content: "→";
font-weight: normal;
margin-left: 8px;
content: "";
display: inline-block;
margin: 0 0 0 0.89em;
height: 16px;
width: 16px;
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23F56F46'%3E%3Cpath d='M11.2 2.8a.8.8 0 00-1.3 1L12.6 7h-11a.8.8 0 100 1.7h11L10 12a.8.8 0 101.3 1L15 8.6a.8.8 0 000-1.2l-3.8-4.5z'/%3E%3C/svg%3E");
vertical-align: -10%;
}

/*-----------------------------------------------*\
Expand Down Expand Up @@ -3188,4 +3201,123 @@ div.wpr-tutorial-item {
.wpr-field--categorizedmultiselect {
padding-right: 80px;
}
}
.custom-select {
position: relative;
width: 60%;
max-width: 100%;
color: #000;
margin: 0 auto !important;
}

.select-button {
width: 100%;
background-color: #fff;
padding: 0.65rem;
border: 1px solid #caced1;
border-radius: 1rem;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
}

.selected-value {
text-align: center;
flex: 1;
}

.custom-select-arrow {
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 6px solid #000;
transition: transform ease-in-out 0.3s;
}

.select-dropdown {
position: absolute;
z-index: 1;
list-style: none;
width: 100%;
border: 1px solid #caced1;
padding: 10px 0;
margin-top: 10px;
max-height: 200px;
overflow-y: auto;
opacity: 0;
visibility: hidden;
border-radius: 16px;
background-color: #fff;
transition: all 0.5s ease;
transform: translateY(-20px);
box-shadow: 0px 24px 40px rgba(0, 0, 0, 0.15);
font-weight: normal;
}

.select-dropdown:focus-within {
box-shadow: 0 10px 25px rgba(94, 108, 233, 0.6);
}

.select-dropdown li {
position: relative;
cursor: pointer;
display: flex;
gap: 1rem;
align-items: center;
justify-content: center;
}
.select-dropdown li:last-child {
margin-bottom: 0;
}

.select-dropdown li label {
width: 100%;
padding: 8px 10px;
cursor: pointer;
display: flex;
gap: 1rem;
align-items: center;
text-align: center;
flex: 1;
justify-content: center;
}

.select-dropdown::-webkit-scrollbar {
width: 7px;
}

.select-dropdown::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 25px;
}

.select-dropdown::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 25px;
}

.select-dropdown li:hover,
.select-dropdown li.active,
.select-dropdown input:checked ~ label {
background-color: #f2f2f2;
}

.select-dropdown input:focus ~ label {
background-color: #dfdfdf;
}

.select-dropdown input[type=radio] {
position: absolute;
left: 0;
opacity: 0;
}

.custom-select.active .custom-select-arrow {
transform: rotate(180deg);
}

.custom-select.active .select-dropdown {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
"berlindb/core",
"wp-media/plugin-family"
]
}
},
"plugin_domain": "rocket"
},
"scripts": {
"test-unit": "\"vendor/bin/phpunit\" --testsuite unit --colors=always --configuration tests/Unit/phpunit.xml.dist",
Expand Down Expand Up @@ -242,11 +243,13 @@
"phpcs:fix": "phpcbf",
"post-install-cmd": [
"\"vendor/bin/mozart\" compose",
"composer dump-autoload"
"composer dump-autoload",
"WP_Rocket\\Dependencies\\WPMedia\\PluginFamily\\PostInstall::apply_text_domain"
],
"post-update-cmd": [
"\"vendor/bin/mozart\" compose",
"composer dump-autoload"
"composer dump-autoload",
"WP_Rocket\\Dependencies\\WPMedia\\PluginFamily\\PostInstall::apply_text_domain"
],
"report-code-coverage": "\"vendor/bin/phpcov\" merge tests/report --clover tests/report/coverage.clover"
}
Expand Down
2 changes: 1 addition & 1 deletion dynamic-lists-delayjs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dynamic-lists.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ private function get_plugin(): string {
* @return string
*/
private function get_download_url(): string {

$slug = $this->get_slug();

$custom_download_url = $this->maybe_get_custom_download_url( $slug );

if ( false !== $custom_download_url ) {
return $custom_download_url;
}

$plugin_install = ABSPATH . 'wp-admin/includes/plugin-install.php';

if ( ! defined( 'ABSPATH' ) || ! file_exists( $plugin_install ) ) {
Expand All @@ -178,7 +187,7 @@ private function get_download_url(): string {
require_once $plugin_install; // @phpstan-ignore-line

$data = [
'slug' => $this->get_slug(),
'slug' => $slug,
'fields' => [
'download_link' => true,
'short_description' => false,
Expand Down Expand Up @@ -251,4 +260,36 @@ private function set_error( $error ) {
wp_safe_redirect( wp_get_referer() );
exit;
}

/**
* Returns a custom download url for plugin if exists.
*
* @param string $plugin_slug plugin slug.
* @return string|bool
*/
private function maybe_get_custom_download_url( string $plugin_slug ) {
$parent_plugin_slug = $this->get_parent_plugin_slug();

$urls = [
'seo-by-rank-math' => 'https://rankmath.com/downloads/plugin-family/' . $parent_plugin_slug,
];

if ( ! isset( $urls[ $plugin_slug ] ) ) {
return false;
}

return $urls[ $plugin_slug ];
}

/**
* Get parent plugin slug.
*
* @return string
*/
private function get_parent_plugin_slug(): string {
$plugin_path = plugin_basename( __FILE__ );
$chunks = explode( '/', $plugin_path );

return $chunks[0];
}
}
8 changes: 4 additions & 4 deletions inc/Dependencies/WPMedia/PluginFamily/Model/PluginFamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi
if ( is_plugin_active( $plugin_path ) && $main_plugin . '.php' !== $plugin_path ) {
// set cta data of active plugins.
$plugins[ $cat ]['plugins'][ $plugin ]['cta'] = [
'text' => 'Activated',
'text' => __( 'Activated', 'rocket' ),
'url' => '#',
];

Expand Down Expand Up @@ -106,7 +106,7 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi

// Set Installation link.
$plugins[ $cat ]['plugins'][ $plugin ]['cta'] = [
'text' => 'Install',
'text' => __( 'Install', 'rocket' ),
'url' => $install_activate_url,
];

Expand All @@ -115,7 +115,7 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi
$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',
'text' => __( 'Get it Now', 'rocket' ),
'url' => $url,
];

Expand All @@ -124,7 +124,7 @@ public function filter_plugins_by_activation( array $plugins, string $main_plugi

// Set activation text.
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_path ) ) {
$plugins[ $cat ]['plugins'][ $plugin ]['cta']['text'] = 'Activate';
$plugins[ $cat ]['plugins'][ $plugin ]['cta']['text'] = __( 'Activate', 'rocket' );

if ( 'wp-rocket/wp-rocket' === $plugin ) {
$plugins[ $cat ]['plugins'][ $plugin ]['cta']['url'] = $install_activate_url;
Expand Down
Loading

0 comments on commit e819232

Please sign in to comment.