Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jbroadway's full-sized avatar

John de Plume jbroadway

View GitHub Profile
@jbroadway
jbroadway / embedded.html
Created February 10, 2014 19:36
Modified apps/filemanager/views/gallery/embedded.html to add previews/next buttons
<link rel="stylesheet" type="text/css" href="/apps/filemanager/css/gallery_embedded.css" />
<script>
var gallery_desc = '{{ desc }}';
$(function () {
// load the first image
$('#gallery-view').attr ('src', $('.gallery').first ().attr ('href'));
if (gallery_desc === 'yes') {
$('#gallery-desc').html ($('.gallery').first ().data ('desc'));
} else {
$('#gallery-desc').hide ();
@jbroadway
jbroadway / Hide the admin URL in Elefant.md
Last active August 29, 2015 13:56
How to rename the /admin URL to /newadminpanel on an Elefant CMS website.
  1. Rewrite incoming requests by adding bootstrap.php to the document root folder.

  2. Rewrite outgoing data by adding adminrewrite.php to the apps/myapp/handlers folder.

  3. Add the following line to the [Hooks] section in conf/config.php:

     page/render[] = myapp/adminrewrite
    
  4. Using Nginx, add the following to your vhost:

     location ~ ^/admin/?$ {
    

error_page 404 /404.html;

@jbroadway
jbroadway / langprefix.php
Created March 10, 2014 15:43
Rewrite internal links to always include a language prefix (Elefant CMS).
<?php
/**
* Rewrite internal links to always include a language prefix.
* Save this to a handler such as apps/myapp/handlers/langprefix.php
* then edit conf/config.php and add the following to the [Hooks]
* section:
*
* page/render[] = myapp/langprefix
*/
@jbroadway
jbroadway / Boris.md
Last active August 29, 2015 13:57
Using Boris REPL with Elefant CMS.

Using Boris REPL with Elefant CMS

Note: Boris requires PHP's pcntl extension.

1. Install Boris via:

    composer.phar require d11wtq/boris

2. Add the provided bootstrap.php to your document root.

@jbroadway
jbroadway / forms_form.php
Created July 2, 2014 15:54
Simple single-field form test. Save to apps/test/* (rename underscores to subfolders) and view the form at the URL /test/form
; <?php /*
[one]
not empty = 1
; */ ?>
@jbroadway
jbroadway / style.css
Last active August 29, 2015 14:04
Minimal Responsive Grid System.
/**
* Minimal Responsive Grid System.
*
* Usage:
*
* <div class="row">
* <div class="unit-75">
* <h1>Body</h1>
* </div>
* <div class="unit-25">
@jbroadway
jbroadway / bootstrap.php
Last active August 29, 2015 14:06
Bootstrap file for the Elefant CMS to hide a site behind HTTP Basic auth.
<?php
/**
* Implements HTTP Basic auth to hide your site
* until it's ready to go live. Based on:
*
* https://gist.github.com/jbroadway/9a18f84ad6be671eb22d
*/
if (! $controller->cli) {
conf ('General', 'master_username', 'USERNAME');

Keybase proof

I hereby claim:

  • I am jbroadway on github.
  • I am lux (https://keybase.io/lux) on keybase.
  • I have a public key whose fingerprint is 660A 7F28 50B0 3F3F 05F4 49A6 EC45 0C7F AD47 AB33

To claim this, I am signing this object:

@jbroadway
jbroadway / Autoloader.old.php
Created February 1, 2012 19:46
Autoloader testing for Elefant CMS with and without a class map.
<?php
/**
* Elefant CMS - http://www.elefantcms.com/
*
* Copyright (c) 2011 Johnny Broadway
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@jbroadway
jbroadway / PclZip.php
Created February 2, 2012 19:40
Unzip wrapper around ZipArchive and PclZip for Elefant CMS
<?php
// --------------------------------------------------------------------------------
// PhpConcept Library - Zip Module 2.8.2
// --------------------------------------------------------------------------------
// License GNU/LGPL - Vincent Blavet - August 2009
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
//
// Presentation :
// PclZip is a PHP library that manage ZIP archives.