Skip to content

Commit db855c0

Browse files
committed
updated documentation link
1 parent d07bcd5 commit db855c0

8 files changed

Lines changed: 43 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#### Added
44
- Added DB->choose
55
- Added DB->add
6-
- Added DB->selectFew
76
- Added Auth->login
87
- Added Auth->register
98
- Added Session->unset

Leaf/App.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @author Michael Darko <mickdd22@gmail.com>
66
* @copyright 2019-2020 Michael Darko
7-
* @link http://www.leaf-docs.netlify.com
7+
* @link http://www.leafphp.netlify.com/#/
88
* @license MIT
99
* @version 2.0.0
1010
* @package Leaf

Leaf/Http/Headers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
/**
33
* Leaf - a micro PHP 5 framework
44
*
5-
* @author Michael Darko <info@leaf-docs.netlify.com>
5+
* @author Michael Darko <info@leafphp.netlify.com/#/>
66
* @copyright 2019-2020 Michael Darko
7-
* @link http://www.leaf-docs.netlify.com
8-
* @license http://www.leaf-docs.netlify.com/license
7+
* @link http://www.leafphp.netlify.com/#/
8+
* @license http://www.leafphp.netlify.com/#/license
99
* @version 2.6.4
1010
* @package Leaf
1111
*

Leaf/Http/Session.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function __construct() {
1212
if (!isset($_SESSION['id'])) {
1313
$this->set("id", session_id());
1414
}
15-
$response = new Response;
15+
$this->response = new Response;
1616
}
1717

1818
/**
@@ -23,10 +23,10 @@ public function __construct() {
2323
* @return string, string: session variable
2424
*/
2525
public function get($param) {
26-
if (isset($_SESSION)) {
26+
if (isset($_SESSION[$param])) {
2727
return $_SESSION[$param];
2828
} else {
29-
return null;
29+
$this->response->throwErr("$param not found in session, initialise it or check your spelling");
3030
}
3131
}
3232

@@ -46,6 +46,10 @@ public function getBody() {
4646
return null;
4747
}
4848
}
49+
50+
protected function add_new_session_var($key, $value) {
51+
$_SESSION[$key] = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
52+
}
4953

5054
/**
5155
* Set a new session variable
@@ -55,11 +59,24 @@ public function getBody() {
5559
*
5660
* @return void
5761
*/
58-
public function set($key, $value) {
62+
public function set($key, $value = null) {
5963
if (!isset($_SESSION)) {
6064
session_start();
6165
}
62-
$_SESSION[$key] = $value;
66+
if (is_array($key)) {
67+
foreach ($key as $name => $val) {
68+
$this->add_new_session_var($name, $val);
69+
}
70+
} else {
71+
if ($value == null) {
72+
$this->response->throwErr('$value can\'t be null in Session set()');
73+
}
74+
$this->add_new_session_var($key, $value);
75+
}
76+
}
77+
78+
protected function unset_session_var($key) {
79+
unset($_SESSION[$key]);
6380
}
6481

6582
/**
@@ -74,7 +91,13 @@ public function unset($key) {
7491
$this->response->throwErr("There's no active session");
7592
exit();
7693
}
77-
unset($_SESSION[$key]);
94+
if (is_array($key)) {
95+
foreach ($key as $field) {
96+
$this->unset_session_var($field);
97+
}
98+
} else {
99+
$this->unset_session_var($key);
100+
}
78101
}
79102

80103
/**

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<br><br>
3-
<img src="https://leaf-docs.netlify.com/images/logo.png" height="100"/>
3+
<img src="https://leafphp.netlify.com/#/images/logo.png" height="100"/>
44
<h1 align="center">Leaf PHP Framework</h1>
55
<br>
66
<br><br><br>
@@ -54,7 +54,7 @@ $leaf->post('/users/add', function () use($leaf) {
5454
// Don't forget to call leaf run
5555
$leaf->run();
5656
```
57-
You can view the full documentation [here](https://leaf-docs.netlify.com)
57+
You can view the full documentation [here](https://leafphp.netlify.com/#/)
5858

5959
You may quickly test this using the built-in PHP server:
6060
```bash
@@ -79,4 +79,4 @@ Checkout the LeafAPI package [here](https://github.com/leafsphp/leafAPI)
7979
Of course, with this core package, you can build your app in any way that you wish to as Leaf contains all the required functionality to do so
8080

8181

82-
## View Leaf's docs [here](https://leaf-docs.netlify.com/v1.3.0)
82+
## View Leaf's docs [here](https://leafphp.netlify.com/#/v1.3.0)

app/pages/index.vein.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
</head>
5050
<body>
5151
<header>
52-
<a href="https://leaf-docs.netlify.com" style="text-decoration: none">
53-
<img src="https://leaf-docs.netlify.com/images/logo.png" alt="Leaf PHP Framework" style="width: 110px;">
52+
<a href="https://leafphp.netlify.com/#/" style="text-decoration: none">
53+
<img src="https://leafphp.netlify.com/#/images/logo.png" alt="Leaf PHP Framework" style="width: 110px;">
5454
</a>
5555
</header>
5656
<h1>
@@ -60,13 +60,13 @@
6060
</h1>
6161
<p>
6262
Congratulations! Your Leaf application is running. If this is
63-
your first time using Leaf, start with this <a href="https://leaf-docs.netlify.com/v2.0/introduction/getting-started.html" target="_blank">"Hello World" Tutorial</a>.
63+
your first time using Leaf, start with this <a href="https://leafphp.netlify.com/#/2.0/intro/first" target="_blank">"Hello World" Tutorial</a>.
6464
</p>
6565
<section>
6666
<h2>Get Started</h2>
6767
<ol>
6868
<li>The application code is in <code>index.php</code></li>
69-
<li>Read the <a href="https://leaf-docs.netlify.com/" target="_blank">docs</a></li>
69+
<li>Read the <a href="https://leafphp.netlify.com/#/" target="_blank">docs</a></li>
7070
<li>Follow <a href="http://www.twitter.com/leafphp" target="_blank">@leafphp</a> on Twitter</li>
7171
</ol>
7272
</section>
@@ -91,7 +91,7 @@
9191
<p>
9292
Other Leaf projects include Templating with Leaf Veins, Leaf MVC and Leaf API
9393
</p>
94-
<p><a href="https://leaf-docs.netlify.com/v1.5.0/projects.html" target="_blank">View other Leaf projects</a></p>
94+
<p><a href="https://leafphp.netlify.com/#/v1.5.0/projects.html" target="_blank">View other Leaf projects</a></p>
9595
</section>
9696
</body>
9797
</html>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "leafs/leaf",
33
"description": "Leaf is a PHP micro framework that helps you create clean, simple but powerful web apps and APIs quickly.",
44
"keywords": ["microframework","rest","router", "leaf", "php", "framework"],
5-
"homepage": "https://leaf-docs.netlify.com",
5+
"homepage": "https://leafphp.netlify.com/#/",
66
"type": "library",
77
"license": "MIT",
88
"authors": [

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)