paulredmond / cakephp-ugc Goto Github PK
View Code? Open in Web Editor NEWHelper for dealing with CDN content in CakePHP
Helper for dealing with CDN content in CakePHP
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));
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.