Skip to content

Commit

Permalink
V2.0 changes and extensions compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
gwin committed Jun 3, 2022
2 parents 80fce62 + de5f7eb commit 2cea8d0
Show file tree
Hide file tree
Showing 30 changed files with 468 additions and 192 deletions.
14 changes: 12 additions & 2 deletions addons/contact-form/includes/class-block-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public function contact_options_form() {
)
);

add_filter( "wpadverts/block/form/styles/atts", array( $this, "no_interline" ) );

?>

<?php if( adext_contact_form_get_to( $post_id ) ): ?>
Expand All @@ -159,9 +161,9 @@ public function contact_options_form() {
<div class="atw-my-3 atw-mx-0 atw-pt-6 atw-pb-0 atw-font-bold atw-text-2xl"><?php _e( "Contact Seller", "wpadverts" ) ?></div>

<?php if( $form_sent ): ?>
<?php wpadverts_block_flash( $flash, "big" ) ?>
<?php echo wpadverts_block_flash( $flash, "big" ) ?>
<?php else: ?>
<?php wpadverts_block_flash( $flash ) ?>
<?php echo wpadverts_block_flash( $flash ) ?>
<?php $buttons_position = "atw-flex-col"; ?>
<?php include ADVERTS_PATH . '/templates/block-partials/form.php' ?>
<?php endif; ?>
Expand All @@ -172,6 +174,14 @@ public function contact_options_form() {


<?php

remove_filter( "wpadverts/block/form/styles/atts", array( $this, "no_interline" ) );
}

public function no_interline( $atts ) {
if( isset( $atts["interline"] ) ) {
unset( $atts["interline"] );
}
return $atts;
}
}
6 changes: 1 addition & 5 deletions addons/payments/includes/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function adext_payments_ajax_render() {
$gateway_name = adverts_request('gateway');
$gateway = adext_payment_gateway_get( $gateway_name );

$listing_id = absint( adverts_request( "listing_id" ) );
$payment_id = absint( adverts_request( "payment_id" ) );
$listing_id = get_post_meta( $payment_id, "_adverts_pricing_id", true );

$response = null;

Expand All @@ -52,10 +52,6 @@ function adext_payments_ajax_render() {

if($isValid) {

$pricing = get_post( $data["listing_id"] );
$price = get_post_meta( $listing_id, "adverts_price", true );


$price = get_post_meta( $payment_id, "_adverts_payment_total", true );

$data["price"] = $price;
Expand Down
2 changes: 1 addition & 1 deletion addons/payments/payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ function adverts_payments_field_payment($field) {
function adverts_payments_field_payment_block( $field ) {
ob_start();

echo '<div class="atw-flex atw-flex-col">';
echo '<div class="adverts-pricings-list atw-flex atw-flex-col">';

foreach( $field["options"] as $option ) {

Expand Down
2 changes: 1 addition & 1 deletion addons/payments/templates/publish-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<?php wpadverts_block_button_css( "secondary", isset( $atts["secondary_button"] ) ? $atts["secondary_button"] : array() ) ?>
</style>

<?php wpadverts_block_flash( $adverts_flash ) ?>
<?php echo wpadverts_block_flash( $adverts_flash ) ?>

<div class="wpadverts-blocks wpadverts-publish-payment">

Expand Down
2 changes: 1 addition & 1 deletion addons/payments/templates/renew-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<?php wpadverts_block_button_css( "secondary", isset( $atts["secondary_button"] ) ? $atts["secondary_button"] : array() ) ?>
</style>

<?php wpadverts_block_flash( $adverts_flash ) ?>
<?php echo wpadverts_block_flash( $adverts_flash ) ?>

<div class="wpadverts-blocks wpadverts-manage-renew">
<?php include ADVERTS_PATH . '/templates/block-partials/form.php' ?>
Expand Down
61 changes: 53 additions & 8 deletions assets/css/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

.wpadverts-form .wpa-w-full input[type=text],
.wpadverts-form .wpa-w-full select {
@apply atw-w-full atw-max-w-full atw-m-0;
@apply atw-w-full atw-max-w-full ;
}

.wpadverts-hidden {
Expand All @@ -52,7 +52,7 @@
}

.wpadverts-form .wpa-form-header {
@apply atw-relative atw-items-end atw-box-border atw-pt-6 atw-pb-1 atw-mx-1;
@apply atw-relative atw-items-end atw-box-border atw-pt-6 atw-pb-1 md:atw-mx-1;
}

.wpadverts-form .wpa-form-header-label {
Expand Down Expand Up @@ -91,6 +91,10 @@
@apply atw-block atw-w-full;
}

.wpadverts-form .wpa-field-desc .wpa-field-desc-text {
@apply atw-text-sm atw-text-gray-500;
}

.wpadverts-form .wpa-form-buttons {
@apply atw-flex atw-mt-3 atw-py-3 atw-bg-gray-50 atw-rounded-md atw-justify-end md:atw-flex-none;
}
Expand All @@ -112,6 +116,7 @@

.wpadverts-form select,
.wpadverts-form select[multiple],
.wpadverts-form input[type=text].wpadverts-autocomplete,
.wpadverts-form .adverts-multiselect-holder input[type=text] {
@apply atw-outline-none atw-box-border atw-leading-loose atw-border-solid atw-bg-right atw-bg-no-repeat atw-appearance-none;

Expand All @@ -120,7 +125,21 @@

.wpadverts-form input[type=checkbox],
.wpadverts-form input[type=radio] {
@apply atw-appearance-none atw-box-border atw-border-solid atw-w-5 atw-h-5 atw-text-base atw-outline-none atw-p-0 atw-m-0 atw-leading-loose;
@apply atw-appearance-none atw-box-border atw-border-solid atw-w-7 md:atw-w-5 atw-h-7 md:atw-h-5 atw-text-base atw-outline-none atw-p-0 atw-m-0 atw-leading-loose;
}

.wpadverts-form input[type=checkbox][disabled=disabled],
.wpadverts-form input[type=radio][disabled=disabled],
.wpadverts-form input[type=checkbox][readonly=readonly],
.wpadverts-form input[type=radio][readonly=readonly] {
@apply atw-bg-gray-100 atw-cursor-not-allowed !important;
}

..wpadverts-form input[type=text].wpadverts-autocomplete {
@apply atw-cursor-pointer;
}
.wpadverts-form .wpadverts-autocomplete-openclose {
@apply atw-hidden !important;
}

/* Flat */
Expand Down Expand Up @@ -289,7 +308,8 @@
.wpadverts-form.wpa-padding-sm select {
@apply atw-py-2 atw-px-2 atw-leading-loose;
}
.wpadverts-form.wpa-padding-sm.wpa-layout-aligned .wpa-field-label {
.wpadverts-form.wpa-padding-sm.wpa-layout-aligned .wpa-field-label,
.wpadverts-form.wpa-padding-sm.wpa-layout-aligned .wpa-field-input.wpa-with-margin {
@apply md:atw-py-2 atw-px-0 atw-leading-loose;
}

Expand All @@ -300,10 +320,16 @@
.wpadverts-form.wpa-padding-md select {
@apply atw-py-3 atw-px-3 atw-leading-loose;
}
.wpadverts-form.wpa-padding-md.wpa-layout-aligned .wpa-field-label {
.wpadverts-form.wpa-padding-md.wpa-layout-aligned .wpa-field-label,
.wpadverts-form.wpa-padding-md.wpa-layout-aligned .wpa-field-input.wpa-with-margin {
@apply md:atw-py-3 atw-px-0 atw-leading-loose;
}

.wpadverts-form.wpa-padding-sm.wpa-layout-aligned .wpa-field-input.wpa-with-margin,
.wpadverts-form.wpa-padding-md.wpa-layout-aligned .wpa-field-input.wpa-with-margin {
@apply atw-self-center;
}

/* FORM ROUNDING */
.wpadverts-form.wpa-mood-simple input[type=text],
.wpadverts-form.wpa-mood-simple select {
Expand Down Expand Up @@ -340,6 +366,10 @@
@apply atw-flex-grow;
}

.wpadverts-form.wpa-layout-aligned.wpa-form-interline .wpa-field-wrap .wpa-field-desc {
@apply atw-mt-2
}

.wpadverts-form.wpa-layout-aligned .wpa-field-label {
@apply atw-border-transparent atw-border-solid;
}
Expand Down Expand Up @@ -629,17 +659,32 @@
}

.wpadverts-flash.wpa-layout-big .wpa-flash-content {
@apply atw-flex-col atw-items-center atw-pb-3;
@apply atw-flex-col atw-items-center;
}

.wpadverts-flash.wpa-layout-big .wpa-flash-icon {
@apply atw-flex-none atw-m-0 atw-pt-3 atw-pb-3 atw-text-5xl;
@apply atw-flex-none atw-m-0 atw-pt-0 atw-pb-3 atw-text-5xl;
}

.wpadverts-flash.wpa-layout-big .wpa-flash-message {
@apply atw-text-lg;
@apply atw-text-lg atw-py-3;
}

.wpadverts-flash .wpa-flash-link-wrap {
@apply atw-flex atw-flex-col md:atw-flex-row atw-pt-3 md:atw--mx-2
}

.wpadverts-flash.wpa-layout-big .wpa-flash-link-wrap {
@apply atw-justify-center;
}

.wpadverts-flash .wpa-flash-link-wrap .wpa-flash-link {
@apply atw-leading-loose atw-no-underline atw-rounded-lg atw-py-2 atw-px-4 atw-mt-3 md:atw-mx-2 md:atw-my-0 atw-bg-black/5 atw-font-bold
}

.wpadverts-flash .wpa-flash-link-wrap .wpa-flash-link:hover {
@apply atw-bg-black/10 atw-no-underline;
}

.wpa-tabs {
@apply atw-flex atw-flex-col md:atw-flex-row atw-list-none atw-p-0 atw-m-0 md:atw--mx-1;
Expand Down
4 changes: 2 additions & 2 deletions assets/js/block-details.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jQuery(function($) {

/*

$(".wpadverts-show-contact-form").on("click", function(e) {
e.preventDefault();

Expand All @@ -14,5 +14,5 @@ jQuery(function($) {
window.location.hash = "#wpadverts-block-contact-box";
}
});
*/

});
25 changes: 24 additions & 1 deletion blocks/categories/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function get_cols_mobile( $cols ) {
public function get_icon_size( $icon_size ) {
$icon_sizes = array(
0 => "atw-text-xs",
1 => "atw-text-xm",
1 => "atw-text-sm",
2 => "atw-text-base",
3 => "atw-text-lg",
4 => "atw-text-xl",
Expand Down Expand Up @@ -249,4 +249,27 @@ public function get_icon_padding( $padding ) {
return $paddings[3];
}
}

public function get_block_icon_size( $icon_size ) {
$icon_sizes = array(
0 => "atw-h-3",
1 => "atw-h-3.5",
2 => "atw-h-4",
3 => "atw-h-5",
4 => "atw-h-5",
5 => "atw-h-6",
6 => "atw-h-7",
7 => "atw-h-9",
8 => "atw-h-12",
9 => "atw-h-14",
10 => "atw-h-16",
11 => "atw-h-24",
12 => "atw-h-32",
);
if( isset( $icon_sizes[$icon_size] ) ) {
return $icon_sizes[$icon_size];
} else {
return $icon_sizes[6];
}
}
}
10 changes: 7 additions & 3 deletions blocks/categories/templates/categories-all.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
<?php foreach( $terms as $k => $term ): ?>
<div class="wpa-block-categories-item <?php echo "$item_display $class_margin" ?> atw-flex atw-rounded atw-shadow-none atw-border atw-border-solid <?php echo esc_attr( "adverts-category-slug-".$term->slug ) ?>">
<?php if( $show_icons ): ?>
<?php $icon = adverts_taxonomy_get("advert_category", $term->term_id, "advert_category_icon", $default_icon ) ?>
<span class="wpa-block-categories-icon <?php echo "$class_icon_size $class_icon_padding" ?> <?php echo apply_filters("adverts_category_font_icon", adverts_guess_icon_class($icon), $term, "big") ?>"></span>
<?php $icon = adverts_taxonomy_get("advert_category", $term->term_id, "advert_category_icon", $default_icon ) ?>
<?php $font_icon = apply_filters("wpadverts/block/categories/tpl/font-icon", adverts_guess_icon_class($icon), $term, "big"); ?>
<?php if( is_string( $font_icon ) ): ?>
<span class="wpa-block-categories-icon <?php echo "$class_icon_size $class_icon_padding $font_icon" ?>"></span>
<?php endif; ?>
<?php do_action( "wpadverts/block/categories/tpl/icon", $term, "big", $atts ) ?>
<?php endif; ?>
<?php do_action( "adverts_category_pre_title", $term, "big") ?>

<span class="wpa-block-categories-title atw-font-bold atw-no-underline <?php echo "$class_item_padding" ?>">

<a class="atw-font-bold atw-no-underline adverts-category-link" href="<?php echo esc_attr(get_term_link($term)) ?>">
Expand Down
8 changes: 4 additions & 4 deletions blocks/details/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public function init() {

public function render( $atts = array() ) {

$atts = apply_filters( "wpadverts/block/details/atts", $atts );

$params = shortcode_atts(array(
'name' => 'default',
'post_type' => 'advert'
Expand All @@ -76,7 +78,7 @@ public function render( $atts = array() ) {
$post_content = wp_kses($post_content, wp_kses_allowed_html( 'post' ) );
$post_content = apply_filters( "adverts_the_content", $post_content );

$data_table = array(
$data_table = apply_filters( "wpadverts/block/details/data-table", array(
array(
"label" => __( "Category", "wpadverts" ),
"icon" => "fas fa-folder",
Expand All @@ -88,14 +90,12 @@ public function render( $atts = array() ) {
"value" => $this->_get_location_parsed( $post_id )
)

);
), $post_id );

$contact_methods = $this->_get_contact_options( $atts, $post_id );
$contact_options = array( );
$contact_additional = array();



foreach( $atts['contact'] as $k => $contact ) {
if( isset( $contact_methods[ $contact['name'] ] ) ) {
$contact_options[] = $contact_methods[ $contact['name'] ];
Expand Down
6 changes: 3 additions & 3 deletions blocks/details/templates/single.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<div class="wpadverts-cpt <?php echo sprintf( "wpadverts-cpt-", $atts["post_type"] ) ?> atw-w-full">

<?php do_action( "adverts_tpl_single_top", $post_id ) ?>
<?php do_action( "adverts_tpl_single_top", $post_id, true ) ?>

<div class="atw-flex atw-flex-col md:atw-flex-row">
<div class="atw-flex atw-grow ">
Expand Down Expand Up @@ -69,7 +69,7 @@
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php do_action( "adverts_tpl_single_details", $post_id ) ?>
<?php do_action( "adverts_tpl_single_details", $post_id, true ) ?>
</div>

<div class="">
Expand Down Expand Up @@ -109,7 +109,7 @@
</div-->


<?php do_action( "adverts_tpl_single_bottom", $post_id ) ?>
<?php do_action( "adverts_tpl_single_bottom", $post_id, true ) ?>

<?php if( ! empty( $contact_options ) || ! empty( $options ) ): ?>
<div class="wpa-cpt-contact-details atw-my-3 atw--mx-1">
Expand Down
2 changes: 1 addition & 1 deletion blocks/list/templates/list-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="wpa-result-title atw-mb-1 atw-leading-snug">
<a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ) ?>" class="wpa-result-link atw-inline-block atw-no-underline ">
<span class="wpa-result-title-text atw-inline-block atw-max-h-16 atw-text-gray-700 atw-text-lg atw-leading-tight atw-font-semibold "><?php echo esc_html( wpadverts_get_object_value( get_the_ID(), $atts["title_source"] ) ) ?></span>
<?php do_action( "adverts_list_after_title", get_the_ID() ) ?>
<?php do_action( "adverts_list_after_title", get_the_ID(), true ) ?>
</a>
</div>

Expand Down
16 changes: 11 additions & 5 deletions blocks/manage/class-manage-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,20 @@ public function main( $atts = array() ) {
if(!get_current_user_id()) {

$permalink = get_permalink();
$message = __('Only logged in users can access this page. <a href="%1$s">Login</a> or <a href="%2$s">Register</a>.', "wpadverts");
$message = __('Only logged in users can access this page.', "wpadverts");
$parsed = sprintf($message, wp_login_url( $permalink ), wp_registration_url( $permalink ) );

return $this->flash( array(
"info" => array(
array( "message" => $parsed, "icon" => "fa fa-lock" ),
array(
"message" => $parsed,
"icon" => "fa fa-lock",
"link" => array(
array( "title" => __( "Login", "wpadverts" ), "url" => "#" ),
array( "title" => __( "Register", "wpadverts" ), "url" => "#" ),
)

),
)
), "big" );
}
Expand Down Expand Up @@ -367,9 +375,7 @@ public function moderation_notice() {
}

public function flash( $data, $layout = "normal" ) {
ob_start();
wpadverts_block_flash( $data, $layout );
return ob_get_clean();
return wpadverts_block_flash( $data, $layout );
}

public function modal_delete() {
Expand Down
Loading

0 comments on commit 2cea8d0

Please sign in to comment.