Beispiel #1
0
 /**
  * Show images available in themes
  *
  */
 public function ShowThemeImages()
 {
     global $langmessage;
     $this->page->ajaxReplace = array();
     $current_theme = false;
     //which theme folder
     if (isset($_REQUEST['theme']) && isset($this->avail_addons[$_REQUEST['theme']])) {
         $current_theme = $_REQUEST['theme'];
         $current_info = $this->avail_addons[$current_theme];
         $current_label = $current_info['name'];
         $current_dir = $current_info['full_dir'];
         $current_url = \gp\tool::GetDir($current_info['rel']);
         //current layout
     } else {
         $layout_info = \gp\tool::LayoutInfo($this->curr_layout, false);
         $current_label = $layout_info['theme_name'];
         $current_dir = $layout_info['dir'];
         $current_url = \gp\tool::GetDir(dirname($layout_info['path']));
     }
     //list of themes
     ob_start();
     echo '<div class="gp_edit_select ckeditor_control">';
     echo '<a class="gp_selected_folder"><span class="folder"></span>';
     echo $current_label;
     echo '</a>';
     echo '<div class="gp_edit_select_options">';
     foreach ($this->avail_addons as $theme_id => $info) {
         $slug = 'Admin_Theme_Content/Image/' . rawurlencode($this->curr_layout);
         echo \gp\tool::Link($slug, '<span class="folder"></span>' . $info['name'], 'cmd=ShowThemeImages&theme=' . rawurlencode($theme_id), ' data-cmd="gpajax" class="gp_gallery_folder" ');
     }
     echo '</div>';
     echo '</div>';
     $gp_option_area = ob_get_clean();
     //images in theme
     $images = array();
     self::GetAvailThemeImages($current_dir, $current_url, $images);
     ob_start();
     foreach ($images as $image) {
         echo '<span class="expand_child">' . '<a href="' . $image['url'] . '" data-cmd="gp_gallery_add" data-width="' . $image['width'] . '" data-height="' . $image['height'] . '">' . '<img src="' . $image['url'] . '" alt=""/>' . '</a></span>';
     }
     $gp_gallery_avail_imgs = ob_get_clean();
     if ($current_theme) {
         $this->page->ajaxReplace[] = array('inner', '#gp_option_area', $gp_option_area);
         $this->page->ajaxReplace[] = array('inner', '#gp_gallery_avail_imgs', $gp_gallery_avail_imgs);
     } else {
         $content = '<div id="gp_option_area">' . $gp_option_area . '</div>' . '<div id="gp_gallery_avail_imgs">' . $gp_gallery_avail_imgs . '</div>';
         $this->page->ajaxReplace[] = array('inner', '#gp_image_area', $content);
     }
     $this->page->ajaxReplace[] = array('inner', '#gp_folder_options', '');
     //remove upload button
 }
Beispiel #2
0
 /**
  * Set the page's theme name and path information according to the specified $layout
  * If $layout is not found, use the installation's default theme
  *
  */
 function SetTheme($layout = false)
 {
     global $dataDir;
     if ($layout === false) {
         $layout = self::OrConfig($this->gp_index, 'gpLayout');
     }
     $layout_info = \gp\tool::LayoutInfo($layout);
     if (!$layout_info) {
         $default_theme = explode('/', gp_default_theme);
         $this->gpLayout = false;
         $this->theme_name = $default_theme[0];
         $this->theme_color = $default_theme[1];
         $this->theme_rel = '/themes/' . $this->theme_name . '/' . $this->theme_color;
         $this->theme_dir = $dataDir . '/themes/' . $this->theme_name;
     } else {
         $this->gpLayout = $layout;
         $this->theme_name = $layout_info['theme_name'];
         $this->theme_color = $layout_info['theme_color'];
         $this->theme_rel = $layout_info['path'];
         $this->theme_dir = $layout_info['dir'];
         if (isset($layout_info['addon_id'])) {
             $this->theme_addon_id = $layout_info['addon_id'];
         }
         $this->theme_is_addon = $layout_info['is_addon'];
         //if installed in /themes or /data/_themes
         //css preferences
         if (isset($layout_info['menu_css_ordered']) && !$layout_info['menu_css_ordered']) {
             $this->menu_css_ordered = false;
         }
         if (isset($layout_info['menu_css_indexed']) && !$layout_info['menu_css_indexed']) {
             $this->menu_css_indexed = false;
         }
     }
     $this->theme_path = \gp\tool::GetDir($this->theme_rel);
 }
Beispiel #3
0
 /**
  * Display layout label and options
  *
  */
 public function LayoutDiv($layout, $info)
 {
     global $langmessage;
     $layout_info = \gp\tool::LayoutInfo($layout, false);
     echo '<div class="panelgroup" id="panelgroup_' . md5($layout) . '">';
     echo $this->GetLayoutLabel($layout, $info);
     echo '<div class="panelgroup2">';
     echo '<ul class="submenu">';
     echo '<li>';
     echo \gp\tool::Link('Admin_Theme_Content/Edit/' . rawurlencode($layout), $langmessage['edit_this_layout'], '', ' title="' . htmlspecialchars($langmessage['Arrange Content']) . '" ');
     echo '</li>';
     //layout options
     echo '<li class="expand_child_click">';
     echo '<a>' . $langmessage['Layout Options'] . '</a>';
     echo '<ul>';
     $this->LayoutOptions($layout, $layout_info);
     echo '</ul>';
     //css options
     echo '<li class="expand_child_click">';
     echo '<a>CSS</a>';
     echo $this->CSSPreferenceForm($layout, $layout_info);
     echo '</li>';
     $this->LayoutDivAddon($layout_info);
     //new versions
     if (isset($layout_info['addon_id'])) {
         $addon_id = $layout_info['addon_id'];
         $version =& $layout_info['version'];
         //local or already downloaded
         if (isset($this->versions[$addon_id]) && version_compare($this->versions[$addon_id]['version'], $version, '>')) {
             $version_info = $this->versions[$addon_id];
             $label = $langmessage['upgrade'] . ' &nbsp; ' . $version_info['version'];
             $source = $version_info['index'] . '/' . $layout_info['theme_color'];
             //could be different folder
             echo '<div class="gp_notice">';
             echo \gp\tool::Link('Admin_Theme_Content', $label, 'cmd=UpgradeTheme&source=' . $source, array('data-cmd' => 'creq'));
             echo '</div>';
             //remote version
         } elseif (gp_remote_themes && isset(\gp\admin\Tools::$new_versions[$addon_id]) && version_compare(\gp\admin\Tools::$new_versions[$addon_id]['version'], $version, '>')) {
             $version_info = \gp\admin\Tools::$new_versions[$addon_id];
             $label = $langmessage['new_version'] . ' &nbsp; ' . $version_info['version'] . ' &nbsp; (' . CMS_READABLE_DOMAIN . ')';
             echo '<div class="gp_notice">';
             echo \gp\tool::Link('Admin_Theme_Content', $label, 'cmd=RemoteInstall&id=' . $addon_id . '&name=' . rawurlencode($version_info['name']) . '&layout=' . $layout);
             echo '</div>';
         }
     }
     echo '</ul>';
     echo '</div>';
     echo '</div>';
 }
Beispiel #4
0
 /**
  * Preview changes to the custom css/less
  *
  */
 public function PreviewCSS()
 {
     global $langmessage;
     $layout_info = \gp\tool::LayoutInfo($this->curr_layout, false);
     $this->page->theme_color = $layout_info['theme_color'];
     $this->page->theme_rel = dirname($this->page->theme_rel) . '/' . $this->page->theme_color;
     $this->page->theme_path = dirname($this->page->theme_path) . '/' . $this->page->theme_color;
     $dir = $this->page->theme_dir . '/' . $this->page->theme_color;
     $style_type = \gp\tool\Output::StyleType($dir);
     $style_files = array();
     if ($style_type == 'scss') {
         $this->PreviewScss($dir);
         return;
     }
     // which css files
     if ($style_type == 'css') {
         $this->page->css_user[] = rawurldecode($this->page->theme_path) . '/style.css';
     } else {
         $style_files[] = $dir . '/style.less';
     }
     // variables.less
     $var_file = $dir . '/variables.less';
     if (file_exists($var_file)) {
         $style_files[] = $var_file;
     }
     $temp = trim($_REQUEST['css']);
     if (!empty($temp)) {
         $style_files[] = $_REQUEST['css'] . "\n";
         //make sure this is seen as code and not a filename
     }
     if (count($style_files)) {
         $compiled = \gp\tool\Output\Css::ParseLess($style_files);
         if ($compiled === false) {
             message($langmessage['OOPS'] . ' (Invalid LESS)');
             return false;
         }
         $this->page->head .= '<style>' . $compiled . '</style>';
     }
     $this->page->get_theme_css = false;
 }