Added comment to new `output_ad_block` method. Removed differences introduced by PhpStorm autoformat.

This commit is contained in:
And Finally 2021-05-06 15:16:49 +01:00
parent 3fa233872c
commit f1a69cb4af
2 changed files with 124 additions and 122 deletions

View File

@ -1,3 +1,4 @@
/**
* admin.scss
* General WooCommerce admin styles. Settings, product data tabs, reports, etc.
@ -101,43 +102,6 @@
height: 62px;
}
.addons-ad-block {
display: flex;
padding: 20px;
.addons-img {
height: auto;
width: 200px;
}
}
.addons-ad-block-content {
display: flex;
flex-direction: column;
margin-left: 24px;
}
.addons-ad-block-description {
margin-bottom: 20px;
}
.addons-ad-block-title {
margin: 0 0 16px;
padding: 0;
}
.addons-ad-block-buttons {
margin-top: auto;
.addons-button {
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
}
.addons-banner-block p {
margin: 0 0 20px;
}
@ -197,6 +161,43 @@
}
}
.addons-ad-block {
display: flex;
padding: 20px;
.addons-img {
height: auto;
width: 200px;
}
}
.addons-ad-block-content {
display: flex;
flex-direction: column;
margin-left: 24px;
}
.addons-ad-block-description {
margin-bottom: 20px;
}
.addons-ad-block-title {
margin: 0 0 16px;
padding: 0;
}
.addons-ad-block-buttons {
margin-top: auto;
.addons-button {
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
}
.addons-shipping-methods .addons-wcs-banner-block {
margin-left: 0;
margin-right: 0;
@ -493,8 +494,9 @@
flex: 1;
overflow: hidden;
background: #f5f5f5;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),
inset 0 -1px 0 rgba(0, 0, 0, 0.1);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.2),
inset 0 -1px 0 rgba(0, 0, 0, 0.1);
a {
text-decoration: none;
@ -686,7 +688,7 @@ mark.amount {
&::after {
@include icon_dashicons("\f223");
@include icon_dashicons( "\f223" );
cursor: help;
}
}
@ -871,7 +873,7 @@ table.wc_status_table--tools {
}
// Adjust log table columns only when table is not collapsed
@media screen and (min-width: 783px) {
@media screen and ( min-width: 783px ) {
.column-timestamp {
width: 18%;
@ -1062,7 +1064,7 @@ ul.wc_coupon_list {
&::before {
@include icon_dashicons("\f158");
@include icon_dashicons( "\f158" );
}
&:hover::before {
@ -1106,7 +1108,7 @@ ul.wc_coupon_list_block {
&::after {
@include icon_dashicons("\f345");
@include icon_dashicons( "\f345" );
line-height: 28px;
}
}
@ -1630,7 +1632,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons("\f128");
@include icon_dashicons( "\f128" );
width: 38px;
line-height: 38px;
display: block;
@ -1878,7 +1880,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon("\e007");
@include icon( "\e007" );
color: #ccc;
}
}
@ -1893,7 +1895,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon("\e014");
@include icon( "\e014" );
color: #ccc;
}
}
@ -1910,7 +1912,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon("\e01a");
@include icon( "\e01a" );
color: #ccc;
}
}
@ -1939,7 +1941,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons("\f153");
@include icon_dashicons( "\f153" );
color: #999;
}
@ -1961,7 +1963,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons("\f171");
@include icon_dashicons( "\f171" );
position: relative;
top: auto;
left: auto;
@ -2017,7 +2019,7 @@ ul.wc_coupon_list_block {
.edit-order-item::before {
@include icon_dashicons("\f464");
@include icon_dashicons( "\f464" );
position: relative;
}
@ -2026,7 +2028,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon_dashicons("\f158");
@include icon_dashicons( "\f158" );
position: relative;
}
@ -2394,7 +2396,7 @@ ul.wc_coupon_list_block {
&::before {
@include icon("\e010");
@include icon( "\e010" );
line-height: 16px;
font-size: 14px;
vertical-align: middle;
@ -2685,6 +2687,7 @@ ul.wc_coupon_list_block {
}
.wc_addons_wrap {
.addons-ad-block {
flex-direction: column;
padding: 24px;
@ -2716,7 +2719,7 @@ ul.wc_coupon_list_block {
&::after {
@include icon("\e026");
@include icon( "\e026" );
line-height: 16px;
}
}
@ -2729,7 +2732,7 @@ ul.wc_coupon_list_block {
&::after {
@include icon("\e027");
@include icon( "\e027" );
line-height: 16px;
}
}
@ -2966,7 +2969,7 @@ table.wp-list-table {
&::before {
@include icon_dashicons("\f128");
@include icon_dashicons( "\f128" );
}
}
@ -3931,19 +3934,19 @@ img.help_tip {
.status-manual::before {
@include icon("\e008");
@include icon( "\e008" );
color: #999;
}
.status-enabled::before {
@include icon("\e015");
@include icon( "\e015" );
color: $woocommerce;
}
.status-disabled::before {
@include icon("\e013");
@include icon( "\e013" );
color: #ccc;
}
@ -4362,7 +4365,7 @@ img.help_tip {
&::after {
@include icon_dashicons("\f161");
@include icon_dashicons( "\f161" );
font-size: 2.618em;
line-height: 72px;
color: #ddd;
@ -4404,7 +4407,7 @@ img.help_tip {
&::before {
@include icon_dashicons("\f153");
@include icon_dashicons( "\f153" );
color: #999;
background: #fff;
border-radius: 50%;
@ -4591,7 +4594,7 @@ img.help_tip {
&::before {
@include iconbeforedashicons("\f107");
@include iconbeforedashicons( "\f107" );
}
}
@ -4675,7 +4678,7 @@ img.help_tip {
.add.button::before {
@include iconbefore("\e007");
@include iconbefore( "\e007" );
}
}
@ -4791,7 +4794,7 @@ img.help_tip {
&::before {
@include icon_dashicons("\f153");
@include icon_dashicons( "\f153" );
color: #999;
}
@ -5706,7 +5709,7 @@ img.ui-datepicker-trigger {
&::before {
@include iconbeforedashicons("\f346");
@include iconbeforedashicons( "\f346" );
margin-right: 4px;
}
}
@ -5833,7 +5836,7 @@ img.ui-datepicker-trigger {
&::after {
@include iconafter("\e035");
@include iconafter( "\e035" );
float: right;
font-size: 0.9em;
line-height: 1.618;
@ -5966,8 +5969,9 @@ img.ui-datepicker-trigger {
}
&:hover {
box-shadow: inset 0 -1px 0 0 #dfdfdf,
inset 300px 0 0 rgba(156, 93, 144, 0.1);
box-shadow:
inset 0 -1px 0 0 #dfdfdf,
inset 300px 0 0 rgba(156, 93, 144, 0.1);
border-right: 5px solid #9c5d90 !important;
padding-left: 1.5em;
color: #9c5d90;
@ -6167,27 +6171,27 @@ table.bar_chart {
.post-type-shop_order .woocommerce-BlankState-message::before {
@include icon("\e01d");
@include icon( "\e01d" );
}
.post-type-shop_coupon .woocommerce-BlankState-message::before {
@include icon("\e600");
@include icon( "\e600" );
}
.post-type-product .woocommerce-BlankState-message::before {
@include icon("\e006");
@include icon( "\e006" );
}
.woocommerce-BlankState--api .woocommerce-BlankState-message::before {
@include icon("\e01c");
@include icon( "\e01c" );
}
.woocommerce-BlankState--webhooks .woocommerce-BlankState-message::before {
@include icon("\e01b");
@include icon( "\e01b" );
}
.woocommerce-BlankState {
@ -7361,7 +7365,7 @@ table.bar_chart {
&::before {
@include icon("\e015");
@include icon( "\e015" );
color: #a16696;
position: static;
font-size: 100px;

View File

@ -50,7 +50,6 @@ class WC_Admin_Addons {
if ( is_object( $featured ) ) {
self::output_featured_sections( $featured->sections );
return $featured;
}
}
@ -58,9 +57,9 @@ class WC_Admin_Addons {
/**
* Build url parameter string
*
* @param string $category Addon (sub) category.
* @param string $term Search terms.
* @param string $country Store country.
* @param string $category Addon (sub) category.
* @param string $term Search terms.
* @param string $country Store country.
*
* @return string url parameter string
*/
@ -78,14 +77,14 @@ class WC_Admin_Addons {
/**
* Call API to get extensions
*
* @param string $category Addon (sub) category.
* @param string $term Search terms.
* @param string $country Store country.
* @param string $category Addon (sub) category.
* @param string $term Search terms.
* @param string $country Store country.
*
* @return array of extensions
*/
public static function get_extension_data( $category, $term, $country ) {
$parameters = self::build_parameter_string( $category, $term, $country );
$parameters = self::build_parameter_string( $category, $term, $country );
$headers = array();
$auth = WC_Helper_Options::get( 'auth' );
@ -102,7 +101,6 @@ class WC_Admin_Addons {
if ( ! is_wp_error( $raw_extensions ) ) {
$addons = json_decode( wp_remote_retrieve_body( $raw_extensions ) )->products;
}
return $addons;
}
@ -124,14 +122,13 @@ class WC_Admin_Addons {
}
}
}
return apply_filters( 'woocommerce_addons_sections', $addon_sections );
}
/**
* Get section for the addons screen.
*
* @param string $section_id Required section ID.
* @param string $section_id Required section ID.
*
* @return object|bool
*/
@ -140,14 +137,13 @@ class WC_Admin_Addons {
if ( isset( $sections[ $section_id ] ) ) {
return $sections[ $section_id ];
}
return false;
}
/**
* Get section content for the addons screen.
*
* @param string $section_id Required section ID.
* @param string $section_id Required section ID.
*
* @return array
*/
@ -230,12 +226,12 @@ class WC_Admin_Addons {
<h3><?php echo esc_html( $item->title ); ?></h3>
<p><?php echo esc_html( $item->description ); ?></p>
<?php
self::output_button(
$item->href,
$item->button,
'addons-button-solid',
$item->plugin
);
self::output_button(
$item->href,
$item->button,
'addons-button-solid',
$item->plugin
);
?>
</div>
</div>
@ -292,12 +288,12 @@ class WC_Admin_Addons {
<div class="addons-column-block-item-content">
<h2><?php echo esc_html( $item->title ); ?></h2>
<?php
self::output_button(
$item->href,
$item->button,
'addons-button-solid',
$item->plugin
);
self::output_button(
$item->href,
$item->button,
'addons-button-solid',
$item->plugin
);
?>
<p><?php echo esc_html( $item->description ); ?></p>
</div>
@ -324,11 +320,11 @@ class WC_Admin_Addons {
<div class="addons-small-light-block-buttons">
<?php foreach ( $block->buttons as $button ) : ?>
<?php
self::output_button(
$button->href,
$button->text,
'addons-button-solid'
);
self::output_button(
$button->href,
$button->text,
'addons-button-solid'
);
?>
<?php endforeach; ?>
</div>
@ -356,11 +352,11 @@ class WC_Admin_Addons {
</div>
<?php endif; ?>
<?php
self::output_button(
$item->href,
$item->button,
'addons-button-outline-white'
);
self::output_button(
$item->href,
$item->button,
'addons-button-outline-white'
);
?>
</div>
<?php endforeach; ?>
@ -465,11 +461,11 @@ class WC_Admin_Addons {
<?php endforeach; ?>
</ul>
<?php
self::output_button(
$block_data['href'],
$block_data['button'],
'addons-button-outline-purple'
);
self::output_button(
$block_data['href'],
$block_data['button'],
'addons-button-outline-purple'
);
?>
</div>
</div>
@ -527,17 +523,22 @@ class WC_Admin_Addons {
<h1><?php echo esc_html( $block_data['title'] ); ?></h1>
<p><?php echo esc_html( $block_data['description'] ); ?></p>
<?php
self::output_button(
$block_data['href'],
$block_data['button'],
'addons-button-outline-purple'
);
self::output_button(
$block_data['href'],
$block_data['button'],
'addons-button-outline-purple'
);
?>
</div>
</div>
<?php
}
/**
* Handles the output of a full-width block.
*
* @param $section
*/
public static function output_ad_block( $section ) {
if (
! current_user_can( 'install_plugins' ) ||
@ -642,7 +643,6 @@ class WC_Admin_Addons {
// Get url (from path onward) for the current page,
// so WCCOM "back" link returns user to where they were.
$back_admin_path = add_query_arg( array() );
return array(
'wccom-site' => site_url(),
'wccom-back' => rawurlencode( $back_admin_path ),
@ -657,7 +657,7 @@ class WC_Admin_Addons {
* Adds various url parameters to a url to support a streamlined
* flow for obtaining and setting up WooCommerce extensons.
*
* @param string $url Destination URL.
* @param string $url Destination URL.
*/
public static function add_in_app_purchase_url_params( $url ) {
return add_query_arg(
@ -698,7 +698,6 @@ class WC_Admin_Addons {
if ( isset( $_GET['section'] ) && 'helper' === $_GET['section'] ) {
do_action( 'woocommerce_helper_output' );
return;
}
@ -785,7 +784,6 @@ class WC_Admin_Addons {
* Should an extension be shown on the featured page.
*
* @param object $item Item data.
*
* @return boolean
*/
public static function show_extension( $item ) {