Giter VIP home page Giter VIP logo

cakephp-ugc's Introduction

Plugin for dealing with CDN content in a CakePHP application. This is a simple helper that will quickly help you serve CDN content without much configuration. I realize that existing applications probably already use HTML helper extensively -- this helper is probably geared towards new applications in development or smaller projects.

========================
Installation
========================
From plugins or APP/plugins run:

git clone [email protected]:paulredmond/cakephp-ugc.git ugc
(eventually will branch/tag, but use master for now)


========================
Basic Configuration
========================

public $helpers = array(
	'Ugc.Ugc' => array(
		'servers' => array(
			'css' => array('css.yourcdn.com'),
			'default' => array('cdn.yourcdn.com'), // default MUST be configured, or UGC will be disabled.
			'js' => array('js.yourcdn.com'),
			'img' => array('img.yourcdn.com')
		)
	)
);

========================
Usage
========================
Ugc helper will operate similar to the HTML helper, only the URLs will be pointed to the servers if configured and UGC is enabled. Otherwise, this helper falls back to default HTML helper funcitonality.

$this->Ugc->css('mycss') // will output http(s)://css.yourcdn.com/css/mycss.css if configured like the example above.

$this->Ugc->js('/yo/myjavascript') // url output will be http(s)://js.yourcdn.com/yo/myjavascript.js
// Using absolute path will match app/webroot/yo/myjavascript.js file if UGC is disabled.

$this->Ugc->js('myjavascript') // url in output will be http(s)://js.yourcdn.com/js/myjavascript.js

$this->Ugc->image('myimage.jpg') // url output will be http(s)://img.yourcdn.com/img/myimage.jpg

// Using relative protocol on CDN
$this->Ugc->css('mycss', null, array(), false, '//'); /* Will output //css.yourcdn.com/css/mycss.css */

* if port = 443 all urls generated from UGC helper will be forced to return https.
* if http:// or https:// is detected in the url UgcHelper will fall back to using HTML helper.


========================
Disable/Enable site-wide
========================
Configure::write('UGC.disabled', (bool));

cakephp-ugc's People

Contributors

paulredmond avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

cakephp-ugc's Issues

Is this still usable?

I know the issue queue is not the place for this, but is this still a workable plugin? We'd like to use it on a production site.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.