Changeset 707277
- Timestamp:
- 05/03/2013 06:02:59 AM (13 years ago)
- Location:
- cross-network-posts/trunk
- Files:
-
- 1 added
- 1 edited
-
cnp-build-shortcode.php (added)
-
cnp.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cross-network-posts/trunk/cnp.php
r706376 r707277 113 113 114 114 //append the icon 115 $context .= "<a class=' thickbox' title='{$title}'116 href='#TB_inline?width= 400&inlineId={$container_id}'>115 $context .= "<a class='button thickbox' title='{$title}' 116 href='#TB_inline?width=100%&inlineId={$container_id}'> 117 117 CNP</a>"; 118 118 … … 156 156 $result = get_categories( $args ); 157 157 } 158 if($type == 'post'){ 159 $args = array( 160 'posts_per_page' => -1, 161 'category' => '', 162 'orderby' => 'post_date', 163 'order' => 'DESC', 164 'include' => '', 165 'exclude' => '', 166 'meta_key' => '', 167 'meta_value' => '', 168 'post_type' => 'post', 169 'post_mime_type' => '', 170 'post_parent' => '', 171 'post_status' => 'publish', 172 'suppress_filters' => true); 173 $result = get_posts( $args ); 174 } 158 175 if(ms_is_switched()){ 159 176 if( function_exists('restore_current_blog')){ restore_current_blog();} … … 168 185 function add_cnp_inline_popup_content() { 169 186 ?> 187 <style> 188 fieldset{ 189 width:49%; 190 float:left; 191 } 192 fieldset#result{ 193 width: 100%; 194 } 195 </style> 170 196 <div id="cnp_popup_container" style="display:none;"> 171 197 <form method="post" action=""> 198 <fieldset name="content" title="Content" class="cnp-content-field"> 172 199 <h4>Choose type of content</h4> 173 200 <input type="radio" name="cnp-type" value="post" class="cnp-type" id="cnp-type-post" /><label for="cnp-type-post">Single post</label><br /> 174 <input type="radio" name="cnp-type" value="category" class="cnp-type" id="cnp-type-category" /><label for="cnp-type-category">Posts from category</label>175 <h4> Choose which blog you want to get the content from</h4>201 <input type="radio" name="cnp-type" value="category" class="cnp-type" id="cnp-type-category"/><label for="cnp-type-category">Posts from category</label> 202 <h4>Select the website and content</h4> 176 203 <?php 177 204 foreach(cnp_get_blogs() as $blog): 178 205 ?> 179 206 <input type="radio" name="cnp-blogid" value="<?php echo $blog['blog_id'];?>" class="cnp-blogid" id="cnp-type-blogid-<?php echo $blog['blog_id'];?>" /><label for="cnp-type-blogid-<?php echo $blog['blog_id'];?>"><?php echo $blog['path'];?></label><br /> 180 <select name="cnp-categoryid" class="cnp-categoryid">207 <select style="display:none;" name="cnp-categoryid" class="cnp-categories cnp-categoryid-<?php echo $blog['blog_id'];?>"> 181 208 <?php 182 209 foreach(cnp_get_content($blog['blog_id'],'cat') as $category):?> … … 184 211 <?php 185 212 endforeach; 186 ?></select><br /> 213 ?></select> 214 <select style="display:none;" name="cnp-postid" class="cnp-posts cnp-postid-<?php echo $blog['blog_id'];?>"> 215 <?php 216 foreach(cnp_get_content($blog['blog_id'],'post') as $post):?> 217 <option value="<?php echo $post->ID;?>"/><?php echo $post->post_title;?></option> 218 <?php 219 endforeach; 220 ?></select> 221 <br /> 187 222 <?php 188 223 endforeach; 189 224 ?> 190 <div class="cnpwizard"></div> 225 </fieldset> 226 <fieldset name="attributes" title="Optional attributes" class="cnp-attribute-field"> 227 <h4>Optional attributes</h4> 228 <input type="checkbox" name="excerpt" id="cnp-excerpt" value="false" /><label for="cnp-excerpt">Only show excerpts (default is full post)</label><br /> 229 <label for="header">Header numer (default: 2)</label><input type="text" maxlength="1" name="header" id="header" /><br /> 230 <label for="numberofposts">Number of posts (default: 5)</label><input type="text" name="numberofposts" id="numberofposts" /><br /> 231 <label for="titlelink">Do not link post title (default: has a link)</label><input type="checkbox" maxlength="1" name="numberofposts" id="titlelink" value="false" /> 232 </fieldset> 233 234 <fieldset name="result" id="result"> 235 <input type="button" value="Build shortcode" class="cnp-build-schortcode"/> 236 <h3>The shortcode is:</h3> 237 <div class="cnp-shortcode"></div> 238 </fieldset> 191 239 </form> 192 240 193 241 <script type="text/javascript"> 242 jQuery('.cnp-type').on('click',function(){ 243 if(jQuery('.cnp-type:checked').val() == 'post'){ 244 jQuery('.cnp-categories').hide(); 245 jQuery('.cnp-posts').show(); 246 }else if(jQuery('.cnp-type:checked').val() == 'category'){ 247 jQuery('.cnp-categories').show(); 248 jQuery('.cnp-posts').hide(); 249 } 250 }); 251 jQuery('.cnp-build-schortcode').on('click', function(){ 252 jQuery('.cnp-shortcode').text('Loading, please wait...'); 253 var _type = jQuery('.cnp-type:checked').val(); 254 var _blogid = jQuery('.cnp-blogid:checked').val(); 255 var _postid = jQuery('.cnp-postid-'+_blogid+' option:selected').val(); 256 var _catid = jQuery('.cnp-categoryid-'+_blogid+' option:selected').val(); 257 var _excerpt = jQuery('#cnp-excerpt:checked').val(); 258 var _titlelink = jQuery('#titlelink:checked').val(); 259 var _numberofposts = jQuery('#numberofposts').val(); 260 if(_numberofposts == ""){ 261 _numberofposts = null; 262 } 263 var _header = jQuery('#header').val(); 264 if(_header == ""){ 265 _header = null; 266 } 267 268 jQuery.ajax({ 269 type: "POST", 270 url: "<?php echo plugins_url("cnp-build-shortcode.php" , __FILE__ );?>", 271 data: { type: _type, blogid: _blogid, postid: _postid, catid: _catid, excerpt: _excerpt, titlelink: _titlelink, numberofposts: _numberofposts, header: _header } 272 }).done(function(data){ 273 jQuery('.cnp-shortcode').text(data); 274 }); 275 }); 194 276 // jQuery('.cnp-blogid').on('click',function(){ 195 277 // jQuery.getJSON('<?php echo plugins_url("cnp-get-blogs.php" , __FILE__ );?>', function(data) {
Note: See TracChangeset
for help on using the changeset viewer.