Skip to content

Commit

Permalink
release: fixes
Browse files Browse the repository at this point in the history
- Improve strings structure for translation workflow
- Enhanced security
- Update internal dependencies
  • Loading branch information
Soare-Robert-Daniel authored Oct 30, 2024
2 parents 72f9d08 + 7f23e14 commit 4ed4480
Show file tree
Hide file tree
Showing 212 changed files with 1,861 additions and 1,292 deletions.
30 changes: 27 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"env": {
"browser": true,
"es2021": true
"browser": true
},
"extends": "wordpress",
"extends": "plugin:@wordpress/eslint-plugin/recommended",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
Expand Down Expand Up @@ -63,5 +62,30 @@
"objectsInObjects": false
}
],
"prettier/prettier": ["off"],
"react-hooks/rules-of-hooks": ["warn"],
"dot-notation": ["off"],
"@wordpress/no-unsafe-wp-apis": ["warn"],
"no-undef": ["warn"],
"no-shadow": ["warn"],
"@typescript-eslint/no-shadow": "warn",
"@wordpress/no-base-control-with-label-without-id": ["warn"],
"no-unused-vars": ["warn"],
"@typescript-eslint/no-unused-vars": "warn",
"jsdoc/require-returns-description": ["warn"],
"no-unused-expressions": ["warn"],
"jsdoc/require-returns-type": ["warn"],
"no-nested-ternary": ["warn"],
"no-console": "warn",
"jsdoc/require-param-type": "warn",
"jsdoc/no-undefined-types": "warn",
"jsx-a11y/click-events-have-key-events": "warn",
"jsx-a11y/no-static-element-interactions": "warn",
"import/no-extraneous-dependencies": "warn",
"jsx-a11y/label-has-associated-control": "warn",
"jsx-a11y/alt-text": "warn",
"jsx-a11y/anchor-is-valid": "warn",
"jsx-a11y/no-noninteractive-element-interactions": "warn",
"jsx-a11y/no-autofocus": "warn"
}
}
58 changes: 58 additions & 0 deletions .github/workflows/update-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Dispatch Update to translations.themeisle.com

on:
push:
tags:
- "*"

jobs:
makepot:
name: Build, make pot file and upload to S3
runs-on: ubuntu-latest

steps:
- name: Check out source files
uses: actions/checkout@v4
- name: Setup node 18
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install composer deps
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
composer install --no-dev --prefer-dist --no-progress
- name: Install NPM deps
run: npm ci
- name: Build files
run: npm run build
- name: Build pot
run: npm run build:makepot
- name: Upload Latest Version to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_DEV_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_KEY_ARTIFACTS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_ARTIFACTS }}
SOURCE_DIR: languages/
DEST_DIR: ${{ github.event.repository.name }}-translations/

dispatch-workflow:
runs-on: ubuntu-latest
needs: makepot

steps:
- name: Dispatch workflow
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.BOT_TOKEN }}
repository: Codeinwp/themeisle-translations
event-type: update-potfile
client-payload: |
{
"ref": "${{ github.ref }}",
"potfile": "https://verti-artifacts.s3.amazonaws.com/${{ github.event.repository.name }}-translations/otter-pro.pot",
"slug": "otter-pro"
}
17 changes: 9 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions inc/class-blocks-animation.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,13 @@ public function render_welcome_notice() {
$notice_html .= '<div class="notice-copy">';

$notice_html .= '<h1 class="notice-title">';
/* translators: %s: Otter Blocks */
$notice_html .= sprintf( __( 'Power Up Your Site with %1$s, %2$s, %3$s, and more!', 'otter-blocks' ), '<span>Add-on Blocks</span>', '<span>Enhanced Animations</span>', '<span>Visibility Conditions</span>' );
$notice_html .= sprintf(
/* translators: %1$s: Add-on Blocks, %2$s: Enhanced Animations, %3$s: Visibility Conditions */
__( 'Power Up Your Site with %1$s, %2$s, %3$s, and more!', 'otter-blocks' ),
'<span>' . __( 'Add-on Blocks', 'otter-blocks' ) . '</span>',
'<span>' . __( 'Enhanced Animations', 'otter-blocks' ) . '</span>',
'<span>' . __( 'Visibility Conditions', 'otter-blocks' ) . '</span>'
);

$notice_html .= '</h1>';

Expand Down
5 changes: 5 additions & 0 deletions inc/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function init() {
if ( ! function_exists( 'is_wpcom_vip' ) ) {
add_filter( 'upload_mimes', array( $this, 'allow_meme_types' ), PHP_INT_MAX ); // phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.upload_mimes
add_filter( 'wp_handle_upload_prefilter', array( $this, 'check_svg_and_sanitize' ) );
add_filter( 'wp_handle_sideload_prefilter', array( $this, 'check_svg_and_sanitize' ) );
add_filter( 'wp_check_filetype_and_ext', array( $this, 'fix_mime_type_json_svg' ), 75, 3 );
add_filter( 'wp_generate_attachment_metadata', array( $this, 'generate_svg_attachment_metadata' ), PHP_INT_MAX, 2 );
}
Expand Down Expand Up @@ -398,6 +399,10 @@ public function check_svg_and_sanitize( $file ) {
'otter-blocks'
);
}

$path_info = pathinfo( $file['name'] );
$unique_suffix = '-' . substr( md5( uniqid() ), 0, 6 );
$file['name'] = $path_info['filename'] . $unique_suffix . '.' . $path_info['extension'];
}

return $file;
Expand Down
31 changes: 19 additions & 12 deletions inc/integrations/class-form-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,27 +262,34 @@ public function build_error_body( $form_data ) {
*/
public function build_test_email( $form_data ) {
return sprintf(
"
'
<!doctype html>
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html;\" charset=\"utf-8\"/>
<meta http-equiv="Content-Type" content="text/html;" charset="utf-8"/>
<!-- view port meta tag -->
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>
<title>%s%s</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>%s</title>
</head>
<body>
%s
<br><br>
Location: <a href='%s'>link</a>.
%s
</body>
</html>
",
esc_html__( 'Mail From: ', 'otter-blocks' ),
sanitize_email( get_site_option( 'admin_email' ) ),
esc_html( __( 'This a test email. If you receive this email, your SMTP set-up is working for sending emails via Form Block.', 'otter-blocks' ) ),
$form_data->get_data_from_payload( 'site' )
',
sprintf(
// translators: %s is the admin email address.
__( 'Mail From: %s', 'otter-blocks' ),
sanitize_email( get_site_option( 'admin_email' ) )
),
esc_html__( 'This a test email. If you receive this email, your SMTP set-up is working for sending emails via Form Block.', 'otter-blocks' ),
sprintf(
// translators: %s is the URL of the site from which the email was sent.
__( 'Location: %s', 'otter-blocks' ),
'<a href="' . $form_data->get_data_from_payload( 'site' ) . '">' . esc_html__( 'link', 'otter-blocks' ) . '</a>'
)
);
}

Expand Down
17 changes: 12 additions & 5 deletions inc/render/class-review-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ function() use ( $attributes, $post_id ) {
$html .= ' <div class="o-review__header_ratings__stars">';
$html .= $this->get_overall_stars( $this->get_overall_ratings( $attributes['features'] ), $scale );
$html .= ' </div>';
// translators: Overall rating from 1 to 10.
$html .= ' <span>' . sprintf( __( '%1$g out of %2$g', 'otter-blocks' ), $this->get_overall_ratings( $attributes['features'], $scale ), 10 / $scale ) . '</span>';
$html .= ' <span>' . sprintf(
// translators: %1$g is the overall rating, %2$g is the maximum rating.
__( '%1$g out of %2$g', 'otter-blocks' ),
$this->get_overall_ratings( $attributes['features'], $scale ),
10 / $scale
) . '</span>';
$html .= ' </div>';

if ( ( isset( $attributes['price'] ) && ! empty( $attributes['price'] ) ) || isset( $attributes['discounted'] ) ) {
Expand Down Expand Up @@ -133,9 +137,12 @@ function() use ( $attributes, $post_id ) {
$html .= ' <div class="o-review__left_feature_ratings__stars">';
$html .= $this->get_overall_stars( $feature['rating'], $scale );
$html .= ' </div>';

// translators: Overall rating from 1 to 10.
$html .= ' <span class="o-review__left_feature_num">' . sprintf( __( '%1$g out of %2$g', 'otter-blocks' ), 1 <= round( $feature['rating'] / $scale, 1 ) ? round( $feature['rating'] / $scale, 1 ) : 1, 10 / $scale ) . '</span>';
$html .= ' <span class="o-review__left_feature_num">' . sprintf(
// translators: %1$g is the overall rating, %2$g is the maximum rating.
__( '%1$g out of %2$g', 'otter-blocks' ),
1 <= round( $feature['rating'] / $scale, 1 ) ? round( $feature['rating'] / $scale, 1 ) : 1,
10 / $scale
) . '</span>';

$html .= ' </div>';

Expand Down
Loading

0 comments on commit 4ed4480

Please sign in to comment.