Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URW-189 Open Graph tags #179

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion about/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require(BASE . '/api/discord/bots/admin.php');
//require(BASE . '/api/google/count_majors.php');

head('About Us', true);
head('About Us', true, false, false, "UNT Robotics is a broad engineering student organization at the University of North Texas. We focus on developing student's skills in engineering & robotics, which involves a range of beginner workshops, industry talks, robotics-based hackathons, recreational projects and competitions.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about having these as function args...

What if we create two new classes:
HeadingConfig which contains the auth, return, and the second class OpenGraphConfig

That way this ugliness of stacking params should be fixed and instead we'll have a nicer way to specify something like

$config = {
  auth: false,
  og: $og_config
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it go in template/top.php or in a separate file in template/classes/?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each would be its own new class under template/classes and head would take a single argument of $config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you instantiate objects in PHP like that? The only way I can see to get a similar instantiation is if it's an array. As an object, it ends up moving the messy stacking of params into a constructor instead of the head function like this:

$og_config = new OpenGraphConfig('UNT Robotics is a broad engineering...', 'images/og-image-2.png');
$config = new HeadingConfig('About Us', true, true, false, $og_config);
head($config);

I don't think that's any better than extracting the params into separate variables and passing the variables instead of values.

?>
<main class="page-content">
<!-- Classic Breadcrumbs-->
Expand Down
2 changes: 1 addition & 1 deletion about/our-alumni.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../template/top.php');
require_once('card.php');
head('Our Alumni', true);
head('Our Alumni', true, false, false, "Learn more about the members who made UNT Robotics into what it is today!");
$members = array();
$members[] = [
'name'=>'Nick Tindle',
Expand Down
2 changes: 1 addition & 1 deletion about/our-team.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../template/top.php');
require_once('card.php');
head('Our Team', true);
head('Our Team', true, false, false, "Meet the officers of UNT Robotics. These are the people driving the organization forward into the future!");
$members = array();

//co-president
Expand Down
2 changes: 1 addition & 1 deletion about/our-web-team-alumni.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../template/top.php');
require_once('card.php');
head('Our Web Team Alumni', true);
head('Our Web Team Alumni', true, false, false, "Curious about who helped build UNT Robotics' website into what it is now? Look no further because all of our former web developers are here!");
$members = array();
$members[] = [
'name'=>'Peyton Thibodeaux',
Expand Down
2 changes: 1 addition & 1 deletion about/our-web-team.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../template/top.php');
require('card.php');
head('Our Team', true);
head('Our Team', true, false, false, "Discover the team who keep the UNT Robotics website up and running!");
$members = array();

$members[] = [
Expand Down
2 changes: 1 addition & 1 deletion activities.php
Kenneth-W-Chen marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('template/top.php');
head('Activities', true);
head('Activities', true, false, false, "Explore the dynamic world of robotics with [University Name] Robotics Club! From hosting STEM company seminars and hands-on workshops to collaborating on innovative projects and competing in inter-collegiate events, we provide endless opportunities to learn and grow.");
?>

<main class="page-content">
Expand Down
2 changes: 1 addition & 1 deletion auth/discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function assign_user_good_standing($user_discord_id) {
return AdminBot::add_user_role($user_discord_id);
}

head('Joined Discord', true, true);
head('Joined Discord', true, true, false, "", null);

// user must be authenticated to reach this point

Expand Down
2 changes: 1 addition & 1 deletion auth/join-discord.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Join us on Discord', true);
head('Join us on Discord', true, false, false, "Want to stay up to date with all of UNT Robotics' fun? Join our Discord here!");

$log = var_export($_REQUEST, true);
error_log($log, 3, BASE . '/paypal/logs/pdt-dues.log');
Expand Down
2 changes: 1 addition & 1 deletion auth/join.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
}
} while (false);
}
head('Join', true);
head('Join', true, false, false, "");
?>
<style>
.select2-container--bootstrap .select2-selection--single .select2-selection__rendered {
Expand Down
2 changes: 1 addition & 1 deletion auth/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}
} while (false);
}
head('Login', true);
head('Login', true, false, false, "");
?>

<main class="page-content">
Expand Down
2 changes: 1 addition & 1 deletion auth/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
session_unset();
session_destroy();

head('Logged Out', true);
head('Logged Out', true, false, false, "");
?>

<main class="page-content">
Expand Down
2 changes: 1 addition & 1 deletion auth/reset-password.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
} while (false);
}
head('Reset Password', true);
head('Reset Password', true, false, false, "");
?>

<main class="page-content">
Expand Down
2 changes: 1 addition & 1 deletion auth/saml/auth.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('template/top.php');
head('Authentication', true);
head('Authentication', true, false, false, "");

require_once('saml/simplesamlphp/lib/_autoload.php');
$as = new \SimpleSAML\Auth\Simple('untrobotics-sp');
Expand Down
2 changes: 1 addition & 1 deletion auth/saml/login.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('template/top.php');
head('Login', true);
head('Login', true, false, false, "");
?>
<main class="page-content">
<section class="section-75 section-md-100 section-lg-150">
Expand Down
2 changes: 1 addition & 1 deletion auth/saml/logout.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('template/top.php');
head('Login', true);
head('Login', true, false, false, "");
?>
<main class="page-content">
<section class="section-75 section-md-100 section-lg-150">
Expand Down
2 changes: 1 addition & 1 deletion auth/welcome.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
//header("Location: https://discord.gg/j3D5Zdp");
require('../template/top.php');
head('Welcome', true, true);
head('Welcome', true, true, false, "", null);
?>
<style>
.select2-container--bootstrap .select2-selection--single .select2-selection__rendered {
Expand Down
2 changes: 1 addition & 1 deletion botathon/botathon-teams.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Botathon Teams', true);
head('Botathon Teams', true, false, false, "Find out about the teams competing in Botathon this year! Their bots may look scary, but they don't bite!");
?>
<style>
.bio-area {
Expand Down
2 changes: 1 addition & 1 deletion botathon/brackets.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Botathon Brackets', true);
head('Botathon Brackets', true, false, false, "See the current Botathon brackets here.");
?>
<div style="padding: 20px 0px 10px 0px;">
<iframe src="https://challonge.com/botathon3/module" width="100%" height="400" frameborder="0" scrolling="auto" allowtransparency="true"></iframe>
Expand Down
2 changes: 1 addition & 1 deletion botathon/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Botathon Info', true);
head('Botathon Info', true, false, false, "UNT's first robotics competition — Botathon. Learn more about Botathon as a whole and the current Botathon season here.");
?>

<style>
Expand Down
2 changes: 1 addition & 1 deletion botathon/live.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Botathon Live Page', true);
head('Botathon Live Page', true, false, false, "");
?>

<style>
Expand Down
2 changes: 1 addition & 1 deletion botathon/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require('../template/top.php');
require('../template/functions/botathon-funcs.php');

head('Botathon Registration', true);
head('Botathon Registration', true, false, false, "Register for the upcoming Botathon season here!");
?>
<style>
.checkbox-container {
Expand Down
2 changes: 1 addition & 1 deletion botathon/team.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

require('../template/top.php');

$head = head('Botathon Live Page', true, true, true);
$head = head('Botathon Live Page', true, true, true, "Use this page to debug your Botathon robot's connection.", null);

//get team name and number
global $db;
Expand Down
2 changes: 1 addition & 1 deletion contact.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('template/top.php');
head('Contact Us', true);
head('Contact Us', true, false, false, "Have questions for UNT Robotics or want to get involved? Visit our Contact Us page to get in touch with us!");
?>
<style>
#contact-form-submit-area {
Expand Down
2 changes: 1 addition & 1 deletion dues/alternatives.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../template/top.php');
require(BASE . '/api/discord/bots/admin.php');
head('Pay Dues via Alternatives', true);
head('Pay Dues via Alternatives', true, false, false, "If you paid for your dues not using PayPal, fill out the form on this page to get your Good Standing role.");

if (isset($_POST['submit'])) {
AdminBot::send_message("Nick said this was okay..." . var_export(array($_POST, $userinfo['id'], $userinfo['name']), true));
Expand Down
2 changes: 1 addition & 1 deletion dues/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../template/top.php');
require(BASE . '/api/discord/bots/admin.php');
head('Pay Dues', true);
head('Pay Dues', true, false, false, "Want to support UNT Robotics and get access to some exclusive projects? Get your Good Standing status by paying your UNT Robotics dues.");

$q = $db->query("SELECT `key`,`value` FROM dues_config WHERE `key` = 'semester_price' OR `key` = 't_shirt_dues_purchase_price'");
if (!$q || $q->num_rows !== 2) {
Expand Down
2 changes: 1 addition & 1 deletion dues/paid.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Dues Paid', true);
head('Dues Paid', true, false, false, "");

$log = var_export($_REQUEST, true);
error_log($log, 3, BASE . '/paypal/logs/pdt-dues.log');
Expand Down
2 changes: 1 addition & 1 deletion events.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('template/top.php');
head('Events Calendar', true);
head('Events Calendar', true, false, false, "Stay updated with UNT Robotics' upcoming meetings and events! Discover upcoming workshops, competitions, meetings, and more.");
?>
<style>
@media (min-width: 480px) and (max-width: 768px) {
Expand Down
Binary file added images/og-image.png
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do some platforms require a square og image? I vaguely recall from my days of setting up og at NT Daily that I had to specify a square image for facebook or twitter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think twitter has a specific tag since the rectangle image gets cropped. https://devcommunity.x.com/t/twitter-card-for-open-graph/149336

You can specify the width and height for the image too. With Facebook it helps it load properly apparently? https://developers.facebook.com/docs/sharing/webmasters/#images

I'll try messing around with a square image

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion legal/discord-rules.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require("../template/top.php");
head("Discord Rules", true);
head("Discord Rules", true, false, false, "These are the rules for the official UNT Robotics Discord server.");
Kenneth-W-Chen marked this conversation as resolved.
Show resolved Hide resolved
?>
<style>
h3 {
Expand Down
2 changes: 1 addition & 1 deletion legal/privacy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require("../template/top.php");
head("Privacy", true);
head("Privacy", true, false, false, "");
?>
<style>
[data-custom-class='body'], [data-custom-class='body'] * {
Expand Down
2 changes: 1 addition & 1 deletion me/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<?php
require('../template/top.php');
head('My Profile', true, true);
head('My Profile', true, false, false, "You must be logged in in order to view this page.", true);
?>

<main class="page-content">
Expand Down
2 changes: 1 addition & 1 deletion merch/buy/complete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../../template/top.php');
head('Merch Ordered', true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change shouldn't be needed, since it's just passing in defaults, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default description is null which puts the default description. Putting an empty string sets the OG description to be empty.

head('Merch Ordered', true, false, false, "");

$log = var_export($_REQUEST, true);
$log .= var_export($userinfo, true);
Expand Down
2 changes: 1 addition & 1 deletion merch/gear.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require('../template/top.php');
require(BASE . '/template/functions/functions.php');
require('includes/merch-template.php');
head('Order Gear', true);
head('Order Gear', true, false, false, "Support UNT Robotics & look dapper while doing it!");

merch_template("Gear", "(Gear)");

Expand Down
2 changes: 1 addition & 1 deletion merch/hats.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require('../template/top.php');
require(BASE . '/template/functions/functions.php');
require('includes/merch-template.php');
head('Order Hats', true);
head('Order Hats', true, false, false, "Support UNT Robotics & look dapper while doing it!");

merch_template("Hats", "(Hat)");

Expand Down
2 changes: 1 addition & 1 deletion merch/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Merch', true);
head('Merch', true, false, false, "Support UNT Robotics & look dapper while doing it!");
?>
<style>
.page-index-listing li {
Expand Down
36 changes: 14 additions & 22 deletions merch/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require('../template/top.php');
require(BASE . '/api/printful/printful.php');
require(BASE . '/template/functions/functions.php');
require(BASE . '/template/functions/payment_button.php');
//require(BASE . '/template/functions/payment_button.php');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was throwing an error when I pushed it to the dev site (probably because I deleted the file)


$printfulapi = new PrintfulCustomAPI();

Expand Down Expand Up @@ -61,15 +61,22 @@
$mockup_file = "";
}
$back_file = $selected_variant->get_file_by_type(PrintfulVariantFilesTypes::BACK);

head("Buy {$product->get_name()}", true);

preg_match("@^(.+?)•@ims", $catalog_product->get_description(), $m);
//var_dump($m);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the debugging code

$description = "";
if (count($m)) {
$description = trim($m[1]);
}

head("Buy {$product->get_name()}", true, false, false, $description, $mockup_file->get_url() ? $mockup_file->get_url() : $mockup_file->get_preview_url());
$category_name = strtolower(preg_replace('@^.*\(([^()]+)\)$@i', '$1', $product->get_name()));
if($category_name !== 'gear' && $category_name[-1]!=='s'){
$category_name .= 's';
}

} else {
head("Invalid Product", true);
head("Invalid Product", true, false, false, null, null);
}

function get_variant_variant($variant_name) {
Expand Down Expand Up @@ -248,12 +255,6 @@ class="btn variant-btn"
?>

<?php
preg_match("@^(.+?)•@ims", $catalog_product->get_description(), $m);
//var_dump($m);
$description = "";
if (count($m)) {
$description = trim($m[1]);
}
preg_match_all("@• (.+)\n@i", $catalog_product->get_description(), $m);
//var_dump($m);
$other_info = array();
Expand Down Expand Up @@ -289,7 +290,7 @@ class="btn variant-btn"
'variant' => $selected_variant->get_id()
));

$payment_button = new PaymentButton(
/* $payment_button = new PaymentButton(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any code is commented, it needs to:

  • Have a TODO or FIXME comment, with a backlog ticket number to address the issue that led to it being commented out
  • Or be considered dead code and just deleted (the nice thing about git is we can still find dead and deleted code from the past)

$product->get_name(),
$product->get_product_price()
);
Expand All @@ -303,7 +304,7 @@ class="btn variant-btn"
$product->get_name(),
get_variant_variant($selected_variant->get_name())
));
$payment_button->set_complete_return_uri('/merch/buy/complete');
$payment_button->set_complete_return_uri('/merch/buy/complete');*/

/*
$button = payment_button(
Expand All @@ -323,16 +324,7 @@ class="btn variant-btn"
*/

//echo $button['btn'];
$button = $payment_button->get_button();
if ($button->error === false) {
echo "button success";
echo $payment_button->get_button()->button;
} else {
// TODO: Alert
?>
<div class="alert alert-danger">An error occurred loading the payment button...</div>
<?php
}

?>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion merch/shirts-hoodies.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require('../template/top.php');
head('Order Shirts & Hoodies', true);
head('Order Shirts & Hoodies', true, false, false, "Support UNT Robotics & look dapper while doing it!");
?>
<style>
/*
Expand Down
2 changes: 1 addition & 1 deletion merch/trousers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require('../template/top.php');
require(BASE . '/template/functions/functions.php');
require('includes/merch-template.php');
head('Order Trousers', true);
head('Order Trousers', true, false, false, "Support UNT Robotics & look dapper while doing it!");

merch_template("Trousers", "(Trousers)");

Expand Down
2 changes: 1 addition & 1 deletion sponsorships/donate/thank-you.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('../../template/top.php');
require_once(BASE . '/api/discord/bots/admin.php');
head('Thank you for your donation', true);
head('Thank you for your donation', true, false, false, "");

AdminBot::send_message("Donation received (probably)!");
?>
Expand Down
Loading