First of all, this is a great module. Very simple to implement in a custom mod. Thanks!
I think a nice feature would be the ability to define multiple mirrors per module.
for example:
I have a custom module that outputs urls for several seperate function calls.
I would like to be able to assign a different mirror (or turn off cdn completely) in the admin, for these individual elements.
if you were able to define these elements by returning an array of arrays in hook_simplecdnapi()
Something like:
/**
* Implementation of hook_simplecdnapi().
*/
function mymodule_simplecdnapi($op) {
switch ($op) {
case 'load':
$data[] = array(
'eid' => 'mymodule_some_element',
'name' => 'My Module: Element 1',
);
$data[] = array(
'eid' => 'mymodule_some_other_element',
'name' => 'My Module: Element 2',
);
return $data;
break;
}
}
and then invoke it with:
if (module_exists('simplecdn')) {
$url = simplecdn_rewrite_url($url, 'mymodule_some_element');
}
if (module_exists('simplecdn')) {
$url = simplecdn_rewrite_url($url, 'mymodule_some_other_element');
}
from within the same module wherever appropriate.
I guess i could make a separate plugin module for each case, but that seems excessive, no?
thoughts?
thanks again!
Comments
Comment #1
recrit commentedThe attach patch has worked well for me and does exactly what you have described. The
simplecdn_invoke_simplecdnapiwill handle returns from modules implementingsimplecdnapias follows:The 2nd option above allows you to put all of your elements in one module which enables reuse of hooks for preprocessing, etc.