Skip to content

Commit 90e3861

Browse files
release: fixes
- Improved tooltip style in the dashboard - Enhanced security - Improved translatable strings - Fixed conditional field display issue with a select option
2 parents 2e414fe + 2b0e4fc commit 90e3861

File tree

86 files changed

+553
-41628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+553
-41628
lines changed

.releaserc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins:
99
- - "@semantic-release/release-notes-generator"
1010
- preset: simple-preset
1111
- - "@semantic-release/exec"
12-
- prepareCmd: "replace-in-file \"== Changelog ==\" \"== Changelog ==\n\n${nextRelease.notes}\" readme.txt"
12+
- prepareCmd: "export nextReleaseNotes="${nextRelease.notes}" && node bin/update-changelog.js"
1313
- - "@semantic-release/exec"
1414
- prepareCmd: grunt version::${nextRelease.version} && grunt wp_readme_to_markdown
1515
- - "semantic-release-slack-bot"

backend/options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ function ppom_load_pro_options() {
487487
'ppom-enf-btn-class' => array(
488488
'type' => 'text',
489489
'title' => __( 'Button Class', 'woocommerce-product-addon' ),
490-
'desc' => __( ' Add custom CSS classes to the enquiry form button, separated by commas.', 'woocommerce-product-addon' ),
490+
'desc' => __( 'Add custom CSS classes to the enquiry form button, separated by commas.', 'woocommerce-product-addon' ),
491491
),
492492
'ppom-enf-btn-text-color' => array(
493493
'type' => 'color',

backend/templates/admin-settings.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ class="nmsf-label <?php echo ! $is_available ? 'ppom-is-locked-section' : ''; ?
9999
<div class="nmsf-panel-settings-area <?php echo ! $is_available ? 'ppom-is-locked-panel' : ''; ?>">
100100
<?php if ( ! $is_available ): ?>
101101
<div class="ppom-notice-upsell"><p>
102-
<?php echo sprintf( __( '%s customization is not available on your current plan. %sUpgrade to the Pro%s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ), esc_html( $title ), sprintf( '<a href="%s" target="_blank">', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '</a>' ); ?>
102+
<?php echo sprintf(
103+
// translators: %1$s: the name of plugin feature, %2$s: the upgrade link.
104+
__( '%1$s customization is not available on your current plan. %2$s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ),
105+
esc_html( $title ),
106+
sprintf(
107+
'<a href="%s" target="_blank">%s</a>',
108+
esc_url( tsdk_translate_link( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ),
109+
__( 'Upgrade to the Pro', 'woocommerce-product-addon' )
110+
)
111+
); ?>
103112
</p>
104113
</div>
105114
<?php endif; ?>
@@ -142,7 +151,16 @@ class="<?php echo $condition_class; ?>"
142151
<td class="nmsf-section-type" colspan="2">
143152
<?php if ( $is_available && !$is_input_available ): ?>
144153
<div class="ppom-notice-upsell"><p>
145-
<?php echo sprintf( __( '%s customization is not available on your current plan. %sUpgrade to the Pro%s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ), esc_html( $title ), sprintf( '<a href="%s" target="_blank">', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '</a>' ); ?>
154+
<?php echo sprintf(
155+
// translators: %1$s: the name of plugin feature, %2$s: opening anchor tag.
156+
__( '%1$s customization is not available on your current plan. %2$s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ),
157+
esc_html( $title ),
158+
sprintf(
159+
'<a href="%s" target="_blank">%s</a>',
160+
esc_url( tsdk_translate_link( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ),
161+
__( 'Upgrade to the Pro', 'woocommerce-product-addon' )
162+
)
163+
); ?>
146164
</p>
147165
</div>
148166
<?php endif; ?>

bin/update-changelog.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const replace = require('replace-in-file');
2+
3+
async function updateChangelog() {
4+
const options = {
5+
files: 'readme.txt',
6+
from: /== Changelog ==[\s\S]*?\[See changelog for all versions\]/,
7+
to: (match) => {
8+
return `== Changelog ==\n\n${process.env.nextReleaseNotes}\n\n[See changelog for all versions]`;
9+
},
10+
encoding: 'utf8',
11+
};
12+
try {
13+
const results = await replace(options);
14+
console.log('Replacement results:', results);
15+
} catch (error) {
16+
console.error('Error occurred:', error);
17+
}
18+
}
19+
20+
updateChangelog();

classes/admin.class.php

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function add_menu_pages() {
150150

151151
$menu = add_submenu_page(
152152
$page ['parent_slug'],
153-
__( $page ['page_title'], 'woocommerce-product-addon' ),
153+
$page ['page_title'],
154154
__( 'PPOM Fields', 'woocommerce-product-addon' ),
155155
$cap,
156156
$page ['slug'],
@@ -165,7 +165,7 @@ function add_menu_pages() {
165165
$cap = 'ppom_options_page';
166166
// Menu page for roles set by PPOM Permission Settings
167167
$menu = add_menu_page(
168-
__( $page ['page_title'], 'woocommerce-product-addon' ),
168+
$page ['page_title'],
169169
__( 'PPOM Fields', 'woocommerce-product-addon' ),
170170
$cap,
171171
$page ['slug'],
@@ -239,14 +239,14 @@ function product_meta() {
239239
// existing meta group tables show only ppom main page
240240
if ( $action != 'new' && $do_meta != 'edit' && $view != 'addons' && $view != 'changelog' ) {
241241
ppom_load_template( 'admin/existing-meta.php' );
242-
242+
243243
// NOTE: Allow only for Tier 1 Plan or lower if license is present.
244244
$should_load_banner = NM_PersonalizedProduct::LICENSE_PLAN_1 >= NM_PersonalizedProduct::get_license_category( intval( apply_filters( 'product_ppom_license_plan', 0 ) ) );
245-
245+
246246
if ( $should_load_banner ) {
247247
do_action( 'themeisle_sdk_load_banner', 'ppom' );
248248
}
249-
249+
250250
}
251251

252252
echo '</div>';
@@ -270,7 +270,17 @@ function get_products() {
270270
$ppom_id = intval( $_GET['ppom_id'] );
271271
$license_status = apply_filters( 'product_ppom_license_status', '' );
272272
$current_saved_value = $this->get_db_field( $ppom_id );
273-
$pro_multiple_fields = ! ppom_pro_is_installed() || 'valid' !== $license_status ? '</br><i style="font-size: 90%">' . sprintf( __( 'Your current plan supports adding one group of fields per product. To add multiple groups to the same product, please %supgrade%s your plan!', 'woocommerce-product-addon' ), '<a target="_blank" href="' . tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'multiple-fields' ) . '">', '</a>' ) . '</i>' : '';
273+
$pro_multiple_fields = ! ppom_pro_is_installed() || 'valid' !== $license_status
274+
? '</br><i style="font-size: 90%">' . sprintf(
275+
// translators: %1$s: the link to the store with label 'upgrade'.
276+
__( 'Your current plan supports adding one group of fields per product. To add multiple groups to the same product, please %1$s your plan!', 'woocommerce-product-addon' ),
277+
sprintf(
278+
'<a href="%1$s" target="_blank">%2$s</a>',
279+
esc_url( tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'multiple-fields' ) ),
280+
__( 'Upgrade to the Pro', 'woocommerce-product-addon' )
281+
)
282+
) . '</i>'
283+
: '';
274284
$select_products_id_component = ( new \PPOM\Attach\SelectComponent() )
275285
->set_id( 'attach-to-products' )
276286
->set_title( __( 'Display on Specific Products', 'woocommerce-product-addon' ) )
@@ -477,7 +487,7 @@ public function get_wc_categories( $current_values ) {
477487
* Retrieves WooCommerce product tags and checks if they are used in the current values.
478488
*
479489
* @param array $current_values The current values to check against.
480-
*
490+
*
481491
* @return array An array containing the options of product tags and a flag indicating if any category is used.
482492
*/
483493
function get_wc_tags( $current_values ) {
@@ -635,7 +645,13 @@ function ppom_attach_ppoms() {
635645
self::save_categories_and_tags( $ppom_id, $categories_to_attach, $tags_to_attach );
636646

637647
$response = array(
638-
'message' => "PPOM updated for {$updated_products} Products, {$updated_cat} Categories and {$updated_tags} Tags.",
648+
'message' => sprintf(
649+
// translators: %1$d: number of products, %2$d: number of categories, %3$d: number of tags.
650+
__('PPOM updated for %1$d Products, %2$d Categories and %3$d Tags.', 'woocommerce-product-addon'),
651+
$updated_products,
652+
$updated_cat,
653+
$updated_tags
654+
),
639655
'status' => 'success',
640656
);
641657

@@ -680,10 +696,8 @@ function validate_plugin() {
680696

681697
echo '<div class="wrap">';
682698
echo '<h2>' . __( 'Provide API key below:', 'woocommerce-product-addon' ) . '</h2>';
683-
echo '<p>' . __( 'If you don\'t know your API key, please login into your: <a target="_blank" href="http://wordpresspoets.com/member-area">Member area</a>', 'woocommerce-product-addon' ) . '</p>';
684-
685699
echo '<form onsubmit="return validate_api_wooproduct(this)">';
686-
echo '<p><label id="plugin_api_key">' . __( 'Entery API key', 'woocommerce-product-addon' ) . ':</label><br /><input type="text" name="plugin_api_key" id="plugin_api_key" /></p>';
700+
echo '<p><label id="plugin_api_key">' . __( 'Enter API key', 'woocommerce-product-addon' ) . ':</label><br /><input type="text" name="plugin_api_key" id="plugin_api_key" /></p>';
687701
wp_nonce_field();
688702
echo '<p><input type="submit" class="button-primary button" name="plugin_api_key" /></p>';
689703
echo '<p id="nm-sending-api"></p>';
@@ -873,7 +887,7 @@ public function ppom_create_db_tables() {
873887
) {
874888
return;
875889
}
876-
890+
877891
NM_PersonalizedProduct::activate_plugin();
878892
}
879893
}

classes/attach-popup/container-view.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ContainerView {
1212
* @return string
1313
*/
1414
public function render() {
15-
return 'Empty!';
15+
return '';
1616
}
1717

1818
/**

0 commit comments

Comments
 (0)