folders, $folders);
}
/**
* Applies the configuration of the plugin
* @var array $config The config that is to be edited
* @return array The new config
*/
public function applyConfig($config) {
$config['tabs'] = array(
0 => array( 'Settings', 'tabs__settings_withinboredom'),
1 => array('About', 'tabs__about_withinboredom'),
);
$config['help'] = array(
'settings' => array(
'Overview' => "Stuff here",
)
);
$config['config'] = array(
'settings' => true,
'page_title' => 'Abundatrade',
'button_title' => 'Abundatrade',
'slug' => 'abundatrade',
'shortcodes' => array(
'abundatrade'
),
);
return $config;
}
public function shortcode($atts) {
$display = '
';
$top = '
";
$endtop = "
";
$table = '
| # |
UPC |
Product Details |
Qty |
Per Item |
Total |
Delete All |
ID |
| Total Items: |
0 |
Pre-Valuation Total |
$0.00 |
Delete All |
';
$display .= $top;
$display .= $endform;
$display .= $second;
$display .= $table;
$display .= $endtop;
return $display;
}
/**
* Retuns a pointer to the settings object
*/
public function getSettings() {
return array(&$this->settings);
}
public function doshortcode($atts) {
$display = apply_filters("abundatrade(shortcode(abundatrade))", $atts);
return $display;
}
public function addScripts() {
wp_register_style("abundatrade_classic", $this->folders['PluginUrl'] . '/themes/classic.css');
wp_register_script("abundatrade_remote", $this->folders['PluginUrl'] . '/js/remote.js', array('jquery'));
wp_register_script("abundatrade_impromptu", $this->folders['PluginUrl'] . '/js/jquery-impromptu.4.0.min.js', array('jquery'));
wp_enqueue_style("abundatrade_classic");
wp_enqueue_script("abundatrade_remote");
wp_enqueue_script("abundatrade_impromptu");
wp_localize_script('abundatrade_remote','abundacalc',array('server' => 'dev.abundatrade.com', 'url' => $this->folders['PluginUrl']));
}
/**
* Creates a map structure
*/
function __construct() {
$this->BuildFolderList();
add_filter("abundatrade(getFolders)", array(&$this, "getFolders"), 1);
add_filter("abundatrade(applyConfig)", array(&$this, "applyConfig"), 1);
add_filter("abundatrade(shortcode(abundatrade))", array(&$this, "shortcode"), 1);
add_shortcode("abundatrade", array($this, "doshortcode"));
add_filter("abundatrade(settings)", array($this, "getSettings"), 200, 0);
add_action("wp_enqueue_scripts", array($this, "addScripts"));
spl_autoload_register(array($this, "autoload"));
$skel = new skel__skel();
//load settings last for updates
$this->settings = new skel__settings();
}
/**
* Autoloads all classes as required to only load in what we need
* @var string $classname The name of the class to load
*/
static public function autoload($classname) {
$file = str_replace("__", "/", $classname);
$folders = apply_filters("abundatrade(getFolders)", array());
if (file_exists($folders['PluginDir'] . $file . ".php"))
include_once($folders['PluginDir'] . $file . ".php");
//else
//echo "file no exists: " . $folders['PluginDir'] . $file . ".php\n
";
}
/**
* Builds a list of folders for later distribution so we can find ourselves
*/
private function BuildFolderList() {
$config = $this->applyConfig(array());
$this->folders = array();
$this->folders['PluginDir'] = plugin_dir_path(__FILE__);
$this->folders['PluginUrl'] = plugins_url('', __FILE__);
$this->folders['PluginAdmin'] = admin_url() . 'options-general.php?page=' . $config['config']['slug'];
$this->folders['Basename'] = plugin_basename(__FILE__);
}
}
$GLOBALS['abundatrade_withinboredom'] = new abundatrade_withinboredom();
//we don't want to autoload later on
//spl_autoload_unregister(array($GLOBALS['TheMap_withinboredom'], 'autoload'));