Skip to content

Commit

Permalink
Pageswap events for GA, FA version numbers updated, CF7 listing sort …
Browse files Browse the repository at this point in the history
…improvement, set cookie function improvement

#2286
  • Loading branch information
chrisblakley committed Apr 27, 2024
1 parent 9b5aee6 commit db707b5
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nebula-wp",
"title": "Nebula",
"description": "Advanced Starter WordPress Theme for Developers",
"version": "11.11.18.453",
"version": "11.11.27.777",
"homepage": "https://gearside.com/nebula/",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion Nebula-Child/assets/css/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Nebula-Child/resources/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//BEGIN automated edits. These will be automatically overwritten.
const THEME_NAME = 'nebula-child';
const NEBULA_VERSION = 'v11.11.18.453'; //Thursday, April 18, 2024 10:52:19 AM
const NEBULA_VERSION = 'v11.11.27.777'; //Saturday, April 27, 2024 6:38:37 PM
const OFFLINE_URL = 'https://nebula.gearside.com/offline/';
const OFFLINE_IMG = 'https://nebula.gearside.com/wp-content/themes/Nebula-main/assets/img/offline.svg';
const META_ICON = 'https://nebula.gearside.com/wp-content/themes/Nebula-main/assets/img/meta/android-chrome-512x512.png';
Expand Down
4 changes: 2 additions & 2 deletions Nebula-Child/style.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/css/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/critical.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/login.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions assets/css/pre.css

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions assets/js/modules/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ nebula.helpers = async function(){
nebula.dom.document.on('keydown', function(e){
if ( e.key === 'Escape' ){
nebula.dom.document.trigger('esc'); //Trigger a simpler DOM event. Is this helpful?

//Close modals
jQuery('.modal').modal('hide');
jQuery('.modal').modal('hide'); //Close modals
}
});

Expand Down
23 changes: 20 additions & 3 deletions assets/js/modules/measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,29 @@ nebula.eventTracking = async function(){

nebula.attributionTracking();

//When a pageswap happens via the View Transition API
nebula.dom.document.on('pageswap', function(event){
if ( event.viewTransition ){ //Ignore if a view transition did not actually occur
gtag('event', 'pageswap', {
event_category: 'View Transition',
event_action: 'Page Swap',
event_label: 'From ' + event.oldURL + ' to ' + event.newURL,
location: event.newURL,
old_url: event.oldURL,
new_url: event.newURL
});
}
});

//When the page is restored from BFCache (which means it is not fully reloaded)
window.addEventListener('pageshow', function(event){
if ( event.persisted === true ){
//Send another pageview if the page is restored from bfcache
gtag('event', 'page_view', {
type: 'bfcache'
//When the page is restored from bfcache
gtag('event', 'bfcache', {
event_category: 'Back/Forward Cache',
event_action: 'Restored',
event_label: event.target.location.href,
location: event.target.location.href
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/partials/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ body.admin-bar {scroll-padding-top: 32px;} //Account for the admin bar height wh
//Nebula social share buttons
a.nebula-share-btn {display: inline-block; padding: 5px 7px; border-radius: 3px; font-size: rem(12px); line-height: 1; color: #fff !important; text-shadow: 1px 1px rgb(0 0 0 / 25%); margin-right: 5px;
&:last-child {margin-right: 0;}
&::before {font-family: "Font Awesome 5 Brands"; margin-right: 4px; text-shadow: none;}
&::before {font-family: "Font Awesome 6 Brands"; margin-right: 4px; text-shadow: none;}

&.facebook {background: brand(facebook);
&::before {content: "\f09a";}
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/partials/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $xl: 1200;
$xxl: 1400;

$system_font: var(--font-family-sans-serif); //CSS variable defined in Bootstrap
$font_awesome: "Font Awesome 5 Pro", "Font Awesome 5 Free", "Font Awesome 5 Brands"; //Convenient stack for Font Awesome icons //DEPRECATED: Eventually delete this
$font_awesome: "Font Awesome 6 Pro", "Font Awesome 6 Free", "Font Awesome 6 Brands"; //Convenient stack for Font Awesome icons //DEPRECATED: Eventually delete this

//Easings
$easings: (
Expand Down
12 changes: 6 additions & 6 deletions assets/scss/pre.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

//@include nebula_code(javascript jquery js, #2b5797);
@mixin nebula_code($languages, $color: $text_color, $unicode: false, $style: "Font Awesome 5 Solid"){
@mixin nebula_code($languages, $color: $text_color, $unicode: false, $style: "Font Awesome 6 Solid"){
@each $language in $languages {
.nebula-code.codetitle.#{$language} {color: $color;
@if $unicode {
Expand All @@ -35,12 +35,12 @@
}

@include nebula_code(apache directive, #af2473);
@include nebula_code(html htm, brand(html), f13b, "Font Awesome 5 Brands");
@include nebula_code(html htm, brand(html), f13b, "Font Awesome 6 Brands");
@include nebula_code(actionscript as, #a42222);
@include nebula_code(css, brand(css), f13c, "Font Awesome 5 Brands");
@include nebula_code(sass scss, brand(sass), f41e, "Font Awesome 5 Brands");
@include nebula_code(javascript js jquery, brand(javascript), f3b8, "Font Awesome 5 Brands");
@include nebula_code(css, brand(css), f13c, "Font Awesome 6 Brands");
@include nebula_code(sass scss, brand(sass), f41e, "Font Awesome 6 Brands");
@include nebula_code(javascript js jquery, brand(javascript), f3b8, "Font Awesome 6 Brands");
@include nebula_code(php, brand(php));
@include nebula_code(regex, #666);
@include nebula_code(shortcode wordpress, brand(wordpress), f19a, "Font Awesome 5 Brands");
@include nebula_code(shortcode wordpress, brand(wordpress), f19a, "Font Awesome 6 Brands");
@include nebula_code(sql mysql, #3e78a6);
2 changes: 1 addition & 1 deletion assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Theme URI: https://nebula.gearside.com
Description: Nebula is a springboard WordPress theme framework for developers. Like other WordPress startup themes, it has custom functionality built-in (like shortcodes, styles, and JS/PHP functions), but unlike other themes Nebula is not meant for the end-user.
Author: Nebula
Version: 11.11.18.453
Version: 11.11.27.777
License: GNU General Public License v2.0 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nebula
Expand Down
2 changes: 1 addition & 1 deletion inc/data/nebula_theme.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "11.11.18.453",
"version": "11.11.27.777",
"details_url": "https://github.com/chrisblakley/Nebula/commits/main",
"download_url": "https://github.com/chrisblakley/Nebula/archive/main.zip"
}
41 changes: 22 additions & 19 deletions libs/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1724,22 +1724,30 @@ public function cf7_submissions_columns_content($column_name, $submission_id){
}
}
public function cf7_submissions_columns_orderby($query){
if ( $this->is_admin_page() && get_post_type() == 'nebula_cf7_submits' ){
$orderby = $query->get('orderby');
if ( $this->is_admin_page() ){
if ( $query->get('post_type') == 'nebula_cf7_submits' ){
$query->set('orderby', 'ID'); //Default to sort by ID
$query->set('order', 'DESC'); //Newest ID first

if ( is_string($orderby) ){
$orderby = strtolower($orderby);
$orderby = $query->get('orderby');

if ( $orderby === 'form_name' ){
$query->set('orderby', 'form_name');
}
if ( is_string($orderby) ){
$orderby = strtolower($orderby);

if ( $orderby === 'page_title' ){
$query->set('orderby', 'page_title');
}
if ( $orderby === 'form_name' ){
$query->set('orderby', 'form_name');
$query->set('order', 'ASC');
}

if ( $orderby === 'page_title' ){
$query->set('orderby', 'page_title');
$query->set('order', 'ASC');
}

if ( $orderby === 'notes' ){
$query->set('orderby', 'notes');
if ( $orderby === 'notes' ){
$query->set('orderby', 'notes');
$query->set('order', 'ASC');
}
}
}
}
Expand Down Expand Up @@ -1965,13 +1973,8 @@ public function cf7_storage_output($post){
'post_type' => 'nebula_cf7_submits',
'post_status' => array('submission', 'invalid'),
'posts_per_page' => 15, //Limit the number of results
'orderby' => 'date',
'orderby' => 'ID', //Use ID to avoid timezone confusion
'order' => 'ASC', //Earliest to more recent
// 'date_query' => array(
// 'after' => date('Y-m-d', $form_data->_nebula_timestamp-YEAR_IN_SECONDS), //Check over the last year for successful/invalid submissions
// 'before' => date('Y-m-d'),
// 'inclusive' => true,
// ),
's' => $form_data->_nebula_ga_cid,
));

Expand Down Expand Up @@ -2004,7 +2007,7 @@ public function cf7_storage_output($post){
$submission_icon = ( get_post_status() == 'submission' && strpos(get_the_title(), '(Invalid)') === false )? '<i class="fa-solid fa-fw fa-circle-check"></i><i class="fa-solid fa-arrow-right"></i>' : '<i class="fa-solid fa-fw fa-circle-xmark"></i><i class="fa-solid fa-arrow-right"></i>';
}

$the_submissions[] = '<li data-date="' . get_the_date('Y-m-dTh:i:s') . '" class="' . get_post_status() . '-submission-item ' . $submission_class . '"><a href="' . get_edit_post_link(get_the_ID()) . '"><strong>' . $submission_icon . ' ' . $submission_label . '</strong></a> <small>(' . get_the_title($invalid_form_data->_wpcf7) . ' on ' . get_the_date('F j, Y \a\t g:i:sa') . ')</small></li>';
$the_submissions[] = '<li data-date="' . get_the_date('Y-m-dTh:i:s') . '" class="' . get_post_status() . '-submission-item ' . $submission_class . '"><a href="' . get_edit_post_link(get_the_ID()) . '"><strong>' . $submission_icon . ' ' . $submission_label . '</strong></a> <small>(' . get_the_title($invalid_form_data->_wpcf7) . ' on ' . get_the_date('l, F j, Y \a\t g:i:sa') . ')</small></li>';
}

if ( count($the_submissions) >= 2 ){ //If this user has submitted a form more than once (successfully or not)
Expand Down
3 changes: 2 additions & 1 deletion libs/Utilities/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ public function is_transients_enabled(){
}

//Create a session and cookie
public function set_cookie($name, $value, $expiration){
public function set_cookie($name, $value, $expiration=false){
$string_value = (string) $value;
if ( empty($string_value) ){
$string_value = 'false';
Expand All @@ -765,6 +765,7 @@ public function set_cookie($name, $value, $expiration){
}

$this->super->cookie[$name] = $string_value;

if ( !headers_sent() ){
setcookie(
$name,
Expand Down
6 changes: 3 additions & 3 deletions style.css

Large diffs are not rendered by default.

0 comments on commit db707b5

Please sign in to comment.