public function __construct()
 {
     /*
      * We'll initialise our model which will do compatibility checks and store in
      * the $gfpdfe_data data class.
      */
     include PDF_PLUGIN_DIR . 'model/settings.php';
     self::$model = new GFPDF_Settings_Model();
 }
示例#2
0
 public static function pdf_init()
 {
     /*
      * Initialise our data helper class
      */
     global $gfpdfe_data;
     $gfpdfe_data = new GFPDFE_DATA();
     /* set our PDF folder storage */
     $gfpdfe_data->set_directory_structure();
     /*
      * Include any dependancy-based files
      */
     include_once PDF_PLUGIN_DIR . 'pdf-settings.php';
     include_once PDF_PLUGIN_DIR . 'depreciated.php';
     include_once PDF_PLUGIN_DIR . 'helper/pdf-entry-detail.php';
     /*
      * Set the notice type 
      */
     self::set_notice_type();
     /*
      * Add localisation support
      */
     load_plugin_textdomain('pdfextended', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     /*
      * Call our Settings class which will do our compatibility processing
      */
     $gfpdfe_data->settingsClass = new GFPDF_Settings();
     /*
      * Only run settings page if Gravity Forms version is installed and compatible 
      * Needs to be run before major compatibility checks so it can prompt user 
      * about issues with WP version or PHP 
      */
     if ($gfpdfe_data->gf_is_compatible === true && is_admin()) {
         /*
          * Run our settings page
          */
         GFPDF_Settings::settings_page();
         /*
          * Only load our scripts if on a Gravity Forms admin page
          */
         if (isset($_GET['page']) && substr($_GET['page'], 0, 3) === 'gf_') {
             /*
              * Run our scripts and add the settings page to the admin area 
              */
             add_action('admin_init', array('GFPDF_Core', 'gfe_admin_init'), 9);
         }
     }
     /*
      * We'll initialise our model which will do any function checks ect
      */
     include PDF_PLUGIN_DIR . 'model/pdf.php';
     /*
      * Check for any major compatibility issues early
      */
     if (GFPDF_Core_Model::check_major_compatibility() === false) {
         /*
          * Major compatibility errors (WP version, Gravity Forms or PHP errors)
          * Exit to prevent conflicts
          */
         return;
     }
     /*
      * Some functions are required to monitor changes in the admin area
      * and ensure the plugin functions smoothly
      */
     add_action('admin_init', array('GFPDF_Core', 'fully_loaded_admin'), 9999);
     /* run later than usual to give our auto initialiser a chance to fire */
     /*
      * Only load the plugin if the following requirements are met:
      *  - Load on Gravity Forms Admin pages
      *  - Load if on any front-end admin page
      *  - Load if doing AJAX request (which natively is called from the /wp-admin/ backend)
      */
     if (is_admin() && isset($_GET['page']) && substr($_GET['page'], 0, 3) === 'gf_' || !is_admin() || defined('DOING_AJAX') && DOING_AJAX) {
         /*
          * Initialise the core class which will load the __construct() function
          */
         global $gfpdf;
         $gfpdf = new GFPDF_Core();
     }
     return;
 }