/** * List available CSS for this skin set * * @return @e void */ protected function _listReplacements() { //----------------------------------------- // INIT //----------------------------------------- $setID = intval($this->request['setID']); $replacements = array(); $setData = array(); //----------------------------------------- // Get template set data //----------------------------------------- $setData = $this->skinFunctions->fetchSkinData($setID); //----------------------------------------- // Get Replacements //----------------------------------------- $replacements = $this->skinFunctions->fetchReplacements($setID); // Filter out ones belonging to apps not installed // @todo: remove those checks below once we abstract replacements to each app if (!IPSLib::appIsInstalled('blog')) { $replacements = array_filter($replacements, create_function('$v', 'return !in_array( $v[\'replacement_key\'], array( \'blog_banish\', \'blog_blog\', \'blog_category\', \'blog_comments\', \'blog_comments_new\', \'blog_link\', \'blog_locked\', \'blog_rss_import\' ) );')); } if (!IPSLib::appIsInstalled('gallery')) { $replacements = array_filter($replacements, create_function('$v', 'return !in_array( $v[\'replacement_key\'], array( \'galery_album_edit\', \'gallery_album_delete\', \'gallery_image\', \'gallery_link\', \'gallery_slideshow\' ) );')); } //----------------------------------------- // Navvy Gation //----------------------------------------- $this->registry->output->extra_nav[] = array($this->settings['base_url'] . 'module=templates&section=skinsets&do=overview', $this->lang->words['re_nav1']); $this->registry->output->extra_nav[] = array($this->settings['base_url'] . 'module=templates&section=replacements&do=list&setID=' . $setID, $this->lang->words['re_nav2'] . $setData['set_name']); //----------------------------------------- // Print it... //----------------------------------------- $this->registry->output->html .= $this->html->replacements_listReplacements($replacements, $setData); }
/** * List available CSS for this skin set * * @access private * @return void */ private function _listReplacements() { //----------------------------------------- // INIT //----------------------------------------- $setID = intval($this->request['setID']); $replacements = array(); $setData = array(); //----------------------------------------- // Get template set data //----------------------------------------- $setData = $this->skinFunctions->fetchSkinData($setID); //----------------------------------------- // Get CSS //----------------------------------------- $replacements = $this->skinFunctions->fetchReplacements($setID); //----------------------------------------- // Navvy Gation //----------------------------------------- $this->registry->output->extra_nav[] = array($this->settings['base_url'] . 'module=templates&section=skinsets&do=overview', $this->lang->words['re_nav1']); $this->registry->output->extra_nav[] = array($this->settings['base_url'] . 'module=templates&section=replacements&do=list&setID=' . $setID, $this->lang->words['re_nav2'] . $setData['set_name']); //----------------------------------------- // Print it... //----------------------------------------- $this->registry->output->html .= $this->html->replacements_listReplacements($replacements, $setData); }
/** * Show the form to change the logo * * @access public * @return void [Outputs to screen/redirects] */ public function splash() { //----------------------------------------- // Can we upload into style_images? //----------------------------------------- $warning = !is_writable(IPS_CACHE_PATH . 'public/style_images') ? true : false; //----------------------------------------- // Get header logo image //----------------------------------------- $replacements = $this->skinFunctions->fetchReplacements(0); $currentUrl = $replacements['logo_img']['replacement_content']; $currentId = $replacements['logo_img']['replacement_id']; $this->registry->output->html .= $this->html->easyLogo($warning, $currentUrl, $currentId); }
/** * Saves the CSS * * @return string Json */ protected function _saveReplacement() { //----------------------------------------- // INIT //----------------------------------------- $setID = intval($this->request['setID']); $replacementID = intval($this->request['replacement_id']); $type = $this->request['type'] == 'add' ? 'add' : 'edit'; $replacement_content = $this->convertUnicode($_POST['replacement_content']); $replacement_key = $this->convertUnicode($_POST['_replacement_key']); //----------------------------------------- // Checks... //----------------------------------------- if (!$setID or $type == 'edit' and !$replacementID) { $this->returnJsonError('Missing Data'); exit; } //----------------------------------------- // Add checks //----------------------------------------- if ($type == 'add') { if (!$replacement_key) { $this->returnJsonError('Missing Data'); exit; } } //----------------------------------------- // Save it //----------------------------------------- if ($type == 'edit') { $css_id = $this->skinFunctions->saveReplacementFromEdit($replacementID, $setID, $replacement_content, $replacement_key); } else { try { $css_id = $this->skinFunctions->saveReplacementFromAdd($setID, $replacement_content, $replacement_key); } catch (Exception $err) { $this->returnJsonError($err->getMessage()); exit; } } //----------------------------------------- // Get Data //----------------------------------------- $replacements = $this->skinFunctions->fetchReplacements($setID); $this->returnJsonArray(array('replacements' => $replacements, 'errors' => $this->skinFunctions->fetchErrorMessages())); }