function GenerateOutput() { global $langmessage, $page; common::ShowingGallery(); echo '<h2>'; echo gpOutput::ReturnText('galleries'); echo '</h2>'; includeFile('admin/admin_tools.php'); $wrap = admin_tools::CanEdit($page->gp_index); if ($wrap) { echo gpOutput::EditAreaLink($edit_index, 'Admin_Galleries', $langmessage['edit']); echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">'; // class="edit_area" added by javascript } $image_text = gpOutput::ReturnText('image'); $images_text = gpOutput::ReturnText('images'); $list = ''; $shown = 0; foreach ($this->galleries as $title => $info) { //page is hidden if (!$this->GalleryVisible($title, $info)) { continue; } $count = ''; if (is_array($info)) { $icon = $info['icon']; if ($info['count'] == 1) { $count = $info['count'] . ' ' . gpOutput::ReturnText('image'); } elseif ($info['count'] > 1) { $count = $info['count'] . ' ' . gpOutput::ReturnText('images'); } } else { $icon = $info; } if (empty($icon)) { continue; } $icon = rawurldecode($icon); //prevent double encoding if (strpos($icon, '/thumbnails/') === false) { $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg'); } else { $thumbPath = common::GetDir('/data/_uploaded' . $icon); } $label = common::GetLabel($title); $title_attr = ' title="' . common::GetBrowserTitle($title) . '"'; $label_img = ' <img src="' . $thumbPath . '" alt=""/>'; $list .= '<li>' . common::Link($title, $label_img, '', $title_attr) . '<div>' . common::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>'; } if (!empty($list)) { echo '<ul class="gp_gallery gp_galleries">'; echo $list; echo '</ul>'; } if ($wrap) { echo '</div>'; } $this->PostSave(); }
function GenerateContent_Admin() { global $langmessage, $GP_NESTED_EDIT; //add to all pages in case a user adds a gallery gpPlugin::Action('GenerateContent_Admin'); common::ShowingGallery(); $content = ''; $section_num = 0; foreach ($this->file_sections as $section_key => $section_data) { $content .= "\n"; $type = isset($section_data['type']) ? $section_data['type'] : 'text'; if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) { $link_name = 'inline_edit_generic'; $link_rel = $type . '_inline_edit'; $title_attr = sprintf($langmessage['Section %s'], $section_key + 1); $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $section_key, ' title="' . $title_attr . '" name="' . $link_name . '" rel="' . $link_rel . '"'); //section control links $content .= '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">'; $content .= $link; if ($section_num > 0) { $content .= common::Link($this->title, $langmessage['move_up'], 'cmd=move_up§ion=' . $section_key, ' name="creq"', 'move_up' . $section_key); } $content .= common::Link($this->title, $langmessage['New Section'], 'cmd=new_section§ion=' . $section_key, ' name="gpabox"'); $q = 'cmd=add_section©=copy§ion=' . $section_key . '&last_mod=' . rawurlencode($this->fileModTime); $content .= common::Link($this->title, $langmessage['Copy'], $q, ' name="creq"'); //remove section link if (count($this->file_sections) > 1) { $title_attr = $langmessage['rm_section_confirm']; if ($type != 'include') { $title_attr .= "\n\n" . $langmessage['rm_section_confirm_deleting']; } $content .= common::Link($this->title, $langmessage['Remove Section'], 'cmd=rm_section§ion=' . $section_key . '&total=' . count($this->file_sections), ' title="' . $title_attr . '" name="creq" class="gpconfirm"'); } $content .= '</span>'; $content .= '<div class="editable_area GPAREA filetype-' . $type . '" id="ExtraEditArea' . $edit_index . '">'; // class="edit_area" added by javascript } else { $content .= '<div class="GPAREA filetype-' . $type . '">'; } $GP_NESTED_EDIT = true; $content .= $this->SectionToContent($section_data, $section_num); $GP_NESTED_EDIT = false; $content .= '<div class="gpclear"></div>'; $content .= '</div>'; $section_num++; } return $content; }
function GetSection(&$section_num) { global $langmessage, $GP_NESTED_EDIT; if (!isset($this->file_sections[$section_num])) { trigger_error('invalid section number'); return; } $curr_section_num = $section_num; $section_num++; $content = ''; $section_data = $this->file_sections[$curr_section_num]; $section_data += array('attributes' => array(), 'type' => 'text'); $section_data['attributes'] += array('class' => ''); $orig_attrs = json_encode($section_data['attributes']); $section_data['attributes']['data-gp-section'] = $curr_section_num; $section_types = section_content::GetTypes(); if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) { if (isset($section_types[$section_data['type']])) { $title_attr = $section_types[$section_data['type']]['label']; } else { $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1); } $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit'); $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&revision=' . $this->fileModTime, $attrs); //section control links if ($section_data['type'] != 'wrapper_section') { ob_start(); echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">'; echo $link; echo common::Link($this->title, $langmessage['Manage Sections'] . '...', 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections')); echo '</span>'; gpOutput::$editlinks .= ob_get_clean(); } $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index; $section_data['attributes']['class'] .= ' editable_area'; // class="edit_area" added by javascript //$section_data['attributes']['data-gp-editarea'] = $edit_index; } if (!isset($section_data['nodeName'])) { $content .= "\n" . '<div' . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>'; } else { $content .= "\n" . '<' . $section_data['nodeName'] . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>'; } if ($section_data['type'] == 'wrapper_section') { for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) { $content .= $this->GetSection($section_num); } } else { $GP_NESTED_EDIT = true; $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats); $GP_NESTED_EDIT = false; } if (!isset($section_data['nodeName'])) { $content .= '<div class="gpclear"></div>'; $content .= '</div>'; } else { $content .= '</' . $section_data['nodeName'] . '>'; } return $content; }
public function GetSection(&$section_num) { global $langmessage; if (!isset($this->file_sections[$section_num])) { trigger_error('invalid section number'); return; } $curr_section_num = $section_num; $section_num++; $content = ''; $section_data = $this->file_sections[$curr_section_num]; //make sure section_data is an array $type = gettype($section_data); if ($type !== 'array') { trigger_error('$section_data is ' . $type . '. Array expected'); return; } $section_data += array('attributes' => array(), 'type' => 'text'); $section_data['attributes'] += array('class' => ''); $orig_attrs = $section_data['attributes']; $section_data['attributes']['data-gp-section'] = $curr_section_num; $section_types = section_content::GetTypes(); if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) { if (isset($section_types[$section_data['type']])) { $title_attr = $section_types[$section_data['type']]['label']; } else { $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1); } $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit'); $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&revision=' . $this->fileModTime, $attrs); //section control links if ($section_data['type'] != 'wrapper_section') { ob_start(); echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">'; echo $link; echo common::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections')); echo '<hr/>'; echo common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"'); echo common::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox')); echo '</span>'; gpOutput::$editlinks .= ob_get_clean(); } $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index; $section_data['attributes']['class'] .= ' editable_area'; // class="edit_area" added by javascript } $content .= $this->SectionNode($section_data, $orig_attrs); if ($section_data['type'] == 'wrapper_section') { for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) { $content .= $this->GetSection($section_num); } } else { gpOutput::$nested_edit = true; $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats); gpOutput::$nested_edit = false; } if (!isset($section_data['nodeName'])) { $content .= '<div class="gpclear"></div>'; $content .= '</div>'; } else { $content .= section_content::EndTag($section_data['nodeName']); } return $content; }