<?php

/**
 * File: index.php
 * User: zacharydubois
 * Date: 2016-01-04
 * Time: 20:47
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Create objects.
$config = new Config();
$view = new View($config);
$nav = new Nav($config);
// Create nav (Index is empty).
$nav->setActive('');
// Tell view the nav array.
$view->navArray($nav->navArray());
// Tell view what template and content.
$view->tpl('index');
$view->content(array('title' => 'Welcome | Digital Footprint Profile', 'sessionLink' => Utility::buildFullLink($config, true, 'session')));
echo $view->render();
Пример #2
0
 /**
  * Sets the template renderer.
  */
 public static function init($tpl)
 {
     self::$tpl = $tpl;
 }
<?php

/**
 * File: about.php
 * User: zacharydubois
 * Date: 2016-01-04
 * Time: 20:47
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Create objects.
$config = new Config();
$view = new View($config);
$nav = new Nav($config);
// Create nav.
$nav->setActive('about');
// Tell view the nav array.
$view->navArray($nav->navArray());
// Tell view what template and content.
$view->tpl('about');
$view->content(array('title' => 'About | Digital Footprint Profile'));
echo $view->render();
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Config
$config = new Config();
// Session
$session = new Session($config);
if ($session->getTMP('allowNext') !== true) {
    header('Location: ' . Utility::buildFullLink($config, false, 'session'));
} else {
    // View
    $nav = new Nav($config);
    $nav->setActive('list');
    $view = new View($config);
    $view->tpl('list');
    $view->navArray($nav->navArray(true));
    // Parse
    $parse = new Parse();
    // List array
    $list = array();
    $total = 0;
    $flagged = 0;
    foreach ($session->get('posts') as $post) {
        $content = preg_replace('/(\\n)/', ' ', $post['content']);
        $parse->parse($content);
        $score = $parse->score();
        $tags = $parse->tags();
        if ($score >= 3) {
            $list[] = array('url' => $post['url'], 'score' => $score, 'tags' => $tags, 'content' => $content);
            $flagged++;
<?php

/**
 * File: 404.php
 * User: zacharydubois
 * Date: 2016-01-05
 * Time: 12:06
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Create objects.
$config = new Config();
$view = new View($config);
$nav = new Nav($config);
// Tell view the nav array.
$view->navArray($nav->navArray());
// Tell view what template and content.
$view->tpl('404');
$view->content(array('title' => '404 | Digital Footprint Profile'));
header("HTTP/1.1 404 Not Found");
echo $view->render();
<?php

/**
 * File: terms.php
 * User: zacharydubois
 * Date: 2016-01-04
 * Time: 20:47
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Create objects.
$config = new Config();
$view = new View($config);
$nav = new Nav($config);
// Create nav.
$nav->setActive('terms');
// Tell view the nav array.
$view->navArray($nav->navArray());
// Tell view what template and content.
$view->tpl('terms');
$view->content(array('title' => 'Terms | Digital Footprint Profile'));
echo $view->render();
<?php

/**
 * File: privacy.php
 * User: zacharydubois
 * Date: 2016-01-04
 * Time: 20:48
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Create objects.
$config = new Config();
$view = new View($config);
$nav = new Nav($config);
// Create nav.
$nav->setActive('privacy');
// Tell view the nav array.
$view->navArray($nav->navArray());
// Tell view what template and content.
$view->tpl('privacy');
$view->content(array('title' => 'Privacy | Digital Footprint Profile'));
echo $view->render();
 * Time: 20:48
 * Project: Digital-Footprint-Profile
 */
namespace dfp;

// Create config
$config = new Config();
// Create session instance.
$session = new Session($config);
// Create Nav
$nav = new Nav($config);
$nav->setActive('session');
// Create view.
$view = new View($config);
$view->navArray($nav->navArray(true));
$view->tpl('session');
// Twitter
if ($session->getTMP('twitter_name') === false) {
    $twitter = new Twitter($config, $session);
    $twitterButton = array('url' => $twitter->authorizeURL(), 'text' => 'Login with Twitter', 'classes' => '');
} else {
    $twitterButton = array('url' => '#', 'text' => 'Twitter: @' . $session->getTMP('twitter_name'), 'classes' => 'disabled');
}
// Facebook
if ($session->getTMP('facebook_name') === false) {
    $facebook = new Facebook($config, $session);
    $facebookButton = array('url' => $facebook->authorizeURL(), 'text' => 'Login with Facebook', 'classes' => '');
} else {
    $facebookButton = array('url' => '#', 'text' => 'Facebook: ' . $session->getTMP('facebook_name'), 'classes' => 'disabled');
}
// Render and return