本文整理汇总了PHP中Component::print_headers方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::print_headers方法的具体用法?PHP Component::print_headers怎么用?PHP Component::print_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::print_headers方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Выводит результат работы компонента
*/
public function output()
{
Component::print_headers();
$this->objects->call("handler_bind");
$this->objects->call("handler_output");
}
示例2: output
/**
* Отправляет данные картинку капчи на сервер
*/
public function output()
{
$captcha = $this->Common->gen_password(CAPTCHA_LENGTH, false);
$captcha = strtoupper($captcha);
$_SESSION['captcha'] = $captcha;
$width = 15 + CAPTCHA_LENGTH * self::SymbolWidth + 15;
$image = imagecreatetruecolor($width, self::ImageHeight);
$backcolor = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
imagefill($image, 0, 0, $backcolor);
for ($i = 0; $i < self::PointsCount; $i++)
{
$color = imagecolorallocate($image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
imagesetpixel($image, mt_rand(0, $width), mt_rand(0, self::ImageHeight), $color);
}
for ($i = 0; $i < CAPTCHA_LENGTH; $i++)
{
$color = imagecolorallocate($image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
imagettftext($image, self::FontSize, mt_rand(-15, 15), 15 + $i * self::SymbolWidth, 35, $color, CAPTCHA_FONT_LOCATION, $captcha[$i]);
}
Component::print_headers("image/png", false);
imagepng($image);
imagedestroy($image);
exit;
}
示例3: send_empty
private function send_empty()
{
Component::print_headers();
echo json_encode(array('aaData' => array()));
exit;
}
示例4: on_add_item
public function on_add_item()
{
Component::print_headers("text/xml");
$fields = array('order_id' => array('filter' => FILTER_VALIDATE_INT),
'code' => array('filter' => FILTER_VALIDATE_INT),
'size' => array('require' => false, 'filter' => FILTER_VALIDATE_FLOAT),
'count' => array('filter' => FILTER_VALIDATE_INT),
'name' => array(),
'price' => array('filter' => FILTER_VALIDATE_INT),
'initial_price' => array('filter' => FILTER_VALIDATE_FLOAT),
'status_manager' => array()
);
$fields = $this->EasyForms->fields($fields);
if ($fields === false)
{
$this->XML->send_error("Не верно заполнены поля");
exit;
}
if ($fields['size'] < 0 || $fields['size'] > 100)
{
$this->XML->send_error("Не верно заполнено поле размер");
exit;
}
if ($fields['count'] <= 0 || $fields['count'] > 100)
{
$this->XML->send_error("Не верно заполнено поле кол-во");
exit;
}
if ($fields['price'] <= 0 || $fields['price'] > 1000000)
{
$this->XML->send_error("Не верно заполна цена продажи");
exit;
}
if ($fields['initial_price'] <= 0 || $fields['initial_price'] > 1000000)
{
$this->XML->send_error("Не верно заполнена цена отгрузки");
exit;
}
$new_id = $this->Orders->add_order_items($fields['order_id'], array($fields));
$fields['id'] = $new_id[0];
$this->Orders->update_price($fields['order_id'], $fields['price'] * $fields['count']);
$template = $this->Templates->get("");
$order_item = $template->order_item;
if ($order_item === false)
$this->Log->error("Can't find 'order_item' param");
$fields[$fields['status_manager']] = true;
$fields['status_manager'] = $this->get_manager_status($fields['status_manager']);
$order_item->bind_params($fields);
$fields['status_manager'] = "ignored";
$xml = $this->XML->start_answer();
$xml->addChild("item", (string) $order_item);
$this->XML->send_xml($xml);
}
示例5: set_page
/**
* Устанавливает страницу для отображения
* @param $page_name String: Имя страницы
*/
public function set_page($page_name)
{
$this->set($page_name);
$this->header = false;
$this->footer = false;
if (empty($this->template))
return;
$template = $this->get("/".$this->template);
$content_type = $template->get_param("Pages::Content-type");
if ($content_type !== false)
Component::print_headers((string) $content_type);
if (isset($template->params['Pages::Header']))
{
$this->header = $template->params['Pages::Header'];
unset($template->params['Pages::Header']);
}
if (isset($template->params['Pages::Footer']))
{
$this->footer = $template->params['Pages::Footer'];
unset($template->params['Pages::Footer']);
}
$this->assign_params($template);
}
示例6: on_set_count
public function on_set_count()
{
Component::print_headers();
$fields = array(
'id' => array(),
'count' => array(),
'size' => array(),
'product_id' => array()
);
$fields = $this->EasyForms->fields($fields, array('flags' => FILTER_VALIDATE_INT));
if ($fields === false)
exit;
$order = $this->Orders->get($fields['id']);
if ($order === false)
exit;
$order['products'] = unserialize($order['products']);
if (!isset($orders['products'][$fields['product_id']][$fields['size']]))
exit;
$order['products'][$fields['product_id']][$fields['size']] = $fields['count'];
$summary = $this->Basket->summary($order['products']);
$summary = $summary['buy'];
$this->Orders->update($fields['id'], array('products' => serialize($order['products']), 'price' => $summary['price']));
echo $this->format_list_products($order['products']);
exit;
}
示例7: on_export_submit
/**
* Отображает данные экспорта страниц
*/
public function on_export_submit()
{
$fields = array(
'names' => array('array' => true),
'compress' => array('require' => false),
'trim' => array('require' => false),
);
$fields = $this->EasyForms->fields($fields);
if (!$fields)
$this->Log->error("No page names specified");
if (empty($fields['compress']))
$fields['compress'] = "none";
$fields['trim'] = intval($fields['trim']);
$export = array();
if (!empty($fields['names']))
{
$result = $this->Pages->get_all($fields['names']);
while (($row = $result->fetch()))
{
if ($fields['trim'] != 0)
{
$pieces = explode("/", $row['name']);
$pieces = array_slice($pieces, $fields['trim']);
$row['name'] = implode("/", $pieces);
}
$data = $this->Common->copy_fields($row, array("name", "params", "content"));
$this->Common->remove_empty($data);
array_push($export, $data);
}
}
$export = serialize($export);
$export = $this->Compress->compress($export, $fields['compress']);
header("Content-Length: ".strlen($export));
header("Content-Disposition: attachment; filename=\"export.itw\"");
header("Content-Transfer-Encoding: binary");
Component::print_headers("application/octet-stream", false);
echo $export;
exit;
}
示例8: on_get_categories
/**
* Получение всех категорий
*/
public function on_get_categories()
{
Component::print_headers();
$template = $this->Templates->get("");
$category_item = $template->category_item;
if ($category_item === false)
$this->Log->error("Can't find 'category_item' param");
$categories = $this->News->get_categories();
echo $this->Lists->make($category_item, $categories);
exit;
}
示例9: send_as_xml
/**
* Отправляет данные инкапсулированными в XML-объект
* @param $element String: Данные для передачи
*/
public function send_as_xml($element)
{
$buffer = ob_get_clean();
$xml = $this->start_answer();
$xml->addChild($element, $buffer);
Component::print_headers("text/xml");
echo $xml->asXML();
exit;
}