Пример #1
0
 /**
  * Prints a view file.
  */
 public static function getView(Controller $controller)
 {
     global $data;
     $config = Config::getInstance();
     $data = $controller->getData();
     $action = $controller->action;
     $class = $controller->class;
     $head = true;
     $header = true;
     $footer = true;
     if (defined('REUSINGDUBLIN_API')) {
         $head = false;
         $header = false;
         $footer = false;
     }
     if (isset($_GET['modal'])) {
         $head = true;
         $header = false;
         $footer = true;
     }
     if ($head) {
         require_once REUSINGDUBLIN_DIR . '/view/head.php';
     }
     if ($header) {
         require_once REUSINGDUBLIN_DIR . '/view/header.php';
     }
     require_once REUSINGDUBLIN_DIR . '/view/' . lcfirst($class) . $action . '.php';
     if ($footer) {
         require_once REUSINGDUBLIN_DIR . '/view/footer.php';
     }
 }
Пример #2
0
 /**
  * Action callback.
  * Subscribe to newsletter on hompage.
  * @return Index Returns self
  */
 public function actionSubscribe()
 {
     if (isset($_GET['data'])) {
         $mail = new \PHPMailer();
         $data = $_GET['data'];
         $config = Config::getInstance()->get('admin');
         $mail->From = $data['email'];
         $mail->FromName = 'Reusing Dublin';
         $mail->Subject = 'Reusing Dublin - newsletter request';
         $mail->Body = "\n\t\t\t\tThe following Person wants to Register with Us: {$data['email']}\n\t\t\t";
         $mail->addAddress($config['email'], $config['name']);
         $mail->addReplyTo($data['email']);
         $mail->setFrom($data['email'], $data['email']);
         if (!$mail->send()) {
             echo '
                 <div class="alert alert-error">
                     <a href="#" class="close" data-dismiss="alert">&times;</a>
                     <strong>Error!</strong> A problem has been occurred while submitting your data.
                     ' . $mail->ErrorInfo . '
                 </div>';
         } else {
             echo '
                 <div class="alert alert-success">
                     <a href="#" class="close" data-dismiss="alert">&times;</a>
                     <strong>Success!</strong> Your message has been sent successfully.
                 </div>';
         }
     }
     return $this;
 }
Пример #3
0
 /**
  * Factory method.
  * Tries to return instance of db in global space, if exists
  * @return \PDO Returns a singleton PDO instance ($db).
  */
 public static function factory()
 {
     global $db;
     if (isset($db) && is_object($db) && get_class($db) == __CLASS__) {
         return $db;
     }
     $config = Config::getInstance()->get('db');
     try {
         $pdo = new \PDO("mysql:host={$config['host']};dbname={$config['name']}", $config['user'], $config['pass']);
         $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         var_dump($e);
     }
     $obj = new Model();
     return $obj->setDb($pdo);
 }
Пример #4
0
 /**
  * Parse form data for email.
  * @param string $source The source action method for email subject.
  */
 public function actionLetUsKnow($source = 'let us know')
 {
     if (isset($_POST['data'])) {
         $mail = new \PHPMailer();
         $data = $_POST['data'];
         $config = Config::getInstance()->get('admin');
         $mail->From = $data['email'];
         $mail->FromName = $data['name'];
         $mail->subject = $source . ': ' . $data['subject'];
         $mail->Body = $data['message'];
         $mail->addAddress($config['email'], $config['name']);
         if (!$mail->send()) {
             echo '
                 <div class="alert alert-error">
                     <a href="#" class="close" data-dismiss="alert">&times;</a>
                     <strong>Error!</strong> A problem has been occurred while submitting your data.
                     ' . $mail->ErrorInfo . '
                 </div>';
         } else {
             echo '
                 <div class="alert alert-success">
                     <a href="#" class="close" data-dismiss="alert">&times;</a>
                     <strong>Success!</strong> Your message has been sent successfully.
                 </div>';
         }
     }
     return $this;
 }
Пример #5
0
if (isset($data) && isset($data->title)) {
    ?>
		- <?php 
    echo $data->title;
}
?>
</title>

		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" type="text/css"/>
		<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>

		<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
		<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
		<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
		<![endif]-->

		<link rel="stylesheet" href="/assets/js/bootstrap-fileinput/css/fileinput.min.css" type="text/css"/>
		<link rel="stylesheet" href="/assets/css/reusingdublin.css" type="text/css"/>
	</head>
	<body class="<?php 
echo \ReusingDublin\Config::getInstance()->routes[0];
if (isset($_GET['modal'])) {
    echo ' view-modal';
}
?>
"
		data-spy="scroll"
		data-target="#mainNav">
Пример #6
0
<?php

/**
 * @package  ReusingDublin
 * @author daithi coombes <*****@*****.**>
 */
/**
 * boostrap
 */
require_once 'bootstrap.php';
// end bootstrap
/**
 * Routing
 */
$config = \ReusingDublin\Config::getInstance();
$query = isset($_GET['q']) ? $_GET['q'] : null;
$config->set('query', $query);
// end Routing
/**
 * Controller
 */
$controller = \ReusingDublin\Controller::factory($config->routes);
/**
 * Ajax.
 * If ajax request then controller should contain json string.
 * @see Config::setQuery() Where ajax routes are defined.
 */
if (defined('REUSINGDUBLIN_API')) {
    echo $controller->result;
    die;
}
Пример #7
0
                                <img src="/assets/images/icon_instagram.png" alt="Instagram Profile">
                            </a></li>
                            <li><a href="mailto:reusingdublin@gmail.com">
                                <img src="/assets/images/icon_email.png" alt="Email Link">
                            </a></li>
                            <li><a href="http://facebook.com/reusingdublin">
                                <img src="/assets/images/icon_facebook.png" alt="Facebook Profile">
                            </a></li>
                            <li><a href="http://twitter.com/reusingdublin">
                                <img src="/assets/images/icon_twitter.png" alt="Twitter Profile">
                            </a></li>
                        </ul>
                        <ul class="nav navbar-nav navbar-right" id="inline-links">
                            <li class="active">
                                <?php 
\ReusingDublin\Config::getInstance()->routes[0] == 'index' ? $home_link = '#welcome' : ($home_link = '/');
?>
                                <a href="<?php 
echo $home_link;
?>
">HOME</a>
                            </li>
                            <li><a href="#how-it-works">HOW IT WORKS</a></li>
                            <li><a href="#try-it-out">TRY IT OUT</a></li>
                            <li><a href="#about">ABOUT</a></li>
                            <li><a href="#mailing-list">MAILING LIST</a></li>
                        </ul>
                    </div><!-- /.navbar-collapse -->
                </div><!-- /.container-fluid -->
            </nav>
        </header>
Пример #8
0
                        Reusing Dublin is licensed under
                        <img alt="Creative Commons License" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png">
                    </a>
                </div>
            <?php 
}
?>

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
            <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
            <script type="text/javascript" src="/assets/js/bootstrap3-dialog/dist/js/bootstrap-dialog.js"></script>
            <script type="text/javascript" src="/assets/js/bootstrap-fileinput/js/fileinput.min.js"></script>
            <script type="text/javascript" src="/assets/js/nano/nano.js"></script>
            <script src="/assets/js/reusingdublin.js" type="text/javascript"></script>
            <?php 
if (\ReusingDublin\Config::getInstance()->routes[0] == 'index') {
    ?>
                <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
                <script type="text/javascript" src="/assets/js/markerclusterer.js"></script>
                <script type="text/javascript" src="/assets/js/jQuery-Autocomplete/dist/jquery.autocomplete.min.js"></script>
                <script type="text/javascript" src="/assets/js/reusingdublinGmaps.js"></script>

                <script type="text/javascript">
                    google.maps.event.addDomListener(window, 'load', function(){
                        reusingDublinMap.init();
                    });
                </script>
            <?php 
} elseif (isset($_GET['modal'])) {
    ?>
                <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>