Example #1
0
 private function __construct()
 {
     require_once GRAVITYVIEW_DIR . 'includes/class-admin.php';
     // If Gravity Forms doesn't exist or is outdated, load the admin view class to
     // show the notice, but not load any post types or process shortcodes.
     // Without Gravity Forms, there is no GravityView. Beautiful, really.
     if (!GravityView_Admin::check_gravityforms()) {
         // If the plugin's not loaded, might as well hide the shortcode for people.
         add_shortcode('gravityview', array($this, '_shortcode_gf_notice'), 10, 3);
         return;
     }
     // Load Extensions
     // @todo: Convert to a scan of the directory or a method where this all lives
     include_once GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php';
     include_once GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php';
     // Load WordPress Widgets
     include_once GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php';
     // Load GravityView Widgets
     include_once GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php';
     // Add oEmbed
     include_once GRAVITYVIEW_DIR . 'includes/class-oembed.php';
     // Add logging
     include_once GRAVITYVIEW_DIR . 'includes/class-logging.php';
     include_once GRAVITYVIEW_DIR . 'includes/class-ajax.php';
     include_once GRAVITYVIEW_DIR . 'includes/class-settings.php';
     include_once GRAVITYVIEW_DIR . 'includes/class-frontend-views.php';
     include_once GRAVITYVIEW_DIR . 'includes/helper-functions.php';
     include_once GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php';
     include_once GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php';
     /** @since 1.8.4 */
     include_once GRAVITYVIEW_DIR . 'includes/class-data.php';
     include_once GRAVITYVIEW_DIR . 'includes/class-gvlogic-shortcode.php';
     // Load plugin text domain
     add_action('init', array($this, 'load_plugin_textdomain'), 1);
     // Load frontend files
     add_action('init', array($this, 'frontend_actions'), 20);
     // Load default templates
     add_action('init', array($this, 'register_default_templates'), 11);
 }
 /**
  * Check whether the extension is supported:
  *
  * - Checks if GravityView and Gravity Forms exist
  * - Checks GravityView and Gravity Forms version numbers
  * - Sets
  *
  * @uses GravityView_Admin::check_gravityforms()
  * @return boolean Is the extension supported?
  */
 protected function is_extension_supported()
 {
     self::$is_compatible = true;
     if (!class_exists('GravityView_Plugin')) {
         $message = sprintf(__('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title);
         self::add_notice($message);
         do_action('gravityview_log_error', __CLASS__ . '[is_compatible] ' . $message);
         self::$is_compatible = false;
     } else {
         if (false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version, ">=")) {
             $message = sprintf(__('The %s Extension requires GravityView Version %s or newer.', 'gravityview'), $this->_title, '<tt>' . $this->_min_gravityview_version . '</tt>');
             self::add_notice($message);
             do_action('gravityview_log_error', __CLASS__ . '[is_compatible] ' . $message);
             self::$is_compatible = false;
         } else {
             if (!GravityView_Admin::check_gravityforms()) {
                 self::$is_compatible = false;
             }
         }
     }
     return self::$is_compatible;
 }