Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 51 additions & 51 deletions .github/workflows/gulp-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,54 +68,54 @@ jobs:
branch: ${{ (github.base_ref || github.ref) }}
github_token: ${{ secrets.GITHUB_TOKEN }}

# Job name
rclone-dev:
# Run after build
needs: build

# Runner name
runs-on: ubuntu-latest
if: ${{ (github.event.release.target_commitish || github.ref_name) == 'dev' }}

steps:
# Checkout to the branch to use the last (build) commit
- uses: actions/checkout@v2
with:
ref: ${{ (github.event.release.target_commitish || github.ref_name) }}

# rclone
- name: Copy files on dev
uses: wei/rclone@v1
env:
RCLONE_CONFIG_HDX_TYPE: ${{ secrets.RCLONE_CONFIG_HDX_TYPE }}
RCLONE_CONFIG_HDX_HOST: ${{ secrets.RCLONE_CONFIG_HDX_HOST }}
RCLONE_CONFIG_HDX_USER: ${{ secrets.RCLONE_CONFIG_HDX_USER_DEV }}
RCLONE_CONFIG_HDX_PASS: ${{ secrets.RCLONE_CONFIG_HDX_PASS_DEV }}
with:
args: copy build HDX:${{ env.dest_path }}

# Job name
rclone-prod:
# Run after build
needs: build

# Runner name
runs-on: ubuntu-latest
if: ${{ (github.event.release.target_commitish || github.ref_name) == 'prod' }}

steps:
# Checkout to the branch to use the last (build) commit
- uses: actions/checkout@v2
with:
ref: ${{ (github.event.release.target_commitish || github.ref_name) }}

# rclone
- name: Copy files on prod
uses: wei/rclone@v1
env:
RCLONE_CONFIG_HDX_TYPE: ${{ secrets.RCLONE_CONFIG_HDX_TYPE }}
RCLONE_CONFIG_HDX_HOST: ${{ secrets.RCLONE_CONFIG_HDX_HOST }}
RCLONE_CONFIG_HDX_USER: ${{ secrets.RCLONE_CONFIG_HDX_USER_PROD }}
RCLONE_CONFIG_HDX_PASS: ${{ secrets.RCLONE_CONFIG_HDX_PASS_PROD }}
with:
args: copy build HDX:${{ env.dest_path }}
# # Job name
# rclone-dev:
# # Run after build
# needs: build
#
# # Runner name
# runs-on: ubuntu-latest
# if: ${{ (github.event.release.target_commitish || github.ref_name) == 'dev' }}
#
# steps:
# # Checkout to the branch to use the last (build) commit
# - uses: actions/checkout@v2
# with:
# ref: ${{ (github.event.release.target_commitish || github.ref_name) }}
#
# # rclone
# - name: Copy files on dev
# uses: wei/rclone@v1
# env:
# RCLONE_CONFIG_HDX_TYPE: ${{ secrets.RCLONE_CONFIG_HDX_TYPE }}
# RCLONE_CONFIG_HDX_HOST: ${{ secrets.RCLONE_CONFIG_HDX_HOST }}
# RCLONE_CONFIG_HDX_USER: ${{ secrets.RCLONE_CONFIG_HDX_USER_DEV }}
# RCLONE_CONFIG_HDX_PASS: ${{ secrets.RCLONE_CONFIG_HDX_PASS_DEV }}
# with:
# args: copy build HDX:${{ env.dest_path }}
#
# # Job name
# rclone-prod:
# # Run after build
# needs: build
#
# # Runner name
# runs-on: ubuntu-latest
# if: ${{ (github.event.release.target_commitish || github.ref_name) == 'prod' }}
#
# steps:
# # Checkout to the branch to use the last (build) commit
# - uses: actions/checkout@v2
# with:
# ref: ${{ (github.event.release.target_commitish || github.ref_name) }}
#
# # rclone
# - name: Copy files on prod
# uses: wei/rclone@v1
# env:
# RCLONE_CONFIG_HDX_TYPE: ${{ secrets.RCLONE_CONFIG_HDX_TYPE }}
# RCLONE_CONFIG_HDX_HOST: ${{ secrets.RCLONE_CONFIG_HDX_HOST }}
# RCLONE_CONFIG_HDX_USER: ${{ secrets.RCLONE_CONFIG_HDX_USER_PROD }}
# RCLONE_CONFIG_HDX_PASS: ${{ secrets.RCLONE_CONFIG_HDX_PASS_PROD }}
# with:
# args: copy build HDX:${{ env.dest_path }}
41 changes: 23 additions & 18 deletions build/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,30 @@
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
<script src="https://www.youtube.com/player_api"></script>

<?php
$url = $_SERVER['HTTP_HOST'];
switch($url) {
case 'hdx-centre.site.strattic.io':
case 'centre.humdata.org':
$mixpanelToken = 'hdx-mixpanel-token-prod';
break;
default:
$mixpanelToken = 'hdx-mixpanel-token-local';
}
<script type="text/javascript">
// Get the current hostname
var hostname = window.location.hostname;
var mixpanelToken;

// Check the hostname and set the Mixpanel token
if (hostname === 'centre.humdata.org') {
mixpanelToken = '5cbf12bc9984628fb2c55a49daf32e74';
} else if (hostname === 'dev-centre.humdata.org') {
mixpanelToken = '99035923ee0a67880e6c05ab92b6cbc0';
} else {
mixpanelToken = '875bfe50f9cb981f4e2817832c83c165';
}

if(!empty(get_option($mixpanelToken))) : ?>
<!-- start Mixpanel -->
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
// Initialize Mixpanel if the token is not empty
if (mixpanelToken) {
(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init("<?=get_option($mixpanelToken)?>");
</script>
<!-- end Mixpanel -->
<?php endif;
mixpanel.init(mixpanelToken);
}
<!-- end Mixpanel -->
</script>

<?php

wp_head();

Expand Down Expand Up @@ -149,7 +154,7 @@ class="btn ocha-see-all">See all</a>

<nav>
<div class='nav-container'>
<a href="<?= esc_url(home_url(get_current_blog_id(), '/')) ?>">
<a href="<?= esc_url(home_url(get_current_blog_id(), '/')) ?>/">
<svg class='logo' viewBox="0 0 245 77" version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
Expand Down
2 changes: 1 addition & 1 deletion build/js/humdata-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3802,7 +3802,7 @@ var util = window.util = {
$.ajax({
type: 'GET',
cache: false,
url: '/custom-latest-tweets/',
url: '/custom-latest-tweets.json',
success: function (data) {
twitterDataReady(data);
}
Expand Down
2 changes: 1 addition & 1 deletion build/js/humdata-footer.js.map

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions build/page-templates/blank.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
remove_filter('the_content', 'wpautop');

$pageID = get_the_ID();
$mixpanelToken = ($_SERVER['HTTP_HOST'] === 'hdx-centre.site.strattic.io' || $_SERVER['HTTP_HOST'] === 'centre.humdata.org') ? 'hdx-mixpanel-token-prod' : 'hdx-mixpanel-token-local';
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?> xmlns="http://www.w3.org/1999/xhtml">
Expand All @@ -25,12 +24,28 @@
<script src="<?php echo esc_url(includes_url('js/jquery/jquery.min.js')); ?>"></script>
<script src="<?php echo get_stylesheet_directory_uri().'/js/humdata-mixpanel.js'; ?>"></script>

<?php if(!empty(get_option($mixpanelToken))) : ?>
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init("<?=get_option($mixpanelToken)?>");
</script>
<?php endif; ?>
<script type="text/javascript">
// Get the current hostname
var hostname = window.location.hostname;
var mixpanelToken;

// Check the hostname and set the Mixpanel token
if (hostname === 'centre.humdata.org') {
mixpanelToken = '5cbf12bc9984628fb2c55a49daf32e74';
} else if (hostname === 'dev-centre.humdata.org') {
mixpanelToken = '99035923ee0a67880e6c05ab92b6cbc0';
} else {
mixpanelToken = '875bfe50f9cb981f4e2817832c83c165';
}

// Initialize Mixpanel if the token is not empty
if (mixpanelToken) {
(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init(mixpanelToken);
}
<!-- end Mixpanel -->
</script>

<meta property="og:image" content="<?php echo get_stylesheet_directory_uri().'/assets/blank-pages/hdf2024/HDF-og-image.jpg'; ?>">
<link rel="icon" href="https://centre.humdata.org/wp-content/uploads/2018/07/favicon_32x32.png" sizes="192x192">
Expand Down
2 changes: 1 addition & 1 deletion build/page-templates/learning-path.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<div class="content-width column-container">
<div class='column column-12'>
<ol class="breadcrumb header-subtitle" vocab="http://schema.org/" typeof="BreadcrumbList">
<li><a href="<?php echo $homeURL ?>" itemprop="url">Home</a></li>
<li><a href="<?php echo $homeURL ?>/" itemprop="url">Home</a></li>
<li>Resources</li>
<li><a href="<?php echo $homeURL ?>/learning-path" itemprop="url">All Learning Paths</a></li>
<li class="current"><?php echo get_the_title(); ?></li>
Expand Down
4 changes: 2 additions & 2 deletions build/partials/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ function uncode_breadcrumbs($navigation_index = '')
if (is_home() || is_front_page())
{

if ($show_on_home == 1) $html = '<ol vocab="http://schema.org/" typeof="BreadcrumbList"><li property="itemListElement" typeof="ListItem"><a href="' . $home_link . '">' . $text['home'] . '</a></li></ol>';
if ($show_on_home == 1) $html = '<ol vocab="http://schema.org/" typeof="BreadcrumbList"><li property="itemListElement" typeof="ListItem"><a href="' . $home_link . '/">' . $text['home'] . '</a></li></ol>';
} else
{

Expand All @@ -1690,7 +1690,7 @@ function uncode_breadcrumbs($navigation_index = '')
$html = '<ol class="breadcrumb header-subtitle" vocab="http://schema.org/" typeof="BreadcrumbList">';
if ($show_home_link == 1)
{
$html.= '<li property="itemListElement" typeof="ListItem"><a href="' . $home_link . '" itemprop="url">' . $text['home'] . '</a></li>';
$html.= '<li property="itemListElement" typeof="ListItem"><a href="' . $home_link . '/" itemprop="url">' . $text['home'] . '</a></li>';
if ($frontpage_id == 0 || $parent_id != $frontpage_id) $html.= $delimiter;
}

Expand Down
41 changes: 23 additions & 18 deletions src/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,30 @@
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
<script src="https://www.youtube.com/player_api"></script>

<?php
$url = $_SERVER['HTTP_HOST'];
switch($url) {
case 'hdx-centre.site.strattic.io':
case 'centre.humdata.org':
$mixpanelToken = 'hdx-mixpanel-token-prod';
break;
default:
$mixpanelToken = 'hdx-mixpanel-token-local';
}
<script type="text/javascript">
// Get the current hostname
var hostname = window.location.hostname;
var mixpanelToken;

// Check the hostname and set the Mixpanel token
if (hostname === 'centre.humdata.org') {
mixpanelToken = '5cbf12bc9984628fb2c55a49daf32e74';
} else if (hostname === 'dev-centre.humdata.org') {
mixpanelToken = '99035923ee0a67880e6c05ab92b6cbc0';
} else {
mixpanelToken = '875bfe50f9cb981f4e2817832c83c165';
}

if(!empty(get_option($mixpanelToken))) : ?>
<!-- start Mixpanel -->
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
// Initialize Mixpanel if the token is not empty
if (mixpanelToken) {
(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments, 0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn4.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init("<?=get_option($mixpanelToken)?>");
</script>
<!-- end Mixpanel -->
<?php endif;
mixpanel.init(mixpanelToken);
}
<!-- end Mixpanel -->
</script>

<?php

wp_head();

Expand Down Expand Up @@ -149,7 +154,7 @@ class="btn ocha-see-all">See all</a>

<nav>
<div class='nav-container'>
<a href="<?= esc_url(home_url(get_current_blog_id(), '/')) ?>">
<a href="<?= esc_url(home_url(get_current_blog_id(), '/')) ?>/">
<svg class='logo' viewBox="0 0 245 77" version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
Expand Down
Loading