/** * Controller. * * This function will locate the associated element and display it in the * place of this function call * * @param string $name */ function bum_get_show_view($name = null) { //initializing variables $paths = set_controller_path(); $theme = get_theme_path(); $html = ''; if (!($view = bum_find(array($theme), "views" . DS . $name . ".php"))) { $view = bum_find($paths, "views" . DS . $name . ".php"); } if (!($model = bum_find(array($theme), "models" . DS . $name . ".php"))) { $model = bum_find($paths, "models" . DS . $name . ".php"); } if (is_null($name)) { return false; } if (!$view && !$model) { return false; } do_action("byrd-controller", $model, $view); $path = $view; $html = false; if (file_exists($model)) { ob_start(); $args = func_get_args(); require $model; unset($html); $html = ob_get_clean(); } else { ob_start(); $args = func_get_args(); require $path; unset($html); $html = ob_get_clean(); } $html = apply_filters("byrd-controller-html", $html); return $html; }
* * This block of functions is only preloading a set of functions that I've prebuilt * and that I use throughout my websites. * */ require_once dirname(__FILE__) . DS . "bootstrap.php"; require_once dirname(__FILE__) . DS . "register.php"; require_once dirname(__FILE__) . DS . "formbuilder.php"; //require_once dirname(__file__).DS."xml-handler.php"; require_once dirname(__FILE__) . DS . "better-user-management.php"; require_once dirname(__FILE__) . DS . "ValidForm" . DS . "class.validform.php"; /** * Initialize the Framework * */ set_controller_path(dirname(__FILE__)); /** * MAIN INIT */ //register assets wp_register_script('bum_js', plugin_dir_url(__FILE__) . 'js/bum.js', array('jquery'), BUM_VERSION, true); wp_register_script('bum_validform_js', plugin_dir_url(__FILE__) . 'js/validform.js', array('jquery'), BUM_VERSION, true); wp_register_script('bum_formbuilder', plugin_dir_url(__FILE__) . 'js/formbuilder.min.js', array('jquery'), BUM_VERSION, true); wp_register_script('jquery_ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js', array('jquery'), BUM_VERSION, true); wp_enqueue_script('bum_js'); wp_enqueue_script('bum_formbuilder'); wp_enqueue_script('bum_validform_js'); wp_enqueue_script('jquery_ui'); wp_register_style('bum_css', plugin_dir_url(__FILE__) . 'css/bum.css', array(), BUM_VERSION, 'all'); wp_register_style('bum_validform_css', plugin_dir_url(__FILE__) . 'css/validform.css', array(), BUM_VERSION, 'all'); wp_register_style('bum_formbuilder', plugin_dir_url(__FILE__) . 'css/formbuilder.min.css', array(), BUM_VERSION, 'all');