Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve sniffer's errors and warning in src/admin-views/ #2124

Merged
merged 5 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions src/admin-views/app-shop.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
// $main, $products, $bundles, $extensions must be defined before loading this file
/**
* The template for the App Shop page.
*
* $main, $products, $bundles, $extensions must be defined before loading this file.
*/

$all_products = [
'for-sale' => [],
'for-sale' => [],
'installed' => [],
];
foreach ( $products as $product ) {
Expand All @@ -13,12 +17,12 @@
}
}

use \Tribe\Admin\Troubleshooting;
use Tribe\Admin\Troubleshooting;
?>

<div id="tribe-app-shop">

<?php
<?php
tribe( Troubleshooting::class )->admin_notice( 'app-shop' );
?>

Expand Down Expand Up @@ -48,21 +52,21 @@ class="tribe-events-admin-graphic"
/>
<div class="content-wrapper">
<div class="addon-grid">
<?php foreach ( $all_products as $status => $some_products ) : ?>
<?php if ( 'for-sale' == $status ) :?>
<?php foreach ( $all_products as $pr_status => $some_products ) : ?>
<?php if ( 'for-sale' == $pr_status ) : ?>
<h2><?php esc_html_e( 'One calendar. Countless ways to make it your own.', 'tribe-common' ); ?></h2>
<p><?php esc_html_e( 'Calendars, ticketing, and powerful WordPress tools to manage your events from start to finish.', 'tribe-common' ); ?></p>
<?php else: ?>
<?php else : ?>
<h2 class="already-installed"><?php esc_html_e( 'Already Installed', 'tribe-common' ); ?></h2>
<?php endif; ?>

<?php foreach ( $some_products as $product ) : ?>
<div class="tribe-addon">
<div class="headline">
<img src="<?php echo esc_url( tribe_resource_url( $product->logo, false, null, $main ) ); ?>" alt="<?php esc_attr_e( 'TEC Logo', 'tribe-common' ); ?>" />
<h3 <?php echo ( 'installed' == $status || $product->free ) ? 'class="has-pill"' : ''; ?>><a href="<?php echo esc_url( $product->link ); ?>" target="_blank"><?php echo esc_html( $product->title ); ?></a></h3>
<h3 <?php echo ( 'installed' == $pr_status || $product->free ) ? 'class="has-pill"' : ''; ?>><a href="<?php echo esc_url( $product->link ); ?>" target="_blank"><?php echo esc_html( $product->title ); ?></a></h3>

<?php if ( 'installed' == $status ) : ?>
<?php if ( 'installed' == $pr_status ) : ?>
<span class="pill active"><?php esc_html_e( 'Active', 'tribe-common' ); ?></span>
<?php elseif ( $product->free ) : ?>
<span class="pill free"><?php esc_html_e( 'FREE', 'tribe-common' ); ?></span>
Expand All @@ -89,7 +93,7 @@ class="tribe-events-admin-graphic"
<?php endforeach; ?>
</ul>

<?php if ( 'installed' == $status ) : ?>
<?php if ( 'installed' == $pr_status ) : ?>
<a class="button" href="https://evnt.is/1aiz"><?php esc_html_e( 'Manage', 'tribe-common' ); ?></a>
<?php else : ?>
<a class="button" href="<?php echo esc_url( $product->link ); ?>"><?php esc_html_e( 'Learn More', 'tribe-common' ); ?></a>
Expand Down Expand Up @@ -133,7 +137,7 @@ class="tribe-events-admin-graphic"
<ul>
<?php foreach ( $bundle->includes as $i => $product_key ) : ?>
<?php
// get $product object
// get $product object.
$product = $products[ $product_key ];
?>

Expand All @@ -142,7 +146,7 @@ class="tribe-events-admin-graphic"
<span><?php echo esc_html( $product->title ); ?></span>
</li>

<?php if ( $i == 4 ) : // if there are 5 products included, then we need 2 lists ?>
<?php if ( $i == 4 ) : // if there are 5 products included, then we need 2 lists. ?>
</ul><ul class="second">
<?php endif; ?>
<?php endforeach; ?>
Expand Down Expand Up @@ -210,7 +214,12 @@ class="tribe-events-admin-graphic"
</div>

<div class="stellar-discounts-coupon-callout">
<p><?php printf( wp_kses( __( '$25 towards any Stellar product using code <u>%s</u>', 'tribe-common' ), ['u' => []] ), 'Stellar25' );?></p>
<p>
<?php
/* translators: %s is the coupon code */
printf( wp_kses( __( '$25 towards any Stellar product using code <u>%s</u>', 'tribe-common' ), [ 'u' => [] ] ), 'Stellar25' );
?>
</p>
</div>

<div class="stellar-brand-grid addon-grid">
Expand All @@ -227,7 +236,7 @@ class="tribe-events-admin-graphic"
<div class="stellar-brand__content">
<h3 class="stellar-brand__title"><?php echo esc_html( $stellar_brand->title ); ?></h3>
<p class="stellar-brand__description"><?php echo esc_html( $stellar_brand->description ); ?></p>
</div>
</div>

<a class="button stellar-brand__link" href="<?php echo esc_url( $stellar_brand->link ); ?>" target="_blank" rel="noopener noreferrer">
<?php echo esc_html( $stellar_brand->linktext ); ?>
Expand All @@ -240,7 +249,7 @@ class="tribe-events-admin-graphic"

</div>

<?php // this is inline jQuery / javascript for extra simplicity */ ?>
<?php /* this is inline jQuery / javascript for extra simplicity */ ?>
<script type="text/javascript">
jQuery( document ).ready( function($) {
var current_tab = "#tribe-all-solutions";
Expand Down
11 changes: 7 additions & 4 deletions src/admin-views/components/dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,27 @@
?>
<div
<?php tribe_classes( $wrap_classes ); ?>
<?php tribe_attributes( $wrap_attrs ) ?>
<?php tribe_attributes( $wrap_attrs ); ?>
>
<label
<?php tribe_classes( $label_classes ); ?>
for="<?php echo esc_attr( $id ); ?>"
>
<?php echo esc_html( $label ); ?>
</label><?php // Move opening and closing php tags next to html tags to prevent whitespace and alignment issues.
</label>
<?php
// Move opening and closing php tags next to html tags to prevent whitespace and alignment issues.
if ( ! empty( $tooltip['message'] ) ) {
$this->template( 'components/tooltip', $tooltip );
}
?><select
?>
<select
id="<?php echo esc_attr( $id ); ?>"
name="<?php echo esc_attr( $name ); ?>"
<?php tribe_classes( $select_classes ); ?>
value="<?php echo esc_attr( $selected ); ?>"
style="width: 100%;" <?php /* This is required for selectWoo styling to prevent select box overflow */ ?>
<?php tribe_attributes( $attrs ) ?>
<?php tribe_attributes( $attrs ); ?>
>
</select>
</div>
2 changes: 1 addition & 1 deletion src/admin-views/components/icons/dot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @var array<string> $classes Additional classes to add to the svg icon.
*
* @version 4.14.9
*
*/

$svg_classes = [ 'tribe-common-c-svgicon', 'tribe-common-c-svgicon--dot' ];

if ( ! empty( $classes ) ) {
Expand Down
4 changes: 2 additions & 2 deletions src/admin-views/components/integration/add-connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
$connect_label = _x( 'Add Connection', 'Label to add an integration connection fields.', 'tribe-common' );

$classes = [
'button' => true,
'tec-automator-settings__add-api-key-button' => true,
'button' => true,
'tec-automator-settings__add-api-key-button' => true,
];
?>
<a
Expand Down
4 changes: 2 additions & 2 deletions src/admin-views/components/integration/create-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<button
class="tec-automator-settings-details-action__generate button-primary"
type="button"
data-ajax-generate-url="<?php echo $add_link; ?>"
data-generate-error="<?php echo _x( 'Description or User missing. Please add a description and select a user before create the access information.', 'An error message that the description or user is missing when creating access information for an integration connection. ', 'tribe-common'); ?>"
data-ajax-generate-url="<?php echo esc_url( $add_link ); ?>"
data-generate-error="<?php echo esc_attr_x( 'Description or User missing. Please add a description and select a user before create the access information.', 'An error message that the description or user is missing when creating access information for an integration connection. ', 'tribe-common' ); ?>"
>
<span>
<?php echo esc_html( $add_label ); ?>
Expand Down
6 changes: 3 additions & 3 deletions src/admin-views/components/integration/delete-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
*/

$revoke_link = $url->to_delete_connection_link( $consumer_id );
$revoke_label = _x( 'Delete', 'Removes a connection from the list of integration connections.', 'tribe-common' )
$revoke_label = esc_html_x( 'Delete', 'Removes a connection from the list of integration connections.', 'tribe-common' )
?>
<div class="tec-automator-grid-item tec-automator-settings-details-action__delete-wrap">
<button
class="tec-automator-settings-details-action__revoke"
type="button"
data-ajax-revoke-url="<?php echo $revoke_link; ?>"
data-confirmation="<?php echo $api->get_confirmation_to_delete_connection(); ?>"
data-ajax-revoke-url="<?php echo esc_url( $revoke_link ); ?>"
data-confirmation="<?php echo esc_attr( $api->get_confirmation_to_delete_connection() ); ?>"
>
<?php echo esc_html( $revoke_label ); ?>
</button>
Expand Down
4 changes: 2 additions & 2 deletions src/admin-views/components/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @since 4.14.9
*
* @version 4.14.9
*
*/

if ( empty( $text ) ) {
$text = $this->get( 'text' ) ?: __( 'Loading...', 'tribe-common' );
}
Expand Down Expand Up @@ -41,4 +41,4 @@
<?php $this->template( '/components/icons/dot', [ 'classes' => [ 'tribe-common-c-loader__dot', 'tribe-common-c-loader__dot--third' ] ] ); ?>
</div>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions src/admin-views/components/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @var string $type The type of message, either standard or error.
* @var array<string|string> $add_classes An array of message classes.
*/

// If not message, do not display.
if ( empty( $message ) ) {
return;
Expand Down
7 changes: 4 additions & 3 deletions src/admin-views/components/read-only.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @var string $name The name for the text input.
* @var string $value The value of the text field.
*/

?>
<div <?php tribe_classes( $classes_wrap ); ?> >
<fieldset class="tec-automator-settings-details__read-only-field">
Expand All @@ -31,8 +32,8 @@
<input
id="<?php echo esc_attr( $id ); ?>"
type="hidden"
name="<?php echo esc_html( $name ); ?>"
value="<?php echo esc_html( $value ); ?>"
name="<?php echo esc_attr( $name ); ?>"
value="<?php echo esc_attr( $value ); ?>"
>
<?php if ( $screen_reader ) { ?>
<label class="screen-reader-text">
Expand All @@ -41,4 +42,4 @@
<?php } ?>
</div>
</fieldset>
</div>
</div>
3 changes: 2 additions & 1 deletion src/admin-views/components/switch.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @var string|int $checked Whether the switch is enabled or not.
* @var array<string,string> $attrs Associative array of attributes of the switch.
*/

$switch_wrap_classes = [ 'tribe-common-control', 'tribe-common-control--switch' ];
if ( ! empty( $classes_wrap ) ) {
$switch_wrap_classes = array_merge( $switch_wrap_classes, $classes_wrap );
Expand All @@ -46,7 +47,7 @@
type="checkbox"
value="<?php echo esc_attr( $value ); ?>"
<?php checked( true, tribe_is_truthy( $checked ) ); ?>
<?php tribe_attributes( $attrs ) ?>
<?php tribe_attributes( $attrs ); ?>
/>

<label <?php tribe_classes( $switch_label_classes ); ?> for="<?php echo esc_attr( $id ); ?>">
Expand Down
10 changes: 5 additions & 5 deletions src/admin-views/components/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
id="<?php echo esc_attr( $id ); ?>"
<?php tribe_classes( $input_classes ); ?>
type="text"
name="<?php echo esc_html( $name ); ?>"
placeholder="<?php echo esc_html( $placeholder ); ?>"
value="<?php echo esc_html( $value ); ?>"
<?php tribe_attributes( $attrs ) ?>
name="<?php echo esc_attr( $name ); ?>"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
value="<?php echo esc_attr( $value ); ?>"
<?php tribe_attributes( $attrs ); ?>
>
</div>
</div>
7 changes: 4 additions & 3 deletions src/admin-views/components/tooltip.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
* @var array<string,string> $classes_wrap An array of classes for the tooltip wrap.
* @var string $message The message to add to the tooltip.
*
*/

$wrap_classes = [ 'tribe-tooltip', 'event-helper-text' ];
if ( ! empty( $classes_wrap ) ) {
$wrap_classes = array_merge( $wrap_classes, $classes_wrap );
Expand All @@ -33,8 +33,9 @@
<?php
echo wp_kses(
$message,
[ 'a' => [ 'href' => [] ] ] );
[ 'a' => [ 'href' => [] ] ]
);
?>
</p>
</div>
</div>
</div>
9 changes: 5 additions & 4 deletions src/admin-views/conditional_content/black-friday.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @var string $branding_logo - the url of the TEC branding logo
* @var string $button_link - the url the button links to
*/

?>

<div class="black-friday-promo">
Expand All @@ -17,19 +18,19 @@
class="black-friday-promo__branding-image"
/>
</div>
<div class="black-friday-promo__promo" style="background-image: url('<?php echo $background_image; ?>')">
<div class="black-friday-promo__promo" style="background-image: url('<?php echo esc_attr( $background_image ); ?>')">
<div class="black-friday-promo__content">
<p class="black-friday-promo__text">
<?php _e( 'Our biggest<br/> sale of the<br/> year ends<br/> soon</p>', 'tribe-common' ); ?>
<?php esc_html_e( 'Our biggest<br/> sale of the<br/> year ends<br/> soon</p>', 'tribe-common' ); ?>
<a
href="<?php echo esc_url( $button_link ); ?>"
class="button black-friday-promo__button"
rel="noreferrer noopener"
target="_blank"
>
<?php echo esc_html__( 'Save now', 'tribe-common' ); ?>
<?php esc_html_e( 'Save now', 'tribe-common' ); ?>
</a>
</p>
</div>
</div>
</div>
</div>
9 changes: 5 additions & 4 deletions src/admin-views/conditional_content/end-of-year-sale.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @var string $branding_logo - the url of the TEC branding logo
* @var string $button_link - the url the button links to
*/

?>

<div class="end-of-year-sale-promo">
Expand All @@ -17,19 +18,19 @@
class="end-of-year-sale-promo__branding-image"
/>
</div>
<div class="end-of-year-sale-promo__promo" style="background-image: url('<?php echo $background_image; ?>')">
<div class="end-of-year-sale-promo__promo" style="background-image: url('<?php echo esc_attr( $background_image ); ?>')">
<div class="end-of-year-sale-promo__content">
<p class="end-of-year-sale-promo__text">
<?php _e( 'End of Year Sale!<br/>Save 30% on<br/> all our plugins.<br/>Offer expires soon!', 'tribe-common' ); ?>
<?php esc_html_e( 'End of Year Sale!<br/>Save 30% on<br/> all our plugins.<br/>Offer expires soon!', 'tribe-common' ); ?>
</p>
<a
href="<?php echo esc_url( $button_link ); ?>"
class="button end-of-year-sale-promo__button"
rel="noreferrer noopener"
target="_blank"
>
<?php echo esc_html__( 'Save now', 'tribe-common' ); ?>
<?php esc_html_e( 'Save now', 'tribe-common' ); ?>
</a>
</div>
</div>
</div>
</div>
5 changes: 3 additions & 2 deletions src/admin-views/dashboard/components/clear-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @var Endpoints_Manager $manager The Endpoint Manager instance.
* @var Url $url The URLs handler for the integration.
*/

// Only show for queue endpoints.
if ( $endpoint['type'] !== 'queue' || ! $endpoint['enabled'] || $endpoint['missing_dependency'] ) {
return;
Expand All @@ -29,8 +30,8 @@
<button
class="tec-settings-connection-endpoint-dashboard-details-action__button tec-settings-connection-endpoint-dashboard-details-actions__clear tec-common-integration-endpoint-details-actions__clear"
type="button"
data-ajax-action-url="<?php echo $clear_link; ?>"
data-confirmation="<?php echo $manager->get_confirmation_to_clear_endpoint_queue(); ?>"
data-ajax-action-url="<?php echo esc_url( $clear_link ); ?>"
data-confirmation="<?php echo esc_attr( $manager->get_confirmation_to_clear_endpoint_queue() ); ?>"
>
<?php echo esc_html( $clear_label ); ?>
</button>
Expand Down
Loading
Loading