コード例 #1
0
ファイル: core.php プロジェクト: conscious-jp/website
 /**
  * Setup internals / AKA activate stuffs
  *
  */
 public static function init_cf_internal()
 {
     if (false == self::$internal_init) {
         add_rewrite_tag('%cf_api%', '([^&]+)');
         add_rewrite_tag('%cf_entry%', '([^&]+)');
         // INIT API
         add_rewrite_rule('^cf-api/([^/]*)/([^/]*)/?', 'index.php?cf_api=$matches[1]&cf_entry=$matches[2]', 'top');
         add_rewrite_rule('^cf-api/([^/]*)/?', 'index.php?cf_api=$matches[1]', 'top');
         self::$internal_init = true;
         // check update version
         $db_version = get_option('CF_DB', 0);
         $force_update = false;
         if (is_admin() && isset($_GET['cal_db_update'])) {
             // ensure that admin can only force update
             $force_update = (bool) wp_verify_nonce($_GET['cal_db_update']);
         }
         if (CF_DB > $db_version || $force_update) {
             include_once CFCORE_PATH . 'includes/updater.php';
             if ($db_version < 2 || $force_update) {
                 caldera_forms_db_v2_update();
             }
             if ($db_version < 3 || $force_update) {
                 self::activate_caldera_forms(true);
                 caldera_forms_write_db_flag(3);
             }
         }
     }
 }