Beispiel #1
0
 public function install_templates()
 {
     if (empty($_POST['install'])) {
         return;
     }
     copy_shopp_templates($this->template_path, $this->theme_path);
 }
 function settings_presentation()
 {
     if (!current_user_can('manage_options')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     if (isset($_POST['settings']['theme_templates']) && $_POST['settings']['theme_templates'] == "on") {
         $_POST['settings']['theme_templates'] = addslashes(template_path(STYLESHEETPATH . DIRECTORY_SEPARATOR . "shopp"));
     }
     if (!empty($_POST['save'])) {
         check_admin_referer('shopp-settings-presentation');
         if (empty($_POST['settings']['catalog_pagination'])) {
             $_POST['settings']['catalog_pagination'] = 0;
         }
         $this->settings_save();
         $updated = __('Shopp presentation settings saved.');
     }
     $builtin_path = $this->basepath . DIRECTORY_SEPARATOR . "templates";
     $theme_path = template_path(STYLESHEETPATH . DIRECTORY_SEPARATOR . "shopp");
     // Copy templates to the current WordPress theme
     if (!empty($_POST['install'])) {
         check_admin_referer('shopp-settings-presentation');
         copy_shopp_templates($builtin_path, $theme_path);
     }
     $status = "available";
     if (!is_dir($theme_path)) {
         $status = "directory";
     } else {
         if (!is_writable($theme_path)) {
             $status = "permissions";
         } else {
             $builtin = array_filter(scandir($builtin_path), "filter_dotfiles");
             $theme = array_filter(scandir($theme_path), "filter_dotfiles");
             if (empty($theme)) {
                 $status = "ready";
             } else {
                 if (array_diff($builtin, $theme)) {
                     $status = "incomplete";
                 }
             }
         }
     }
     $category_views = array("grid" => __('Grid', 'Shopp'), "list" => __('List', 'Shopp'));
     $row_products = array(2, 3, 4, 5, 6, 7);
     $productOrderOptions = Category::sortoptions();
     $orderOptions = array("ASC" => __('Order', 'Shopp'), "DESC" => __('Reverse Order', 'Shopp'), "RAND" => __('Shuffle', 'Shopp'));
     $orderBy = array("sortorder" => __('Custom arrangement', 'Shopp'), "name" => __('File name', 'Shopp'), "created" => __('Upload date', 'Shopp'));
     $sizingOptions = array(__('Scale to fit', 'Shopp'), __('Scale & crop', 'Shopp'));
     $qualityOptions = array(__('Highest quality, largest file size', 'Shopp'), __('Higher quality, larger file size', 'Shopp'), __('Balanced quality & file size', 'Shopp'), __('Lower quality, smaller file size', 'Shopp'), __('Lowest quality, smallest file size', 'Shopp'));
     include SHOPP_ADMINPATH . "/settings/presentation.php";
 }
Beispiel #3
0
 public function presentation()
 {
     if (!current_user_can('shopp_settings_presentation')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $builtin_path = SHOPP_PATH . '/templates';
     $theme_path = sanitize_path(STYLESHEETPATH . '/shopp');
     $term_recount = false;
     if (!empty($_POST['save'])) {
         check_admin_referer('shopp-settings-presentation');
         $updated = __('Shopp presentation settings saved.', 'Shopp');
         if (isset($_POST['settings']['theme_templates']) && $_POST['settings']['theme_templates'] == 'on' && !is_dir($theme_path)) {
             $_POST['settings']['theme_templates'] = 'off';
             $updated = __('Shopp theme templates can\'t be used because they don\'t exist.', 'Shopp');
         }
         if (empty($_POST['settings']['catalog_pagination'])) {
             $_POST['settings']['catalog_pagination'] = 0;
         }
         // Recount terms when this setting changes
         if (isset($_POST['settings']['outofstock_catalog']) && $_POST['settings']['outofstock_catalog'] != shopp_setting('outofstock_catalog')) {
             $term_recount = true;
         }
         shopp_set_formsettings();
         $this->notice(Shopp::__('Presentation settings saved.'), 'notice', 20);
     }
     if ($term_recount) {
         $taxonomy = ProductCategory::$taxon;
         $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
         if (!empty($terms)) {
             wp_update_term_count_now($terms, $taxonomy);
         }
     }
     // Copy templates to the current WordPress theme
     if (!empty($_POST['install'])) {
         check_admin_referer('shopp-settings-presentation');
         copy_shopp_templates($builtin_path, $theme_path);
     }
     $status = 'available';
     if (!is_dir($theme_path)) {
         $status = 'directory';
     } else {
         if (!is_writable($theme_path)) {
             $status = 'permissions';
         } else {
             $builtin = array_filter(scandir($builtin_path), 'filter_dotfiles');
             $theme = array_filter(scandir($theme_path), 'filter_dotfiles');
             if (empty($theme)) {
                 $status = 'ready';
             } else {
                 if (array_diff($builtin, $theme)) {
                     $status = 'incomplete';
                 }
             }
         }
     }
     $category_views = array('grid' => __('Grid', 'Shopp'), 'list' => __('List', 'Shopp'));
     $row_products = array(2, 3, 4, 5, 6, 7);
     $productOrderOptions = ProductCategory::sortoptions();
     $productOrderOptions['custom'] = __('Custom', 'Shopp');
     $orderOptions = array('ASC' => __('Order', 'Shopp'), 'DESC' => __('Reverse Order', 'Shopp'), 'RAND' => __('Shuffle', 'Shopp'));
     $orderBy = array('sortorder' => __('Custom arrangement', 'Shopp'), 'created' => __('Upload date', 'Shopp'));
     include $this->ui('presentation.php');
 }