Advertisement
Guest User

Untitled

a guest
Jul 12th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.57 KB | None | 0 0
  1. <?php
  2.     $post       = false;
  3.     $post_id    = -1;
  4.     $featured_img_html = '';
  5.     if( isset($_GET['fep_id']) && isset($_GET['fep_action']) && $_GET['fep_action'] == 'edit' ){
  6.         $post_id            = $_GET['fep_id'];
  7.         $p                  = get_post($post_id, 'ARRAY_A');
  8.         if($p['post_author'] != $current_user->ID) return 'You don\'t have permission to edit this post';
  9.         $category           = get_the_category($post_id);
  10.         $tags               = wp_get_post_tags( $post_id, array( 'fields' => 'names' ) );
  11.         $featured_img       = get_post_thumbnail_id( $post_id );
  12.         $featured_img_html  = (!empty($featured_img))?wp_get_attachment_image( $featured_img, array(200,200) ):'';
  13.         $post               = array(
  14.                                 'title'             => $p['post_title'],
  15.                                 'content'           => $p['post_content'],
  16.                                 'about_the_author'  => get_post_meta($post_id, 'about_the_author', true)
  17.                             );
  18.         if(isset($category[0]) && is_array($category))
  19.             $post['category']   = $category[0]->cat_ID;
  20.         if(isset($tags) && is_array($tags))
  21.             $post['tags']       = implode(', ', $tags);
  22.     }
  23. ?>
  24. <noscript><div id="no-js" class="warning">This form needs JavaScript to function properly. Please turn on JavaScript and try again!</div></noscript>
  25. <div id="fep-new-post">
  26.     <div id="fep-message" class="warning"></div>
  27.     <form id="fep-submission-form">
  28.        
  29.         <?php
  30. $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  31.  
  32.  
  33. if (false !== strpos($url,'fep_action=edit')) {
  34.     echo 'Link verwijderen? Klik op GO !<input type="hidden" name="post_title" id="fep-post-title" value="VERWIJDEREN"><br/>';
  35.    
  36.    
  37.    
  38. } else {
  39.  
  40.  
  41. ======>>>>>>>>>>>>>>>>>>
  42.    echo 'We only accept links from:<br><img src="shops.jpg" border="0"><br>(binnenkort meer)<br><label for="fep-post-title">Link/URL naar productpagina:</label><br/><input type="text" name="post_title" id="fep-post-title" value=""><br/>';
  43. }
  44. ?>
  45.        
  46.         <<<<<<==================================
  47.        
  48.         <input type="hidden" name="post_id" id="fep-post-id" value="<?php echo $post_id ?>">
  49.        
  50.         <button type="button" id="fep-submit-post" class="active-btn">Go</button><img class="fep-loading-img" src="<?php echo plugins_url( 'static/img/ajax-loading.gif', dirname(__FILE__) ); ?>"/>
  51.     </form>
  52.    
  53.    
  54.  
  55. <div id="fep-new-postdd" style="visibility:hidden;height:0px;width:0px;overflow: auto;"><label for="fep-post-content">Content</label><br/>      <?php           $enable_media = (isset($fep_roles['enable_media']) && $fep_roles['enable_media'])?current_user_can($fep_roles['enable_media']):1;          
  56. wp_editor( $post['content'], 'fep-post-content', $settings = array('editor_height' => 10) );            wp_nonce_field('fepnonce_action','fepnonce');       ?>     
  57.  
  58. <?php if(!$fep_misc['disable_author_bio']): ?>          <label for="fep-about">Author Bio</label><br/>          <textarea name="about_the_author" id="fep-about" rows="1"><?php echo ($post) ? $post['about_the_author']:''; ?></textarea><br/>     <?php else: ?>          <input type="hidden" name="about_the_author" id="fep-about" value="-1">     <?php endif; ?>     <label for="fep-category">Category</label><br/>     <?php wp_dropdown_categories(array('id'=>'fep-category', 'hide_empty' => 0, 'name' => 'post_category', 'orderby' => 'name', 'selected' => $post['category'], 'hierarchical' => true)); ?><br/>      <label for="fep-tags">Tags</label><br/>     <input type="text" name="post_tags" id="fep-tags" value="<?php echo ($post) ? $post['tags']:''; ?>"><br/>       <div id="fep-featured-image">           <div id="fep-featured-image-container"><?php echo $featured_img_html; ?></div>          <a id="fep-featured-image-link" href="#">Choose Featured Image</a>          <input type="hidden" id="fep-featured-image-id" value="<?php echo (!empty($featured_img))?$featured_img:'-1'; ?>"/>     </div></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement