예제 #1
0
 /**
  * Setup and Initiate Pods
  *
  * @return \PodsInit
  *
  * @license http://www.gnu.org/licenses/gpl-2.0.html
  * @since 1.8.9
  */
 function __construct()
 {
     self::$version = get_option('pods_framework_version');
     self::$version_last = get_option('pods_framework_version_last');
     self::$db_version = get_option('pods_framework_db_version');
     self::$upgraded = (int) get_option('pods_framework_upgraded_1_x');
     if (empty(self::$version_last) && 0 < strlen(get_option('pods_version'))) {
         $old_version = get_option('pods_version');
         if (!empty($old_version)) {
             if (false === strpos($old_version, '.')) {
                 $old_version = pods_version_to_point($old_version);
             }
             update_option('pods_framework_version_last', $old_version);
             self::$version_last = $old_version;
         }
     }
     self::$upgrade_needed = $this->needs_upgrade();
     add_action('plugins_loaded', array($this, 'plugins_loaded'));
     add_action('init', array($this, 'activate_install'), 9);
     if (!empty(self::$version)) {
         add_action('plugins_loaded', array($this, 'load_components'), 11);
         add_action('setup_theme', array($this, 'load_meta'), 14);
         add_action('init', array($this, 'core'), 11);
         add_action('init', array($this, 'setup_content_types'), 11);
         add_filter('post_updated_messages', array($this, 'setup_updated_messages'), 10, 1);
         add_action('delete_attachment', array($this, 'delete_attachment'));
         if (is_admin()) {
             add_action('init', array($this, 'admin_init'), 12);
         }
         // Register widgets
         add_action('widgets_init', array($this, 'register_widgets'));
         // Show admin bar links
         add_action('admin_bar_menu', array($this, 'admin_bar_links'), 81);
     }
 }
예제 #2
0
파일: PodsInit.php 프로젝트: benbrandt/pods
 /**
  * Setup and Initiate Pods
  *
  * @return \PodsInit
  *
  * @license http://www.gnu.org/licenses/gpl-2.0.html
  * @since 1.8.9
  */
 function __construct()
 {
     self::$version = get_option('pods_framework_version');
     self::$version_last = get_option('pods_framework_version_last');
     self::$db_version = get_option('pods_framework_db_version');
     self::$upgraded = (int) get_option('pods_framework_upgraded_1_x');
     if (empty(self::$version_last) && 0 < strlen(get_option('pods_version'))) {
         $old_version = get_option('pods_version');
         if (!empty($old_version)) {
             if (false === strpos($old_version, '.')) {
                 $old_version = pods_version_to_point($old_version);
             }
             update_option('pods_framework_version_last', $old_version);
             self::$version_last = $old_version;
         }
     }
     self::$upgrade_needed = $this->needs_upgrade();
     add_action('plugins_loaded', array($this, 'plugins_loaded'));
     add_action('init', array($this, 'activate_install'), 9);
     add_action('wp_loaded', array($this, 'flush_rewrite_rules'));
     if (!empty(self::$version)) {
         $this->run();
     }
 }