https://github.com/baylorrae/gist-php-class
A class that provides an easy interface for embedding and caching gists.
https://github.com/baylorrae/gist-php-class
Last synced: 9 months ago
JSON representation
A class that provides an easy interface for embedding and caching gists.
- Host: GitHub
- URL: https://github.com/baylorrae/gist-php-class
- Owner: BaylorRae
- Created: 2012-03-24T13:29:45.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-11-17T13:50:45.000Z (over 13 years ago)
- Last Synced: 2025-04-03T02:51:15.173Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 121 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# What is the Gist Class [](https://travis-ci.org/BaylorRae/Gist-PHP-Class)
The `Gist` class provides an interface for easily
1. Embedding gists
2. Caching gists
3. Adding the gist's source to `` tags in case JS is disabled
## How to Use it
```php
render();
?>
```
# Available Methods
## Gist::__construct
Gist::__construct($gist_id[, $file_name = null[, $cache = true]])
Prepares the class for adding gists to the page
### Parameters
$gist_id
string
The ID of the gist to add
$file_name
string (optional)
Which file to display; if empty it will embed all files
$cache
boolean (optional) (default=true)
Cache the gist source in a file and display it in `<noscript>` tags
## Gist::script\_tag()
Gist::script_tag()
Creates the script tag for embedding gists
### Return
```html
```
## Gist::noscript\_tag()
Gist::noscript_tag()
If caching is enabled then download
and display the gist content in
`` tags
### Return
```html
The source gist
```
## Gist::render()
Create the script and noscript tags
in one go
### Return
```html
The source gist
```
## (private) Gist::download\_raw\_source()
Attempt to download a gist
and cache it into a file
### Return
{null}
## (private) Gist::get\_cache\_name()
Returns the path for where the file
should be cached
### Return
./gists_cache/58abasdf4858asadf58