Skip to content

Commit

Permalink
* Demo Import screen improvements - CHANGED
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiofan committed Jul 1, 2024
1 parent f2b34fe commit f4f97a5
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 73 deletions.
Binary file added assets/img/blockstrap-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/img/kadencewp-icon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
159 changes: 136 additions & 23 deletions includes/class-ayecode-demo-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,27 +229,21 @@ public function settings_page( $wizard = false ) {


<div class="bsui" style="<?php if(!$wizard){ ?>margin-left: -20px; display: flex<?php } ?>">
<div class="<?php if(!$wizard){ ?>container<?php } ?>">
<div class="<?php if(!$wizard){ ?>containerx bg-white w-100 p-4 m-4 border rounded<?php } ?>">
<?php
echo aui()->alert(array(
'type'=> 'info',
'class' => 'mt-4',
$sites = $this->get_sites();

echo aui()->alert(array(
'type'=> 'danger',
// 'class' => 'mt-4',
'content'=> __("This importer should only be used on NEW sites, it will change the whole look and appearance of your site.","ayecode-connect")
)
);
?>
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-2 mt-4">

<?php
foreach ($this->get_sites() as $site){
global $ac_site_args,$ac_prefix;
$ac_prefix = $this->client->prefix;
$ac_site_args = $site;
load_template( dirname( __FILE__ )."/../templates/import/site.php", false ); // $args only introduced in wp 5.5 so lets use a more backwards compat way
}
?>

</div>
echo $this->get_demo_tabs_head( $sites );
echo $this->get_demo_tabs_body( $sites );

?>
</div>

<!-- Modal -->
Expand Down Expand Up @@ -543,32 +537,151 @@ function ac_preview_site($item){
}
}

public function get_demo_site_types($sites)
{
// define the types
$types = array(
'blockstrap' => array(),
'elementor' => array(),
'kadence' => array(),
'legacy' => array(),
);

foreach ($sites as $site ){
// check if string contains

$desc = !empty( $site->desc ) ? $site->desc : '';

if ( !empty( $desc ) && strpos($desc, 'BlockStrap' ) !== false) {
$types['blockstrap'][] = $site;
}elseif ( !empty( $desc ) && strpos($desc, 'Kadence' ) !== false) {
$types['kadence'][] = $site;
}elseif ( !empty( $desc ) && strpos($desc, 'elementor' ) !== false) {
$types['elementor'][] = $site;
}else{
$types['legacy'][] = $site;
}

}

return $types;

}

public function get_demo_tabs_body( $sites )
{


$types = $this->get_demo_site_types($sites);

ob_start();

echo '<div class="tab-content" id="ayecode-connect-demo-tabsContent">';

foreach ( $types as $type => $sites ){

// maybe open
if (!empty($sites)) {
$active = 'blockstrap'==$type ? 'show active' : '';
echo '<div class="tab-pane fade '.esc_attr($active).'" id="ayecode-demo-'.esc_attr($type).'-pane" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">';

if ('legacy'==$type) {
echo aui()->alert(array(
'type'=> 'warning',
'class' => 'mt-4',
'content'=> __("These are legacy themes which are no longer supported and will be removed soon.","ayecode-connect")
)
);
}

echo '<div class="row row-cols-1 row-cols-sm-2 row-cols-md-2 mt-4">';


foreach ( $sites as $site ){
global $ac_site_args,$ac_prefix;
$ac_prefix = $this->client->prefix;
$ac_site_args = $site;
load_template( dirname( __FILE__ )."/../templates/import/site.php", false ); // $args only introduced in wp 5.5 so lets use a more backwards compat way
}

echo '</div></div>';
}
}

echo '</div>';


return ob_get_clean();

}

public function get_demo_tabs_head($sites)
{

$types = $this->get_demo_site_types($sites);
ob_start();

echo '<ul class="nav nav-tabs mb-3" id="ayecode-connect-demo-tabs" role="tablist">';

$names = array(
'blockstrap' => 'BlockStrap',
'elementor' => 'Elementor',
'kadence' => 'Kadence WP',
'legacy' => 'legacy',
);

foreach ( $types as $type => $sites ){
if (!empty($sites)) {
$active = 'blockstrap'==$type ? 'active' : '';
$selected = 'blockstrap' == $type ? 'true' : 'false';



echo '<li class="nav-item" role="presentation">';
echo '<button class="nav-link '.esc_attr($active).'" id="ayecode-demo-'.esc_attr($type).'" data-bs-toggle="pill" data-bs-target="#ayecode-demo-'.esc_attr($type).'-pane" type="button" role="tab" aria-controls="pills-home" aria-selected="'.esc_attr($selected).'">';
if('kadence'===$type) {
echo '<img width="22px" src = "'.$this->base_url .'assets/img/kadencewp-icon-dark.svg" alt="Kadence WP"/>';
}elseif('elementor'===$type) {
echo '<i style="color:#db3157;font-size: 22px;float: left;margin-bottom: -6px;padding-top: 1px;" class="fab fa-elementor me-1" ></i>';
}elseif('blockstrap'===$type) {
echo '<img width="22px" class="me-1" src = "'.$this->base_url .'assets/img/blockstrap-logo.jpg" alt="BlockStrap"/>';
}
echo esc_html($names[$type]);
echo '</button>';
echo '</li>';
}
}

echo '</ul>';

return ob_get_clean();
}

/**
* Get demo site info.
*
* @return mixed
*/
public function get_sites() {
$sites = get_transient( 'ayecode_connect_demos' );
public function get_sites(){

$sites = get_transient( 'ayecode_connect_demos' );
if ( empty( $demos ) ) {
$args = array(
'timeout' => 30,
'redirection' => 0,
'sslverify' => AYECODE_CONNECT_SSL_VERIFY,
);

$url = $this->client->get_api_url( '/demos' );

$url = $this->client->get_api_url( '/demos' );
$data = wp_remote_get( $url, $args );

if ( ! is_wp_error( $data ) && $data['response']['code'] == 200 ) {
$responseBody = wp_remote_retrieve_body( $data );
$sites = json_decode( $responseBody );
$sites = json_decode( $responseBody );
set_transient( 'ayecode_connect_demos', $sites, HOUR_IN_SECONDS );
}
}


return $sites;
}

Expand Down Expand Up @@ -1572,7 +1685,7 @@ public function check_ayecode_demo_folder_protection() {
if ( false === $file ) {
return new WP_Error( 'demo_download_protect_failed', __( 'Unable to protect demo data download folder from browsing.' ) );
}

fwrite( $file, "<?php\n// Silence is golden.\n" ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
fclose( $file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
}
Expand Down
28 changes: 26 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Tested up to: 6.5
Stable tag: 1.3.0


AyeCode Connect once linked to our site allows you to install any purchased AyeCode Ltd product add-ons without a zip file. It also installs and activates licences automatically, so there is no need to copy/paste licenses.
Use this service plugin to easily activate any of our products, open a support ticket and view documentation all from your wp-admin!

== Description ==

Expand Down Expand Up @@ -79,6 +79,7 @@ If your host runs "mod security" on your hosting and has some specific additiona

= 1.3.0 - TBD =
* Import demo import - CHANGED
* Demo Import screen improvements - CHANGED

= 1.2.19 - 2024-06-06 =
* Function auto_detect_line_endings is deprecated - FIXED
Expand Down Expand Up @@ -211,4 +212,27 @@ If your host runs "mod security" on your hosting and has some specific additiona
* Warning added that localhost sites won't work - ADDED

= 1.0.0 =
* First release - YAY
* First release - YAY


= Resources used to build this plugin =

* Image for Demo Import Screen ( kadencewp-icon-dark.svg ), Copyright Kadence WP
License: CC0 Public Domain
Source: https://www.kadencewp.com/brand-assets/

* Image for Demo Import Screen ( blockstrap-logo.jpg ), Copyright AyeCode Ltd
License: CC0 Public Domain
Source: https://ayecode.io/

* Image for Connection Screen ( connect-site.png ), Copyright AyeCode Ltd
License: CC0 Public Domain
Source: https://ayecode.io/

* Image for Plugins screens ( ayeccode.png ), Copyright AyeCode Ltd
License: CC0 Public Domain
Source: https://ayecode.io/

* Image for Plugins screens ( ayeccode.svg ), Copyright AyeCode Ltd
License: CC0 Public Domain
Source: https://ayecode.io/
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
add_action('after_setup_theme', function () {
global $ayecode_ui_version,$ayecode_ui_file_key;
$this_version = "0.2.15";
$this_version = "0.2.18";
if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
$ayecode_ui_version = $this_version ;
$ayecode_ui_file_key = wp_hash( __FILE__ );
Expand Down
9 changes: 9 additions & 0 deletions vendor/ayecode/wp-ayecode-ui/change-log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
= 0.2.18 - 2024-06-27 =
* Pagination style conflict on Hello Elementor theme - FIXED

= 0.2.17 - 2024-06-20 =
* Carousel slide swipe in BS modal is not working on touch device - FIXED

= 0.2.16 - 2024-06-13 =
* Buttons after click when still have :focus can have wrong box-shadow if colour has been changed - FIXED

= 0.2.15 - 2024-05-22 =
* Checkbox not showing hand cursor on hover - FIXED

Expand Down
15 changes: 8 additions & 7 deletions vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AyeCode_UI_Settings {
*
* @var string
*/
public $version = '0.2.15';
public $version = '0.2.17';

/**
* Class textdomain.
Expand Down Expand Up @@ -1265,13 +1265,15 @@ public static function custom_css($compatibility = true) {
echo esc_attr( $bep . $hn ) . '{'.esc_attr( $h_css ).'}';
}
}
}

// Pagination on Hello Elementor theme.
if ( function_exists( 'hello_elementor_setup' ) ) {
echo '.aui-nav-links .pagination{justify-content:inherit}';
}
?>
?>
</style>
<?php


/*
* We only add the <script> tags for code highlighting, so we strip them from the output.
*/
Expand All @@ -1281,8 +1283,6 @@ public static function custom_css($compatibility = true) {
), '', self::minify_css( ob_get_clean() ) );
}



/**
* Check if we should add booststrap 3 compatibility changes.
*
Expand Down Expand Up @@ -1583,7 +1583,8 @@ public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex
// $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000; border-color: #000;} ";
$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10."; border-color: ".$darker_125.";} ";
$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled):focus {box-shadow: 0 0.25rem 0.25rem 0.125rem rgba(var(--bs-{$type}-rgb), 0.1), 0 0.375rem 0.75rem -0.125rem rgba(var(--bs-{$type}-rgb), 0.4);} ";

// text
// $output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} ";
Expand Down
7 changes: 7 additions & 0 deletions vendor/ayecode/wp-ayecode-ui/includes/inc/bs5-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,13 @@ function aui_lightbox_embed($link,ele){
// ayeModal.getOrCreateInstance();
ayeModal.show();

/* Support carousel swipe in BS modal on touch device */
try {
if ('ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0) {
let _bsC = new bootstrap.Carousel('#aui-embed-slider-modal');
}
} catch(err) {}

// enable ajax load
//gd_init_carousel_ajax();
}
Expand Down
7 changes: 7 additions & 0 deletions vendor/ayecode/wp-super-duper/change-log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
= 1.1.45 - 2024-06-20 =
* Yoast SEO conflict causes JS error on post edit pages - FIXED

= 1.1.44 - 2024-06-13 =
* Width and Height helper functions added - ADDED
* Undefined array key warning - FIXED

= 1.1.43 - 2024-06-05 =
* example block attribute now works for block previews - ADDED
* Block previews now enabled by default (set example as false to disable) - CHANGED
Expand Down
Loading

0 comments on commit f4f97a5

Please sign in to comment.