Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a new framework QuickSilver by extending PIP #35

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Features.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//IMPLEMENTED

MVC Architecture
SEO friendly routing
Config and overrides



//TO DO
Caching
Helpers
Package Building
Grunt
Linting
View templating
AJAX Utils
Utilities
static content grouping and minification
XSS Helpers
JS Components (scroll to view, lazy loading, popup, product carousel)
29 changes: 4 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
#PIP
=======
QuickSilver
===========

PIP is a tiny application framework built for people who use a LAMP stack. PIP aims to be as simple as possible to set up and use.
A Simple Lightweight PHP MVC Framework

Visit [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/) for more information and documentation.

## Requirements

* PHP 5.1 or greater
* MySQL 4.1.2 or greater
* The mod_rewrite Apache module

## Installation

* Download PIP and extract
* Navigate to `application/config/config.php` and fill in your `base_url`
* You are ready to rock! Point your browser to your `base_url` and hopefully see a welcome message.

## Documentation

Visit [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/) to see the documentation.

## License

PIP is released under the MIT license.

Want to say thanks? [Consider tipping me](https://www.gittip.com/gilbitron).
13 changes: 0 additions & 13 deletions application/config/config.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Main extends Controller {

function index()
{
$template = $this->loadView('main_view');
$template = $this->loadView('main');
$template->render();
}

Expand Down
36 changes: 36 additions & 0 deletions application/controllers/sample.controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

class Sample extends Controller {

function index()
{
$login = $this->loadModel('sampleModel');
$something = $login->getName();

$template = $this->loadView('sample');
$template->set('name', $something);
$template->render();
}

function home()
{
$name = $_GET['name'];

$template = $this->loadView('sample');
$template->set('name', $name);
$template->render();
}

function plugin()
{
//Loading Plugins
$this->loadPlugin('strings');

//Loading Template
$template = $this->loadView('plugin');
$template->render();
}

}

?>
6 changes: 1 addition & 5 deletions application/helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

class Url_helper {

function base_url()
{
global $config;
return $config['base_url'];
}


function segment($seg)
{
Expand Down
14 changes: 0 additions & 14 deletions application/models/example_model.php

This file was deleted.

14 changes: 14 additions & 0 deletions application/models/sampleModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

class SampleModel extends Model {

public function getName()
{

$result = "John";
return $result;
}

}

?>
57 changes: 57 additions & 0 deletions application/plugins/strings.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

function randomString($length){
$valid_chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$random_string = "";
$num_valid_chars = strlen($valid_chars);
for ($i = 0; $i < $length; $i++){
$random_pick = mt_rand(1, $num_valid_chars);
$random_char = $valid_chars[$random_pick-1];
$random_string .= $random_char;
}
return $random_string;
}
function encrypt($string, $key)
{
$result = '';
for($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key)) - 1, 1);
$char = chr(ord($char) + ord($keychar));
$result .= $char;
}
return base64_encode($result);
}

function decrypt($string, $key)
{
$result = '';
$string = base64_decode($string);
for($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key)) - 1, 1);
$char = chr(ord($char) - ord($keychar));
$result .= $char;
}
return $result;
}


function makeUrlFriendly($input)
{
$output = preg_replace("/\s+/" , "_" , trim($input));
$output = preg_replace("/\W+/" , "" , $output);
$output = preg_replace("/_/" , "-" , $output);
return strtolower($output);
}

function convertLinks($text)
{
$text = preg_replace('/(((f|ht){1}tps?:\/\/)[-a-zA-Z0-9@:;%_\+.~#?&\/\/=]+)/', '<a href="\\1" target="_blank">\\1</a>', $text);
$text = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:;%_\+.~#?&\/\/=]+)/', '\\1<a href="http://\\2" target="_blank">\\2</a>', $text);
$text = preg_replace('/(([0-9a-zA-Z\.\-\_]+)@([0-9a-zA-Z\.\-\_]+)\.([0-9a-zA-Z\.\-\_]+))/', '<a href="mailto:$1">$1</a>', $text);
return $text;
}


?>
8 changes: 8 additions & 0 deletions application/views/footer.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
<div style="min-height:4000px"> s </div>
</body>

<script type="text/javascript" src="<?php echo Config::$URL; ?>static/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo Config::$URL; ?>static/js/components/scrollToView.js"></script>
<script type="text/javascript" src="<?php echo Config::$URL; ?>static/js/components/ui.js"></script>
<script type="text/javascript">
QS.ui.goTop.init();
</script>
</html>
5 changes: 3 additions & 2 deletions application/views/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<head>
<meta charset="utf-8" />

<title>Welcome to PIP</title>
<title>QuickSilver</title>
<meta name="description" content="">
<meta name="author" content="">

<link rel="stylesheet" href="<?php echo BASE_URL; ?>static/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo Config::$URL; ?>static/css/bootstrap.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo Config::$URL; ?>static/css/style.css" type="text/css" media="screen" />
</head>
<body>
13 changes: 13 additions & 0 deletions application/views/main.view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php include('header.php'); ?>

<div id="content">

<h1>Welcome to QuickSilver</h1>
<p>
<a href="sample/" > Sample Page with data from Model </a> </p>
<a href="sample/home/?name=innocent" > Sample Page with Params </a> </p>
<a href="sample/plugin" > Sample Page calling Plugins </a> </p>

</div>

<?php include('footer.php'); ?>
10 changes: 0 additions & 10 deletions application/views/main_view.php

This file was deleted.

13 changes: 13 additions & 0 deletions application/views/plugin.view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php include('header.php'); ?>

<div id="content">

<h1>Sample page calling Plugins</h1>



Random String from Plugin: <?php $r = randomString(10); echo $r; ?>
</div>


<?php include('footer.php'); ?>
14 changes: 14 additions & 0 deletions application/views/sample.view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php include('header.php'); ?>

<div id="content">

<h1>Sample page with data from Model</h1>
<p>Sample Page</p>

Name from model: <?php echo $name; ?>


</div>


<?php include('footer.php'); ?>
49 changes: 49 additions & 0 deletions config/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

class Config {

public static $Host = 'localhost';
public static $User = 'ideasr_demoroot';
public static $Password = 'demoroot123';
public static $Database = "ideasr_schgoogle";

//URLs
public static $URL = "http://in.schoolneuron.com/";
public static $base_url = "http://in.schoolneuron.com/home/";
public static $js_url = "http://in.schoolneuron.com/home/";
public static $css_url = "http://in.schoolneuron.com/home/";
public static $images_url = "http://in.schoolneuron.com/home/";

//Defaults
public static $defaultController = "main";
public static $errorController = "error";


public static $js_files = array("jquery.min.js","bootstrap.js","app.js");
public static $utilities = array("common","debug","ui");
public static $classes = array("db","generic","user");

public static $enableLocalOverride = true;
public static $useTemplates = false;

public static $isBlocked = false;
public static $key = "neTc4JCUoerg5pyl4snmu8rgoNLd3KTTzd7Kk9Xi1p7Xo+TN4sTG3rS5uJ2c1dyexs3istTU53I";

//emails
public static $noreply_email="[email protected]";
public static $Contact_email ="[email protected],[email protected]";
public static $send_alerts_to ="[email protected],[email protected]";
public static $alerts_from ="[email protected]";


}

date_default_timezone_set('Asia/Calcutta');

$settings['title'] = ":: Schoogle | The School Community";
$settings['meta_description'] = "site description";
$settings['meta_keywords'] = "site keywords";

$settings['name'] = "Schoogle";

?>
22 changes: 22 additions & 0 deletions config/ConfigOverride.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class ConfigOverride {

public static function __override() {

Config :: $Host = 'localhost';
Config :: $User = 'root';
Config :: $Password = '123';
Config :: $Database = 'schoolneuron';

//URLs
Config :: $URL = 'http://localhost/QuickSilver/';
Config :: $js_url = 'http://localhost/QuickSilver/js/';
Config :: $css_url = 'http://localhost/QuickSilver/css/';
Config :: $images_url = 'http://localhost/QuickSilver/css/';
}


}

?>
Loading