ArrayIterator
Forum Replies Created
-
Thank you?
Truly is also my fault ??cause I’ve been in wrong topic & replies. I was writing about textdomain.
Hello @rsouzaam this looks like your code direct load the integration before
after_setup_theme
Looks like your code is invalid on integration, eg: (divi or default themes)
/**
* This is array<string>
* @var array<string>
*/
$allow_themes = [ 'Divi', 'Extra' ]; // string[]
$theme = wp_get_theme();
$theme_name = $theme->get_template(); // string (OK)
$theme_parent = $theme->parent(); // but this is \WP_Theme
// invalid comparation cause using __tostring() / stringable theme object
return (bool) array_intersect( [ $theme_name, $theme_parent ], $allow_themes );When you use it for comparation it will call
__tostring()
method, the stringable also call thedisplay()
method onWP_Theme
.Please follow the github source of
WP_Theme
, that mean the display method will call the method ofload_textdomain()
even the init/setup theme not yet called.// ref: https://github.com/WordPress/wordpress-develop/blob/d088e31c73456179502c9bd5354fc43c6267bd7a/src/wp-includes/class-wp-theme.php#L811
public function display( $header, $markup = true, $translate = true ) {
$value = $this->get( $header );
if ( false === $value ) {
return false;
}
// this is the problem
if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) {
$translate = false;
}
if ( $translate ) {
$value = $this->translate_header( $header, $value );
}
if ( $markup ) {
$value = $this->markup_header( $header, $value, $translate );
}
return $value;
}I prefer to change
array_intersect
with this code: (divi)/**
* This is array<string>
* @var array<string>
*/
$allow_themes = [ 'Divi', 'Extra' ];
$theme = wp_get_theme();
$theme_name = $theme->get_template();
$theme_parent = $theme->parent(); // \WP_Theme
$theme_list = [
$theme_name
];
if ($theme_parent instanceof \WP_Theme) {
$theme_list[] = $theme_parent->get_template();
}
// using comparison with real string[]
return (bool) array_intersect( $theme_list, $allow_themes );- This reply was modified 3 months, 2 weeks ago by ArrayIterator. Reason: change description
Forum: Reviews
In reply to: [Jetpack - WP Security, Backup, Speed, & Growth] Greedy and deceptiveWhen I full focused as a programmer & developer since 2008, I also feels that charge of jetpack stats with 8$ maybe it was expensive.
So was sad to know this!This is not about to make long terms sustainability! But, jetpack just like venture capital does! Want to money – money & money, pushing the other to make money everytime & everywhere!
Too many people will migrate to the alternative, and I feel that too many people now remove the jetpack from their sites.
Your team decisions make a fatal decision! When their gone, they will not comeback.
Forum: Plugins
In reply to: [Kirki Customizer Framework] There is a critical error on your website.@davidvongries thanks for the update.
I’m still facing the issues about same error causes autoloading class.Class Kirki\Field\CSS\ReactColorful located in ./packages/kirki-framework/control-react-colorful/src/Field/Css/ReactColorful.php does not comply with psr-4 autoloading standard. Skipping. Class Kirki\Control\MultiCheck located in ./packages/kirki-framework/control-multicheck/src/Control/Multicheck.php does not comply with psr-4 autoloading standard. Skipping.
I also try to update composer
dumpautoload
withoptimize-autoloader
but no luck.Forum: Plugins
In reply to: [Kirki Customizer Framework] There is a critical error on your website.PHP message: PHP Fatal error: Uncaught Error: Class "\Kirki\Field\CSS\ReactColorful" not found in {ROOT}/wp-content/plugins/kirki/packages/kirki-framework/module-css/src/CSS/Generator.php:170
this is 4.0, 4.1 version, looks like
composer.json
autoloader config does not configure properly.- This reply was modified 3 years, 2 months ago by ArrayIterator.
- This reply was modified 3 years, 2 months ago by ArrayIterator.