XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
image_gallery.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
9 {
10  // editor_sequence from the editor must attend mandatory wearing ....
12  var $component_path = '';
13 
18  {
19  $this->editor_sequence = $editor_sequence;
20  $this->component_path = $component_path;
21  }
22 
26  function getPopupContent()
27  {
28  // Pre-compiled source code to compile template return to
29  $tpl_path = $this->component_path.'tpl';
30  $tpl_file = 'popup.html';
31 
32  Context::set("tpl_path", $tpl_path);
33 
34  $oTemplate = &TemplateHandler::getInstance();
35  return $oTemplate->compile($tpl_path, $tpl_file);
36  }
37 
44  function transHTML($xml_obj)
45  {
46  $gallery_info = new stdClass();
47  $gallery_info->srl = rand(111111, 999999);
48  $gallery_info->border_thickness = (int)$xml_obj->attrs->border_thickness;
49  $gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
50  $color_preg = "/^([a-fA-F0-9]{6})/";
51  $gallery_info->border_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->border_color);
52  $gallery_info->bg_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->bg_color);
53  $gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
54 
55  if(!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) {
56  $gallery_info->gallery_align = 'center';
57  }
58 
59  $images_list = $xml_obj->attrs->images_list;
60  $images_list = preg_replace('/\.(gif|jpe?g|png) /i', ".\\1\n", $images_list);
61  $images_list = explode("\n", trim($images_list));
62  $gallery_info->images_list = preg_grep("/^[a-z0-9\/]+\.(gif|jpe?g|png)+$/i", $images_list);
63 
64  // If you set the output to output the XML code generated a list of the image
65  if(Context::getResponseMethod() == 'XMLRPC')
66  {
67  $output = array();
68  for($i=0;$i<count($gallery_info->images_list);$i++)
69  {
70  $output[] = sprintf('<img src="%s" alt="" />', $gallery_info->images_list[$i]);
71  }
72  $output[] = '<br />';
73  return implode('<br />', $output);
74  }
75  // HTML gallery output, the output settings via the template for the conversion to generate the html code should
76  preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
77  $gallery_info->width = trim($matches[3][0]);
78  if(!$gallery_info->width) $gallery_info->width = 400;
79 
80  Context::set('gallery_info', $gallery_info);
81 
82  $tpl_path = $this->component_path.'tpl';
83  Context::set("tpl_path", $tpl_path);
84 
85  if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html';
86  else $tpl_file = 'slide_gallery.html';
87 
88  $oTemplate = &TemplateHandler::getInstance();
89  return $oTemplate->compile($tpl_path, $tpl_file);
90  }
91 }
92 /* End of file image_gallery.class.php */
93 /* Location: ./modules/editor/components/image_gallery/image_gallery.class.php */
$output
Definition: ko.install.php:193
set($key, $val, $set_to_get_vars=0)