Exemple #1
0
 /**
  * Output a flash movie object tag
  *
  * @param string $data The flash file
  * @param array  $attribs Attribs for the object tag
  * @param array  $params Params for in the object tag
  * @param string $content Alternative content
  * @return string
  */
 public function direct($data = null, array $attribs = array(), array $params = array(), $content = null)
 {
     if ($data == null) {
         throw new \InvalidArgumentException('HTMLFlash: missing argument. $data is required in htmlFlash($data, array $attribs = array(), array $params = array(), $content = null)');
     }
     // Params
     $params = array_merge(array('movie' => $data, 'quality' => 'high'), $params);
     return parent::direct($data, self::TYPE, $attribs, $params, $content);
 }
Exemple #2
0
 /**
  * Output a html object tag
  *
  * @param string $data The html url
  * @param array  $attribs Attribs for the object tag
  * @param array  $params Params for in the object tag
  * @param string $content Alternative content
  * @return string
  */
 public function direct($data = null, array $attribs = array(), array $params = array(), $content = null)
 {
     if ($data == null) {
         throw new \InvalidArgumentException('HTMLPage: missing argument. $data is required in htmlObject($data, array $attribs = array(), array $params = array(), $content = null)');
     }
     // Attrs
     $attribs = array_merge($this->_attribs, $attribs);
     // Params
     $params = array_merge(array('data' => $data), $params);
     return parent::direct($data, self::TYPE, $attribs, $params, $content);
 }
Exemple #3
0
 public function getContent()
 {
     $output = '';
     $errors = array();
     $languages = Language::getLanguages();
     $id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
     $id_lang = $this->context->language->id;
     if (Tools::getValue('confirm_msg')) {
         $output .= $this->displayConfirmation(Tools::getValue('confirm_msg'));
     }
     if (Tools::isSubmit('submitGlobal')) {
         $id_position = (int) Tools::getValue('id_position', 1);
         $html_id = $this->getHtmlIdByPosition($id_position);
         if ($html_id && count($html_id) > 0) {
             $htmlObject = new HtmlObject($html_id['id_htmlobject']);
         } else {
             $htmlObject = new HtmlObject();
         }
         $htmlObject->active = (int) Tools::getValue('active');
         //$hook_postition
         $htmlObject->hook_postition = (int) Tools::getValue('id_position');
         foreach ($languages as $language) {
             $htmlObject->title[$language['id_lang']] = Tools::getValue('item_title_' . $language['id_lang']);
             $htmlObject->content[$language['id_lang']] = Tools::getValue('item_html_' . $language['id_lang']);
         }
         if (!$errors || count($errors) < 1) {
             /* Update */
             if ($html_id && count($html_id) > 0) {
                 if (!$htmlObject->update()) {
                     $errors[] = $this->displayError($this->l('The Advertising slide could not be updated.'));
                 }
             } elseif (!$htmlObject->add()) {
                 $errors[] = $this->displayError($this->l('The Advertising slide could not be add.'));
             }
             /* Adds */
         }
         if (!isset($errors) || count($errors) < 1) {
             if ($html_id && count($html_id) > 0) {
                 $confirm_msg = $this->l('Slide successfully updated.');
             } else {
                 $confirm_msg = $this->l('New slide successfully added.');
             }
             Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('blockhtml.tpl'));
             Tools::redirectAdmin(AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&confirm_msg=' . $confirm_msg . '&id_position=' . $id_position);
         }
     }
     if (isset($errors) && count($errors)) {
         $output .= $this->displayError(implode('<br />', $errors));
     }
     return $output . $this->displayForm();
 }
 /**
  * @return void
  * @var string $html conteudo html a ser injetado.
  * Encapsula o conteudo html em um objeto HtmlObject e adiciona a lista de objetos para ser injetado.
  */
 public function appendHtml($html, $priority = 1)
 {
     $html = new HtmlObject('html');
     $html->set('text', $html);
     $this->_list->insert($html, $priority);
 }
<?php

include_once 'core/HtmlObject.php';
include_once 'core/HtmlPage.php';
$page = new HtmlPage();
$p = new HtmlObject();
$i = new HtmlObject();
$i->set_type("iframe");
$i->set_custom_attribute("src='http://www.example.com' height=800px width=800px");
$p->set_type("p");
$p->add_content("hello");
$page->add_body('<p>This is my body</p>');
$page->add_body($p->get_object());
$page->add_body($i->get_object());
$page->set_title('hello');
$page->add_meta('http-equiv="X-UA-Compatible" content="IE=edge"');
$page->add_lib('jquery');
//$page->add_script("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js");
//$page->clear_body();
$page->get_page();