Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
Sign In functionality (#17)
Browse files Browse the repository at this point in the history
* Display clubs near provided address

* Style guide UI

* Create contact form template

* Added League/Plates package along with class autoloader

* CCW functionality

* Use correct plates directory in edit club form.

* Add api calls for sign in

* Fix templates

* Fix top menu

* Looking for volunteer flag

* Tidy up pages setup

* Mark translatable

* Remove page title custom field from required pages

* Tidy up contact form

* Proven wordpress redirecting to 404 on form submit

* Updates pot file

* Example translation file

* Add new constants to example config

* Display errors false by default

* Comment out host volunteer matching setup

* Comment out Looking for Volunteer flag

* Update changelog

* Revert wrong changelog changes
  • Loading branch information
Yulia authored Feb 10, 2017
1 parent a9aa7c6 commit 5bd34ea
Show file tree
Hide file tree
Showing 63 changed files with 4,810 additions and 167 deletions.
64 changes: 55 additions & 9 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ function ccw_countries_setup() {

// This theme uses multiple nav menus
register_nav_menus( array(
'primary_navigation' => esc_html__( 'Primary Navigation', 'ccw_countries' ),
'footer_navigation_1' => esc_html__( 'Footer Nav 1', 'ccw_countries' ),
'footer_navigation_2' => esc_html__( 'Footer Nav 2', 'ccw_countries' ),
'footer_navigation_3' => esc_html__( 'Footer Nav 3', 'ccw_countries' ),
'footer_navigation_4' => esc_html__( 'Footer Nav 4', 'ccw_countries' ),
'primary_navigation' => esc_html__( 'Primary Navigation', 'ccw_countries' ),
'footer_navigation_1' => esc_html__( 'Footer Nav 1', 'ccw_countries' ),
'footer_navigation_2' => esc_html__( 'Footer Nav 2', 'ccw_countries' ),
'footer_navigation_3' => esc_html__( 'Footer Nav 3', 'ccw_countries' ),
'footer_navigation_4' => esc_html__( 'Footer Nav 4', 'ccw_countries' ),
'club_navigation_menu' => esc_html__( 'Club Navigation Menu', 'ccw_countries' ),
) );

/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/

/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
Expand All @@ -74,6 +76,11 @@ function ccw_countries_setup() {
endif;
add_action( 'after_setup_theme', 'ccw_countries_setup' );

function display_php_errors() {
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
}

/**
* Enqueue scripts and styles.
*/
Expand Down Expand Up @@ -135,3 +142,42 @@ function ccw_countries_scripts() {
* CCW API class.
*/
require get_template_directory() . '/inc/ccw-api.php';

/**
* Host Volunteer Matching class.
*/
require get_template_directory() . '/inc/host-volunteer-matching.php';

/**
* Flash Messages class.
*/
require get_template_directory() . '/inc/flash-messages.php';

/**
* Generic PHP class autoloader, in lieu of using Composer.
* See: https://gist.github.com/jwage/221634
*/
require get_template_directory() . '/inc/SplClassLoader.php';

/**
* Load the League Plates package via the above class autoloader.
*/
$classLoader = new SplClassLoader('League\Plates', get_template_directory() . '/inc');
$classLoader->register();


/**
* Helper methods
*/
require get_template_directory() . '/inc/helpers.php';


/**
* Sign in logic functions and Club Session class.
*/
require get_template_directory() . '/inc/club-session.php';

/**
* Set up
*/
require get_template_directory() . '/inc/set-up/run-setup.php';
7 changes: 7 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

<body <?php body_class(); ?>>

<?php DISPLAY_ERRORS ? display_php_errors() : '' ?>

<header class="o-nav">
<div class="o-nav__container u-clearfix">
<div class="c-logo">
Expand Down Expand Up @@ -57,3 +59,8 @@
</header>

<main class="o-main">
<?php

$flash_message = Flash_Message::Singleton();
$flash_message->display();
?>
279 changes: 279 additions & 0 deletions inc/League/Plates/Engine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
<?php

namespace League\Plates;

use League\Plates\Extension\ExtensionInterface;
use League\Plates\Template\Data;
use League\Plates\Template\Directory;
use League\Plates\Template\FileExtension;
use League\Plates\Template\Folders;
use League\Plates\Template\Func;
use League\Plates\Template\Functions;
use League\Plates\Template\Name;
use League\Plates\Template\Template;

/**
* Template API and environment settings storage.
*/
class Engine
{
/**
* Default template directory.
* @var Directory
*/
protected $directory;

/**
* Template file extension.
* @var FileExtension
*/
protected $fileExtension;

/**
* Collection of template folders.
* @var Folders
*/
protected $folders;

/**
* Collection of template functions.
* @var Functions
*/
protected $functions;

/**
* Collection of preassigned template data.
* @var Data
*/
protected $data;

/**
* Create new Engine instance.
* @param string $directory
* @param string $fileExtension
*/
public function __construct($directory = null, $fileExtension = 'php')
{
$this->directory = new Directory($directory);
$this->fileExtension = new FileExtension($fileExtension);
$this->folders = new Folders();
$this->functions = new Functions();
$this->data = new Data();
}

/**
* Set path to templates directory.
* @param string|null $directory Pass null to disable the default directory.
* @return Engine
*/
public function setDirectory($directory)
{
$this->directory->set($directory);

return $this;
}

/**
* Get path to templates directory.
* @return string
*/
public function getDirectory()
{
return $this->directory->get();
}

/**
* Set the template file extension.
* @param string|null $fileExtension Pass null to manually set it.
* @return Engine
*/
public function setFileExtension($fileExtension)
{
$this->fileExtension->set($fileExtension);

return $this;
}

/**
* Get the template file extension.
* @return string
*/
public function getFileExtension()
{
return $this->fileExtension->get();
}

/**
* Add a new template folder for grouping templates under different namespaces.
* @param string $name
* @param string $directory
* @param boolean $fallback
* @return Engine
*/
public function addFolder($name, $directory, $fallback = false)
{
$this->folders->add($name, $directory, $fallback);

return $this;
}

/**
* Remove a template folder.
* @param string $name
* @return Engine
*/
public function removeFolder($name)
{
$this->folders->remove($name);

return $this;
}

/**
* Get collection of all template folders.
* @return Folders
*/
public function getFolders()
{
return $this->folders;
}

/**
* Add preassigned template data.
* @param array $data;
* @param null|string|array $templates;
* @return Engine
*/
public function addData(array $data, $templates = null)
{
$this->data->add($data, $templates);

return $this;
}

/**
* Get all preassigned template data.
* @param null|string $template;
* @return array
*/
public function getData($template = null)
{
return $this->data->get($template);
}

/**
* Register a new template function.
* @param string $name;
* @param callback $callback;
* @return Engine
*/
public function registerFunction($name, $callback)
{
$this->functions->add($name, $callback);

return $this;
}

/**
* Remove a template function.
* @param string $name;
* @return Engine
*/
public function dropFunction($name)
{
$this->functions->remove($name);

return $this;
}

/**
* Get a template function.
* @param string $name
* @return Func
*/
public function getFunction($name)
{
return $this->functions->get($name);
}

/**
* Check if a template function exists.
* @param string $name
* @return boolean
*/
public function doesFunctionExist($name)
{
return $this->functions->exists($name);
}

/**
* Load an extension.
* @param ExtensionInterface $extension
* @return Engine
*/
public function loadExtension(ExtensionInterface $extension)
{
$extension->register($this);

return $this;
}

/**
* Load multiple extensions.
* @param array $extensions
* @return Engine
*/
public function loadExtensions(array $extensions = array())
{
foreach ($extensions as $extension) {
$this->loadExtension($extension);
}

return $this;
}

/**
* Get a template path.
* @param string $name
* @return string
*/
public function path($name)
{
$name = new Name($this, $name);

return $name->getPath();
}

/**
* Check if a template exists.
* @param string $name
* @return boolean
*/
public function exists($name)
{
$name = new Name($this, $name);

return $name->doesPathExist();
}

/**
* Create a new template.
* @param string $name
* @return Template
*/
public function make($name)
{
return new Template($this, $name);
}

/**
* Create a new template and render it.
* @param string $name
* @param array $data
* @return string
*/
public function render($name, array $data = array())
{
return $this->make($name)->render($data);
}
}
Loading

0 comments on commit 5bd34ea

Please sign in to comment.