'
. esc_html__( 'We are unable to load the addons for this theme right now. Please try again later!', 'wpz-ai-image-lab' )
. '
'
);
return;
}
echo( '' );
foreach ( $addons as $addon ) {
self::outputListItem( $addon );
}
echo( '
' );
}
static function outputListItem( $addon ) { ?>
badges ) ) {
foreach ( $addon->badges as $badge ) {
printf(
'%s',
esc_attr(sanitize_hex_color( $badge->textColor )),
esc_attr(sanitize_hex_color( $badge->bgColor )),
esc_html( $badge->label )
);
}
}
?>
name ) );
?>
description ) ); ?>
type ) {
case 'repo':
// from (modified) wp-admin/includes/plugin-install.php
$installed_plugin = get_plugins( '/' . $addon->target );
if ( empty( $installed_plugin ) ) {
$label = __( 'Install', 'wpz-ai-image-lab' );
if ( current_user_can( 'install_plugins' ) ) {
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->target ), 'install-plugin_' . $addon->target );
$onclick_escaped = '';
} else {
$url = '#';
$onclick_escaped = ' onclick="alert(\'' . esc_js( __( 'You do not have sufficient permissions to install plugins. If you think this message is in error, go to Plugins > Add New and search for the plugin name.', 'wpz-ai-image-lab' ) ) . '\');return false;"';
}
} else {
$label = __( 'Already Installed', 'wpz-ai-image-lab' );
$classes .= ' ags-settings-addon-btn-disabled';
$url = '#';
$onclick_escaped = ' onclick="return false;"';
}
break;
case 'link':
$label = $addon->buttonLabel;
$url = $addon->target;
$onclick_escaped = '';
break;
default:
return;
}
printf(
'%s',
esc_url( $url ),
esc_attr( $classes ),
$onclick_escaped, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
esc_html( $label )
);
}
}
WPZ_Ai_Image_Lab_Addons::setup();