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 | |
/** | |
* This code retrieves course data from an external API and displays it in the user's | |
* My Account area. A merchant has noticed that there's a delay when loading the page. | |
* | |
* 1) What changes would you suggest to reduce or remove that delay? | |
* 2) Is there any other code changes that you would make? | |
*/ | |
public function add_my_courses_section() { | |
$courses = null; |
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
public function admin_menu() { | |
add_submenu_page( | |
'publish_status', | |
'Scheduled Jobs', | |
'Scheduled Jobs', | |
'manage_options', | |
'admin.php?page=scheduled_jobs', | |
[ &$this, 'display_schedule' ] | |
); | |
} |
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 | |
/** | |
* PSR4 autoloader using spl_autoload_register | |
* @package HN_Reactive | |
* @author Thomas J Belknap <tbelknap@holisticnetworking.net> | |
*/ | |
namespace HN_Reactive; | |
spl_autoload_register( function ( $class ) { |
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
private function do_table() { | |
global $wpdb; | |
$charset_collate = $wpdb->get_charset_collate(); | |
$sql = "CREATE TABLE $this->table_name ( | |
id mediumint(9) NOT NULL AUTO_INCREMENT, | |
created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, | |
modified datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, | |
interval TEXT NOT NULL, |
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
MacBook-Pro-3:HNReactiveBuildTools tomb$ gulp watch-child | |
[17:48:26] Using gulpfile /Applications/MAMP/htdocs/HNReactive/wp-content/themes/HNReactiveBuildTools/gulpfile.js | |
[17:48:26] Starting 'sass'... | |
[17:48:26] Change detected. Building HNReactiveChild CSS... | |
[17:48:26] Finished 'sass' after 643 ms | |
[17:48:26] Starting 'watch-child'... | |
[17:48:27] Finished 'watch-child' after 191 ms | |
? Target theme slug? BubbleButt | |
[17:48:33] BubbleButt | |
[17:48:58] Starting 'sass'... |
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
/** | |
* HN Build Tools | |
* Contains build tools for developing HNReactive themes. This includes SASS compilation, | |
* CSS/JS minification and concatenation. | |
* @type {*|Gulp} | |
*/ | |
"use strict"; | |
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); |
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
0 info it worked if it ends with ok | |
1 verbose cli [ '/usr/local/Cellar/node/9.3.0_1/bin/node', | |
1 verbose cli '/usr/local/bin/npm', | |
1 verbose cli 'install', | |
1 verbose cli '--global', | |
1 verbose cli 'foundation-cli' ] | |
2 info using npm@5.6.0 | |
3 info using node@v9.3.0 | |
4 verbose npm-session 6ddaa9c6bd7dec72 | |
5 silly install loadCurrentTree |
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
if(!empty($this->post)) { | |
$ch=curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $this->resource); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, [ | |
"Content-Type: {$this->content_type}", | |
"omitOutputtingOriginalText: {$this->omit_original}", | |
"outputFormat: {$this->output_type}", | |
"x-ag-access-token : {$this->api_token}", | |
"x-calais-contentClass: {$this->content_class}", | |
"x-calais-language: {$this->language}", |
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
/* | |
* Display column headers for the user-selected array of columns. | |
* | |
* @var str $query: The query array. | |
*/ | |
public function displayColumnHeaders( $query ) { | |
$headers = ''; | |
$sort = $query['sort']; | |
$direction = $query['direction']; | |
$arrow = sprintf('fa fa-sort-%s', $direction); |
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
public static function name($post) | |
{ | |
$ei = new EasyInputs([ | |
'name' => 'Person', | |
'group' => 'name', | |
'type' => 'meta' | |
]); | |
// Use nonce for verification | |
wp_nonce_field(plugin_basename(__FILE__), 'scholar_name_nonce'); | |
$prefix = get_post_meta($post->ID, 'scholar_prefix', true); |