Skip to content

Commit

Permalink
Fixes Invision upgrade CSS error (#1)
Browse files Browse the repository at this point in the history
* Fix css load error during upgrades

* Formatting
  • Loading branch information
jonerickson authored Jul 6, 2023
1 parent 0cfc5f2 commit c2f015d
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 10 deletions.
2 changes: 0 additions & 2 deletions Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class _Application extends \IPS\Application
public function __construct()
{
require_once static::getRootPath().'/applications/stripeverification/sources/vendor/autoload.php';

\IPS\Output::i()->cssFiles = array_merge(\IPS\Output::i()->cssFiles, \IPS\Theme::i()->css('fontawesome.css', 'stripeverification', 'global'));
}

/**
Expand Down
1 change: 1 addition & 0 deletions data/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
<hook key="userBar"><![CDATA[{"type":"S","class":"\\IPS\\Theme\\class_core_front_global"}]]></hook>
<hook key="Member"><![CDATA[{"type":"C","class":"\\IPS\\Member"}]]></hook>
<hook key="profileHeader"><![CDATA[{"type":"S","class":"\\IPS\\Theme\\class_core_front_profile"}]]></hook>
<hook key="css"><![CDATA[{"type":"S","class":"\\IPS\\Theme\\class_core_front_global"}]]></hook>
</build>
4 changes: 4 additions & 0 deletions data/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"profileHeader": {
"type": "S",
"class": "\\IPS\\Theme\\class_core_front_profile"
},
"css": {
"type": "S",
"class": "\\IPS\\Theme\\class_core_front_global"
}
}
2 changes: 1 addition & 1 deletion data/javascript.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="stripeverification">
<file javascript_app="stripeverification" javascript_location="front" javascript_path="controllers/verification" javascript_name="ips.verification.main.js" javascript_type="controller" javascript_version="10004" javascript_position="1000050"><![CDATA[;( function($, _, undefined){
<file javascript_app="stripeverification" javascript_location="front" javascript_path="controllers/verification" javascript_name="ips.verification.main.js" javascript_type="controller" javascript_version="10005" javascript_position="1000050"><![CDATA[;( function($, _, undefined){
"use strict";
ips.controller.register('stripeverification.front.verification.main', {
Expand Down
2 changes: 1 addition & 1 deletion data/lang.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="stripeverification" version="10004">
<app key="stripeverification" version="10005">
<word key="__app_stripeverification" js="0">Stripe Identity Verification</word>
<word key="menutab__stripeverification" js="0">Stripe Verification</word>
<word key="menutab__stripeverification_icon" js="0">cc-stripe</word>
Expand Down
6 changes: 3 additions & 3 deletions data/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
</div>

]]></template>
<css css_location="global" css_app="stripeverification" css_attributes="" css_path="." css_name="fontawesome.css">.fa-solid {
font-family: 'Font Awesome 6 Free'; }
<css css_location="front" css_app="stripeverification" css_attributes="" css_path="." css_name="stripeverification.css">.fa-solid {
font-family: 'Stripe Verification'; }

.fa-circle-check::before {
content: &quot;\f058&quot;; }

@font-face {
font-family: 'Font Awesome 6 Free';
font-family: 'Stripe Verification';
font-style: normal;
font-weight: 900;
font-display: block;
Expand Down
3 changes: 2 additions & 1 deletion data/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"10001": "1.0.1",
"10002": "1.0.2",
"10003": "1.0.3",
"10004": "1.0.4"
"10004": "1.0.4",
"10005": "1.0.5"
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.fa-solid {
font-family: 'Font Awesome 6 Free'; }
font-family: 'Stripe Verification'; }

.fa-circle-check::before {
content: "\f058"; }

@font-face {
font-family: 'Font Awesome 6 Free';
font-family: 'Stripe Verification';
font-style: normal;
font-weight: 900;
font-display: block;
Expand Down
29 changes: 29 additions & 0 deletions hooks/css.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//<?php

/* To prevent PHP errors (extending class does not exist) revealing path */
if (! \defined('\IPS\SUITE_UNIQUE_KEY')) {
exit;
}

/**
* @mixin \IPS\Theme\class_core_front_global
*/
class stripeverification_hook_css extends _HOOK_CLASS_
{
/* !Hook Data - DO NOT REMOVE */
public static function hookData()
{
return array_merge_recursive([
'globalTemplate' => [
0 => [
'selector' => 'html > head',
'type' => 'add_inside_end',
'content' => '<link rel=\'stylesheet\' href=\'{expression="\IPS\Http\Url::external(reset(\IPS\Theme::i()->css(\'stripeverification.css\', \'stripeverification\', \'front\')))->setQueryString(\'v\',\IPS\Theme::i()->cssCacheBustKey())"}\' media=\'all\'>
',
],
],
], parent::hookData());
}
/* End Hook Data */

}
23 changes: 23 additions & 0 deletions setup/upg_10005/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": 10005,
"name": "1.0.5",
"steps": {
"queries": false,
"lang": false,
"theme": true,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": true,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
7 changes: 7 additions & 0 deletions setup/upg_10005/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"added": [
"css"
],
"edited": [],
"removed": []
}
21 changes: 21 additions & 0 deletions setup/upg_10005/theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"html": {
"added": [],
"edited": [],
"removed": []
},
"css": {
"added": [
"front\/stripeverification.css"
],
"edited": [],
"removed": [
"global\/fontawesome.css"
]
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}

0 comments on commit c2f015d

Please sign in to comment.