function _wysiwyg_delivery_dummy in Wysiwyg 7.2
A simple page delivery dummy implementation.
Renders a dummy string on a page so a pre_render callback on the style tag can collect all stylesheets, then grabs them from the cache and prints import rules for each file in the cache.
Success:
- Status header: "200 OK"
- Content: One import rule per stylesheet from the theme.
Failure:
- Status header: "403 Forbidden"
- Content: Empty
See also
1 string reference to '_wysiwyg_delivery_dummy'
- wysiwyg_menu in ./
wysiwyg.module - Implementation of hook_menu().
File
- includes/
styling.inc, line 37 - Handles adding theme stylesheets into WYSIWYG editors.
Code
function _wysiwyg_delivery_dummy($page_callback_result) {
global $theme_key;
drupal_add_http_header('Content-Language', 'en');
drupal_add_http_header('Content-Type', 'text/css; charset=utf-8');
// Make sure the theme is always initialized.
drupal_theme_initialize();
// Render a completely themed empty page to catch as many stylesheets as
// possible, but don't actually return anything because we only need the CSS.
drupal_render_page('Dummy');
if ($page_callback_result) {
drupal_add_http_header('Status', '200 OK');
// Make the client get the actual stylesheets.
$css = array();
$cached = cache_get('wysiwyg_css');
if ($cached && !empty($cached->data[$theme_key])) {
$css = $cached->data[$theme_key]['files'];
}
foreach ($css as $file) {
print '@import url("' . $file . '");' . "\n";
}
}
else {
drupal_add_http_header('Status', '403 Forbidden');
}
// Cleanup and session handling.
drupal_page_footer();
}