How to Renew SSL Certificate for law.gmu.edu

Log into cPanel (GoDaddy) and go to SSL/TLS Generate CSR and fill out all the information. Request SSL certificate from ITS. Submit a request to get a certificate. Once you get it from ITS, go back to cPanel – SSL and then go to certificates Then upload the .crt file that ITS gave you Go … Continue reading “How to Renew SSL Certificate for law.gmu.edu”

Force Update of PDFs

When replacing an existing PDF, browsers don’t serve the latest version. They usually serve the cached version. To change that, we use Apache directives as below: # Instruct browsers to always check for the latest version of your files using Apache directives <IfModule mod_headers.c> <FilesMatch "(?i)^.*\.(css|htm|html|gif|jpg|jpeg|js|png|pdf)$"> Header set Cache-Control "max-age=0,must-revalidate" </FilesMatch> </IfModule> The instruction above … Continue reading “Force Update of PDFs”

PHP Script Swapping out GA codes

This script was used to delineate Google Analytic Tracking codes between four different sites sharing the same wordpress theme files. Originally placed in footer.php above the GA tracking code provided by Google. <?php $host = ‘https://’ . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’]; if (strpos($host,’sls’) !== false) { $gacode =”UA-792782-19″; } elseif (strpos($host,’gai’) !== false) { $gacode =”UA-792782-21″; … Continue reading “PHP Script Swapping out GA codes”

Homepage Featured Events Display Using DOM

The featured events on the Mason Law homepage is pulled from the master calendar’s RSS. To get the dates and times separated from the titles, accessing the DOM is needed. The following codes, which requires jQuery, make the magic happened: $(‘.rssItemLink’).each( function(){ $this = $(this); $this. html(‘<em>’ + $this. html(). replace(/((\d{1,2}\/){2}\d{2,4}\s*[0-9]{1,2}:[0-9]{1,2}\s*[apAP][mM]\s*to\s*[0-9]{1,2}:[0-9]{1,2}\s*[apAP][mM])/, ‘</em><b>$1</b>’ ) ); } );

Sticky Nav on Scroll

Here’s a little JavaScript function to make your site’s header or navigation stick to the top of the window when users scroll the page: HTML: <div id=”navigation”> <!– your navigation code –> </div> CSS: #navigation{ position:absolute; top:120px; left:0; } #navigation.fixed{ position:fixed; top:16px; } JavaScript: // Handles the page being scrolled by ensuring the navigation is … Continue reading “Sticky Nav on Scroll”

EMS Master Calendar Modification

Connect to the server via Microsoft Remote Desktop Locate: C:\inetpub\wwwroot\MasterCalendar (under My Computer, C drive) In order to add the Mason Law logo in the master calendar of events, I had to modify the master template file (Calendar.master). Scroll down to line 105, you’ll see this: <div> <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="28B11E50" /> <input type="hidden" … Continue reading “EMS Master Calendar Modification”

Sort HTML Table Columns With jQuery

Tablesorter is a flexible client-side table sorting via jQuery. It’s easy to implement and progressive enhancement. Update: Tablesorter has a few bugs in IE9 and I couldn’t find a quick fix, but then I came across Sortable by Joost de Valk. The nice thing about this script is that it doesn’t required jQuery. I switched the … Continue reading “Sort HTML Table Columns With jQuery”

Simple RSS Parser With lastRSS

LastRSS makes displaying RSS feed easy. Here’s an example: <?php // include lastRSS include “./lastRSS.php”; // Create lastRSS object $rss = new lastRSS; // Set cache dir and cache time limit (1200 seconds) // (don’t forget to chmod cahce dir to 777 to allow writing) $rss->cache_dir = ‘./temp’; $rss->cache_time = 1200; // Try to load and parse RSS file if ($rs = $rss->get(‘http://www.law.gmu.edu/rss/news_all’)) { // Show website logo (if presented) if ($rs[image_url] != ”) { echo “<a href=\”$rs[image_link]\”><img src=\”$rs[image_url]\” alt=\”$rs[image_title]\”  /></a>\n”; } // Show clickable website title echo “<h1><a href=\”$rs[link]\”>$rs[title]</a></h1>\n”; // Show website description echo “<p>$rs[description]</p>\n”; // Show last published articles (title, link, description) echo “<ul>\n”; foreach($rs[‘items’] as $item) { echo “\t<li><a href=\”$item[link]\”>”.$item[‘title’].”</a>”.$item[‘description’].”</li>\n”; } echo “</ul>\n”; } else { echo “Error: It’s not possible to reach RSS file…\n”; } ?>

Simple CAS Authentication

The following script makes a private web site accessible only to authenticated users. For example, if you have a career services web site and you only want students to access the materials using their email (university) credentials, this script would do the trick. You don’t need to create separate accounts  for the site. 1. Download phpCAS and unzip/untar it: https://wiki.jasig.org/display/CASC/phpCAS. 2. … Continue reading “Simple CAS Authentication”

phpCAS and WordPress

Make sure your account is in the “Administrator” role, as you won’t be able to login as admin after switching to CAS. 1. Download phpCAS and unzip/untar it: https://wiki.jasig.org/display/CASC/phpCAS 2. Download wpcas.zip and unzip it in wp-content/plugins 3. edit wp-content/plugins/wpcas/wpcas.php and remove or comment out line 57: /* $wpcas_options[‘server_path’] == ” || */ 4. Create wp-content/plugins/wpcas/wpcas-conf.php … Continue reading “phpCAS and WordPress”