Changeset 893715
- Timestamp:
- 04/15/2014 04:21:26 PM (12 years ago)
- Location:
- filament/branches/jsonp
- Files:
-
- 2 edited
-
filament.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
filament/branches/jsonp/filament.php
r887038 r893715 4 4 Plugin URI: http://filament.io/ 5 5 Description: Install & manage all your Web apps from a single place. Connect your website to Filament with this plugin, and never bug your developers again! 6 Version: 1. 1.06 Version: 1.2.0 7 7 Author: dtelepathy 8 8 Author URI: http://www.dtelepathy.com/ … … 31 31 var $slug = "filament"; 32 32 var $menu_hooks = array(); 33 var $version = '1. 1.0';33 var $version = '1.2.0'; 34 34 35 35 /** … … 129 129 */ 130 130 public function ajax_taxonomy_structure() { 131 header( 'Content-type: application/json' ); 131 $header = "application/json"; 132 133 if( isset( $_REQUEST['callback'] ) ) { 134 $callback = preg_replace( "/([^A-Za-z0-9_\$\.]+)/", "", $_REQUEST['callback'] ); 135 $header = "application/javascript"; 136 } 137 138 header( 'Content-type: ' . $header ); 132 139 133 140 $structure = array( … … 139 146 $post_types = wp_cache_get( 'post_types', $this->slug ); 140 147 if( !$post_types ) { 141 $post_types = get_post_types( array( 'public' => true ) ); 148 $post_types = array(); 149 $post_type_slugs = get_post_types( array( 'public' => true ) ); 150 151 foreach( $post_type_slugs as $post_type_slug ) $post_types[] = get_post_type_object( $post_type_slug ); 152 142 153 wp_cache_set( 'post_types', $post_types, $this->slug, 3600 ); 143 154 } … … 155 166 } 156 167 157 $structure['post_types'] = array_values( $post_types );158 foreach( $categories as $category ) $structure['categories'][ ] = $category->slug;159 foreach( $tags as $tag ) $structure['tags'][ ] = $tag->slug;168 foreach( $post_types as $post_type ) $structure['post_types'][$post_type->name] = $post_type->label; 169 foreach( $categories as $category ) $structure['categories'][$category->slug] = $category->name; 170 foreach( $tags as $tag ) $structure['tags'][$tag->slug] = $tag->name; 160 171 161 exit( json_encode( $structure ) ); 172 $data = json_encode( $structure ); 173 174 if( isset( $callback ) && !empty( $callback ) ) { 175 $data = "$callback($data)"; 176 } 177 178 exit( $data ); 162 179 } 163 180 -
filament/branches/jsonp/readme.txt
r887038 r893715 47 47 48 48 == Changelog == 49 = 1.2.0 = 50 * Modify AJAX end-point to respond to JSONP requests with a _REQUEST['callback'] parameter 51 * Restructure post_types structure in AJAX end-point response to respond with a key/value pair of name and label 52 49 53 = 1.1.0 = 50 54 * Add save messaging to admin view
Note: See TracChangeset
for help on using the changeset viewer.