Last active
December 14, 2015 02:49
-
-
Save trepmal/5016952 to your computer and use it in GitHub Desktop.
wp_editor and media tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 & 2 active: media only inserted into #2</p> | |
<p>Tests 1 & 3 active: media inserted into both</p> | |
<p>Tests 2 & 3 active: media inserted into both</p> | |
<p>Tests 1, 2, & 3 active: media inserted into all (sometimes quicktags & 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>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment