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
| import requests | |
| import subprocess | |
| import json | |
| import sys | |
| import threading | |
| import time | |
| from Queue import Queue | |
| numberOfViewers = int(sys.argv[1]) | |
| builderThreads = int(sys.argv[2]) |
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
| <?php | |
| // The ID of the lists you want to add a user to | |
| $list_ids = array( 1 ); | |
| // User Data without the custom fields | |
| $data_subscriber = array( | |
| 'user' => array( | |
| 'email' => '[email protected]', | |
| 'firstname' => 'John', | |
| 'lastname' => 'Doe', |
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
| $.ajax({ | |
| 'url': ajaxurl, | |
| 'data': { | |
| 'action': data.crop_action, | |
| 'crop': data.crop, | |
| 'attachment': data.$.return.val() | |
| }, | |
| 'dataType': 'json', | |
| 'type': 'POST', | |
| 'success': function (response, textStatus, jqXHR){ |
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
| <?php | |
| /** | |
| * Ref: http://stackoverflow.com/questions/7683133/does-php-have-a-feature-like-pythons-template-strings | |
| */ | |
| class Helper_StringFormat { | |
| public static function sprintf($format, array $args = array()) { | |
| $arg_nums = array_slice(array_flip(array_keys(array(0 => 0) + $args)), 1); |
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
| <?php | |
| /** | |
| * Print MailPoet's Widget without having a Sidebar | |
| * | |
| * Reference: http://codex.wordpress.org/Function_Reference/the_widget | |
| */ | |
| the_widget( | |
| 'WYSIJA_NL_Widget', // Name of the widget | |
| array( // Variables that will configure the Widget | |
| 'title' => 'Subscribe to our Newsletter', |
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
| <?php | |
| /** | |
| * Remove MailPoet Action on the Unsubscribe page `the_content` | |
| */ | |
| add_action( 'init', '__mailpoet_unsubscribe_page' ); | |
| function __mailpoet_unsubscribe_page() { | |
| if ( class_exists( 'WYSIJA_help_front' ) && ! is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] === 'subscribe' ) { | |
| $front_helper = WYSIJA::get('front','helper'); |
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
| <?php | |
| $to = "[email protected]"; | |
| $subject = "Learning how to send an Email in WordPress"; | |
| $content = "WordPress knowledge"; | |
| $headers = [ | |
| 'Reply-To' => "Gustavo Bordoni <[email protected]>" | |
| ]; | |
| $status = wp_mail( $to, $subject, $content, $headers ); |
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
| { | |
| "name" : "Wysija Newsletters Premium", | |
| "slug" : "wysija-newsletters-premium", | |
| "download_url" : "http://packager.mailpoet.com/packages/premium_dev_2.6.0.1_c0d80c07c5.zip", | |
| "version" : "2.6.0.2", | |
| "author" : "Wysija", | |
| "sections" : { | |
| "description" : "Plugin description here. Basic HTML allowed." | |
| } | |
| } |
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
| <?php | |
| add_filter( 'user_has_cap', function($all, $caps, $args, $user){ | |
| if (!in_array('contributor', $user->roles)) | |
| return $all; | |
| $posts = get_posts(array( | |
| 'post_type' => 'post', | |
| 'post_status' => 'publish', | |
| 'posts_per_page' => 1, | |
| 'author' => $user->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
| <?php | |
| // Exemplo 1 | |
| // Filtra a edição de posts da categoria 6 permitida apenas para os usuários 5 e 9 | |
| add_filter( 'user_has_cap', function( $allcaps, $caps, $args, $user ){ | |
| if ( in_array($args[0], array( 'edit_post' ) ) ) | |
| return $allcaps; | |
| // Para `edit_post` será passado um argumento com o ID do post que desejamos verificar | |
| if ( !isset( $args[2] ) || $args[2] == 0 || !is_numeric($args[2]) ) | |
| return $allcaps; |