Exemple #1
0
 public function SectionNode($section, $orig_attrs)
 {
     //if image type, make sure the src is a complete path
     if ($section['type'] == 'image') {
         $orig_attrs['src'] = \gp\tool::GetDir($orig_attrs['src']);
     }
     $orig_attrs = json_encode($orig_attrs);
     if (\gp\tool\Output::ShowEditLink() && \gp\admin\Tools::CanEdit($this->gp_index)) {
         $section['attributes']['class'] .= ' editable_area';
     }
     $section_attrs = array('gp_label', 'gp_color', 'gp_collapse');
     foreach ($section_attrs as $attr) {
         if (!empty($section[$attr])) {
             $section['attributes']['data-' . $attr] = $section[$attr];
         }
     }
     $attributes = \gp\tool\Output\Sections::SectionAttributes($section['attributes'], $section['type']);
     $attributes .= ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'';
     if (!isset($section['nodeName'])) {
         return '<div' . $attributes . '>';
     }
     return '<' . $section['nodeName'] . $attributes . '>';
 }
Exemple #2
0
 public static function GetExtra($name = 'Side_Menu', $info = array())
 {
     global $dataDir, $langmessage;
     $name = str_replace(' ', '_', $name);
     $file_stats = array();
     $is_draft = false;
     $extra_content = self::ExtraContent($name, $file_stats, $is_draft);
     $wrap = self::ShowEditLink('Admin_Extra');
     if (!$wrap) {
         echo '<div>';
         echo \gp\tool\Output\Sections::RenderSection($extra_content[0], 0, '', $file_stats);
         echo '</div>';
         return;
     }
     ob_start();
     $edit_link = self::EditAreaLink($edit_index, 'Admin/Extra', $langmessage['edit'], 'cmd=edit&file=' . $name, array('title' => $name, 'data-cmd' => 'inline_edit_generic'));
     echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
     echo $edit_link;
     echo \gp\tool::Link('Admin/Extra', $langmessage['theme_content'], '', ' class="nodisplay"');
     echo '</span>';
     self::$editlinks .= ob_get_clean();
     $attrs = array();
     $attrs['data-gp_label'] = str_replace('_', ' ', $name);
     $attrs['class'] = 'editable_area';
     $attrs['id'] = 'ExtraEditArea' . $edit_index;
     if ($is_draft) {
         $attrs['data-draft'] = 1;
     } else {
         $attrs['data-draft'] = 0;
     }
     echo '<div' . \gp\tool\Output\Sections::SectionAttributes($attrs, $extra_content[0]['type']) . '>';
     echo \gp\tool\Output\Sections::RenderSection($extra_content[0], 0, '', $file_stats);
     echo '</div>';
 }