function is_cli() { $page = \cd\XmlDocumentHandler::getInstance(); return php_sapi_name() == 'cli' || $page->getMimeType() == 'text/plain'; // return (php_sapi_name() == 'cli' || $page->getMimeType() == 'text/plain' || $page->getMimeType() == ''); }
/** * Embeds SWF using js/swfobject.js, see http://code.google.com/p/swfobject/ * @flashvars array of key=>val pairs */ function js_swfobject($swf, $render_div, $width = 300, $height = 120, $flashvars = '', $params = '', $attributes = '') { $page = \cd\XmlDocumentHandler::getInstance(); $header = \cd\XhtmlHeader::getInstance(); $header->includeJs($page->getRelativeCoreDevUrl() . 'js/swfobject.js'); $min_version = '9.0.115'; // first version to support MP4 $js = 'var flashvars=' . json_encode($flashvars) . ';' . 'var params=' . json_encode($params) . ';' . 'var attributes=' . json_encode($attributes) . ';' . 'swfobject.embedSWF("' . $swf . '","' . $render_div . '","' . $width . '","' . $height . '","' . $min_version . '","false",flashvars,params,attributes);'; return js_embed($js); }