Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin de Graaf committed Mar 23, 2016
2 parents a34a082 + 0a1654b commit d6a6a0c
Show file tree
Hide file tree
Showing 29 changed files with 270 additions and 91 deletions.
1 change: 0 additions & 1 deletion app/modules/App/Controller/Home.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* @package Fluid
* @subpackage Home controller
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
* @license MIT
* @author Robin de Graaf ([email protected])
Expand Down
1 change: 0 additions & 1 deletion app/modules/App/Model/Users.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* @package Fluid
* @subpackage Users example model
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
* @license MIT
* @author Robin de Graaf ([email protected])
Expand Down
1 change: 0 additions & 1 deletion app/modules/App/Routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* @package Fluid
* @subpackage example Routes file
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
* @license MIT
* @author Robin de Graaf ([email protected])
Expand Down
1 change: 0 additions & 1 deletion app/modules/Core/Controller/Base.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* @package Fluid
* @subpackage Base controller
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
* @license MIT
* @author Robin de Graaf ([email protected])
Expand Down
1 change: 0 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* @package Fluid
* @subpackage router
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
* @license MIT
* @author Robin de Graaf ([email protected])
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Autoloader.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Autoloader
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Cli.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Cli
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Curl.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Curl
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Database.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Database
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Date.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Date
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Debug.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Debug
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Dock.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Dock
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/GetSet.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage GetSet
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Hook.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Hook
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Log.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Log
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
113 changes: 113 additions & 0 deletions vendor/Devvoh/Components/Mailer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php
/**
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
*/

namespace Devvoh\Components;

class Mailer {

protected $to = [];
protected $from = null;
protected $subject = null;
protected $body = null;
protected $headers = [];
protected $isHTML = false;

public function setTo($to) {
if (!is_array($to)) {
$to = [$to];
}
$this->to = $to;
return $this;
}

public function getTo() {
return $this->to;
}

public function addTo($to) {
$this->to[] = $to;
return $this;
}

public function setSubject($subject) {
$this->subject = $subject;
return $this;
}

public function getSubject() {
return $this->subject;
}

public function setBody($body) {
$this->body = $body;
return $this;
}

public function getBody() {
return $this->body;
}

public function setHeaders($headers) {
if (!is_array($headers)) {
$headers = [$headers];
}
$this->headers = $headers;
return $this;
}

public function getHeaders() {
return $this->headers;
}

public function addHeader($header) {
$this->headers[] = $header;
return $this;
}

public function setFrom($from) {
$this->from = $from;
}

public function getFrom() {
return $this->from;
}

public function setHTML($active) {
$this->isHTML = (bool)$active;
}

public function isHTML() {
return $this->isHTML;
}

public function send() {
$to = $this->getTo();
if ($to) {
$to = implode(',', $this->getTo());
}
// Get From, and set Reply-To as well if it's set
// @todo add setReplyTo & getReplyTo, as well as CC/BCC
if ($this->getFrom()) {
$this->addHeader('From: ' . $this->getFrom());
$this->addHeader('Reply-To: ' . $this->getFrom());
}
if ($this->isHTML()) {
$this->addHeader('MIME-Version: 1.0');
$this->addHeader('Content-type: text/html; charset=utf-8');
}
$headers = $this->getHeaders();
if (count($headers) > 0) {
$headers = implode("\r\n", $this->getHeaders());
}
$subject = $this->getSubject();
$body = $this->getBody();

return mail($to, $subject, $body, $headers);
}

}
44 changes: 30 additions & 14 deletions vendor/Devvoh/Components/Query.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Query
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down Expand Up @@ -137,6 +135,15 @@ public function setAction($action) {
return $this;
}

/**
* Return the action
*
* @return string
*/
public function getAction() {
return $this->action;
}

/**
* In case of a select, what we're going to select (default *)
*
Expand Down Expand Up @@ -185,7 +192,7 @@ public function join($table, $condition, $value = null) {
* @return $this
*/
public function addValue($key, $value) {
$this->values[] = ['key' => $key, 'value' => $value];
$this->values[$key] = $value;
return $this;
}

Expand Down Expand Up @@ -317,8 +324,6 @@ public function __toString() {
}
}
$query[] = "WHERE " . implode(' AND ', $wheres);
} else {
$query = [];
}

} elseif ($this->action === 'update') {
Expand All @@ -333,13 +338,18 @@ public function __toString() {
$tableKeyValue = null;

$values = [];
foreach ($this->values as $value) {
foreach ($this->values as $key => $value) {
// skip id, since we'll use that as a where condition
if ($value['key'] !== $this->tableKey) {
$values[] = "'" . $value['key'] . "'=" . $this->pdoInstance->quote($value['value']);
if ($key !== $this->tableKey) {
if ($value === null) {
$correctValue = 'NULL';
} else {
$correctValue = $this->pdoInstance->quote($value);
}
$values[] = "'" . $key . "'=" . $correctValue;
} else {
$tableKey = $value['key'];
$tableKeyValue = $value['value'];
$tableKey = $key;
$tableKeyValue = $value;
}
}
$query[] = "SET " . implode(',', $values);
Expand All @@ -358,9 +368,15 @@ public function __toString() {

$keys = [];
$values = [];
foreach ($this->values as $value) {
$keys[] = "'" . $value['key'] . "'";
$values[] = $this->pdoInstance->quote($value['value']);
foreach ($this->values as $key => $value) {
$keys[] = "'" . $key . "'";

if ($value === null) {
$correctValue = 'NULL';
} else {
$correctValue = $this->pdoInstance->quote($value);
}
$values[] = $correctValue;
}

$query[] = "(" . implode(',', $keys) . ")";
Expand Down
16 changes: 13 additions & 3 deletions vendor/Devvoh/Components/Response.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Response
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down Expand Up @@ -146,6 +144,18 @@ public function setContent($content) {
return $this;
}

/**
* Send content immediately
*
* @param $content
*
* @return $this
*/
public function sendContent($content) {
echo $content;
return $this;
}

/**
* Prepend data to content
*
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Rights.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Rights
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
4 changes: 1 addition & 3 deletions vendor/Devvoh/Components/Router.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
/**
* @package Devvoh
* @subpackage Components
* @subpackage Router
* @package Devvoh Components
* @license MIT
* @author Robin de Graaf <[email protected]>
* @copyright 2015-2016, Robin de Graaf, devvoh webdevelopment
Expand Down
Loading

0 comments on commit d6a6a0c

Please sign in to comment.