本文整理汇总了PHP中Context::getResponseMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getResponseMethod方法的具体用法?PHP Context::getResponseMethod怎么用?PHP Context::getResponseMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::getResponseMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: triggerDisplayBefore
function triggerDisplayBefore(&$content)
{
if (Context::getResponseMethod() != 'HTML') {
return new Object();
}
$grant = Context::get('grant');
$logged_info = Context::get('logged_info');
if ((!$grant || $grant->manager != 1) && $logged_info->is_admin != 'Y') {
return new Object();
}
preg_replace_callback('!<img([^\\>]*)widget=([^\\>]*?)\\>!is', array($this, '_setGrantByWidgetSequence'), $content);
Context::loadFile('./modules/magiccontent/tpl/js/magiccontent_for_admin.js');
Context::loadFile('./modules/magiccontent/tpl/css/magiccontent_for_admin.css');
return new Object();
}
示例2: isAroundmapEnable
/**
* @brief Aroundmap 모듈이 사용가능한지 체크
* @param $act 현재페이지의 액션 값
* @param $module_srl 현재 게시판의 번호
* @return true/false
*/
function isAroundmapEnable($act, $module_srl)
{
// 현재의 액션이 쓰기(수정), 보기 페이지인지 확인
if ($act != 'dispBoardWrite' && $act != 'dispBoardContent' && $act != null) {
return false;
}
// 현재 페이지가 HTML페이지인지 확인
if (Context::getResponseMethod() != 'HTML') {
return false;
}
// 현재 모듈이 aroundmap에 적용된 모듈인지 확인
if (!$module_srl || !$this->isModuleEnable($module_srl)) {
return false;
}
return true;
}
示例3: transHTML
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
*/
function transHTML($xml_obj)
{
$gallery_info = new stdClass();
$gallery_info->srl = rand(111111, 999999);
$gallery_info->border_thickness = (int) $xml_obj->attrs->border_thickness;
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
$color_preg = "/^([a-fA-F0-9]{6})/";
$gallery_info->border_color = preg_replace($color_preg, "#\$1", $xml_obj->attrs->border_color);
$gallery_info->bg_color = preg_replace($color_preg, "#\$1", $xml_obj->attrs->bg_color);
$gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
if (!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) {
$gallery_info->gallery_align = 'center';
}
$images_list = $xml_obj->attrs->images_list;
$images_list = preg_replace('/\\.(gif|jpe?g|png) /i', ".\\1\n", $images_list);
$images_list = explode("\n", trim($images_list));
$gallery_info->images_list = preg_grep("/^[a-z0-9\\/]+\\.(gif|jpe?g|png)+\$/", $images_list);
// If you set the output to output the XML code generated a list of the image
if (Context::getResponseMethod() == 'XMLRPC') {
$output = array();
for ($i = 0; $i < count($gallery_info->images_list); $i++) {
$output[] = sprintf('<img src="%s" alt="" />', $gallery_info->images_list[$i]);
}
$output[] = '<br />';
return implode('<br />', $output);
}
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches);
$gallery_info->width = trim($matches[3][0]);
if (!$gallery_info->width) {
$gallery_info->width = 400;
}
Context::set('gallery_info', $gallery_info);
$tpl_path = $this->component_path . 'tpl';
Context::set("tpl_path", $tpl_path);
if ($gallery_info->gallery_style == "list") {
$tpl_file = 'list_gallery.html';
} elseif ($gallery_info->gallery_style == "slide") {
$tpl_file = 'slide_gallery.html';
} else {
$tpl_file = 'jquery.bxslider.html';
}
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例4: transHTML
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj)
{
$gallery_info->srl = rand(111111, 999999);
$gallery_info->border_thickness = $xml_obj->attrs->border_thickness;
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
$gallery_info->border_color = $xml_obj->attrs->border_color;
$gallery_info->bg_color = $xml_obj->attrs->bg_color;
$gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
$images_list = $xml_obj->attrs->images_list;
$images_list = preg_replace('/\\.(gif|jpg|jpeg|png) /i', ".\\1\n", $images_list);
$gallery_info->images_list = explode("\n", trim($images_list));
// If you set the output to output the XML code generated a list of the image
if (Context::getResponseMethod() == 'XMLRPC') {
$output = '';
for ($i = 0; $i < count($gallery_info->images_list); $i++) {
$output .= sprintf('<img src="%s" alt="" /><br />', $gallery_info->images_list[$i]);
}
return $output;
}
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches);
$gallery_info->width = trim($matches[3][0]);
if (!$gallery_info->width) {
$gallery_info->width = 400;
}
Context::set('gallery_info', $gallery_info);
$tpl_path = $this->component_path . 'tpl';
Context::set("tpl_path", $tpl_path);
if ($gallery_info->gallery_style == "list") {
$tpl_file = 'list_gallery.html';
} else {
$tpl_file = 'slide_gallery.html';
}
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例5: transHTML
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj)
{
$src = $xml_obj->attrs->multimedia_src;
$style = $xml_obj->attrs->style;
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $style, $matches);
$width = trim($matches[3][0]);
$height = trim($matches[3][1]);
if (!$width) {
$width = 400;
}
if (!$height) {
$height = 400;
}
$auto_start = $xml_obj->attrs->auto_start;
if ($auto_start != "true") {
$auto_start = "false";
} else {
$auto_start = "true";
}
$wmode = $xml_obj->attrs->wmode;
if ($wmode == 'window') {
$wmode = 'window';
} elseif ($wmode == 'opaque') {
$wmode = 'opaque';
} else {
$wmode = 'transparent';
}
$caption = $xml_obj->body;
$src = str_replace(array('&', '"'), array('&', '&qout;'), $src);
$src = str_replace('&amp;', '&', $src);
if (Context::getResponseMethod() != "XMLRPC") {
return sprintf("<script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\",\"%s\", { \"autostart\" : %s, \"wmode\" : \"%s\" });</script>", $src, $width, $height, $auto_start, $wmode);
} else {
return sprintf("<div style=\"width: %dpx; height: %dpx;\"><span style=\"position:relative; top:%dpx;left:%d\"><img src=\"%s\" /><br />Attached Multimedia</span></div>", $width, $height, $height / 2 - 16, $width / 2 - 31, Context::getRequestUri() . './modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif');
}
}
示例6: transHTML
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
**/
function transHTML($xml_obj)
{
$gallery_info->srl = rand(111111, 999999);
$gallery_info->border_thickness = $xml_obj->attrs->border_thickness;
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
$gallery_info->border_color = $xml_obj->attrs->border_color;
$gallery_info->bg_color = $xml_obj->attrs->bg_color;
$gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
$images_list = $xml_obj->attrs->images_list;
$images_list = preg_replace('/\\.(gif|jpg|jpeg|png) /i', ".\\1\n", $images_list);
$gallery_info->images_list = explode("\n", trim($images_list));
// 만약 출력설정이 XML일 경우 이미지 목록만 출력하도록 코드 생성
if (Context::getResponseMethod() == 'XMLRPC') {
$output = '';
for ($i = 0; $i < count($gallery_info->images_list); $i++) {
$output .= sprintf('<img src="%s" alt="" /><br />', $gallery_info->images_list[$i]);
}
return $output;
}
// HTML 출력일 경우 템플릿 변환을 거쳐서 갤러리 출력 설정에 맞는 html코드를 생성하도록 함
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches);
$gallery_info->width = trim($matches[3][0]);
if (!$gallery_info->width) {
$gallery_info->width = 400;
}
Context::set('gallery_info', $gallery_info);
$tpl_path = $this->component_path . 'tpl';
Context::set("tpl_path", $tpl_path);
if ($gallery_info->gallery_style == "list") {
$tpl_file = 'list_gallery.html';
} else {
$tpl_file = 'slide_gallery.html';
}
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例7: testRequsetResponseMethod
public function testRequsetResponseMethod()
{
$this->assertEquals(Context::getRequestMethod(), 'GET');
$_SERVER['REQUEST_METHOD'] = 'POST';
Context::setRequestMethod();
$this->assertEquals(Context::getRequestMethod(), 'POST');
$GLOBALS['HTTP_RAW_POST_DATA'] = 'abcde';
Context::setRequestMethod();
$this->assertEquals(Context::getRequestMethod(), 'XMLRPC');
$_SERVER['CONTENT_TYPE'] = 'application/json';
Context::setRequestMethod();
$this->assertEquals(Context::getRequestMethod(), 'JSON');
Context::setRequestMethod('POST');
$this->assertEquals(Context::getRequestMethod(), 'POST');
$this->assertEquals(Context::getResponseMethod(), 'HTML');
Context::setRequestMethod('JSON');
$this->assertEquals(Context::getResponseMethod(), 'JSON');
Context::setResponseMethod('WRONG_TYPE');
$this->assertEquals(Context::getResponseMethod(), 'HTML');
Context::setResponseMethod('XMLRPC');
$this->assertEquals(Context::getResponseMethod(), 'XMLRPC');
Context::setResponseMethod('HTML');
$this->assertEquals(Context::getResponseMethod(), 'HTML');
}
示例8: _debugOutput
/**
* Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n
* This method only functions when __DEBUG__ variable is set to 1.
* __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php
* @return void
*/
function _debugOutput()
{
if (!__DEBUG__) {
return;
}
$end = getMicroTime();
// Firebug console output
if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) {
static $firephp;
if (!isset($firephp)) {
$firephp = FirePHP::getInstance(true);
}
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
return;
}
// display total execution time and Request/Response info
if (__DEBUG__ & 2) {
$firephp->fb(array('Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), array(array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'), array(sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), $_SERVER['REQUEST_METHOD'], Context::getResponseMethod(), $this->content_size . ' byte', FileHandler::filesize(memory_get_peak_usage())))), 'TABLE');
$firephp->fb(array('Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), array(sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), sprintf('%0.5f sec', $GLOBALS['__elapsed_class_load__']), sprintf('%0.5f sec (%d called)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']), sprintf('%0.5f sec', $GLOBALS['__xmlparse_elapsed__']), sprintf('%0.5f sec', $end - __StartTime__ - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']), sprintf('%0.5f sec', $GLOBALS['__widget_excute_elapsed__']), sprintf('%0.5f sec', $GLOBALS['__trans_content_elapsed__'])))), 'TABLE');
}
// display DB query history
if (__DEBUG__ & 4 && $GLOBALS['__db_queries__']) {
$queries_output = array(array('Result/' . PHP_EOL . 'Elapsed time', 'Query ID', 'Query'));
foreach ($GLOBALS['__db_queries__'] as $query) {
$queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']);
}
$firephp->fb(array('DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), $queries_output), 'TABLE');
}
// dislpay the file and HTML comments
} else {
$buff = array();
// display total execution time and Request/Response info
if (__DEBUG__ & 2) {
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
return;
}
// Request/Response information
$buff[] = "\n- Request/ Response info";
$buff[] = sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']);
$buff[] = sprintf("\tRequest method \t\t\t: %s", $_SERVER['REQUEST_METHOD']);
$buff[] = sprintf("\tResponse method \t\t: %s", Context::getResponseMethod());
$buff[] = sprintf("\tResponse contents size\t: %d byte", $this->content_size);
// total execution time
$buff[] = sprintf("\n- Total elapsed time : %0.5f sec", $end - __StartTime__);
$buff[] = sprintf("\tclass file load elapsed time \t: %0.5f sec", $GLOBALS['__elapsed_class_load__']);
$buff[] = sprintf("\tTemplate compile elapsed time\t: %0.5f sec (%d called)", $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']);
$buff[] = sprintf("\tXmlParse compile elapsed time\t: %0.5f sec", $GLOBALS['__xmlparse_elapsed__']);
$buff[] = sprintf("\tPHP elapsed time \t\t\t\t: %0.5f sec", $end - __StartTime__ - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']);
$buff[] = sprintf("\tDB class elapsed time \t\t\t: %0.5f sec", $GLOBALS['__dbclass_elapsed_time__'] - $GLOBALS['__db_elapsed_time__']);
// widget execution time
$buff[] = sprintf("\tWidgets elapsed time \t\t\t: %0.5f sec", $GLOBALS['__widget_excute_elapsed__']);
// layout execution time
$buff[] = sprintf("\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']);
// Widgets, the editor component replacement time
$buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']);
}
// DB Logging
if (__DEBUG__ & 4) {
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
return;
}
if ($GLOBALS['__db_queries__']) {
$buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']);
$num = 0;
foreach ($GLOBALS['__db_queries__'] as $query) {
if ($query['result'] == 'Success') {
$query_result = "Query Success";
} else {
$query_result = sprintf("Query {$s} : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']);
}
$buff[] = sprintf("\t%02d. %s\n\t\t%0.6f sec. %s.", ++$num, $query['query'], $query['elapsed_time'], $query_result);
$buff[] = sprintf("\t\tConnection: %s.", $query['connection']);
$buff[] = sprintf("\t\tQuery ID: %s", $query['query_id']);
$buff[] = sprintf("\t\tCalled: %s. %s()", str_replace(_XE_PATH_, '', $query['called_file']), $query['called_method']);
}
}
}
// Output in HTML comments
if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') {
$buff = implode("\r\n", $buff);
$buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
}
return "<!--\r\n" . $buff . "\r\n-->";
}
// Output to a file
if ($buff && __DEBUG_OUTPUT__ == 0) {
$debug_file = _XE_PATH_ . 'files/_debug_message.php';
$buff = implode(PHP_EOL, $buff);
$buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true));
$buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80);
$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
//.........这里部分代码省略.........
示例9: showSendEnv
/**
* Enviroment information send to XE collect server
* @return void
*/
function showSendEnv()
{
if (Context::getResponseMethod() != 'HTML') {
return;
}
$server = 'http://collect.xpressengine.com/env/img.php?';
$path = './files/env/';
$install_env = $path . 'install';
$mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2));
if (file_exists(FileHandler::getRealPath($install_env))) {
$oAdminAdminModel = getAdminModel('admin');
$params = $oAdminAdminModel->getEnv('INSTALL');
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params);
Context::addHtmlFooter($img);
FileHandler::writeFile($path . $mainVersion, '1');
} else {
if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) {
if ($_SESSION['enviroment_gather'] == 'Y') {
$oAdminAdminModel = getAdminModel('admin');
$params = $oAdminAdminModel->getEnv();
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params);
Context::addHtmlFooter($img);
}
FileHandler::writeFile($path . $mainVersion, '1');
unset($_SESSION['enviroment_gather']);
}
}
}
示例10: triggerWidgetCompile
/**
* @brief Widget code compiles and prints the information to trigger
* display:: before invoked in
*/
function triggerWidgetCompile(&$content)
{
if (Context::getResponseMethod() != 'HTML') {
return new Object();
}
$content = $this->transWidgetCode($content, $this->layout_javascript_mode);
return new Object();
}
示例11: getDebugInfo
/**
* Get debug information.
*
* @return string
*/
public function getDebugInfo(&$output = null)
{
// Check if debugging information has already been printed.
if (self::$debug_printed) {
return;
} else {
self::$debug_printed = 1;
}
// Check if debugging is enabled for this request.
if (!config('debug.enabled') || !Rhymix\Framework\Debug::isEnabledForCurrentUser()) {
return;
}
// Do not display debugging information if there is no output.
$display_type = config('debug.display_type');
if ($output === null && $display_type !== 'file') {
return;
}
// Print debug information.
switch ($display_type) {
case 'panel':
$data = Rhymix\Framework\Debug::getDebugData();
$display_content = array_fill_keys(config('debug.display_content'), true);
if (count($display_content) && !isset($display_content['entries'])) {
$data->entries = null;
}
if (count($display_content) && !isset($display_content['queries'])) {
unset($data->queries);
}
if (count($display_content) && !isset($display_content['slow_queries'])) {
unset($data->slow_queries);
}
if (count($display_content) && !isset($display_content['slow_triggers'])) {
unset($data->slow_triggers);
}
if (count($display_content) && !isset($display_content['slow_widgets'])) {
unset($data->slow_widgets);
}
if (count($display_content) && !isset($display_content['slow_remote_requests'])) {
unset($data->slow_remote_requests);
}
if ($data->entries) {
foreach ($data->entries as &$entry) {
if (is_scalar($entry->message)) {
$entry->message = var_export($entry->message, true);
} else {
$entry->message = trim(print_r($entry->message, true));
}
}
}
switch (Context::getResponseMethod()) {
case 'HTML':
$json_options = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE : 0;
$panel_script = sprintf('<script src="%s%s?%s"></script>', RX_BASEURL, 'common/js/debug.js', filemtime(RX_BASEDIR . 'common/js/debug.js'));
if (isset($_SESSION['_rx_debug_previous'])) {
$panel_script .= "\n<script>\nvar rhymix_debug_previous = " . json_encode($_SESSION['_rx_debug_previous'], $json_options) . ";\n</script>";
unset($_SESSION['_rx_debug_previous']);
}
$panel_script .= "\n<script>\nvar rhymix_debug_content = " . json_encode($data, $json_options) . ";\n</script>";
$body_end_position = strrpos($output, '</body>') ?: strlen($output);
$output = substr($output, 0, $body_end_position) . "\n{$panel_script}\n" . substr($output, $body_end_position);
return;
case 'JSON':
if (RX_POST && preg_match('/^proc/', Context::get('act'))) {
$data->ajax_module = Context::get('module');
$data->ajax_act = Context::get('act');
$_SESSION['_rx_debug_previous'] = $data;
} else {
unset($_SESSION['_rx_debug_previous']);
}
if (preg_match('/^(.+)\\}$/', $output, $matches)) {
$output = $matches[1] . ',"_rx_debug":' . json_encode($data) . '}';
}
return;
default:
return;
}
case 'comment':
case 'file':
default:
if ($display_type === 'comment' && Context::getResponseMethod() !== 'HTML') {
return;
}
ob_start();
$data = Rhymix\Framework\Debug::getDebugData();
$display_content = array_fill_keys(config('debug.display_content'), true);
include RX_BASEDIR . 'common/tpl/debug_comment.html';
$content = preg_replace('/\\n{2,}/', "\n\n", trim(ob_get_clean())) . PHP_EOL;
if ($display_type === 'file') {
$log_filename = config('debug.log_filename') ?: 'files/debug/YYYYMMDD.php';
$log_filename = str_replace(array('YYYY', 'YY', 'MM', 'DD'), array(getInternalDateTime(RX_TIME, 'Y'), getInternalDateTime(RX_TIME, 'y'), getInternalDateTime(RX_TIME, 'm'), getInternalDateTime(RX_TIME, 'd')), $log_filename);
$log_filename = RX_BASEDIR . $log_filename;
if (!file_exists($log_filename) || !filesize($log_filename)) {
$phpheader = '<?php exit; ?>' . "\n";
} else {
$phpheader = '';
//.........这里部分代码省略.........
示例12: triggerDisplayLogMessages
public function triggerDisplayLogMessages()
{
if(__DEBUG__ && __XE_SHOP_DEBUG__ && !in_array(Context::getResponseMethod(), array('XMLRPC', 'JSON')))
{
// Load XE Shop errors
$shop_log_messages = FileHandler::readFile(ShopLogger::LOG_FILE_PATH);
Context::set('shop_log_messages', $shop_log_messages);
// Load XE Core query log
$debug_messages = FileHandler::readFile(ShopLogger::XE_CORE_DEBUG_MESSAGE_PATH);
Context::set('debug_messages', $debug_messages);
// Load DB Query log
$debug_db_query = FileHandler::readFile(ShopLogger::XE_CORE_DEBUG_DB_QUERY_PATH);
Context::set('debug_db_query', $debug_db_query);
$oTemplateHandler = TemplateHandler::getInstance();
$view_logs = $oTemplateHandler->compile(_XE_PATH_ . '/modules/shop/tpl', 'log_viewer.html');
print $view_logs;
}
}
示例13: prepareToPrint
/**
* when display mode is HTML, prepare code before print.
* @param string $output compiled template string
* @return void
*/
function prepareToPrint(&$output)
{
if (Context::getResponseMethod() != 'HTML') {
return;
}
if (__DEBUG__ == 3) {
$start = getMicroTime();
}
// move <style ..></style> in body to the header
$output = preg_replace_callback('!<style(.*?)>(.*?)<\\/style>!is', array($this, '_moveStyleToHeader'), $output);
// move <link ..></link> in body to the header
$output = preg_replace_callback('!<link(.*?)/>!is', array($this, '_moveLinkToHeader'), $output);
// move <meta ../> in body to the header
$output = preg_replace_callback('!<meta(.*?)(?:\\/|)>!is', array($this, '_moveMetaToHeader'), $output);
// change a meta fine(widget often put the tag like <!--Meta:path--> to the content because of caching)
$output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\\_\\-\\/\\.\\@]+)-->/is', array($this, '_transMeta'), $output);
// handles a relative path generated by using the rewrite module
if (Context::isAllowRewrite()) {
$url = parse_url(Context::getRequestUri());
$real_path = $url['path'];
$pattern = '/src=("|\'){1}(\\.\\/)?(files\\/attach|files\\/cache|files\\/faceOff|files\\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\\/([^"\']+)\\.(jpg|jpeg|png|gif)("|\'){1}/s';
$output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output);
$pattern = '/href=("|\'){1}(\\?[^"\']+)/s';
$output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output);
if (Context::get('vid')) {
$pattern = '/\\/' . Context::get('vid') . '\\?([^=]+)=/is';
$output = preg_replace($pattern, '/?$1=', $output);
}
}
// prevent the 2nd request due to url(none) of the background-image
$output = preg_replace('/url\\((["\']?)none(["\']?)\\)/is', 'none', $output);
if (is_array(Context::get('INPUT_ERROR'))) {
$INPUT_ERROR = Context::get('INPUT_ERROR');
$keys = array_keys($INPUT_ERROR);
$keys = '(' . implode('|', $keys) . ')';
$output = preg_replace_callback('@(<input)([^>]*?)\\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output);
$output = preg_replace_callback('@<select[^>]*\\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output);
$output = preg_replace_callback('@<textarea[^>]*\\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
}
if (__DEBUG__ == 3) {
$GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start;
}
// Remove unnecessary information
$output = preg_replace('/member\\_\\-([0-9]+)/s', 'member_0', $output);
// set icon
$oAdminModel = getAdminModel('admin');
$favicon_url = $oAdminModel->getFaviconUrl();
$mobicon_url = $oAdminModel->getMobileIconUrl();
Context::set('favicon_url', $favicon_url);
Context::set('mobicon_url', $mobicon_url);
// convert the final layout
Context::set('content', $output);
$oTemplate = TemplateHandler::getInstance();
if (Mobile::isFromMobilePhone()) {
$this->_loadMobileJSCSS();
$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
} else {
$this->_loadJSCSS();
$output = $oTemplate->compile('./common/tpl', 'common_layout');
}
// replace the user-defined-language
$oModuleController = getController('module');
$oModuleController->replaceDefinedLangCode($output);
}
示例14: proc
/**
* excute the member method specified by $act variable
* @return boolean true : success false : fail
* */
function proc()
{
// pass if stop_proc is true
if ($this->stop_proc) {
debugPrint($this->message, 'ERROR');
return FALSE;
}
// trigger call
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this);
if (!$triggerOutput->toBool()) {
$this->setError($triggerOutput->getError());
$this->setMessage($triggerOutput->getMessage());
return FALSE;
}
// execute an addon(call called_position as before_module_proc)
$called_position = 'before_module_proc';
$oAddonController = getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if (FileHandler::exists($addon_file)) {
include $addon_file;
}
if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) {
// Check permissions
if ($this->module_srl && !$this->grant->access) {
$this->stop("msg_not_permitted_act");
return FALSE;
}
// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
$is_default_skin = !Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N' || Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N';
$usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET'));
if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) {
$dir = Mobile::isFromMobilePhone() ? 'm.skins' : 'skins';
$valueName = Mobile::isFromMobilePhone() ? 'mskin' : 'skin';
$oModuleModel = getModel('module');
$skinType = Mobile::isFromMobilePhone() ? 'M' : 'P';
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType);
if ($this->module == 'page') {
$this->module_info->{$valueName} = $skinName;
} else {
$isTemplatPath = strpos($this->getTemplatePath(), '/tpl/') !== FALSE;
if (!$isTemplatPath) {
$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName));
}
}
}
$oModuleModel = getModel('module');
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
Context::set('module_info', $this->module_info);
// Run
$output = $this->{$this->act}();
} else {
return FALSE;
}
// trigger call
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
if (!$triggerOutput->toBool()) {
$this->setError($triggerOutput->getError());
$this->setMessage($triggerOutput->getMessage());
return FALSE;
}
// execute an addon(call called_position as after_module_proc)
$called_position = 'after_module_proc';
$oAddonController = getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if (FileHandler::exists($addon_file)) {
include $addon_file;
}
if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) {
$this->setError($output->getError());
$this->setMessage($output->getMessage());
if (!$output->toBool()) {
return FALSE;
}
}
// execute api methos of the module if view action is and result is XMLRPC or JSON
if ($this->module_info->module_type == 'view') {
if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
$oAPI = getAPI($this->module_info->module, 'api');
if (method_exists($oAPI, $this->act)) {
$oAPI->{$this->act}($this);
}
}
}
return TRUE;
}
示例15: getController
<?php
if (!defined("__ZBXE__")) {
exit;
}
if (Context::getRequestMethod() == "XMLRPC" || Context::getResponseMethod() == "XMLRPC") {
return;
}
if (Context::getRequestMethod() == "POST" && $called_position == 'before_module_proc') {
$mode = $_REQUEST['mode'];
if (!$mode || $mode != "fb") {
return;
}
$oController =& getController('tccommentnotify');
if (!$oController) {
return;
}
$oController->procNotifyReceived();
return;
}
if ($called_position == "after_module_proc") {
$oModel =& getModel('tccommentnotify');
if (!$oModel) {
return;
}
if ($oModel->checkShouldNotify()) {
$scriptCode = <<<EndOfScript
<script type="text/javascript">
// <![CDATA[
exec_xml("tccommentnotify", "procDoNotify");
// ]]>