Changeset 516953
- Timestamp:
- 03/09/2012 07:22:50 PM (14 years ago)
- Location:
- catablog/trunk
- Files:
-
- 3 added
- 7 edited
-
catablog.php (modified) (2 diffs)
-
css/catablog-admin.css (modified) (1 diff)
-
lib/CataBlog.class.php (modified) (19 diffs)
-
lib/CataBlogGallery.class.php (added)
-
lib/CataBlogItem.class.php (modified) (2 diffs)
-
lib/CataBlogWidget.class.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
templates/admin-galleries.php (added)
-
templates/admin-gallery-edit.php (added)
-
templates/admin-library.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
catablog/trunk/catablog.php
r514984 r516953 4 4 Plugin URI: http://catablog.illproductions.com/ 5 5 Description: CataBlog is a comprehensive and effortless tool that helps you create, organize and share catalogs, stores, galleries and portfolios on your blog. 6 Version: 1.4. 46 Version: 1.4.8 7 7 Author: Zachary Segal 8 8 Author URI: http://catablog.illproductions.com/about/ … … 43 43 require('lib/CataBlog.class.php'); 44 44 require('lib/CataBlogItem.class.php'); 45 require('lib/CataBlogGallery.class.php'); 45 46 require('lib/CataBlogDirectory.class.php'); 46 47 require('lib/CataBlogWidget.class.php'); -
catablog/trunk/css/catablog-admin.css
r504559 r516953 988 988 989 989 990 990 #catablog_items input { 991 border: 0 none; 992 background: transparent; 993 } 994 .catablog-red-curtain { 995 display: none; 996 position: absolute; 997 top: 0px; 998 bottom: 0px; 999 left: 0px; 1000 right: 0px; 1001 background-color: #f66; 1002 z-index: -1; 1003 } 1004 #catablog-gallery-create-form { 1005 position: relative; 1006 } 1007 1008 #catablog-gallery-items hr { 1009 background: #DFDFDF; 1010 height: 1px; 1011 border: 0 none; 1012 clear: both; 1013 } 1014 #catablog-gallery-form-title { 1015 width: 100%; 1016 font-size: 16px; 1017 margin: 0 0 10px 0; 1018 } 1019 #catablog-gallery-form-description { 1020 width: 100%; 1021 height: 5em; 1022 } 1023 1024 1025 1026 .catablog-gallery-item { 1027 position: relative; 1028 display: inline-block; 1029 vertical-align: top; 1030 width: 100px; 1031 1032 margin: 0 5px 5px 0; 1033 cursor: move; 1034 } 1035 .catablog-gallery-item small { 1036 display: block; 1037 } 1038 .catablog-gallery-item .catablog-delete-gallery-item { 1039 display: block; 1040 display: none; 1041 position: absolute; 1042 background: #fff; 1043 top: 5px; 1044 right: 5px; 1045 line-height: 22px; 1046 font-size: 16px; 1047 padding: 0 4px 0 5px; 1048 text-decoration: none; 1049 border: 1px #d00 solid; 1050 color: #d00; 1051 cursor: pointer; 1052 } 1053 .catablog-gallery-item:hover .catablog-delete-gallery-item { 1054 display: block; 1055 } 991 1056 992 1057 -
catablog/trunk/lib/CataBlog.class.php
r514984 r516953 5 5 * This file contains the core class for the CataBlog WordPress Plugin. 6 6 * @author Zachary Segal <zac@illproductions.com> 7 * @version 1.4. 47 * @version 1.4.8 8 8 * @package catablog 9 9 */ … … 19 19 20 20 // plugin version number and blog url 21 private $version = "1.4. 4";21 private $version = "1.4.8"; 22 22 private $blog_url = 'http://catablog.illproductions.com/'; 23 23 private $debug = false; 24 24 25 25 // wordpress custom post and taxonomy labels 26 private $custom_post_name = "catablog-items"; 27 private $custom_tax_name = "catablog-terms"; 26 private $custom_post_name = "catablog-items"; 27 private $custom_post_gallery_name = "catablog-gallery"; 28 private $custom_tax_name = "catablog-terms"; 28 29 29 30 // wordpress database options … … 99 100 } 100 101 102 public function getCustomPostGalleryName() { 103 return $this->custom_post_gallery_name; 104 } 105 101 106 public function getCustomTaxName() { 102 107 return $this->custom_tax_name; … … 180 185 // register shortcodes 181 186 add_shortcode('catablog', array(&$this, 'frontend_shortcode_catablog')); 187 add_shortcode('catablog_gallery', array(&$this, 'frontend_shortcode_catablog_gallery')); 182 188 add_shortcode('catablog_categories', array(&$this, 'frontend_shortcode_catablog_categories')); 183 189 } … … 217 223 218 224 219 // create the custom post type 225 // create the catalog item custom post type 226 $params = array(); 220 227 $params['label'] = __("CataBlog Item", 'catablog'); 221 228 $params['public'] = $public_posts_enabled; … … 232 239 233 240 234 // create the c ustom taxonomy241 // create the catalog categories custom taxonomy 235 242 $params = array(); 236 243 $params['label'] = __("CataBlog Category", 'catablog'); … … 243 250 244 251 252 // create the gallery custom post type 253 $params = array(); 254 $params['label'] = __("CataBlog Gallery", 'catablog'); 255 $params['public'] = false; 256 $params['show_ui'] = false; 257 $params['show_in_nav_menus'] = false; 258 $params['supports'] = array('title', 'editor'); 259 $params['description'] = __("A Catalog Gallery, generated by CataBlog.", 'catablog'); 260 $params['hierarchical'] = false; 261 $params['taxonomies'] = array(); 262 $params['menu_position'] = 46; 263 $params['menu_icon'] = $this->urls['plugin']."/images/catablog-icon-16.png"; 264 $params['rewrite'] = false; 265 register_post_type($this->custom_post_gallery_name, $params); 266 245 267 } 246 268 … … 281 303 if(strpos($_SERVER['QUERY_STRING'], 'catablog-bulkedit') !== false) { 282 304 $this->admin_bulk_edit(true); 305 } 306 307 // go straigt to create gallery action, no interface 308 if(strpos($_SERVER['QUERY_STRING'], 'catablog-gallery-create') !== false) { 309 $this->admin_gallery_create(true); 310 } 311 312 // go straigt to save gallery action, no interface 313 if(strpos($_SERVER['QUERY_STRING'], 'catablog-gallery-save') !== false) { 314 $this->admin_gallery_save(true); 315 } 316 317 // go straigt to append gallery action, no interface 318 if(strpos($_SERVER['QUERY_STRING'], 'catablog-gallery-append') !== false) { 319 $this->admin_gallery_append_new_items(true); 320 } 321 322 323 // go straigt to delete gallery action, no interface 324 if(strpos($_SERVER['QUERY_STRING'], 'catablog-gallery-delete') !== false) { 325 $this->admin_gallery_delete(true); 283 326 } 284 327 … … 330 373 add_submenu_page('catablog', __("CataBlog Library", 'catablog'), __('Library', 'catablog'), $this->user_level, 'catablog', array(&$this, 'admin_library')); 331 374 add_submenu_page('catablog', __("Add New CataBlog Entry", 'catablog'), __('Add New', 'catablog'), $this->user_level, 'catablog-upload', array(&$this, 'admin_new')); 375 add_submenu_page('catablog', __("CataBlog Galleries", 'catablog'), __('Galleries', 'catablog'), $this->user_level, 'catablog-galleries', array(&$this, 'admin_galleries')); 332 376 add_submenu_page('catablog', __("CataBlog Templates", 'catablog'), __('Templates', 'catablog'), $this->user_level, 'catablog-templates', array(&$this, 'admin_templates')); 333 377 add_submenu_page('catablog', __("CataBlog Options", 'catablog'), __('Options', 'catablog'), $this->user_level, 'catablog-options', array(&$this, 'admin_options')); … … 341 385 add_submenu_page('catablog-hidden', "Replace Main Image", "Replace", $this->user_level, 'catablog-replace-image', array(&$this, 'admin_replace_main_image')); 342 386 add_submenu_page('catablog-hidden', "Add SubImage", "SubImage", $this->user_level, 'catablog-add-subimage', array(&$this, 'admin_add_subimage')); 387 388 // register create/edit/delete catalog gallery actions 389 add_submenu_page('catablog-hidden', "Create CataBlog Gallery", "Create Gallery", $this->user_level, 'catablog-gallery-create', array(&$this, 'admin_gallery_create')); 390 add_submenu_page('catablog-hidden', "Edit CataBlog Gallery", "Edit Gallery", $this->user_level, 'catablog-gallery-edit', array(&$this, 'admin_gallery_edit')); 391 add_submenu_page('catablog-hidden', "Save CataBlog Gallery", "Save Gallery", $this->user_level, 'catablog-gallery-save', array(&$this, 'admin_gallery_save')); 392 add_submenu_page('catablog-hidden', "Append To CataBlog Gallery", "Append To Gallery", $this->user_level, 'catablog-gallery-append', array(&$this, 'admin_gallery_append_new_items')); 393 add_submenu_page('catablog-hidden', "Delete CataBlog Gallery", "Delete Gallery", $this->user_level, 'catablog-gallery-delete', array(&$this, 'admin_gallery_delete')); 343 394 344 395 // register import/export page actions to hidden menu … … 410 461 $wp_admin_bar->add_menu( array( 'parent' => 'catablog-menu', 'id' => 'catablog-library', 'title' => __( 'Library', 'catablog' ), 'href' => get_admin_url(null, 'admin.php?page=catablog'), ) ); 411 462 $wp_admin_bar->add_menu( array( 'parent' => 'catablog-menu', 'id' => 'catablog-new-entry', 'title' => __( 'Add New', 'catablog' ), 'href' => get_admin_url(null, 'admin.php?page=catablog-upload'), ) ); 463 $wp_admin_bar->add_menu( array( 'parent' => 'catablog-menu', 'id' => 'catablog-galleries', 'title' => __( 'Galleries', 'catablog' ), 'href' => get_admin_url(null, 'admin.php?page=catablog-galleries'), ) ); 412 464 $wp_admin_bar->add_menu( array( 'parent' => 'catablog-menu', 'id' => 'catablog-templates', 'title' => __( 'Templates', 'catablog' ), 'href' => get_admin_url(null, 'admin.php?page=catablog-templates'), ) ); 413 465 $wp_admin_bar->add_menu( array( 'parent' => 'catablog-menu', 'id' => 'catablog-options', 'title' => __( 'Options', 'catablog' ), 'href' => get_admin_url(null, 'admin.php?page=catablog-options'), ) ); … … 600 652 case 7: 601 653 $this->wp_message(__('Reset all data successfully.', 'catablog')); 654 break; 655 case 8: 656 $this->wp_message(__('Catalog items added to Gallery successfully.', 'catablog')); 657 break; 658 case 9: 659 $this->wp_error(__('Could not find the gallery to add items to, please make sure you select a gallery in the drop down menu and try again.', 'catablog')); 660 break; 661 case 10: 662 $this->wp_error(__('Could not validate the gallery, please modify the gallery and try again.', 'catablog')); 663 break; 602 664 } 603 665 } … … 795 857 796 858 include_once($this->directories['template'] . '/admin-options.php'); 797 } 859 } 860 861 862 public function admin_galleries() { 863 864 865 866 // order and pagination defaults 867 $sort = 'title'; 868 $order = 'asc'; 869 $paged = 1; 870 $offset = 0; 871 $limit = 20; 872 873 if (isset($_GET['sort'])) { 874 $sort = $_GET['sort']; 875 } 876 877 if (isset($_GET['order'])) { 878 $order = $_GET['order']; 879 } 880 881 if (isset($_GET['paged'])) { 882 $page_number = (int) $_GET['paged']; 883 $paged = $page_number; 884 } 885 886 $galleries = CataBlogGallery::getGalleries($sort, $order, $offset, $limit); 887 888 if (isset($_GET['message'])) { 889 switch ($_GET['message']) { 890 case 1: 891 $this->wp_message(__("Gallery Created Successfully.", 'catablog')); 892 break; 893 case 2: 894 $this->wp_error(__("Form Validation Error. Please check your gallery title and try again.", 'catablog')); 895 break; 896 case 3: 897 $this->wp_error(__("Form Validation Error. Please reload the page and try again.", 'catablog')); 898 break; 899 case 4: 900 $this->wp_message(__("Gallery Deleted Successfully.", 'catablog')); 901 break; 902 case 5: 903 $this->wp_error(__("Could Not Delete Gallery Because ID was non existent.", 'catablog')); 904 break; 905 case 6: 906 $this->wp_message(__('Multiple Galleries Deleted Successfully.', 'catablog')); 907 break; 908 } 909 } 910 911 include_once($this->directories['template'] . '/admin-galleries.php'); 912 } 913 798 914 799 915 public function admin_templates() { … … 947 1063 948 1064 1065 1066 1067 1068 /***************************************************** 1069 ** - ADMIN GALLERY ACTIONS 1070 *****************************************************/ 1071 public function admin_gallery_create($init_run=false) { 1072 $nonce_verified = wp_verify_nonce( $_REQUEST['_catablog_create_gallery_nonce'], 'catablog_create_gallery' ); 1073 if ($nonce_verified) { 1074 1075 $post_vars = $_POST; 1076 $post_vars = array_map('stripslashes_deep', $post_vars); 1077 1078 $new_gallery = new CataBlogGallery($post_vars); 1079 1080 $validate = $new_gallery->validate(); 1081 if ($validate === true) { 1082 $new_gallery->save(); 1083 header('Location: admin.php?page=catablog-galleries&message=1'); die; 1084 } 1085 else { 1086 header('Location: admin.php?page=catablog-galleries&message=2'); die; 1087 } 1088 1089 } 1090 else { 1091 header('Location: admin.php?page=catablog-galleries&message=3'); die; 1092 } 1093 } 1094 1095 public function admin_gallery_edit() { 1096 if (isset($_GET['id'])) { 1097 1098 if (isset($_GET['message'])) { 1099 switch ($_GET['message']) { 1100 case 1: 1101 $this->wp_message(__("Changes Saved Successfully.", 'catablog')); 1102 break; 1103 case 2: 1104 $this->wp_error(__("Form Validation Error: Please make sure your title is at least one character.", 'catablog')); 1105 break; 1106 case 3: 1107 $this->wp_error(__("Form Validation Error. Please reload the page and try again.", 'catablog')); 1108 break; 1109 } 1110 } 1111 1112 $gallery = CataBlogGallery::getGallery($_GET['id']); 1113 if (!$gallery) { 1114 include_once($this->directories['template'] . '/admin-404.php'); 1115 return false; 1116 } 1117 1118 $gallery_items = $gallery->getCataBlogItems(); 1119 include_once($this->directories['template'] . '/admin-gallery-edit.php'); 1120 } 1121 } 1122 1123 public function admin_gallery_save($init_run=false) { 1124 $nonce_verified = wp_verify_nonce( $_REQUEST['_catablog_save_gallery_nonce'], 'catablog_save_gallery' ); 1125 if ($nonce_verified) { 1126 1127 $post_vars = $_POST; 1128 $post_vars = array_map('stripslashes_deep', $post_vars); 1129 1130 $new_gallery = new CataBlogGallery($post_vars); 1131 // var_dump($new_gallery->getItemIds()); die; 1132 $validate = $new_gallery->validate(); 1133 if ($validate === true) { 1134 $new_gallery->save(); 1135 header('Location: admin.php?page=catablog-gallery-edit&id='.$new_gallery->getId().'&message=1'); die; 1136 } 1137 else { 1138 header('Location: admin.php?page=catablog-gallery-edit&id='.$new_gallery->getId().'&message=2'); die; 1139 } 1140 1141 } 1142 else { 1143 header('Location: admin.php?page=catablog-galleries&message=3'); die; 1144 } 1145 } 1146 1147 public function admin_gallery_append_new_items($init_run=false) { 1148 $nonce_verified = wp_verify_nonce( $_REQUEST['_catablog_append_gallery_nonce'], 'catablog_append_gallery' ); 1149 if ($nonce_verified) { 1150 $gallery_id = (isset($_POST['gallery_id']))? $_POST['gallery_id'] : false; 1151 $item_ids = (isset($_POST['item_ids']))? $_POST['item_ids'] : array(); 1152 1153 if ($gallery_id === false) { 1154 header('Location: admin.php?page=catablog&message=9'); die; 1155 } 1156 1157 $gallery = CataBlogGallery::getGallery($gallery_id); 1158 1159 if (get_class($gallery) !== 'CataBlogGallery') { 1160 header('Location: admin.php?page=catablog&message=9'); die; 1161 } 1162 1163 foreach ($item_ids as $item_id) { 1164 $gallery->addItem($item_id); 1165 } 1166 1167 $validate = $gallery->validate(); 1168 if ($validate === true) { 1169 $gallery->save(); 1170 header('Location: admin.php?page=catablog&message=8'); die; 1171 } 1172 else { 1173 header('Location: admin.php?page=catablog&message=10'); die; 1174 } 1175 } 1176 else { 1177 header('Location: admin.php?page=catablog&message=4'); die; 1178 } 1179 } 1180 1181 public function admin_gallery_delete($init_run=false) { 1182 if (isset($_REQUEST['id'])) { 1183 1184 check_admin_referer('catablog-gallery-delete'); 1185 1186 $gallery = CataBlogGallery::getGallery($_REQUEST['id']); 1187 if ($gallery) { 1188 $gallery->delete(); 1189 header('Location: admin.php?page=catablog-galleries&message=4'); die; 1190 } 1191 else { 1192 header('Location: admin.php?page=catablog-galleries&message=5'); die; 1193 } 1194 } 1195 } 949 1196 950 1197 … … 1776 2023 *****************************************************/ 1777 2024 public function frontend_init($load=false) { 1778 1779 // get global posts and the shortcode regex pattern1780 // global $posts;1781 // $pattern = get_shortcode_regex();1782 1783 // set load supported files variable1784 // $this->load_support_files = true;1785 1786 1787 1788 /*1789 // !!! DISABLE CACHE HERE1790 if (false) {1791 1792 // find all catablog shortcodes in posts and put them in $shortcode_matches1793 $shortcode_matches = array();1794 if ($this->load_support_files == false) {1795 foreach ($posts as $post) {1796 preg_match('/'.$pattern.'/', $post->post_content, $matches);1797 1798 if (is_array($matches) && isset($matches[2]) && is_array($matches[2])) {1799 foreach ($matches[2] as $key => $match) {1800 if ($match == 'catablog') {1801 if (isset($matches[3]) && is_array($matches[3])) {1802 $shortcode_matches[] = $matches[3][$key];1803 }1804 1805 }1806 }1807 }1808 }1809 }1810 1811 1812 // put all the category slugs into one array1813 $slugs = array();1814 foreach ($shortcode_matches as $shortcode) {1815 $atts = shortcode_parse_atts($shortcode);1816 $atts = shortcode_atts(array('category'=>false), $atts);1817 $category = $atts['category'];1818 1819 if ($category === false) {1820 $slugs = false;1821 break;1822 }1823 1824 foreach ($this->get_terms() as $term) {1825 if (strtolower($category) == strtolower($term->name)) {1826 $slugs[] = $term->slug;1827 }1828 }1829 }1830 1831 // if $slugs is an array remove duplicate entries1832 if (is_array($slugs)) {1833 $slugs = array_unique($slugs);1834 }1835 1836 // get all necessary catalog items for the page and save in cache1837 $this->results_cache = CataBlogItem::getItems($slugs, $operator, $sort, $order);1838 1839 }1840 // END DISABLED CACHE1841 */1842 1843 1844 1845 // set load_support_file to true if a catablog shortcode was found1846 // if (count($shortcode_matches) > 0) {1847 // $this->load_support_files = true;1848 // }1849 1850 // $this->load_support_files = true;1851 1852 // only load support files if catablog shortcode was found on page.1853 1854 1855 2025 // $this->load_support_files is hard set to true as a private variable of this class. 1856 2026 if ($this->load_support_files) { … … 1893 2063 echo "<!-- ".sprintf(__('CataBlog %s LightBox Styles | %s'), $this->version, $this->blog_url)." -->\n"; 1894 2064 echo "<style type='text/css'>\n ".implode(" ", $inline_styles)."\n</style>\n"; 1895 // echo "<!-- ".__('End CataBlog LightBox Inline Stylesheet')." -->\n\n";1896 2065 } 1897 2066 } … … 2035 2204 2036 2205 2206 public function frontend_shortcode_catablog_gallery($atts) { 2207 $shortcode_params = array('id'=>false, 'template'=>false, 'limit'=>-1, 'navigation'=>true); 2208 2209 extract(shortcode_atts($shortcode_params, $atts)); 2210 2211 if ($id === false) { 2212 return __("You must use the id attribute in the catablog_gallery Shortcode", "catablog"); 2213 } 2214 2215 2216 // disable navigation if it is present in the turn off words array 2217 $turn_off_nav_words = array(false, 'no', 'off', 'disable', 'disabled', 'false'); 2218 $navigation = (in_array(strtolower($navigation), $turn_off_nav_words))? false : true; 2219 2220 $paged = 0; 2221 if (isset($_REQUEST['catablog-paged'])) { 2222 $paged = (is_numeric($_REQUEST['catablog-paged']))? intval($_REQUEST['catablog-paged']) : 0; 2223 } 2224 $offset = $paged * $limit; 2225 2226 // !! NOTE: Eventually $offset and $limit should be used here for better db performance 2227 $gallery = CataBlogGallery::getGallery($id); 2228 $gallery_item_ids = $gallery->getItemIds(); 2229 $gallery_items = $gallery->getCataBlogItems(); 2230 $total = count($gallery_items); 2231 2232 if ($limit > 0) { 2233 $gallery_item_ids = array_slice($gallery_item_ids, $offset, $limit, true); 2234 } 2235 2236 ob_start(); 2237 2238 if ($navigation) { 2239 if ($this->options['nav-location'] != 'bottom') { 2240 $this->frontend_build_navigation($paged, $limit, $total); 2241 } 2242 } 2243 2244 echo "<div class='catablog-catalog'>"; 2245 foreach ($gallery_item_ids as $item_id) { 2246 echo $this->frontend_render_catalog_row($gallery_items[$item_id], $template); 2247 } 2248 echo "</div>"; 2249 2250 if ($navigation) { 2251 if ($this->options['nav-location'] != 'top') { 2252 $this->frontend_build_navigation($paged, $limit, $total); 2253 } 2254 } 2255 2256 return ob_get_clean(); 2257 } 2258 2259 2260 2037 2261 private function frontend_build_navigation($paged, $limit, $total) { 2038 2262 if ($limit > 0) { … … 2411 2635 } 2412 2636 } 2413 2414 2415 $body_array = array('action'=>'install', 'site-url'=>site_url(), 'version'=>$this->version);2416 $post_action = wp_remote_post('http://catablog.illproductions.com/tracker.php', array('body'=>$body_array));2417 2637 2418 2638 … … 2532 2752 $this->upgrade_options(); 2533 2753 $this->upgrade_directories(); 2534 2535 $body_array = array('action'=>'upgrade', 'site-url'=>site_url(), 'version'=>$this->version);2536 $post_action = wp_remote_post('http://catablog.illproductions.com/tracker.php', array('body'=>$body_array));2537 2754 2538 2755 $this->wp_message(__('CataBlog options and directories have been successfully upgraded.', 'catablog')); -
catablog/trunk/lib/CataBlogItem.class.php
r514984 r516953 5 5 * This file contains the class for each CataBlog Item that is fetched from the database. 6 6 * @author Zachary Segal <zac@illproductions.com> 7 * @version 1.4. 47 * @version 1.4.8 8 8 * @package catablog 9 9 */ … … 265 265 266 266 $items[] = $item; 267 } 268 269 return $items; 270 } 271 272 273 274 /** 275 * Get a collection of catalog items from the database using an array of ids. 276 * May possibly return an empty array. 277 * 278 * @param ids $ids The array of catalog item ids to be fetched from the database. 279 * @return array An array of CataBlogItem objects 280 */ 281 public static function getItemsByIds($ids) { 282 283 $items = array(); 284 285 if (!is_array($ids) || empty($ids)) { 286 $ids = array(-1); 287 } 288 289 $cata = new CataBlogItem(); 290 291 $params = array( 292 'post_type'=> $cata->getCustomPostName(), 293 'post__in'=> $ids, 294 ); 295 296 $posts = get_posts($params); 297 298 // return an array of CataBlogItems 299 foreach ($posts as $post) { 300 301 $item = new CataBlogItem(); 302 303 $item->id = $post->ID; 304 $item->title = $post->post_title; 305 $item->description = $post->post_content; 306 $item->date = $post->post_date; 307 $item->categories = array(); 308 $item->order = $post->menu_order; 309 $item->_post_name = $post->post_name; 310 311 $item_cats = array(); 312 if (true) { // $load_categories 313 $category_ids = array(); 314 $terms = get_the_terms($post->ID, $item->_custom_tax_name); 315 if (is_array($terms)) { 316 foreach ($terms as $term) { 317 $category_ids[$term->term_id] = $term->name; 318 } 319 } 320 $item->categories = $category_ids; 321 } 322 323 $meta = get_post_meta($post->ID, $item->_post_meta_name, true); 324 $item->processPostMeta($meta); 325 326 $items[$item->id] = $item; 267 327 } 268 328 -
catablog/trunk/lib/CataBlogWidget.class.php
r514984 r516953 5 5 * This file contains the widget classes for the CataBlog WordPress Plugin. 6 6 * @author Zachary Segal <zac@illproductions.com> 7 * @version 1.4. 47 * @version 1.4.8 8 8 * @package catablog 9 9 */ -
catablog/trunk/readme.txt
r514984 r516953 101 101 102 102 == Changelog == 103 104 = 1.4.8 = 105 * New: Beta version of the new Galleries feature. 103 106 104 107 = 1.4.4 = -
catablog/trunk/templates/admin-library.php
r407470 r516953 34 34 <option value="">- <?php _e("Bulk Actions", 'catablog'); ?></option> 35 35 <option value="edit-category"><?php _e("Edit Categories", 'catablog'); ?></option> 36 <option value="add-to-gallery"><?php _e("Add to Gallery", 'catablog'); ?></option> 36 37 <option value="delete"><?php _e("Delete", 'catablog'); ?></option> 37 38 </select> … … 198 199 </div> 199 200 201 202 <div id="add-to-gallery-window" class="catablog-modal"> 203 <form id="catablog-add-to-gallery" class="catablog-form" method="post" action="admin.php?page=catablog-gallery-append"> 204 <h3 class="catablog-modal-title"> 205 <span style="float:right;"><a href="#" class="hide-modal-window"><?php _e("[close]", 'catablog'); ?></a></span> 206 <strong><?php _e("Add Catalog Item's To Gallery", 'catablog'); ?></strong> 207 </h3> 208 209 <div class="catablog-modal-body"> 210 211 212 <select name="gallery_id" id="catablog_gallery_id"> 213 <option value="-1">- <?php _e("Select a Gallery", "catablog"); ?></option> 214 <?php foreach(CataBlogGallery::getGalleries('title') as $gallery): ?> 215 <?php echo "<option value='{$gallery->getId()}'>{$gallery->getTitle()}</option>"?> 216 <?php endforeach; ?> 217 </select> 218 219 <?php wp_nonce_field( 'catablog_append_gallery', '_catablog_append_gallery_nonce', false, true ) ?> 220 221 <input type="submit" name="save" value="<?php _e("Add To Gallery", 'catablog'); ?>" class="button-primary" /> 222 <p><small> 223 <?php _e("Select the gallery you would like the selected library item to be added to.", 'catablog'); ?><br /> 224 <?php _e("Note that a library item may be in more than one gallery, or in a gallery more than one time.", "catablog"); ?><br /> 225 <?php _e("Also note that if you delete a library item, it will be removed from all galleries.", "catablog"); ?><br /> 226 </small></p> 227 </div> 228 229 </form> 230 </div> 231 200 232 </div> 201 233 … … 233 265 checked_catalog_items.each(function() { 234 266 $('#catablog-edit-category').append("<input type='hidden' name='bulk_selection[]' value='"+this.value+"' />"); 267 }); 268 269 return false; 270 } 271 272 // add library items to a gallery 273 if ($('#bulk-action').val() == 'add-to-gallery') { 274 275 jQuery('#add-to-gallery-window').show(); 276 jQuery('#catablog_load_curtain').fadeTo(200, 0.8); 277 278 checked_catalog_items.each(function() { 279 $('#catablog-add-to-gallery').append("<input type='hidden' name='item_ids[]' value='"+this.value+"' />"); 235 280 }); 236 281 … … 334 379 return false; 335 380 } 336 337 338 339 340 <?php /* 341 342 // lazy load the images 343 calculate_lazy_loads(); 344 $(window).bind('scroll resize', function(event) { 345 calculate_lazy_loads(); 346 }); 347 348 349 // initialize the sortables 350 var catablog_items_path = "#catablog_items"; 351 $(catablog_items_path).sortable({ 352 disabled: true, 353 forcePlaceholderSize: true, 354 opacity: 0.7, 355 <?php echo ($view == 'list')? "axis: 'y'" : "" ?> 356 }); 357 358 359 $('#enable_sort').bind('click', function(event) { 360 if ($(this).attr('disabled')) { 361 alert('<?php _e("This feature only works when viewing a single category.", "catablog"); ?>'); 362 return false; 363 } 364 365 var items = $(catablog_items_path); 366 if ($(this).hasClass('button-primary')) { 367 368 // disable sortable and save order using ajax 369 items.sortable('option', 'disabled', true); 370 ajax_save_order(); 371 372 // remove disable link classes and show bulk selection 373 items.find('a').removeClass('cb_disabled_link'); 374 items.find('input.bulk_selection').show(); 375 unbind_discourage_leaving_page(); 376 377 // enable selection of text and remove sort enabled class 378 items.enableSelection(); 379 items.removeClass('sort_enabled'); 380 381 // swap button to original state 382 $(this).html('Change Order').removeClass('button-primary'); 383 } 384 else { 385 386 // disable links, hide bulk selection and discourage leaving page 387 items.find('a').addClass('cb_disabled_link'); 388 items.find('input.bulk_selection').hide(); 389 390 discourage_leaving_page('<?php _e("You have not saved your order. If you leave now you will loose your changes. Are you sure you want to continue leaving this page?", "catablog"); ?>'); 391 392 // disable selection of text and add sort enabled class 393 items.disableSelection(); 394 items.addClass('sort_enabled'); 395 396 // enable sortable items 397 items.sortable('option', 'disabled', false); 398 399 // display helpful message to user 400 var help_message = '<?php _e("Drag the items below to rearrange their order.", "catablog"); ?>'; 401 $('#message strong').html(help_message); 402 $('#message').show(); 403 404 // swap button to active state 405 $(this).html('Save Order').addClass('button-primary'); 406 } 407 408 return false; 409 }); 410 411 function ajax_save_order() { 412 var ids = []; 413 $('#catablog_items input.bulk_selection').each(function(i) { 414 var id = $(this).attr('value'); 415 ids.push(id); 416 }); 417 418 var params = { 419 'action': 'catablog_reorder', 420 'security': '<?php echo wp_create_nonce("catablog-reorder") ?>', 421 'ids[]': ids 422 } 423 424 $('#message strong').html('<?php _e("Saving new catalog order...", "catablog"); ?>'); 425 $.post(ajaxurl, params, function(data) { 426 $('#message strong').html('<?php _e("Your catalog items have been rearranged successfully.", "catablog"); ?>'); 427 }); 428 } 429 */ 430 ?> 431 381 432 382 }); 433 383 </script>
Note: See TracChangeset
for help on using the changeset viewer.