This file contains hidden or 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
| if ( $errors = get_transient( "my_save_post_errors_{$post_id}_{$user_id}" ) ) { | |
| foreach( $errors as $error ) { ?> | |
| <div class="error"><p> | |
| <?php echo $error; ?> | |
| </p></div><?php | |
| } | |
| delete_transient( "my_save_post_errors_{$post_id}" ) | |
| } |
This file contains hidden or 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
| if ( array_key_exists( 'my_plugin_errors', $_SESSION ) ) { | |
| foreach( $_SESSION['my_plugin_errors'] as $error ) {?> | |
| <div class="error"><p> | |
| <?php echo $error; ?> | |
| </p></div><?php | |
| } | |
| unset( $_SESSION['my_plugin_errors'] ); | |
| } |
This file contains hidden or 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
| add_action( 'admin_notices', 'my_error_messages' ); |
This file contains hidden or 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
| $num_posts = count( $languages ); | |
| $this->gistpens = $this->factory->post->create_many( $num_posts, array( | |
| 'post_type' => 'gistpens', | |
| ), array( | |
| 'post_title' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ), | |
| 'post_name' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ), | |
| 'post_content' => new WP_UnitTest_Generator_Sequence( 'Post content %s' ) | |
| )); |
This file contains hidden or 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
| sudo apt-get -y install subversion phpunit | |
| cd /srv/www/jamesdigioia.dev/current | |
| cd $(wp plugin path --dir wp-gistpen) | |
| bash test/install-wp-tests.sh wordpress_test root devpw localhost latest |
This file contains hidden or 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
| add_action( 'wp_ajax_plugin_slug_insert_dialog', 'plugin_slug_insert_gistpen_dialog' ); | |
| function plugin_slug_insert_gistpen_dialog() { | |
| die(include 'path/to/dialog/form.php'); | |
| } |
This file contains hidden or 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
| ( function() { | |
| // Register plugin | |
| tinymce.create( 'tinymce.plugins.plugin_slug', { | |
| init: function( editor, url ) { | |
| // Add the Insert Gistpen button | |
| editor.addButton( 'plugin_slug', { | |
| //text: 'Insert Shortcode', |
This file contains hidden or 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
| add_filter( 'mce_external_plugins', 'plugin_slug_add_button' ); | |
| function plugin_slug_add_button( $plugins ) { | |
| $plugins['plugin_slug'] = 'path/to/editor/plugin.js'; | |
| return $plugins; | |
| } | |
| add_filter( 'mce_buttons', 'plugin_slug_register_button' ); | |
| function plugin_slug_register_button( $buttons ) { | |
| array_push( $buttons, 'plugin_slug' ); | |
| return $buttons; |
This file contains hidden or 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
| require("ParseCSV.php"); | |
| $csv = new ParseCSV("youtube-images.csv"); | |
| $n = 1; | |
| foreach($csv->data as $data) { | |
| if(false != file_put_contents("pics/{$data['filename']}.jpg", file_get_contents($data['url']))) { | |
| $log = "File {$n}: Downloaded {$data['filename']} from {$data['url']}n"; | |
| } else { | |
| $log = "File {$n}: Download from {$data['url']} failedn"; | |
| } |
This file contains hidden or 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
| // Source: https://github.com/pixelcog/parallax.js/blob/master/parallax.js#L96 | |
| if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { | |
| // if iOS | |
| } | |
| if (navigator.userAgent.match(/(Android)/)) { | |
| // if Android | |
| } |