Example #1
0
 /**
  * Constructor.
  *
  * @since 1.0
  *
  * @access public
  * @param GuiForm_Plugin $plugin The instance of the plugin.
  */
 public function __construct()
 {
     parent::__construct(GuiForm_Plugin::instance());
     $screen = get_current_screen();
     $id = isset($_REQUEST['form']) ? esc_sql($_REQUEST['form']) : get_user_meta(get_current_user_id(), 'guiform_form_selected', true);
     $this->_pageScreen = $screen->id == GuiForm_Plugin::NAME . '_page_guiform-entry_view' ? $screen->id : $screen->id . '_' . $_REQUEST['form'];
     $this->settings = array('GuiForm_Render_Forms_Notification', 'GuiForm_Render_Forms_Confirmation', 'GuiForm_Render_Forms_Attachment', 'GuiForm_Render_Forms_Settings');
     if (has_filter('guiform_navigation_menu')) {
         $this->settings = apply_filters('guiform_navigation_menu', $this->settings);
     }
 }
Example #2
0
/**
 * Instantiates the plugin and setup all modules.
 *
 * @since 1.0
 */
function guiform_launch()
{
    // setup environment
    define('GUIFORM_BASEFILE', __FILE__);
    define('GUIFORM_ABSURL', plugins_url('/', __FILE__));
    define('GUIFORM_ABSPATH', dirname(__FILE__) . '/');
    if (file_exists(GUIFORM_ABSPATH . 'functions.php')) {
        require_once 'functions.php';
    }
    // don't load the plugin if cron job is running or doing autosave
    $doing_autosave = defined('DOING_AUTOSAVE') && DOING_AUTOSAVE;
    $doing_cron = defined('DOING_CRON') && DOING_CRON;
    $doing_ajax = defined('DOING_AJAX') && DOING_AJAX;
    $doing_admin_post = defined('WP_ADMIN') && WP_ADMIN;
    if ($doing_autosave || $doing_cron) {
        return;
    }
    // instantiate the plugin
    $plugin = GuiForm_Plugin::instance();
    $plugin->setModule(GuiForm_Module_Setup::NAME);
    $plugin->setModule(GuiForm_Module_Widget::NAME);
    if ($doing_ajax) {
        if ($_POST['action'] == GuiForm_Plugin::ACTION_SAVE_FORM) {
            $plugin->setModule(GuiForm_Module_Post::NAME);
        } else {
            if (strpos($_POST['action'], 'guiform-') !== false) {
                // set ajax modules
                $plugin->setModule(GuiForm_Module_Ajax::NAME);
            }
        }
    } else {
        if (basename($_SERVER["PHP_SELF"]) == 'admin-post.php') {
            if (strpos($_POST['action'], 'guiform-') !== false || $_GET['action'] == 'guiform-download-file') {
                $plugin->setModule(GuiForm_Module_Post::NAME);
            }
        } else {
            if (is_admin()) {
                // set admin modules
                $plugin->setModule(GuiForm_Module_Admin::NAME);
            } else {
                // set frontend modules
                $plugin->setModule(GuiForm_Module_Frontend::NAME);
            }
        }
    }
}
Example #3
0
 /**
  * Returns singletone instance of the plugin.
  *
  * @since 1.0
  *
  * @static
  * @access public
  * @return GuiForm_Plugin
  */
 public static function instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new GuiForm_Plugin();
     }
     return self::$_instance;
 }
Example #4
0
 public function autoUpdate()
 {
     $update = new GuiForm_Module_Update(GuiForm_Plugin::instance());
     $update->init();
 }
Example #5
0
    /**
     * Enqueue footer jquery library.
     *
     * @since 1.0
     * @access public
     */
    public function footerScript()
    {
        global $guiform;
        $prefix = file_exists(ABSPATH . "wp-includes/js/jquery/ui/jquery.ui.effect.min.js") ? 'jquery.ui.' : '';
        ?>
		
		<script src="<?php 
        echo includes_url("js/jquery/jquery.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/jquery-migrate.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/jquery.ui.touch-punch.js");
        ?>
" type="text/javascript"></script>
		
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "core.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "widget.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "mouse.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "effect.min.js");
        ?>
" type="text/javascript"></script>
		
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "effect-slide.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "effect-highlight.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "spinner.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo includes_url("js/jquery/ui/" . $prefix . "button.min.js");
        ?>
" type="text/javascript"></script>
		
		<script src="<?php 
        echo $guiform->vendor("formvalidation/js/formValidation.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo $guiform->vendor("formvalidation/js/framework/bootstrap.min.js");
        ?>
" type="text/javascript"></script>
			
		<script src="<?php 
        echo $guiform->assets("js/jquery.maskedinput.min.js");
        ?>
" type="text/javascript"></script>
		<script src="<?php 
        echo $guiform->assets("js/guiform-form.min.js?ver=" . GuiForm_Plugin::VERSION);
        ?>
" type="text/javascript"></script>
		
		<?php 
        $validator = new GuiForm_Module_Validator(GuiForm_Plugin::instance());
        $validator->init($this->_id, $this->_randID, $this->_form);
        echo $validator->printJS();
    }