public
Last active

wp_editor and media tests

  • Download Gist
wp_editor-test.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
<?php
 
//Plugin Name: wp_editor Test
 
new wp_editor_Test();
 
class wp_editor_Test {
 
function __construct() {
add_action( 'admin_menu', array( &$this, 'menu' ) );
}
 
function menu() {
add_options_page( 'wp_editor Test', 'wp_editor Test', 'edit_posts', __FILE__, array( &$this, 'page' ) );
}
 
function page() {
?><div class="wrap">
<h2><?php _e('wp_editor Test'); ?></h2>
<?php
 
echo '<h3>Test 1</h3>';
$args = array(
'tinymce' => false,
'quicktags' => false,
'textarea_rows' => 5,
);
$this->printer( $args );
echo '<div style="float:left;">';
wp_editor( '', 'test1', $args );
echo '</div><br style="clear:both" />';
 
 
echo '<h3>Test 2</h3>';
$args = array(
'tinymce' => false,
'textarea_rows' => 5,
);
$this->printer( $args );
echo '<div style="float:left;">';
wp_editor( '', 'test2', $args );
echo '</div><br style="clear:both" />';
 
 
echo '<h3>Test 3</h3>';
$args = array(
'quicktags' => false,
'textarea_rows' => 5,
);
$this->printer( $args );
echo '<div style="float:left;">';
wp_editor( '', 'test3', $args );
echo '</div><br style="clear:both" />';
 
?>
<hr />
<p>Test 1 active: no media inserted</p>
<p>Test 2 active: media inserted</p>
<p>Test 3 active: media inserted</p>
<p>Tests 1 &amp; 2 active: media only inserted into #2</p>
<p>Tests 1 &amp; 3 active: media inserted into both</p>
<p>Tests 2 &amp; 3 active: media inserted into both</p>
<p>Tests 1, 2, &amp; 3 active: media inserted into all (sometimes quicktags &amp; tinymce weren't showing on #3. probably my fault, need to investigate...)</p>
</div><?php
}
 
function printer( $input ) {
echo '<pre style="width: 200px;float:left;">' . print_r( $input, true ) . '</pre>';
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.