Init Commit
This commit is contained in:
bovenliggende
6f80632004
commit
a05a9bd358
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.DS_Store
|
10
.htaccess
Normal file
10
.htaccess
Normal file
@ -0,0 +1,10 @@
|
||||
php_flag display_startup_errors on
|
||||
php_flag display_errors on
|
||||
php_flag html_errors on
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule .* index.php [L,QSA]
|
17
Gruntfile.js
Normal file
17
Gruntfile.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-php');
|
||||
|
||||
grunt.initConfig({
|
||||
php: {
|
||||
dist: {
|
||||
options: {
|
||||
keepalive: true,
|
||||
open: true,
|
||||
port: 8085
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerTask('default', ['php']);
|
||||
}
|
@ -1,2 +1,6 @@
|
||||
tm-docs
|
||||
=======
|
||||
|
||||
[Theme Options](http://bootswatch.com/)
|
||||
|
||||
[Hightlight Options](http://bootswatch.com/)
|
13
docs/00_Getting_Started.md
Normal file
13
docs/00_Getting_Started.md
Normal file
@ -0,0 +1,13 @@
|
||||
Welcome to the TodayCMS docs. This site contains documentation and examples of how to use TodayCMS, the powerful Content Management System. Here is a breakdown of what this documentation will cover.
|
||||
|
||||
## API
|
||||
The api is the server endpoint for creating, reading, updating and deleting objects from collections in the database.
|
||||
|
||||
##Config
|
||||
The config is used to define the objects in your collections in json.
|
||||
|
||||
## Editor
|
||||
The editor is an embedable tool, for creating and updating objects in a collection.
|
||||
|
||||
## PHP SDK
|
||||
The PHP SDK is a file called connector.php that makes it easier to work with the API. It contains helpers and functions that map to API calls.
|
5
docs/01_API/01_Authentication.md
Normal file
5
docs/01_API/01_Authentication.md
Normal file
@ -0,0 +1,5 @@
|
||||
All calls to the api must include a _token parameter to validate the call.
|
||||
|
||||
http://todaycms-api.herokuapp.com/?_token=XXXXXXXXXXXX
|
||||
|
||||
This guide will not include the _token in the sample calls. It is implied that it must be included.
|
31
docs/01_API/05_Example_Config.md
Normal file
31
docs/01_API/05_Example_Config.md
Normal file
@ -0,0 +1,31 @@
|
||||
The following collection config will be used as the config throughout the example calls in this guide.
|
||||
|
||||
{
|
||||
"team": {
|
||||
"title": "Team Members",
|
||||
"type": "multiple",
|
||||
"fields": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"type": "text"
|
||||
},
|
||||
"employment": {
|
||||
"title": "Employment Status",
|
||||
"type": "select",
|
||||
"options": {
|
||||
"half": "Part Time",
|
||||
"full": "Full Time",
|
||||
"retired": "Retired"
|
||||
}
|
||||
},
|
||||
"bio": {
|
||||
"title": "Bio",
|
||||
"type": "textarea"
|
||||
},
|
||||
"address": {
|
||||
"title": "Home Address",
|
||||
"type": "location"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
docs/01_API/10_Create.md
Normal file
25
docs/01_API/10_Create.md
Normal file
@ -0,0 +1,25 @@
|
||||
To create an object in a collection, issue a HTTP POST call with the object in the body of the POST.
|
||||
|
||||
POST /collections/:collection
|
||||
|
||||
**URL Parameters**
|
||||
|
||||
`:collection` is the key of the collection in the config.
|
||||
|
||||
**Example**
|
||||
|
||||
POST /collections/team
|
||||
|
||||
name = Justin
|
||||
employment = full
|
||||
bio = Node.js developer
|
||||
address[city] = Bismarck
|
||||
address[state] = ND
|
||||
address[zip] = 58501
|
||||
...
|
||||
|
||||
Note: 'team' is the key used in our example config at the top of this guide
|
||||
|
||||
**Returns**
|
||||
|
||||
The object you just created.
|
12
docs/01_API/15_Read.md
Normal file
12
docs/01_API/15_Read.md
Normal file
@ -0,0 +1,12 @@
|
||||
To read from a collection, issue a HTTP GET call
|
||||
|
||||
GET /collections/:collection
|
||||
|
||||
|
||||
**URL Parameters**
|
||||
|
||||
`:collection` is the key of the collection in the config.
|
||||
|
||||
**Returns**
|
||||
|
||||
An array of objects from the collection.
|
18
docs/01_API/20_Update.md
Normal file
18
docs/01_API/20_Update.md
Normal file
@ -0,0 +1,18 @@
|
||||
To update an object in a collection, issue a HTTP POST call with the object in the body of the POST.
|
||||
|
||||
POST /collections/:collection/:id
|
||||
|
||||
name = Justin Walsh
|
||||
employment = part
|
||||
bio = Documention writer
|
||||
...
|
||||
|
||||
**URL Parameters**
|
||||
|
||||
`:collection` is the key of the collection in the config.
|
||||
|
||||
`:id` is the id of the object you want to update.
|
||||
|
||||
**Returns**
|
||||
|
||||
The object you just updated.
|
1
docs/01_API/25_Delete.md
Normal file
1
docs/01_API/25_Delete.md
Normal file
@ -0,0 +1 @@
|
||||
Coming Soon
|
152
docs/01_API/30_Filtering.md
Normal file
152
docs/01_API/30_Filtering.md
Normal file
@ -0,0 +1,152 @@
|
||||
To filter an api call, send the optional `filter` parameter. The filter parameter is a structured json object. Examples use the following terms:
|
||||
|
||||
* field key - Is the key used to define the field in the config.
|
||||
* operator - Is the comparison to preform.
|
||||
* value - Is what we will compare the object value to.
|
||||
|
||||
## Basic Structure
|
||||
|
||||
This is the most basic filter that can be preformed.
|
||||
|
||||
{
|
||||
"field key": "value"
|
||||
}
|
||||
|
||||
*Example Call:*
|
||||
|
||||
GET /collections/team?filter={"employment":"full"}
|
||||
|
||||
This will find all full time team members in the collection.
|
||||
|
||||
## Advanced Structure
|
||||
|
||||
This structure allows more advanced control over operators used when filtering.
|
||||
|
||||
{
|
||||
"field key": {
|
||||
"operator": "value"
|
||||
}
|
||||
}
|
||||
|
||||
*Example Call:*
|
||||
|
||||
GET /collections/team?filter={"employment": {"!=": "retired"}}
|
||||
|
||||
This will find all team members who are not retired in the collection.
|
||||
|
||||
## Multiple Operators Structure
|
||||
|
||||
You can preform multiple comparision operations on the same field
|
||||
|
||||
{
|
||||
"field key": {
|
||||
"operator": "value",
|
||||
"operator2": "value2",
|
||||
"operatorx..": "valuex.."
|
||||
}
|
||||
}
|
||||
|
||||
*Example Call:*
|
||||
|
||||
GET /collections/team?filter={"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}
|
||||
|
||||
This will find all team members who's names start with 'Justin' but are not 'Justin Walsh'.
|
||||
|
||||
## Multiple Fields Structure
|
||||
|
||||
You can filter multiple fields by adding each field key to the object.
|
||||
|
||||
{
|
||||
"field key 1": "value",
|
||||
"field key 2": {
|
||||
"operator": "value"
|
||||
},
|
||||
"field key 3": {
|
||||
"operator": "value"
|
||||
}
|
||||
}
|
||||
|
||||
## Multiple Values Structure
|
||||
|
||||
When filtering, you can use an array instead of a string to match any of the values in the array.
|
||||
|
||||
{
|
||||
"employment": ["full", "part"],
|
||||
"name": {
|
||||
"LIKE": ["Justin%", "Brian%"]
|
||||
}
|
||||
}
|
||||
|
||||
This will match all team members who are full or part time, and whose names starts with 'Justin' or 'Brian'.
|
||||
|
||||
Note: `"employment": ["full", "part"]` is equvalient to
|
||||
|
||||
"employment": {
|
||||
"=": ["full", "part"]
|
||||
}
|
||||
|
||||
## Nested Fields Structure
|
||||
|
||||
You can filter by nested fields in the object using a dot notation syntax as the field key in the filter. This syntax can be used to query deep into nested objects and arrays, including fields like the 'multi'.
|
||||
|
||||
{
|
||||
"address.zip": "58501"
|
||||
}
|
||||
|
||||
This will filter the location field type by zip code, which is a nested field. This example is based on the sample config at the top of this guide.
|
||||
|
||||
## AND/OR Fields Structure (Not Supported Yet)
|
||||
|
||||
This structure allows a very customized query including both `-and` and `-or` statments.
|
||||
|
||||
{
|
||||
"field key 3": {
|
||||
"operator": "value"
|
||||
},
|
||||
"-or": {
|
||||
"field key 1": "value",
|
||||
"-and": {
|
||||
"field key 2": {
|
||||
"operator": "value"
|
||||
},
|
||||
"field key 4": {
|
||||
"operator": "value"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## Supported Operators
|
||||
|
||||
| Operator | Description |
|
||||
| :--- | :--- |
|
||||
| = | equal to |
|
||||
| != | not equal to |
|
||||
| > | greater than |
|
||||
| < | less than |
|
||||
| >= | greater than or equal to |
|
||||
| <= | less than or equal to |
|
||||
| LIKE | case sensitive search, use '%' for wildcard |
|
||||
| ILIKE | case insensitive search, use '%' for wildcard |
|
||||
| NOT LIKE | inverse of 'LIKE' |
|
||||
| NOT ILIKE | inverse of 'ILIKE' |
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
**JSON Filtering**
|
||||
|
||||
The JSON object used for the `filter` parameter must be url encoded when calling the api. Here are examples of how to url encode a json object or string in different languages.
|
||||
|
||||
***php***
|
||||
|
||||
$escaped_json = urlencode('{"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}');
|
||||
|
||||
***javascript string***
|
||||
|
||||
var escaped_json_from_string = escape('{"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}');
|
||||
|
||||
***javascript object***
|
||||
|
||||
var escaped_json_from_object = escape(JSON.stringify({"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}));
|
41
docs/05_Config/01_Parent.md
Normal file
41
docs/05_Config/01_Parent.md
Normal file
@ -0,0 +1,41 @@
|
||||
A config object that contains other objects (admin sections) and displays them in a group.
|
||||
|
||||
Parent elements are characterized by a subhead in the admin panel navigation. They also group elements in the [[Outline (call)]].
|
||||
|
||||
{
|
||||
"sample_parent": {
|
||||
"title": "Sample Parent",
|
||||
"type": "parent"
|
||||
}
|
||||
}
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Description |
|
||||
| :------------- | :------------- | :------------- |
|
||||
| title | required | Descriptive title of the object. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
||||
| type | parent | Object identifier. Required, must be set to: 'parent' |
|
||||
|
||||
### Single
|
||||
The Single object is created in the config.json file. This will create a single page that can be edited in the admin panel and displayed on the front end.
|
||||
|
||||
{
|
||||
"single-name": {
|
||||
"title": "single-title",
|
||||
"parent": "sample_parent",
|
||||
"type": "single",
|
||||
"fields": {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Description |
|
||||
| :------------- | :------------- | :------------- |
|
||||
| title | required | Descriptive title of the page. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
||||
| type | single | Object identifier. Required, must be set to: 'single.' |
|
||||
| parent | - | Defines parent container object. Allows you to group multiple objects together in the admin panel (like a folder). |
|
||||
| nav | true | Allows you to hide or show object elements in the admin panel. |
|
||||
|
20
docs/05_Config/05_Single.md
Normal file
20
docs/05_Config/05_Single.md
Normal file
@ -0,0 +1,20 @@
|
||||
The Single object is created in the config.json file. This will create a single page that can be edited in the admin panel and displayed on the front end.
|
||||
|
||||
{
|
||||
"single-name": {
|
||||
"title": "single-title",
|
||||
"parent": "sample_parent",
|
||||
"type": "single",
|
||||
"fields": {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### Parameters
|
||||
| Name | Default | Description |
|
||||
| :------------- | :------------- | :------------- |
|
||||
| title | required | Descriptive title of the page. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
||||
| type | single | Object identifier. Required, must be set to: 'single.' |
|
||||
| parent | - | Defines parent container object. Allows you to group multiple objects together in the admin panel (like a folder). |
|
||||
| nav | true | Allows you to hide or show object elements in the admin panel. |
|
45
docs/05_Config/10_Mutiple.md
Normal file
45
docs/05_Config/10_Mutiple.md
Normal file
@ -0,0 +1,45 @@
|
||||
The Multiple object is created in the 'config.json' file. This will create a group of many pages (records) that can be edited in the admin panel and displayed on the front end.
|
||||
|
||||
{
|
||||
"multiple-name": {
|
||||
"title": "multiple-title",
|
||||
"parent": "sample_parent",
|
||||
"type": "multiple",
|
||||
"fields": {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Options | Description |
|
||||
| :------------- | :------------- | :------------- | :------------- |
|
||||
| title | required | | Descriptive title of the object. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
||||
| type | multiple | | Object identifier. Required, must be set to: 'multiple.' |
|
||||
| parent | '' | | Defines parent container object. Allows you to group multiple objects together in the admin panel (like a folder). |
|
||||
| nav | true | true,false | Allows you to hide or show object elements in the admin panel. |
|
||||
| filters | '' | | Creates a select menu in the admin panel that will filter returned records. |
|
||||
| sort | '' | asc, desc | Sorts records on call. |
|
||||
| display | '' | | Defines values to display in the admin output table for each record. |
|
||||
| download | true | true,false | Enables raw data download from admin panel. (csv file) |
|
||||
| redirects | true | true,false | Enables option to create link (url) based records. |
|
||||
| publish | true | true,false | Removes ability to save individual record as draft. |
|
||||
|
||||
## Filters Example
|
||||
|
||||
{
|
||||
"filters": ["value"]
|
||||
}
|
||||
|
||||
## Sort Example
|
||||
{
|
||||
"sort":{
|
||||
"value":"asc"
|
||||
}
|
||||
}
|
||||
|
||||
## Display Example
|
||||
{
|
||||
"display":["fname", "lname", "phone", "email"]
|
||||
}
|
8
docs/05_Config/15_Fields/Colorpicker.md
Normal file
8
docs/05_Config/15_Fields/Colorpicker.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates a color picker field that will return a hex value through the API.
|
||||
|
||||
![TodayCMScolor picker](http://space.todaymade.com/todaycms/colorpicker2.jpg)
|
||||
|
||||
"color": {
|
||||
"title": "Color Picker",
|
||||
"type": "colorpicker"
|
||||
}
|
8
docs/05_Config/15_Fields/Date.md
Normal file
8
docs/05_Config/15_Fields/Date.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates a single date field with a visual calendar drop down.
|
||||
|
||||
![Todaycms date field](http://space.todaymade.com/todaycms/date.jpg)
|
||||
|
||||
"date": {
|
||||
"title": "Date Field",
|
||||
"type": "date"
|
||||
}
|
12
docs/05_Config/15_Fields/Datetime.md
Normal file
12
docs/05_Config/15_Fields/Datetime.md
Normal file
@ -0,0 +1,12 @@
|
||||
Creates a single date and time field with a visual drop down for each.
|
||||
|
||||
![todaycms date and time field](http://space.todaymade.com/todaycms/datetime.jpg)
|
||||
|
||||
"datetime": {
|
||||
"title": "Date Time Field",
|
||||
"type": "datetime"
|
||||
}
|
||||
|
||||
Returns a single date/time value.
|
||||
|
||||
[datetime] => 01/16/2012 12:00 am
|
18
docs/05_Config/15_Fields/File.md
Normal file
18
docs/05_Config/15_Fields/File.md
Normal file
@ -0,0 +1,18 @@
|
||||
Creates a single file upload field.
|
||||
|
||||
![TodayCMS File](http://space.todaymade.com/todaycms/file.jpg)
|
||||
|
||||
"file": {
|
||||
"title": "File Field",
|
||||
"type": "file"
|
||||
}
|
||||
|
||||
Returns an array.
|
||||
|
||||
[file] => Array
|
||||
(
|
||||
[caption] =>
|
||||
[date] => 11/1/2012
|
||||
[url] => http://todaycms.s3.amazonaws.com/...filename.pdf
|
||||
[name] => filename.pdf
|
||||
)
|
21
docs/05_Config/15_Fields/Files.md
Normal file
21
docs/05_Config/15_Fields/Files.md
Normal file
@ -0,0 +1,21 @@
|
||||
Creates multiple file upload fields with sort and caption options.
|
||||
|
||||
![todaycms files](http://space.todaymade.com/todaycms/files.jpg)
|
||||
|
||||
"files": {
|
||||
"title": "Files Field",
|
||||
"type": "files"
|
||||
}
|
||||
|
||||
Returns a multidimensional array.
|
||||
|
||||
[files] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[caption] => Pre-Order Form
|
||||
[date] => 2/13/2012
|
||||
[url] => http://todaycms.s3.amazonaws.com/...filename.pdf
|
||||
[name] => Author Visit - Beth McKinney.pdf
|
||||
)
|
||||
)
|
28
docs/05_Config/15_Fields/Form.md
Normal file
28
docs/05_Config/15_Fields/Form.md
Normal file
@ -0,0 +1,28 @@
|
||||
Creates an instance of the TodayCMS FormBuilder. This will allow end users to create complex forms with a variety of options for data collection and submission.
|
||||
|
||||
![TodayCMS Formbuilder](http://space.todaymade.com/todaycms/formbuilder.jpg)
|
||||
|
||||
"form": {
|
||||
"title": "Form Builder",
|
||||
"type": "formbuilder"
|
||||
}
|
||||
|
||||
**Available Fields**
|
||||
|
||||
* Single Line Text
|
||||
* Multiple Line Text
|
||||
* Dropdown Select
|
||||
* Checkbox Options
|
||||
* Multiple Choice (Radio Buttons)
|
||||
* Phone
|
||||
* Email
|
||||
|
||||
**Form Actions**
|
||||
|
||||
* Redirect to another page
|
||||
* Display a message
|
||||
* Send to Paypal
|
||||
|
||||
**Returns**
|
||||
|
||||
See the [[Formbuilder (helper)]]
|
40
docs/05_Config/15_Fields/Hidden.md
Normal file
40
docs/05_Config/15_Fields/Hidden.md
Normal file
@ -0,0 +1,40 @@
|
||||
Creates a hidden form field.
|
||||
|
||||
"hidden": {
|
||||
"title": "Hidden Field",
|
||||
"type": "hidden",
|
||||
}
|
||||
|
||||
"hidden-forced-value": {
|
||||
"title": "Hidden Forced Value Field",
|
||||
"type": "hidden",
|
||||
"value": "Forced Value"
|
||||
}
|
||||
|
||||
"hidden-default-value": {
|
||||
"title": "Hidden Default Value Field",
|
||||
"type": "hidden",
|
||||
"default": "Default Value"
|
||||
}
|
||||
|
||||
"hidden-timestamp-value": {
|
||||
"title": "Hidden Timestamp Value Field",
|
||||
"type": "hidden",
|
||||
"default": "timestamp"
|
||||
}
|
||||
|
||||
"hidden-display-value": {
|
||||
"title": "Hidden Display Field",
|
||||
"type": "hidden",
|
||||
"value": "You should see this",
|
||||
"display": true
|
||||
}
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Options | Description |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| default | '' | string, timestamp | Sets a default value for the hidden field. Timestamp will display current date/time. |
|
||||
| display | false | true,false | Can see the value but can't change it |
|
||||
| auto_increment | false | true, false | Creates unique id starting with 1. |
|
53
docs/05_Config/15_Fields/Image.md
Normal file
53
docs/05_Config/15_Fields/Image.md
Normal file
@ -0,0 +1,53 @@
|
||||
Creates a single image upload field.
|
||||
|
||||
![image](http://space.todaymade.com/todaycms/image-field.jpg)
|
||||
|
||||
"image": {
|
||||
"title": "Image Field",
|
||||
"type": "image",
|
||||
"sizes": {
|
||||
"thumb": {
|
||||
"height": 150,
|
||||
"width": 150,
|
||||
"resize_strategy": "crop"
|
||||
},
|
||||
"large": {
|
||||
"height": 500,
|
||||
"width": 500,
|
||||
"resize_strategy": "fit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image fields allows you to determine multiple thumbnail/image sizes and cropping techniques.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| width | 1-5000 | Width of the input image | Width of the new image, in pixels |
|
||||
| height | 1-5000 | Height of the input image | Height of the new image, in pixels |
|
||||
| strip | boolean | false | Strips all metadata from the image. This is useful to keep thumbnails as small as possible. |
|
||||
| flatten | boolean | true | Flattens all layers onto the specified background to achive better results from transparent formats to non-transparent formats, as explained in the [ImageMagick](http://www.imagemagick.org/script/command-line-options.php?#layers) documentation. **Important:** To preserve animations, GIF files are not flattened when this is set to true. To flatten GIF animations, use the frame parameter. |
|
||||
| correct_gamma | boolean | false | Prevents gamma errors [common in many image scaling algorithms](http://www.4p8.com/eric.brasseur/gamma.html). |
|
||||
| quality | 1-100 | Quality of the input image, or 92 | Controls the image compression for JPG and PNG images. |
|
||||
| background | string | "#FFFFFF" | Either the hexadecimal code or [name](http://www.imagemagick.org/script/color.php#color_names) of the color used to fill the background (only used for the pad resize strategy). **Important:** By default, the background of transparent images is changed to white. For details about how to preserve transparency across all image types, see [this demo](https://transloadit.com/demos/image-resize/properly-preserve-transparency-across-all-image-types). |
|
||||
| resize_strategy | string | "fit" | See [[Resize Strategies Table]] |
|
||||
| zoom | boolean | true | If this is set to false, smaller images will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the [[Resize Strategies Table]]. |
|
||||
| crop | { x1: integer, y1: integer, x2: integer, y2: integer } | {} | Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). For example, `{x1: 80, y1: 100, x2: 160, y2: 180}` will crop the area from `(80,100)` to `(160,180)` which is a square whose width and height are 80px. If crop is set, the width and height parameters are ignored, and the resize_strategy is set to crop automatically. |
|
||||
| format | string | Format of the input image | The available formats are `"jpg"`, `"png"`, `"gif"`, and `"tiff"`. |
|
||||
| gravity | string | center | The direction from which the image is to be cropped. The available options are `"center"`, `"top"`, `"bottom"`, `"left"`, and `"right"`. You can also combine options with a hyphen, such as `"bottom-right"`. |
|
||||
| frame | integer | null (all frames) | Use this parameter when dealing with animated GIF files to specify which frame of the GIF is used for the operation. Specify 1 to use the first frame, 2 to use the second, and so on. |
|
||||
| colorspace | string | " " | Sets the image colorspace. For details about the available values, see the [ImageMagick documentation](http://www.imagemagick.org/script/command-line-options.php#colorspace). |
|
||||
| rotation | string / boolean / integer | true | Determines whether the image should be rotated. Set this to true to auto-rotate images that are misrotated, or depend on EXIF rotation settings. You can also set this to an integer to specify the rotation in degrees. You can also specify degrees> to rotate only when the image width exceeds the height (or degrees< if the width must be less than the height). Specify false to disable auto-fixing of misrotated images. |
|
||||
| compress | string | null | Specifies pixel compression for when the image is written. Valid values are None, `"BZip"`, `"Fax"`, `"Group4"`, `"JPEG"`, `"JPEG2000"`, `"Lossless"`, `"LZW"`, `"RLE"`, and `"Zip"`. Compression is disabled by default. |
|
||||
| blur | string | null | Specifies gaussian blur, using a value with the form `{radius}x{sigma}`. The radius value specifies the size of area the operator should look at when spreading pixels, and should typically be either `"0"` or at least two times the sigma value. The sigma value is an approximation of how many pixels the image is "spread"; think of it as the size of the brush used to blur the image. This number is a floating point value, enabling small values like `"0.5"` to be used. For details about how the radius and sigma values affect blurring, see [this example](http://www.imagemagick.org/Usage/blur/blur_montage.jpg). |
|
||||
|
||||
**Watermark Parameters**
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| watermark_url | string | " " | A url indicating a PNG image to be overlaid above this image. |
|
||||
| watermark_position | string/array | "center" | The position at which the watermark is placed. The available options are `"center"`, `"top"`, `"bottom"`, `"left"`, and `"right"`. You can also combine options, such as `"bottom-right"`. An array of possible values can also be specified, in which case one value will be selected at random, such as `["center","left","bottom-left","bottom-right"]`. _Note that this setting puts the watermark in the specified corner. To use a specific pixel offset for the watermark, you will need to add the padding to the image itself._ |
|
||||
| watermark_size | string | "" | The size of the watermark, as a percentage. For example, a value of `"50%"` means that size of the watermark will be 50% of the size of image on which it is placed. |
|
||||
| watermark_resize_strategy | string | "fit" | Available values are `"fit"` and `"stretch"`. |
|
24
docs/05_Config/15_Fields/Images.md
Normal file
24
docs/05_Config/15_Fields/Images.md
Normal file
@ -0,0 +1,24 @@
|
||||
Creates a multi image upload field. Useful for a gallery or rotating image.
|
||||
|
||||
![images](http://space.todaymade.com/todaycms/images.jpeg)
|
||||
|
||||
"images": {
|
||||
"title": "Images Field",
|
||||
"type": "images",
|
||||
"sizes": {
|
||||
"thumb": {
|
||||
"height": 150,
|
||||
"width": 150,
|
||||
"resize_strategy": "crop"
|
||||
},
|
||||
"large": {
|
||||
"height": 500,
|
||||
"width": 500,
|
||||
"resize_strategy": "crop"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
See [parameters table](https://github.com/justinwalsh/todaycms/wiki/Image).
|
||||
|
||||
See [resize strategies table](https://github.com/justinwalsh/todaycms/wiki/Resize-Strategies-Table).
|
8
docs/05_Config/15_Fields/Markitup.md
Normal file
8
docs/05_Config/15_Fields/Markitup.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates an instance of the markItUp! universal markup editor. Editor allows easy access to HTML editing.
|
||||
|
||||
![MarkItUp! editor](http://space.todaymade.com/todaycms/markitup.jpeg)
|
||||
|
||||
"markitup": {
|
||||
"title":"Markitup",
|
||||
"type":"markitup"
|
||||
}
|
19
docs/05_Config/15_Fields/Multi.md
Normal file
19
docs/05_Config/15_Fields/Multi.md
Normal file
@ -0,0 +1,19 @@
|
||||
Creates a repeatable object that can utilize all TodayCMS field types.
|
||||
|
||||
![Multi Field](http://space.todaymade.com/todaycms/multi.jpeg)
|
||||
|
||||
"multi": {
|
||||
"title": "Multi Field",
|
||||
"display": "title",
|
||||
"type": "multi",
|
||||
"fields": {
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Options | Description |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| display | '' | | Field name to use as the identifier in the title cell. |
|
45
docs/05_Config/15_Fields/Multiselect.md
Normal file
45
docs/05_Config/15_Fields/Multiselect.md
Normal file
@ -0,0 +1,45 @@
|
||||
Creates a form field type that allows the selection of one or more items from a dropdown list.
|
||||
|
||||
![multi select static](http://space.todaymade.com/todaycms/multi-select-static.jpg)
|
||||
|
||||
### Static Options
|
||||
Displays a static list of options.
|
||||
|
||||
"multiselect": {
|
||||
"title": "Multi Select - Static",
|
||||
"type": "multiselect",
|
||||
"options": {
|
||||
"value": "Display Name",
|
||||
"value2": "Display Name 2"
|
||||
}
|
||||
}
|
||||
|
||||
### Reference Options
|
||||
Displays the records from another object in the config. This is commonly used to create multiple relational data associations.
|
||||
|
||||
"referenced-object": {
|
||||
"title": "Referenced Object",
|
||||
"type": "multiple",
|
||||
"fields": {
|
||||
"name": {
|
||||
"title": "Record Name",
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"multiselect": {
|
||||
"title": "Multi Select - Reference",
|
||||
"type": "multiselect",
|
||||
"options": "referenced-object",
|
||||
"display": "name"
|
||||
}
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Options | Description |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| options | '' | | A list of values (object), or reference name for another object in the config. |
|
||||
| display | '' | | Field name to use as the identifier in the dropdown select |
|
||||
|
||||
See also [[Select]].
|
8
docs/05_Config/15_Fields/Password.md
Normal file
8
docs/05_Config/15_Fields/Password.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates a password form field.
|
||||
|
||||
![password](http://space.todaymade.com/todaycms/password.jpg)
|
||||
|
||||
"password": {
|
||||
"title": "Password Field",
|
||||
"type": "password"
|
||||
}
|
49
docs/05_Config/15_Fields/Select.md
Normal file
49
docs/05_Config/15_Fields/Select.md
Normal file
@ -0,0 +1,49 @@
|
||||
Creates a form field type that allows the selection of a single item from a dropdown list.
|
||||
|
||||
![static field](http://space.todaymade.com/todaycms/select.jpg)
|
||||
|
||||
### Static Options
|
||||
Displays a static list of options.
|
||||
|
||||
"select": {
|
||||
"title": "Select Field - Static Options",
|
||||
"type": "select",
|
||||
"options": {
|
||||
"value1": "Display Name One",
|
||||
"value2": "Display Name Two",
|
||||
"value3": "Display Name Three"
|
||||
}
|
||||
}
|
||||
|
||||
### Reference Options
|
||||
Displays a list of the records from another object in the config. This is commonly used to create relational data association. For example, a list of categories or a grouping.
|
||||
|
||||
"referenced-object": {
|
||||
"title": "Referenced Object",
|
||||
"type": "multiple",
|
||||
"fields": {
|
||||
"name": {
|
||||
"title": "Record Name",
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"select-reference": {
|
||||
"title": "Select Field - Reference",
|
||||
"type": "select",
|
||||
"options": "referenced-object",
|
||||
"display": "name"
|
||||
}
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Default | Options | Description |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| options | '' | | A list of values (object), or reference name for another object in the config. |
|
||||
| display | '' | | Field name to use as the identifier in the dropdown select |
|
||||
| blank | '' | string | String uses for the default dropdown select option. Value is set to null. |
|
||||
| hidden | false | true, false | Hides the select menu and passes a value through as a hidden field. |
|
||||
| value | | | Sets a default value. |
|
||||
|
||||
See also [[Multiselect]].
|
8
docs/05_Config/15_Fields/Text.md
Normal file
8
docs/05_Config/15_Fields/Text.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates a text form field.
|
||||
|
||||
![text ](http://space.todaymade.com/todaycms/text.jpg)
|
||||
|
||||
"text": {
|
||||
"title": "Text Field",
|
||||
"type": "text"
|
||||
}
|
8
docs/05_Config/15_Fields/Textarea.md
Normal file
8
docs/05_Config/15_Fields/Textarea.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates a textarea form field.
|
||||
|
||||
![Textarea](http://space.todaymade.com/todaycms/textarea.jpg)
|
||||
|
||||
"textarea": {
|
||||
"title": "Wysiwyg Field",
|
||||
"type": "textarea"
|
||||
}
|
8
docs/05_Config/15_Fields/Wysiwyg.md
Normal file
8
docs/05_Config/15_Fields/Wysiwyg.md
Normal file
@ -0,0 +1,8 @@
|
||||
Creates a WYSIWYG textarea form field.
|
||||
|
||||
![WYSIWYG](http://space.todaymade.com/todaycms/wysiwyg.jpg)
|
||||
|
||||
"wysiwyg": {
|
||||
"title": "Wysiwyg Field",
|
||||
"type": "wysiwyg"
|
||||
}
|
12
docs/10_Editor/01_Install.md
Normal file
12
docs/10_Editor/01_Install.md
Normal file
@ -0,0 +1,12 @@
|
||||
To create an editor on a page use the following code
|
||||
|
||||
<div id="cms-editor"></div>
|
||||
<script type="text/javascript" src="dist/js/todaycms.js"></script>
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings"
|
||||
});
|
||||
</script>
|
||||
|
||||
***Required***: 'apikey' and 'collection' are required parameters for the editor to load.
|
99
docs/10_Editor/05_Setup.md
Normal file
99
docs/10_Editor/05_Setup.md
Normal file
@ -0,0 +1,99 @@
|
||||
There are several customizations that can be made to the 'cms_setup' function.
|
||||
|
||||
##id
|
||||
Used to update an existing record.
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
id: 12345
|
||||
});
|
||||
</script>
|
||||
|
||||
##config
|
||||
Overrides the collections configuration for only this editor.
|
||||
|
||||
In this example we are changing the visibility of the account field:
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
config: {
|
||||
fields: {
|
||||
account: {
|
||||
hidden:true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
##data
|
||||
Overrides the data for this object
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
data: {
|
||||
account: 12345
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
##before_save
|
||||
Function that is called before the object is saved to the api. It recieves a complete json copy of the object. Use this to make any modifications to the object before it is saved. If you return false, the save will be canceled, this is usefully for valdation errors.
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
before_save: function(object) {
|
||||
if (object.first_name === '') {
|
||||
alert('Please enter a first name.');
|
||||
return false;
|
||||
} else {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
##after_save
|
||||
Function that is called after the object has been saved. It recieves a complete json copy of the object that was just saved to the database.
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
after_save: function(object) {
|
||||
window.location = "/account/listings/" + object.id;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
##bootstrap
|
||||
Enable or disable the bootstrap css. Useful if bootstrap has already been loaded on the page.
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
bootstrap: false
|
||||
});
|
||||
</script>
|
||||
|
||||
##theme
|
||||
Sets the theme. Availible themes: light or dark. The light theme is the default. Use false to disable the theme css.
|
||||
|
||||
<script type='text/javascript'>
|
||||
cms_setup({
|
||||
apikey: '7DdPrtGp9ZhKmk',
|
||||
collection: "listings",
|
||||
theme: false,
|
||||
// or
|
||||
// theme: 'dark'
|
||||
});
|
||||
</script>
|
3
docs/15_SDK/05_PHP/01_Getting_Started.md
Normal file
3
docs/15_SDK/05_PHP/01_Getting_Started.md
Normal file
@ -0,0 +1,3 @@
|
||||
The PHP SDK is a file called `connector.php` that makes it easier to work with the API. It contains helpers and functions that map to API calls.
|
||||
|
||||
Receive your unique API key details from [Todaymade] (http://todaymade.com/contact).
|
10
docs/15_SDK/05_PHP/05_Setup.md
Normal file
10
docs/15_SDK/05_PHP/05_Setup.md
Normal file
@ -0,0 +1,10 @@
|
||||
Create (or add) the 'config.json' and 'connector.php' files to the root of your website.
|
||||
|
||||
The connector.php file is the root of the CMS's power. To create a connection to the API server, include the connector.php file and create an instance of the Todaycms class using php.
|
||||
|
||||
```php
|
||||
<?php include($_SERVER["DOCUMENT_ROOT"]."/connector.php");
|
||||
$cms = new Todaycms('API_KEY_HERE'); ?>
|
||||
```
|
||||
|
||||
The $cms variable is now availible to start making calls to the api
|
3
docs/15_SDK/05_PHP/20_Debugging.md
Normal file
3
docs/15_SDK/05_PHP/20_Debugging.md
Normal file
@ -0,0 +1,3 @@
|
||||
To debug your api calls and to find out what data is available to your page. Add '?debug' to the ending of any url.
|
||||
|
||||
http://yourdomain.com?debug
|
9
docs/15_SDK/05_PHP/25_Methods/00_Config.md
Normal file
9
docs/15_SDK/05_PHP/25_Methods/00_Config.md
Normal file
@ -0,0 +1,9 @@
|
||||
Returns the config object that is assosicated with the current API key.
|
||||
|
||||
To retreive the config simply use the $cms variable:
|
||||
|
||||
$config = $cms->config();
|
||||
|
||||
You can also filter your config to a specific collection.
|
||||
|
||||
$team_config = $cms->config("team");
|
13
docs/15_SDK/05_PHP/25_Methods/01_Single.md
Normal file
13
docs/15_SDK/05_PHP/25_Methods/01_Single.md
Normal file
@ -0,0 +1,13 @@
|
||||
Single is the heart of any website. It represents a single record in the CMS system.
|
||||
|
||||
To make a call to the api simply use the $cms variable:
|
||||
|
||||
$page = $cms->key("OBJECT-NAME")->single();
|
||||
|
||||
Call a single record by ID
|
||||
|
||||
$cms->key(1234)->single();
|
||||
|
||||
Call a single record by slug
|
||||
|
||||
$cms->parent(key)->slug(about-us)->single();
|
9
docs/15_SDK/05_PHP/25_Methods/05_Multiple.md
Normal file
9
docs/15_SDK/05_PHP/25_Methods/05_Multiple.md
Normal file
@ -0,0 +1,9 @@
|
||||
Multiple objects represent a group of records in the CMS system.
|
||||
|
||||
To make a call to the api simply use the $cms variable:
|
||||
|
||||
$pages = $cms->key("OBJECT-NAME")->multiple();
|
||||
|
||||
You can also filter your results base field name.
|
||||
|
||||
$pages = $cms->key("OBJECT-NAME")->filter(FIELD-NAME, FIELD-VALUE)->multiple();
|
10
docs/15_SDK/05_PHP/25_Methods/10_Formbuilder.md
Normal file
10
docs/15_SDK/05_PHP/25_Methods/10_Formbuilder.md
Normal file
@ -0,0 +1,10 @@
|
||||
This helper was added to the connector.php file, version 2.*. It is designed to display a fully-functioning AJAX web form with validation built in.
|
||||
|
||||
```php
|
||||
<? if (isset($page['fields']['form'])) {
|
||||
$cms->formbuilder($page['fields']['form'], $page);
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
Returns: HTML/JS
|
6
docs/config.json
Normal file
6
docs/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"title": "TodayCMS Documentation",
|
||||
"homepage": "/Getting_Started",
|
||||
"theme": "simplex",
|
||||
"hightlight": "dark"
|
||||
}
|
105
index.php
Normal file
105
index.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
require_once('libs/functions.php');
|
||||
$options = get_options();
|
||||
$tree = get_tree("docs");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Bootstrap -->
|
||||
<link rel="stylesheet" href="/libs/themes/<?=$options['theme'];?>.css">
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.columns {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.content-area, .article-tree {
|
||||
overflow:auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
li ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
li.open > ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
a.folder {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom:0;
|
||||
left: 0;
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- hightlight.js -->
|
||||
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.3/styles/<?=$options['hightlight'];?>.min.css">
|
||||
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
<!-- Navigation -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
|
||||
<script type='text/javascript'>
|
||||
$(function() {
|
||||
$('.aj-nav').click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).parent().siblings().find('ul').slideUp();
|
||||
$(this).next().slideToggle();
|
||||
// $(this).parent().siblings().removeClass('open');
|
||||
// $(this).parent().addClass('open');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid wrapper">
|
||||
<div class="navbar navbar-static-top">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand" href="/"><?=$options['title']; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid columns content">
|
||||
<div class="span2 article-tree">
|
||||
<? echo build_nav($tree); ?>
|
||||
<div class="footer">Generate by <a href="https://github.com/justinwalsh/tm-docs">TM-Docs</a></div>
|
||||
</div>
|
||||
<div class="span10 content-area">
|
||||
<? echo load_page($tree); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
179
libs/functions.php
Normal file
179
libs/functions.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?
|
||||
require_once('libs/markdown_extended.php');
|
||||
|
||||
function get_options() {
|
||||
$options = array(
|
||||
'title' => "Documentation",
|
||||
'homepage' => false,
|
||||
'theme' => 'spacelab',
|
||||
'hightlight' => 'github'
|
||||
);
|
||||
|
||||
// Load User Config
|
||||
$config_file = './docs/config.json';
|
||||
if (file_exists($config_file)) {
|
||||
$config = json_decode(file_get_contents($config_file), true);
|
||||
$options = array_merge($options, $config);
|
||||
}
|
||||
|
||||
// Homepage Redirect?
|
||||
$path = url_path();
|
||||
if ($path === '/') {
|
||||
// Custom Homepage?
|
||||
if ($options['homepage']) {
|
||||
header('Location: '.$options['homepage']);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function load_page($tree) {
|
||||
$branch = find_branch($tree);
|
||||
|
||||
if (isset($branch['type']) && $branch['type'] == 'file') {
|
||||
$html = '<h1>'. $branch['title'] . '</h1>';
|
||||
$html .= MarkdownExtended(file_get_contents($branch['path']));
|
||||
return $html;
|
||||
} else {
|
||||
return "Oh No. That page dosn't exist";
|
||||
}
|
||||
}
|
||||
|
||||
function find_branch($tree) {
|
||||
$path = url_params();
|
||||
foreach($path as $peice) {
|
||||
if (isset($tree[$peice])) {
|
||||
if ($tree[$peice]['type'] == 'folder') {
|
||||
$tree = $tree[$peice]['tree'];
|
||||
} else {
|
||||
$tree = $tree[$peice];
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $tree;
|
||||
}
|
||||
|
||||
function url_path() {
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$url = $url['path'];
|
||||
return $url;
|
||||
}
|
||||
|
||||
function url_params() {
|
||||
$url = url_path();
|
||||
$params = explode('/', trim($url, '/'));
|
||||
return $params;
|
||||
}
|
||||
|
||||
function clean_sort($text) {
|
||||
// Remove .md file extension
|
||||
$text = str_replace('.md', '', $text);
|
||||
|
||||
// Remove sort placeholder
|
||||
$parts = explode('_', $text);
|
||||
if (isset($parts[0]) && is_numeric($parts[0])) {
|
||||
unset($parts[0]);
|
||||
}
|
||||
$text = implode('_', $parts);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function clean_name($text) {
|
||||
$text = str_replace('_', ' ', $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
function build_nav($tree, $url_params = false) {
|
||||
if (!is_array($url_params)) {
|
||||
$url_params = url_params();
|
||||
}
|
||||
$url_path = url_path();
|
||||
$html = '<ul class="nav nav-list">';
|
||||
foreach($tree as $key => $val) {
|
||||
// Active Tree Node
|
||||
if (isset($url_params[0]) && $url_params[0] == $val['clean']) {
|
||||
array_shift($url_params);
|
||||
|
||||
// Final Node
|
||||
if ($url_path == $val['url']) {
|
||||
$html .= '<li class="active">';
|
||||
} else {
|
||||
$html .= '<li class="open">';
|
||||
}
|
||||
} else {
|
||||
$html .= '<li>';
|
||||
}
|
||||
|
||||
if ($val['type'] == 'folder') {
|
||||
$html .= '<a href="#" class="aj-nav folder">'.$val['name'].'</a>';
|
||||
$html .= build_nav($val['tree'], $url_params);
|
||||
} else {
|
||||
$html .= '<a href="'.$val['url'].'">'.$val['name'].'</a>';
|
||||
}
|
||||
|
||||
$html .= '</li>';
|
||||
}
|
||||
$html .= '</ul>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
function get_tree($path = '.', $clean_path = '', $title = ''){
|
||||
$tree = array();
|
||||
$ignore = array('config.json', 'cgi-bin', '.', '..');
|
||||
$dh = @opendir($path);
|
||||
$index = 0;
|
||||
|
||||
// Loop through the directory
|
||||
while(false !== ($file = readdir($dh))){
|
||||
|
||||
// Check that this file is not to be ignored
|
||||
if(!in_array($file, $ignore)) {
|
||||
$full_path = "$path/$file";
|
||||
$clean_sort = clean_sort($file);
|
||||
$url = $clean_path . '/' . $clean_sort;
|
||||
$clean_name = clean_name($clean_sort);
|
||||
|
||||
// Title
|
||||
if (empty($title)) {
|
||||
$full_title = $clean_name;
|
||||
} else {
|
||||
$full_title = $title . ': ' . $clean_name;
|
||||
}
|
||||
|
||||
if(is_dir("$path/$file")) {
|
||||
// Directory
|
||||
$tree[$clean_sort] = array(
|
||||
'type' => 'folder',
|
||||
'name' => $clean_name,
|
||||
'title' => $full_title,
|
||||
'path' => $full_path,
|
||||
'clean' => $clean_sort,
|
||||
'url' => $url,
|
||||
'tree'=> get_tree($full_path, $url, $full_title)
|
||||
);
|
||||
} else {
|
||||
// File
|
||||
$tree[$clean_sort] = array(
|
||||
'type' => 'file',
|
||||
'name' => $clean_name,
|
||||
'title' => $full_title,
|
||||
'path' => $full_path,
|
||||
'clean' => $clean_sort,
|
||||
'url' => $url,
|
||||
);
|
||||
}
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
|
||||
// Close the directory handle
|
||||
closedir($dh);
|
||||
|
||||
return $tree;
|
||||
}
|
||||
?>
|
2932
libs/markdown.php
Executable file
2932
libs/markdown.php
Executable file
Diff onderdrukt omdat het te groot bestand
Laad Diff
161
libs/markdown_extended.php
Executable file
161
libs/markdown_extended.php
Executable file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
require_once('markdown.php');
|
||||
define( 'MARKDOWNEXTRAEXTENDED_VERSION', "0.3" );
|
||||
|
||||
function MarkdownExtended($text, $default_claases = array()){
|
||||
$parser = new MarkdownExtraExtended_Parser($default_claases);
|
||||
return $parser->transform($text);
|
||||
}
|
||||
|
||||
class MarkdownExtraExtended_Parser extends MarkdownExtra_Parser {
|
||||
# Tags that are always treated as block tags:
|
||||
var $block_tags_re = 'figure|figcaption|p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend';
|
||||
var $default_classes;
|
||||
|
||||
function MarkdownExtraExtended_Parser($default_classes = array()) {
|
||||
$default_classes = $default_classes;
|
||||
|
||||
$this->block_gamut += array(
|
||||
"doFencedFigures" => 7,
|
||||
);
|
||||
|
||||
parent::MarkdownExtra_Parser();
|
||||
}
|
||||
|
||||
function transform($text) {
|
||||
$text = parent::transform($text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
function doHardBreaks($text) {
|
||||
# Do hard breaks:
|
||||
# EXTENDED: changed to allow breaks without two spaces and just one new line
|
||||
# original code /* return preg_replace_callback('/ {2,}\n/', */
|
||||
return preg_replace_callback('/ *\n/',
|
||||
array(&$this, '_doHardBreaks_callback'), $text);
|
||||
}
|
||||
|
||||
|
||||
function doBlockQuotes($text) {
|
||||
$text = preg_replace_callback('/
|
||||
(?>^[ ]*>[ ]?
|
||||
(?:\((.+?)\))?
|
||||
[ ]*(.+\n(?:.+\n)*)
|
||||
)+
|
||||
/xm',
|
||||
array(&$this, '_doBlockQuotes_callback'), $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function _doBlockQuotes_callback($matches) {
|
||||
$cite = $matches[1];
|
||||
$bq = '> ' . $matches[2];
|
||||
# trim one level of quoting - trim whitespace-only lines
|
||||
$bq = preg_replace('/^[ ]*>[ ]?|^[ ]+$/m', '', $bq);
|
||||
$bq = $this->runBlockGamut($bq); # recurse
|
||||
|
||||
$bq = preg_replace('/^/m', " ", $bq);
|
||||
# These leading spaces cause problem with <pre> content,
|
||||
# so we need to fix that:
|
||||
$bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
|
||||
array(&$this, '_doBlockQuotes_callback2'), $bq);
|
||||
|
||||
$res = "<blockquote";
|
||||
$res .= empty($cite) ? ">" : " cite=\"$cite\">";
|
||||
$res .= "\n$bq\n</blockquote>";
|
||||
return "\n". $this->hashBlock($res)."\n\n";
|
||||
}
|
||||
|
||||
function doFencedCodeBlocks($text) {
|
||||
$less_than_tab = $this->tab_width;
|
||||
|
||||
$text = preg_replace_callback('{
|
||||
(?:\n|\A)
|
||||
# 1: Opening marker
|
||||
(
|
||||
~{3,}|`{3,} # Marker: three tilde or more.
|
||||
)
|
||||
|
||||
[ ]?(\w+)?(?:,[ ]?(\d+))?[ ]* \n # Whitespace and newline following marker.
|
||||
|
||||
# 3: Content
|
||||
(
|
||||
(?>
|
||||
(?!\1 [ ]* \n) # Not a closing marker.
|
||||
.*\n+
|
||||
)+
|
||||
)
|
||||
|
||||
# Closing marker.
|
||||
\1 [ ]* \n
|
||||
}xm',
|
||||
array(&$this, '_doFencedCodeBlocks_callback'), $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function _doFencedCodeBlocks_callback($matches) {
|
||||
$codeblock = $matches[4];
|
||||
$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
|
||||
$codeblock = preg_replace_callback('/^\n+/',
|
||||
array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
|
||||
//$codeblock = "<pre><code>$codeblock</code></pre>";
|
||||
//$cb = "<pre><code";
|
||||
$cb = empty($matches[3]) ? "<pre><code" : "<pre class=\"linenums:$matches[3]\"><code";
|
||||
$cb .= empty($matches[2]) ? ">" : " class=\"language-$matches[2]\">";
|
||||
$cb .= "$codeblock</code></pre>";
|
||||
return "\n\n".$this->hashBlock($cb)."\n\n";
|
||||
}
|
||||
|
||||
function doFencedFigures($text){
|
||||
$text = preg_replace_callback('{
|
||||
(?:\n|\A)
|
||||
# 1: Opening marker
|
||||
(
|
||||
={3,} # Marker: equal sign.
|
||||
)
|
||||
|
||||
[ ]?(?:\[([^\]]+)\])?[ ]* \n # Whitespace and newline following marker.
|
||||
|
||||
# 3: Content
|
||||
(
|
||||
(?>
|
||||
(?!\1 [ ]?(?:\[([^\]]+)\])?[ ]* \n) # Not a closing marker.
|
||||
.*\n+
|
||||
)+
|
||||
)
|
||||
|
||||
# Closing marker.
|
||||
\1 [ ]?(?:\[([^\]]+)\])?[ ]* \n
|
||||
}xm', array(&$this, '_doFencedFigures_callback'), $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function _doFencedFigures_callback($matches) {
|
||||
# get figcaption
|
||||
$topcaption = empty($matches[2]) ? null : $this->runBlockGamut($matches[2]);
|
||||
$bottomcaption = empty($matches[5]) ? null : $this->runBlockGamut($matches[5]);
|
||||
$figure = $matches[3];
|
||||
$figure = $this->runBlockGamut($figure); # recurse
|
||||
|
||||
$figure = preg_replace('/^/m', " ", $figure);
|
||||
# These leading spaces cause problem with <pre> content,
|
||||
# so we need to fix that - reuse blockqoute code to handle this:
|
||||
$figure = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
|
||||
array(&$this, '_doBlockQuotes_callback2'), $figure);
|
||||
|
||||
$res = "<figure>";
|
||||
if(!empty($topcaption)){
|
||||
$res .= "\n<figcaption>$topcaption</figcaption>";
|
||||
}
|
||||
$res .= "\n$figure\n";
|
||||
if(!empty($bottomcaption) && empty($topcaption)){
|
||||
$res .= "<figcaption>$bottomcaption</figcaption>";
|
||||
}
|
||||
$res .= "</figure>";
|
||||
return "\n". $this->hashBlock($res)."\n\n";
|
||||
}
|
||||
}
|
||||
?>
|
9
libs/themes/amelia.css
Normal file
9
libs/themes/amelia.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/bootstrap.min.css
vendored
Normal file
9
libs/themes/bootstrap.min.css
vendored
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/cerulean.css
Normal file
9
libs/themes/cerulean.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/cosmo.css
Normal file
9
libs/themes/cosmo.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/cyborg.css
Normal file
9
libs/themes/cyborg.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/flatly.css
Normal file
9
libs/themes/flatly.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/journal.css
Normal file
9
libs/themes/journal.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/readable.css
Normal file
9
libs/themes/readable.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/simplex.css
Normal file
9
libs/themes/simplex.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/slate.css
Normal file
9
libs/themes/slate.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/spacelab.css
Normal file
9
libs/themes/spacelab.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/superhero.css
Normal file
9
libs/themes/superhero.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
libs/themes/united.css
Normal file
9
libs/themes/united.css
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
9
package.json
Normal file
9
package.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "tm-docs",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-php": "~0.1.1"
|
||||
}
|
||||
}
|
Laden…
Verwijs in nieuw issue
Block a user