Fixed errors with encueing scripts
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 19 Jan 2015 18:39:30 +0000 (13:39 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 19 Jan 2015 18:39:30 +0000 (13:39 -0500)
controllers/admin.php
controllers/front.php
index.php
lib/smartyTemplateSupport.php

index 3eb77bb..a27dc3b 100644 (file)
@@ -162,6 +162,13 @@ class glmProtoAdmin
                         $this,
                         'configureMenus'
                 ));
+
+        // Add admin scripts and css
+        add_action('admin_enqueue_scripts',
+                array(
+                        $this,
+                        'glmProtoAdminScripts'
+                ));
     }
 
     /**
@@ -208,6 +215,23 @@ class glmProtoAdmin
         }
     }
 
+    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
      *
@@ -388,11 +412,10 @@ class glmProtoAdmin
 
         // Generate output from model data and view
         if ($viewText) {
-            $smarty->template->display('string:'.$view);
+            $smarty->template->display('string:' . $view);
         } else {
             $smarty->template->display($view);
         }
-
     }
 }
 
index 6ba764c..1756399 100644 (file)
@@ -29,7 +29,7 @@ class glmProtoFront
      */
     public $wpdb;
 
-    public function __construct ()
+    public function __construct ($wpdb)
     {
 
         // Save WordPress Database object
index ce0cdf7..dd767af 100644 (file)
--- a/index.php
+++ b/index.php
@@ -222,34 +222,6 @@ function glmProtoPluginUninstall ()
 }
 register_uninstall_hook(__FILE__, 'glmProtoPluginUninstall');
 
-/*
- *
- * Style Sheets
- *
- */
-
-// 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');
-
-/*
- *
- * JAVAscript files that need to be enqueued.
- *
- */
-
-add_action('admin_enqueue_scripts', 'glmProtoScripts');
-
-function glmProtoScripts ()
-{
-    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');
-}
 
 /*
  *
index 7325035..75ee778 100644 (file)
  * 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