From d2ea2d0513f398967f16f403a746a6c9dbc87560 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 13 Dec 2024 13:54:39 +0300 Subject: [PATCH 1/6] fixed textdomain load --- class-visual-portfolio.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/class-visual-portfolio.php b/class-visual-portfolio.php index dd8356bc..5c3641a7 100644 --- a/class-visual-portfolio.php +++ b/class-visual-portfolio.php @@ -97,7 +97,6 @@ public function __construct() { * Init options */ public function init() { - $this->plugin_name = esc_html__( 'Visual Portfolio', 'visual-portfolio' ); $this->plugin_basename = plugin_basename( __FILE__ ); $this->plugin_path = plugin_dir_path( __FILE__ ); $this->plugin_url = plugin_dir_url( __FILE__ ); @@ -108,14 +107,28 @@ public function init() { $this->pro_plugin_url = plugin_dir_url( WP_PLUGIN_DIR . '/visual-portfolio-pro/class-visual-portfolio-pro.php' ); } - // load textdomain. - load_plugin_textdomain( 'visual-portfolio', false, basename( dirname( __FILE__ ) ) . '/languages' ); + // include helper files. + $this->include_dependencies(); // Hooks. + add_action( 'init', array( $this, 'earlier_init_hook' ), 5 ); + add_action( 'init', array( $this, 'init_hook' ) ); add_action( 'init', array( $this, 'run_deferred_rewrite_rules' ), 20 ); + } - // include helper files. - $this->include_dependencies(); + /** + * Earlier init hook to safety use plugin name in standard init hook. + */ + public function earlier_init_hook() { + $this->plugin_name = esc_html__( 'Visual Portfolio', 'visual-portfolio' ); + } + + /** + * Init hook. + */ + public function init_hook() { + // load textdomain. + load_plugin_textdomain( 'visual-portfolio', false, basename( dirname( __FILE__ ) ) . '/languages' ); } /** From 4e9294c296598724cab691d44554e79416b3cd88 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 13 Dec 2024 13:55:34 +0300 Subject: [PATCH 2/6] fixed usage of some deprecated Gutenberg attributes and components --- gutenberg/components/aspect-ratio/index.js | 6 +++++ gutenberg/components/color-picker/style.scss | 6 +---- gutenberg/components/controls-render/index.js | 22 +++++++++++++++++-- gutenberg/components/date-picker/index.js | 5 ++--- gutenberg/components/gallery-control/index.js | 19 +++++++++++----- gutenberg/components/iframe-preview/index.js | 9 ++------ gutenberg/components/setup-wizard/index.js | 5 ++++- .../components/toggle-group-control/index.js | 2 ++ gutenberg/components/toggle-modal/index.js | 2 +- .../custom-post-meta/image-focal-point.js | 4 ++++ gutenberg/custom-post-meta/video.js | 4 +++- gutenberg/extensions/items-count-all.js | 10 ++++----- gutenberg/layouts-editor/block/index.js | 1 - package-lock.json | 12 +++++----- package.json | 2 +- readme.txt | 2 +- 16 files changed, 71 insertions(+), 40 deletions(-) diff --git a/gutenberg/components/aspect-ratio/index.js b/gutenberg/components/aspect-ratio/index.js index 1fa2c99d..8327661d 100644 --- a/gutenberg/components/aspect-ratio/index.js +++ b/gutenberg/components/aspect-ratio/index.js @@ -102,6 +102,8 @@ export default class AspectRatio extends Component { label: DEFAULT_RATIOS[ratio], value: ratio, }))} + __next40pxDefaultSize + __nextHasNoMarginBottom /> {isCustom ? (
@@ -110,12 +112,16 @@ export default class AspectRatio extends Component { type="number" value={parts[0]} onChange={(val) => this.updatePart(val, true)} + __next40pxDefaultSize + __nextHasNoMarginBottom /> this.updatePart(val, false)} + __next40pxDefaultSize + __nextHasNoMarginBottom />
) : ( diff --git a/gutenberg/components/color-picker/style.scss b/gutenberg/components/color-picker/style.scss index fefafd32..12c93725 100644 --- a/gutenberg/components/color-picker/style.scss +++ b/gutenberg/components/color-picker/style.scss @@ -1,12 +1,8 @@ @use "sass:math"; // Group label. -.vpf-control-wrap-html:has(+ .vpf-control-wrap-color) { - margin-bottom: -8px; -} - .vpf-control-wrap-color:has(+ .vpf-control-wrap-color) { - margin-bottom: -9px; + margin-bottom: 0; .vpf-component-color-toggle { border-bottom: none; diff --git a/gutenberg/components/controls-render/index.js b/gutenberg/components/controls-render/index.js index 9bdddc52..2bf0902c 100644 --- a/gutenberg/components/controls-render/index.js +++ b/gutenberg/components/controls-render/index.js @@ -369,6 +369,8 @@ ControlsRender.Control = function (props) { controlName={props.name} options={categoryControlOptions} key={categoryControlOptions} + __next40pxDefaultSize + __nextHasNoMarginBottom > {(group) => { return ( @@ -459,8 +461,7 @@ ControlsRender.Control = function (props) { {Object.keys(props.options || {}).map((val) => ( )} @@ -293,6 +294,8 @@ const SelectedImageData = function (props) { label={__('File URL:', 'visual-portfolio')} value={imageData?.source_url || ''} readOnly + __next40pxDefaultSize + __nextHasNoMarginBottom />