$this,
'configureMenus'
));
+
+ // Add admin scripts and css
+ add_action('admin_enqueue_scripts',
+ array(
+ $this,
+ 'glmProtoAdminScripts'
+ ));
}
/**
}
}
+ function glmProtoAdminScripts ()
+ {
+ wp_enqueue_media();
+ wp_register_script('glm-proto-index-js',
+ GLM_PROTO_PLUGIN_URL . 'js/index.js',
+ array(
+ 'jquery'
+ ));
+ wp_enqueue_script('glm-proto-index-js');
+
+ // A simple set of styles for things I haven't found as a WordPress
+ // default yet
+ wp_register_style('glmProtoIndexStyle',
+ GLM_PROTO_PLUGIN_URL . 'css/index.css');
+ wp_enqueue_style('glmProtoIndexStyle');
+ }
+
/*
* Menu item specific "Callback" methods
*
// Generate output from model data and view
if ($viewText) {
- $smarty->template->display('string:'.$view);
+ $smarty->template->display('string:' . $view);
} else {
$smarty->template->display($view);
}
-
}
}
* new smartyTemplateSupport();
*
*/
-class smartyTemplateSupport
-{
+class smartyTemplateSupport {
- /**
- * Smarty Template Object
- *
- * @var $template
- * @access public
- */
- public $template;
+ /**
+ * Smarty Template Object
+ *
+ * @var $template
+ * @access public
+ */
+ public $template;
- /*
- * Smarty Template Support Constructor
- *
- * This constructor loads and instatiates smarty templates, then adds some
- * standard template parameters.
- *
- * @return object Class object
- *
- */
- public function __construct ()
- {
+ /*
+ * Smarty Template Support Constructor
+ *
+ * This constructor loads and instatiates smarty templates, then adds some
+ * standard template parameters.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct() {
- /*
- * Load and instatiate Smarty Templates
- */
- require (GLM_PROTO_PLUGIN_DIR .
- '/lib/Smarty-3.1.21/libs/Smarty.class.php');
+ /*
+ * Load and instatiate Smarty Templates
+ */
+ require (GLM_PROTO_PLUGIN_DIR . '/lib/Smarty-3.1.21/libs/Smarty.class.php');
- $this->template = new Smarty();
+ $this->template = new Smarty ();
- /*
- * Configure Smarty Templates for this site
- */
- $this->template->setTemplateDir(GLM_PROTO_PLUGIN_DIR . '/views');
- $this->template->setCompileDir(
- GLM_PROTO_PLUGIN_DIR . '/misc/smarty/templates_c');
- $this->template->setCacheDir(
- GLM_PROTO_PLUGIN_DIR . '/misc/smarty/cache');
- $this->template->setConfigDir(
- GLM_PROTO_PLUGIN_DIR . '/misc/smarty/configs');
- }
+ /*
+ * Configure Smarty Templates for this site
+ */
+ $this->template->setTemplateDir ( GLM_PROTO_PLUGIN_DIR . '/views' );
+ $this->template->setCompileDir ( GLM_PROTO_PLUGIN_DIR . '/misc/smarty/templates_c' );
+ $this->template->setCacheDir ( GLM_PROTO_PLUGIN_DIR . '/misc/smarty/cache' );
+ $this->template->setConfigDir ( GLM_PROTO_PLUGIN_DIR . '/misc/smarty/configs' );
+ }
- /*
- * Assign parameters to the template
- *
- * This method assigns either one parameter to the template object in this
- * class or an array of parameters.
- *
- * Submit an array of parameters to the template.
- *
- * @name array Array of arrays with parameter name (key), value pairs
- *
- * or
- *
- * Submit one parameter to the template
- *
- * @param text parameter name
- * @param {whatever} parameter value
- *
- * @return void
- */
- public function templateAssign ($param, $value = null)
- {
+ /*
+ * Assign parameters to the template
+ *
+ * This method assigns either one parameter to the template object in this
+ * class or an array of parameters.
+ *
+ * Submit an array of parameters to the template.
+ *
+ * @name array Array of arrays with parameter name (key), value pairs
+ *
+ * or
+ *
+ * Submit one parameter to the template
+ *
+ * @param text parameter name
+ * @param {whatever} parameter value
+ *
+ * @return void
+ */
+ public function templateAssign($param, $value = null) {
- // If this is a single assignment
- if ($value !== null) {
- $this->template->assign($param, $value);
+ // If this is a single assignment
+ if ($value !== null) {
+ $this->template->assign ( $param, $value );
- // Otherwise it's an array of parameter/value pairs
- } elseif (is_array($param)) {
+ // Otherwise it's an array of parameter/value pairs
+ } elseif (is_array ( $param )) {
- while (list ($key, $value) = each($param)) {
- $this->template->assign($key, $value);
- }
- }
- }
+ while ( list ( $key, $value ) = each ( $param ) ) {
+ $this->template->assign ( $key, $value );
+ }
+ }
+ }
}
?>
\ No newline at end of file