234 } else { |
234 } else { |
235 if ( ! current_user_can( 'edit_posts' ) ) |
235 if ( ! current_user_can( 'edit_posts' ) ) |
236 wp_die( __('You are not allowed to edit posts.') ); |
236 wp_die( __('You are not allowed to edit posts.') ); |
237 } |
237 } |
238 |
238 |
|
239 if ( -1 == $post_data['_status'] ) { |
|
240 $post_data['post_status'] = null; |
|
241 unset($post_data['post_status']); |
|
242 } else { |
|
243 $post_data['post_status'] = $post_data['_status']; |
|
244 } |
|
245 unset($post_data['_status']); |
|
246 |
239 $post_IDs = array_map( 'intval', (array) $post_data['post'] ); |
247 $post_IDs = array_map( 'intval', (array) $post_data['post'] ); |
240 |
248 |
241 $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' ); |
249 $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' ); |
242 foreach ( $reset as $field ) { |
250 foreach ( $reset as $field ) { |
243 if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) ) |
251 if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) ) |
316 * @since unknown |
324 * @since unknown |
317 * |
325 * |
318 * @return unknown |
326 * @return unknown |
319 */ |
327 */ |
320 function get_default_post_to_edit() { |
328 function get_default_post_to_edit() { |
|
329 |
|
330 $post_title = ''; |
321 if ( !empty( $_REQUEST['post_title'] ) ) |
331 if ( !empty( $_REQUEST['post_title'] ) ) |
322 $post_title = esc_html( stripslashes( $_REQUEST['post_title'] )); |
332 $post_title = esc_html( stripslashes( $_REQUEST['post_title'] )); |
323 else if ( !empty( $_REQUEST['popuptitle'] ) ) { |
|
324 $post_title = esc_html( stripslashes( $_REQUEST['popuptitle'] )); |
|
325 $post_title = funky_javascript_fix( $post_title ); |
|
326 } else { |
|
327 $post_title = ''; |
|
328 } |
|
329 |
333 |
330 $post_content = ''; |
334 $post_content = ''; |
331 if ( !empty( $_REQUEST['content'] ) ) |
335 if ( !empty( $_REQUEST['content'] ) ) |
332 $post_content = esc_html( stripslashes( $_REQUEST['content'] )); |
336 $post_content = esc_html( stripslashes( $_REQUEST['content'] )); |
333 else if ( !empty( $post_title ) ) { |
337 |
334 $text = esc_html( stripslashes( urldecode( $_REQUEST['text'] ) ) ); |
338 $post_excerpt = ''; |
335 $text = funky_javascript_fix( $text); |
|
336 $popupurl = esc_url($_REQUEST['popupurl']); |
|
337 $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text"; |
|
338 } |
|
339 |
|
340 if ( !empty( $_REQUEST['excerpt'] ) ) |
339 if ( !empty( $_REQUEST['excerpt'] ) ) |
341 $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] )); |
340 $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] )); |
342 else |
|
343 $post_excerpt = ''; |
|
344 |
341 |
345 $post->ID = 0; |
342 $post->ID = 0; |
346 $post->post_name = ''; |
343 $post->post_name = ''; |
347 $post->post_author = ''; |
344 $post->post_author = ''; |
348 $post->post_date = ''; |
345 $post->post_date = ''; |
679 |
684 |
680 if ( '' === trim( $meta_value ) ) |
685 if ( '' === trim( $meta_value ) ) |
681 return false; |
686 return false; |
682 |
687 |
683 $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) ); |
688 $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) ); |
684 wp_cache_delete($post_id, 'post_meta'); |
689 |
685 |
690 $meta_value = maybe_serialize( stripslashes_deep( $meta_value ) ); |
686 $meta_value = maybe_serialize( stripslashes( $meta_value ) ); |
|
687 $meta_id = (int) $meta_id; |
691 $meta_id = (int) $meta_id; |
688 |
692 |
689 $data = compact( 'meta_key', 'meta_value' ); |
693 $data = compact( 'meta_key', 'meta_value' ); |
690 $where = compact( 'meta_id' ); |
694 $where = compact( 'meta_id' ); |
691 |
695 |
692 return $wpdb->update( $wpdb->postmeta, $data, $where ); |
696 do_action( 'update_postmeta', $meta_id, $post_id, $meta_key, $meta_value ); |
|
697 $rval = $wpdb->update( $wpdb->postmeta, $data, $where ); |
|
698 wp_cache_delete($post_id, 'post_meta'); |
|
699 do_action( 'updated_postmeta', $meta_id, $post_id, $meta_key, $meta_value ); |
|
700 |
|
701 return $rval; |
693 } |
702 } |
694 |
703 |
695 // |
704 // |
696 // Private |
705 // Private |
697 // |
706 // |
731 $attachment = add_magic_quotes( $attachment); |
741 $attachment = add_magic_quotes( $attachment); |
732 wp_update_post( $attachment); |
742 wp_update_post( $attachment); |
733 } |
743 } |
734 |
744 |
735 $post_search[$i] = $anchor; |
745 $post_search[$i] = $anchor; |
736 $post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor ); |
746 $_fix_attachment_link_id = $id; |
|
747 $post_replace[$i] = preg_replace_callback( "#href=(\"|')[^'\"]*\\1#", '_fix_attachment_links_replace_cb', $anchor ); |
737 ++$i; |
748 ++$i; |
738 } |
749 } |
739 |
750 |
740 $post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] ); |
751 $post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] ); |
741 |
752 |
742 // Escape data pulled from DB. |
753 // Escape data pulled from DB. |
743 $post = add_magic_quotes( $post); |
754 $post = add_magic_quotes( $post); |
744 |
755 |
745 return wp_update_post( $post); |
756 return wp_update_post( $post); |
|
757 } |
|
758 |
|
759 function _fix_attachment_links_replace_cb($match) { |
|
760 global $_fix_attachment_link_id; |
|
761 return stripslashes( 'href='.$match[1] ).get_attachment_link( $_fix_attachment_link_id ).stripslashes( $match[1] ); |
746 } |
762 } |
747 |
763 |
748 /** |
764 /** |
749 * Move child posts to a new parent. |
765 * Move child posts to a new parent. |
750 * |
766 * |
793 'publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')), |
819 'publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')), |
794 'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')), |
820 'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')), |
795 'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), |
821 'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), |
796 'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), |
822 'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), |
797 'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')), |
823 'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')), |
|
824 'trash' => array(_x('Trash', 'post'), __('Trash posts'), _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')), |
798 ); |
825 ); |
799 |
826 |
800 $post_stati = apply_filters('post_stati', $post_stati); |
827 $post_stati = apply_filters('post_stati', $post_stati); |
801 |
828 |
802 $avail_post_stati = get_available_post_statuses('post'); |
829 $avail_post_stati = get_available_post_statuses('post'); |
816 } else { |
843 } else { |
817 $order = 'DESC'; |
844 $order = 'DESC'; |
818 $orderby = 'date'; |
845 $orderby = 'date'; |
819 } |
846 } |
820 |
847 |
821 $posts_per_page = get_user_option('edit_per_page'); |
848 $posts_per_page = (int) get_user_option( 'edit_per_page', 0, false ); |
822 if ( empty($posts_per_page) ) |
849 if ( empty( $posts_per_page ) || $posts_per_page < 1 ) |
823 $posts_per_page = 15; |
850 $posts_per_page = 15; |
824 $posts_per_page = apply_filters('edit_posts_per_page', $posts_per_page); |
851 $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page ); |
825 |
852 |
826 wp("post_type=post&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby"); |
853 wp("post_type=post&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby"); |
827 |
854 |
828 return array($post_stati, $avail_post_stati); |
855 return array($post_stati, $avail_post_stati); |
|
856 } |
|
857 |
|
858 /** |
|
859 * Get default post mime types |
|
860 * |
|
861 * @since 2.9.0 |
|
862 * |
|
863 * @return array |
|
864 */ |
|
865 function get_post_mime_types() { |
|
866 $post_mime_types = array( // array( adj, noun ) |
|
867 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), |
|
868 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), |
|
869 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')), |
|
870 ); |
|
871 |
|
872 return apply_filters('post_mime_types', $post_mime_types); |
829 } |
873 } |
830 |
874 |
831 /** |
875 /** |
832 * {@internal Missing Short Description}} |
876 * {@internal Missing Short Description}} |
833 * |
877 * |
856 $q = $_GET; |
900 $q = $_GET; |
857 |
901 |
858 $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; |
902 $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0; |
859 $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; |
903 $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0; |
860 $q['post_type'] = 'attachment'; |
904 $q['post_type'] = 'attachment'; |
861 $q['post_status'] = 'any'; |
905 $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : 'inherit'; |
862 $media_per_page = get_user_option('upload_per_page'); |
906 $media_per_page = (int) get_user_option( 'upload_per_page', 0, false ); |
863 if ( empty($media_per_page) ) |
907 if ( empty( $media_per_page ) || $media_per_page < 1 ) |
864 $media_per_page = 20; |
908 $media_per_page = 20; |
865 $q['posts_per_page'] = $media_per_page; |
909 $q['posts_per_page'] = apply_filters( 'upload_per_page', $media_per_page ); |
866 $post_mime_types = array( // array( adj, noun ) |
910 |
867 'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), |
911 $post_mime_types = get_post_mime_types(); |
868 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), |
|
869 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')), |
|
870 ); |
|
871 $post_mime_types = apply_filters('post_mime_types', $post_mime_types); |
|
872 |
|
873 $avail_post_mime_types = get_available_post_mime_types('attachment'); |
912 $avail_post_mime_types = get_available_post_mime_types('attachment'); |
874 |
913 |
875 if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) ) |
914 if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) ) |
876 unset($q['post_mime_type']); |
915 unset($q['post_mime_type']); |
877 |
916 |
922 |
961 |
923 // Hack: get_permalink would return ugly permalink for |
962 // Hack: get_permalink would return ugly permalink for |
924 // drafts, so we will fake, that our post is published |
963 // drafts, so we will fake, that our post is published |
925 if (in_array($post->post_status, array('draft', 'pending'))) { |
964 if (in_array($post->post_status, array('draft', 'pending'))) { |
926 $post->post_status = 'publish'; |
965 $post->post_status = 'publish'; |
927 $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID); |
966 $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID); |
928 } |
967 } |
929 |
968 |
930 $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent); |
969 $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent); |
931 |
970 |
932 // If the user wants to set a new name -- override the current one |
971 // If the user wants to set a new name -- override the current one |
933 // Note: if empty name is supplied -- use the title instead, see #6072 |
972 // Note: if empty name is supplied -- use the title instead, see #6072 |
934 if (!is_null($name)) { |
973 if (!is_null($name)) { |
935 $post->post_name = sanitize_title($name? $name : $title, $post->ID); |
974 $post->post_name = sanitize_title($name ? $name : $title, $post->ID); |
936 } |
975 } |
937 |
976 |
938 $post->filter = 'sample'; |
977 $post->filter = 'sample'; |
939 |
978 |
940 $permalink = get_permalink($post, true); |
979 $permalink = get_permalink($post, true); |
958 |
997 |
959 return $permalink; |
998 return $permalink; |
960 } |
999 } |
961 |
1000 |
962 /** |
1001 /** |
963 * {@internal Missing Short Description}} |
1002 * sample permalink html |
964 * |
1003 * |
965 * @since unknown |
1004 * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. |
966 * |
1005 * |
967 * @param unknown_type $id |
1006 * @since unknown |
968 * @param unknown_type $new_title |
1007 * |
969 * @param unknown_type $new_slug |
1008 * @param int|object $id Post ID or post object. |
970 * @return unknown |
1009 * @param string $new_title (optional) New title |
|
1010 * @param string $new_slug (optional) New slug |
|
1011 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. |
971 */ |
1012 */ |
972 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { |
1013 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { |
973 $post = &get_post($id); |
1014 $post = &get_post($id); |
974 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); |
1015 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); |
975 if ( 'publish' == $post->post_status ) |
1016 |
|
1017 if ( 'publish' == $post->post_status ) { |
976 $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page'); |
1018 $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page'); |
|
1019 $title = __('Click to edit this part of the permalink'); |
|
1020 } else { |
|
1021 $title = __('Temporary permalink. Click to edit this part.'); |
|
1022 } |
977 |
1023 |
978 if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { |
1024 if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { |
979 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; |
1025 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n"; |
980 if ( current_user_can( 'manage_options' ) ) |
1026 if ( current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) |
981 $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; |
1027 $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; |
982 if ( isset($view_post) ) |
1028 if ( isset($view_post) ) |
983 $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n"; |
1029 $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n"; |
984 |
1030 |
|
1031 $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); |
|
1032 |
985 return $return; |
1033 return $return; |
986 } |
1034 } |
987 |
1035 |
988 $title = __('Click to edit this part of the permalink'); |
1036 if ( function_exists('mb_strlen') ) { |
989 if (function_exists('mb_strlen')) { |
1037 if ( mb_strlen($post_name) > 30 ) { |
990 if (mb_strlen($post_name) > 30) { |
|
991 $post_name_abridged = mb_substr($post_name, 0, 14). '…' . mb_substr($post_name, -14); |
1038 $post_name_abridged = mb_substr($post_name, 0, 14). '…' . mb_substr($post_name, -14); |
992 } else { |
1039 } else { |
993 $post_name_abridged = $post_name; |
1040 $post_name_abridged = $post_name; |
994 } |
1041 } |
995 } else { |
1042 } else { |
996 if (strlen($post_name) > 30) { |
1043 if ( strlen($post_name) > 30 ) { |
997 $post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14); |
1044 $post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14); |
998 } else { |
1045 } else { |
999 $post_name_abridged = $post_name; |
1046 $post_name_abridged = $post_name; |
1000 } |
1047 } |
1001 } |
1048 } |
1002 |
1049 |
1003 $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; |
1050 $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; |
1004 $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); |
1051 $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); |
1005 $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); |
1052 $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); |
1006 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n"; |
1053 $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n"; |
1007 $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n"; |
1054 $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n"; |
1008 $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n"; |
1055 $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n"; |
1009 if ( isset($view_post) ) |
1056 if ( isset($view_post) ) |
1010 $return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n"; |
1057 $return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n"; |
1011 |
1058 |
|
1059 $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); |
|
1060 |
1012 return $return; |
1061 return $return; |
1013 } |
1062 } |
1014 |
1063 |
1015 /** |
1064 /** |
1016 * {@internal Missing Short Description}} |
1065 * Output HTML for the post thumbnail meta-box. |
1017 * |
1066 * |
1018 * @since unknown |
1067 * @since 2.9.0 |
1019 * |
1068 * |
1020 * @param unknown_type $post_id |
1069 * @param int $thumbnail_id ID of the attachment used for thumbnail |
|
1070 * @return string html |
|
1071 */ |
|
1072 function _wp_post_thumbnail_html( $thumbnail_id = NULL ) { |
|
1073 global $content_width, $_wp_additional_image_sizes; |
|
1074 $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>'; |
|
1075 |
|
1076 if ( $thumbnail_id && get_post( $thumbnail_id ) ) { |
|
1077 $old_content_width = $content_width; |
|
1078 $content_width = 266; |
|
1079 if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) ) |
|
1080 $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) ); |
|
1081 else |
|
1082 $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' ); |
|
1083 if ( !empty( $thumbnail_html ) ) { |
|
1084 $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>'; |
|
1085 $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>'; |
|
1086 } |
|
1087 $content_width = $old_content_width; |
|
1088 } |
|
1089 |
|
1090 return apply_filters( 'admin_post_thumbnail_html', $content ); |
|
1091 } |
|
1092 |
|
1093 /** |
|
1094 * Check to see if the post is currently being edited by another user. |
|
1095 * |
|
1096 * @since 2.5.0 |
|
1097 * |
|
1098 * @param int $post_id ID of the post to check for editing |
1021 * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock. |
1099 * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock. |
1022 */ |
1100 */ |
1023 function wp_check_post_lock( $post_id ) { |
1101 function wp_check_post_lock( $post_id ) { |
1024 global $current_user; |
1102 global $current_user; |
1025 |
1103 |
1059 update_post_meta( $post->ID, '_edit_last', $current_user->ID ); |
1137 update_post_meta( $post->ID, '_edit_last', $current_user->ID ); |
1060 } |
1138 } |
1061 |
1139 |
1062 /** |
1140 /** |
1063 * Outputs the notice message to say that someone else is editing this post at the moment. |
1141 * Outputs the notice message to say that someone else is editing this post at the moment. |
1064 * |
1142 * |
1065 * @since 2.8.5 |
1143 * @since 2.8.5 |
1066 * @return none |
1144 * @return none |
1067 */ |
1145 */ |
1068 function _admin_notice_post_locked() { |
1146 function _admin_notice_post_locked() { |
1069 global $post; |
1147 global $post; |
1070 $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) ); |
1148 $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) ); |
1071 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); |
1149 $last_user_name = $last_user ? $last_user->display_name : __('Somebody'); |
1072 |
1150 |
1073 switch ($post->post_type) { |
1151 switch ($post->post_type) { |
1074 case 'post': |
1152 case 'post': |
1075 $message = __( 'Warning: %s is currently editing this post' ); |
1153 $message = __( 'Warning: %s is currently editing this post' ); |
1076 break; |
1154 break; |
1077 case 'page': |
1155 case 'page': |
1078 $message = __( 'Warning: %s is currently editing this page' ); |
1156 $message = __( 'Warning: %s is currently editing this page' ); |
1079 break; |
1157 break; |
1080 default: |
1158 default: |
1081 $message = __( 'Warning: %s is currently editing this.' ); |
1159 $message = __( 'Warning: %s is currently editing this.' ); |
1082 } |
1160 } |
1083 |
1161 |
1084 $message = sprintf( $message, esc_html( $last_user_name ) ); |
1162 $message = sprintf( $message, esc_html( $last_user_name ) ); |
1085 echo "<div class='error'><p>$message</p></div>"; |
1163 echo "<div class='error'><p>$message</p></div>"; |
1086 } |
1164 } |
1087 |
1165 |
1088 /** |
1166 /** |
1089 * Creates autosave data for the specified post from $_POST data. |
1167 * Creates autosave data for the specified post from $_POST data. |
1090 * |
1168 * |
1205 http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker |
1286 http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker |
1206 */ |
1287 */ |
1207 $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv'); |
1288 $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv'); |
1208 |
1289 |
1209 if ( $teeny ) { |
1290 if ( $teeny ) { |
1210 $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'autosave', 'fullscreen') ); |
1291 $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'fullscreen', 'wordpress') ); |
1211 $ext_plugins = ''; |
1292 $ext_plugins = ''; |
1212 } else { |
1293 } else { |
1213 $plugins = array( 'safari', 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus' ); |
1294 $plugins = array( 'safari', 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus' ); |
1214 |
1295 |
1215 /* |
1296 /* |
1339 'gecko_spellcheck' => true, |
1420 'gecko_spellcheck' => true, |
1340 'entities' => '38,amp,60,lt,62,gt', |
1421 'entities' => '38,amp,60,lt,62,gt', |
1341 'accessibility_focus' => true, |
1422 'accessibility_focus' => true, |
1342 'tabfocus_elements' => 'major-publishing-actions', |
1423 'tabfocus_elements' => 'major-publishing-actions', |
1343 'media_strict' => false, |
1424 'media_strict' => false, |
1344 'save_callback' => 'switchEditors.saveCallback', |
1425 'paste_remove_styles' => true, |
|
1426 'paste_remove_spans' => true, |
|
1427 'paste_strip_class_attributes' => 'all', |
1345 'wpeditimage_disable_captions' => $no_captions, |
1428 'wpeditimage_disable_captions' => $no_captions, |
1346 'plugins' => "$plugins" |
1429 'plugins' => "$plugins" |
1347 ); |
1430 ); |
1348 |
1431 |
1349 $mce_css = trim(apply_filters('mce_css', ''), ' ,'); |
1432 $mce_css = trim(apply_filters('mce_css', ''), ' ,'); |
1350 |
1433 |
1351 if ( ! empty($mce_css) ) |
1434 if ( ! empty($mce_css) ) |
1352 $initArray['content_css'] = "$mce_css"; |
1435 $initArray['content_css'] = "$mce_css"; |
|
1436 |
|
1437 if ( is_array($settings) ) |
|
1438 $initArray = array_merge($initArray, $settings); |
1353 |
1439 |
1354 // For people who really REALLY know what they're doing with TinyMCE |
1440 // For people who really REALLY know what they're doing with TinyMCE |
1355 // You can modify initArray to add, remove, change elements of the config before tinyMCE.init |
1441 // You can modify initArray to add, remove, change elements of the config before tinyMCE.init |
1356 // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init". |
1442 // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init". |
1357 // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0. |
1443 // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0. |