Example #1
0
 public function delete_object($type, $class)
 {
     global $wp_filesystem, $thesis;
     $this->init();
     $this->fs_connect();
     $this->skin->header();
     if (!in_array($type, array('box', 'skin', 'package'))) {
         return new WP_Error('wrong_type', __('Type not recognized.', 'thesis'));
     }
     if (empty($class)) {
         wp_die(__('Object class not passed.', 'thesis'));
     }
     $this->thesis_type = $type;
     $this->thesis_class = $class;
     $items = false;
     $delete = false;
     if ($type == 'skin') {
         $items = thesis_skins::get_items();
         $delete = THESIS_USER_SKINS;
     } elseif ($type == 'package') {
         $items = thesis_user_packages::get_items();
         $delete = THESIS_USER_PACKAGES;
     } elseif ($type == 'box') {
         $items = thesis_user_boxes::get_items();
         $delete = THESIS_USER_BOXES;
     }
     $delete = !empty($items[$class]['folder']) ? $delete . "/{$items[$class]['folder']}" : false;
     if (is_object($wp_filesystem) && $delete) {
         $delete = $wp_filesystem->find_folder($delete);
         if (!!!$items || !!!$delete) {
             $this->skin->feedback(__('Could not find the requested object.', 'thesis'));
         } elseif (!$wp_filesystem->delete($delete, true)) {
             $this->skin->feedback('Could not delete ' . esc_attr($items[$class]['name']));
         } else {
             $this->skin->feedback(esc_attr($items[$class]['name']) . ' has been deleted.');
             $this->done = true;
         }
     } else {
         $this->skin->feedback(__('The box you are trying to delete could not be located.', 'thesis'));
     }
     $this->skin->footer($type);
 }
Example #2
0
 public function admin_footer($complete = true)
 {
     global $thesis;
     $iframe = "#thesis_upload_iframe_{$this->args_t['prefix']}";
     $div = empty($GLOBALS['thesis_object_upload_fail']) ? "'#{$this->args_t['folder']}_{$this->item_headers['class']}'" : 'false';
     if ($this->args_t['folder'] == 'skin') {
         $item = empty($GLOBALS['thesis_object_upload_fail']) ? thesis_skins::item_info($this->item_headers) : '';
         $js = 'skins';
         $selector = '#installed_skins';
     } elseif ($this->args_t['folder'] == 'package') {
         $item = empty($GLOBALS['thesis_object_upload_fail']) ? thesis_user_packages::item_info($this->item_headers) : '';
         $js = 'objects';
         $selector = '.object_list';
     } elseif ($this->args_t['folder'] == 'box') {
         $item = empty($GLOBALS['thesis_object_upload_fail']) ? thesis_user_boxes::item_info($this->item_headers) : '';
         $js = 'objects';
         $selector = '.object_list';
     }
     // final override
     $selector = empty($GLOBALS['thesis_object_upload_fail']) ? "'{$selector}'" : 'false';
     echo "<div style=\"display:none;\">{$item}</div>", "<script type=\"text/javascript\">\n", "(function(){\n", "\tparent.thesis_{$js}.add_item('{$iframe}', {$div}, {$selector}, '", admin_url("admin-post.php?action={$this->args_t['prefix']}_window&window_nonce=" . wp_create_nonce('thesis_upload_iframe')), "');\n", "\tparent.thesis_{$js}.init();\n", "})();\n", "</script>\n";
 }