|
static | setRESTAuth ($username, $password) |
|
static | getRESTAuth ($username, $password) |
|
static | getPageTemplate ($title="Default") |
|
static | autoLoad ($paths, $loadAutoLoad=true, $ignoreRequires=false) |
|
static | Message ($message) |
|
static | DEBUG () |
|
static | setREQUEST ($keyName="", $keyValue="") |
|
static | getREQUEST ($keyName="") |
|
static | getREQUEST_URI () |
|
static | requestToSESSION ($filter="") |
|
static | requestToInput ($type="hidden", $filter=null) |
|
static | getPOST_DATA () |
|
static | getOBJECT ($keyName="") |
|
static | setOBJECT ($name, $object) |
|
static | setCOOKIE ($cookieName, $value="", $minutes=60) |
|
static | getCOOKIE ($keyName="") |
|
static | getFILES ($keyName="") |
|
static | getSERVER ($keyName="") |
|
static | getPATH () |
|
static | getRequestMethod () |
|
static | getREAL_PATH () |
|
static | getDOCUMENT_ROOT () |
|
static | getLASTROUTE ($requestMethod="") |
|
static | setSESSION ($keyName="", $keyValue="") |
|
static | getSESSION ($keyName="") |
|
static | unsetSESSION ($keyName="") |
|
static | setROLE ($roleName="", $routesAllowed="", $defaultRole=false) |
|
static | authorizeRoute ($roleNames="", $routeAllowed) |
|
static | setAuthorization ($roleName="", $authDATA="", $lifeTime=30) |
|
static | delAuthorization () |
|
static | initRuth ($sessionName) |
|
static | addRoute ($requestMethod, $routePath, $routeFunction, $customParams="", $routeIgnoreTracking=false) |
|
static | addErrorRoute ($errorCode, $routePath) |
|
static | responseHeader ($errorCode=404, $message="") |
|
static | createRegEx ($routePath) |
|
static | matchRoute ($routePath, $URI) |
|
static | getParams ($routePath, $URI) |
|
static | redirect ($newPath="") |
|
static | getAuthorization ($routePath="") |
|
static | parseRoutes ($customPath="") |
|
static | scripts () |
|
static Ruth::addErrorRoute |
( |
|
$errorCode, |
|
|
|
$routePath |
|
) |
| |
|
static |
This is where you add custom routes for HTML error codes, they should be already defined via addRoute in order to work
- Parameters
-
Integer | $errorCode | A valid HTML error code |
String | $routePath | A valid route for Ruth to redirect to |
- Returns
- boolean
static Ruth::addRoute |
( |
|
$requestMethod, |
|
|
|
$routePath, |
|
|
|
$routeFunction, |
|
|
|
$customParams = "" , |
|
|
|
$routeIgnoreTracking = false |
|
) |
| |
|
static |
The Add Route Method
This method adds routes into the system based on what the user wants to use, your webserver needs to be configured correctly for this to work.
- Parameters
-
String | $requestMethod | Either GET, PUT, POST, DELETE |
String | $routePath | A path to be used as a route, eg. /user, variables can also be parsed /user/{id}/ and wildcards are * |
Closure | $routeFunction | A function which will be called with the corresponding variables |
Boolean | $routeIgnoreTracking | Ruth uses this to give you back the last route but you may not want her to remember all the paths |
- Returns
- Boolean Always returns true
static Ruth::authorizeRoute |
( |
|
$roleNames = "" , |
|
|
|
$routeAllowed |
|
) |
| |
|
static |
Dynamically allow routes to be added to a Role
- Parameters
-
string | array | $roleName | |
| $routeAllowed | |
static Ruth::autoLoad |
( |
|
$paths, |
|
|
|
$loadAutoLoad = true , |
|
|
|
$ignoreRequires = false |
|
) |
| |
|
static |
Auto Load tries to include new class requires automatically
static Ruth::createRegEx |
( |
|
$routePath | ) |
|
|
static |
Creates a regular expression
This method created a regular expression to be used for matching with the routing and security
- Parameters
-
type | $routePath | The path specified by the user |
- Returns
- String A regular expression which can be used for routing
Switch debugging on for Ruth
Turns on the debugging in Ruth showing a user how the routing is done
static Ruth::delAuthorization |
( |
| ) |
|
|
static |
Deletes the security token
The session is invalidated and the internal session variable of Ruth updated
- Returns
- Boolean Returns true if there was a non empty authToken in the session
static Ruth::getAuthorization |
( |
|
$routePath = "" | ) |
|
|
static |
static Ruth::getCOOKIE |
( |
|
$keyName = "" | ) |
|
|
static |
Getter for the cookie variables, blank keyName returns all
- Parameters
-
String | $keyName | The name of the cookie |
- Returns
- String The value of the cookie
static Ruth::getDOCUMENT_ROOT |
( |
| ) |
|
|
static |
Return the document root where the webserver is running from is running from
- Returns
- String The path to where the website is being hosted relative to the server
static Ruth::getFILES |
( |
|
$keyName = "" | ) |
|
|
static |
Getter for the file variables, blank keyName will return all
- Parameters
-
String | $keyName | The name of the file variable |
- Returns
- Object The file object that is present in the $_FILES variable
static Ruth::getLASTROUTE |
( |
|
$requestMethod = "" | ) |
|
|
static |
Gets the last route based on an option match to request method , either post or get
- Parameters
-
String | $requestMethod | GET or POST |
- Returns
- String Last route that Ruth remembers
static Ruth::getOBJECT |
( |
|
$keyName = "" | ) |
|
|
static |
Gets a particular object based on the key
- Parameters
-
String | $keyName | The name of the object |
- Returns
- Object The object that was requested
static Ruth::getPageTemplate |
( |
|
$title = "Default" | ) |
|
|
static |
The default page template for Ruth so she can make routes
- Parameters
-
type | $title | String A title to name the page by |
- Returns
- type Shape A page template with default bootstrap
static Ruth::getParams |
( |
|
$routePath, |
|
|
|
$URI |
|
) |
| |
|
static |
Get the path of the URL after the website address
- Returns
- String The path of the website after the domain name
static Ruth::getPOST_DATA |
( |
| ) |
|
|
static |
Getter for the raw post data as per php://input
static Ruth::getREAL_PATH |
( |
| ) |
|
|
static |
Get the real path to where ruth is running form
- Returns
- String return the real path
static Ruth::getREQUEST |
( |
|
$keyName = "" | ) |
|
|
static |
Getter for the stored $_REQUEST params, blank keyName returns all
- Parameters
-
String | $keyName | The name of the request variable |
- Returns
- Mixed An mixed variable of what was present for that key
static Ruth::getREQUEST_URI |
( |
| ) |
|
|
static |
static Ruth::getRequestMethod |
( |
| ) |
|
|
static |
Get the request method that was used
- Returns
- String The request method used - either POST or GET
static Ruth::getRESTAuth |
( |
|
$username, |
|
|
|
$password |
|
) |
| |
|
static |
Function to check that the authorization is correct for the user's requesting permission
- Parameters
-
String | $username | |
String | $password | |
static Ruth::getSERVER |
( |
|
$keyName = "" | ) |
|
|
static |
Getter for the Server variables
- Parameters
-
String | $keyName | The name of the variable requested |
- Returns
- String The value of the variable requested
static Ruth::getSESSION |
( |
|
$keyName = "" | ) |
|
|
static |
Get a session variable using Ruth
- Parameters
-
- Returns
- type
static Ruth::initRuth |
( |
|
$sessionName | ) |
|
|
static |
Create the session name and initialize all the system variables
This method creates a session with the name specified and sets all the internal variables it can. It also parses the URL for any get variables that may be present and puts them in the internal $REQUEST
- Parameters
-
String | $sessionName | The name of the session for the web application |
CREATE Add a specific record to the table
READ Get a specific record from a table using the primary key
UPDATE Update a specific record in the system based on its ID
PATCH Patch a specific record in the system based on its ID
DELETE Delete a specific record from a table using the primary key
LIST Get a list of records out of the database
static Ruth::matchRoute |
( |
|
$routePath, |
|
|
|
$URI |
|
) |
| |
|
static |
The method
- Parameters
-
type | $routePath | |
string | $URI | |
- Returns
- boolean
static Ruth::Message |
( |
|
$message | ) |
|
|
static |
The debugging system for the class
- Parameters
-
String | $message | A message to be sent through for debugging purposes |
static Ruth::parseRoutes |
( |
|
$customPath = "" | ) |
|
|
static |
static Ruth::redirect |
( |
|
$newPath = "" | ) |
|
|
static |
static Ruth::requestToInput |
( |
|
$type = "hidden" , |
|
|
|
$filter = null |
|
) |
| |
|
static |
- Parameters
-
String | $type,hidden,text | |
Array | $filter | List of elements not to create |
- Returns
- type
static Ruth::requestToSESSION |
( |
|
$filter = "" | ) |
|
|
static |
Function to make request variables into Session variables with a filter array of fields that shouldn't be considered
- Parameters
-
static Ruth::responseHeader |
( |
|
$errorCode = 404 , |
|
|
|
$message = "" |
|
) |
| |
|
static |
The response header
We use response header to return a valid HTTP response when something happens, included is a message or body to display with the message
- Parameters
-
String | $errorCode | A valid error code which is declared above |
String | $message | A custom message to display with the error code otherwise the default is taken. |
Some useful scripts which can be used with KIM
static Ruth::setAuthorization |
( |
|
$roleName = "" , |
|
|
|
$authDATA = "" , |
|
|
|
$lifeTime = 30 |
|
) |
| |
|
static |
The method to set authorization
Authorization works by setting an authToken in the session and an expiry time. Also the role is defined for security purposes.
- Parameters
-
String | $roleName | The naame of the Role matching declared roles |
Mixed | $authDATA | Any PHP array or object |
Integer | $lifeTime | The amount minutes |
static Ruth::setCOOKIE |
( |
|
$cookieName, |
|
|
|
$value = "" , |
|
|
|
$minutes = 60 |
|
) |
| |
|
static |
Sets the Cookie name and value for things we need to store client side
- Parameters
-
String | $cookieName | The name of the cookie |
String | $value | The value to be stored in the cookie |
String | $minutes | How many minutes until the cookie must expire |
static Ruth::setOBJECT |
( |
|
$name, |
|
|
|
$object |
|
) |
| |
|
static |
Sets the object in the Ruth system for use everywhere
- Parameters
-
String | $name | The name of the object |
Object | $object | The actual object |
static Ruth::setREQUEST |
( |
|
$keyName = "" , |
|
|
|
$keyValue = "" |
|
) |
| |
|
static |
A function to set request variables using Ruth
- Parameters
-
String | $keyName | The name of the request variable to set. |
type | $keyValue | The value stored in the request variable |
static Ruth::setRESTAuth |
( |
|
$username, |
|
|
|
$password |
|
) |
| |
|
static |
Function to add rest authorization to the rest calls which should be protected
- Parameters
-
String | $username | |
String | $password | |
static Ruth::setROLE |
( |
|
$roleName = "" , |
|
|
|
$routesAllowed = "" , |
|
|
|
$defaultRole = false |
|
) |
| |
|
static |
Set a role for Ruth to use in validating your routes that you want people to access
- Parameters
-
type | $roleName | |
type | $routesAllowed | |
type | $defaultRole | |
static Ruth::setSESSION |
( |
|
$keyName = "" , |
|
|
|
$keyValue = "" |
|
) |
| |
|
static |
A function to set session variables using Ruth
- Parameters
-
String | $keyName | The name of the sesson variable to set. |
type | $keyValue | The value stored in the session variable |
static Ruth::unsetSESSION |
( |
|
$keyName = "" | ) |
|
|
static |
Unset session variables using Ruth
- Parameters
-
String | $keyName | The name of the session variable |
- Returns
- boolean Was the resseting successful
Ruth::$restPass = "RESTMaster" |
|
static |
Ruth::$restUser = "RESTUser" |
|
static |
Ruth::$wasAJAXCall = false |
|
static |
The documentation for this class was generated from the following file: