add_action('init', function () { $meta_version = get_option('pressbooks_metadata_version', 0); if ($meta_version < \PressBooks\Metadata::$currentVersion) { $metadata = new \PressBooks\Metadata(); $metadata->upgrade($meta_version); update_option('pressbooks_metadata_version', \PressBooks\Metadata::$currentVersion); } }, 1000); } // ------------------------------------------------------------------------------------------------------------------- // Upgrade Catalog // ------------------------------------------------------------------------------------------------------------------- add_action('init', function () { $catalog_version = get_site_option('pressbooks_catalog_version', 0); if ($catalog_version < \PressBooks\Catalog::$currentVersion) { $metadata = new \PressBooks\Catalog(); $metadata->upgrade($catalog_version); update_site_option('pressbooks_catalog_version', \PressBooks\Catalog::$currentVersion); } }, 1000); // ------------------------------------------------------------------------------------------------------------------- // Force Flush // ------------------------------------------------------------------------------------------------------------------- if (!empty($GLOBALS['PB_SECRET_SAUCE']['FORCE_FLUSH'])) { add_action('init', function () { flush_rewrite_rules(false); }, 9999); } else { add_action('init', '\\PressBooks\\Redirect\\flusher', 9999); } // -------------------------------------------------------------------------------------------------------------------
echo '"' . $tag['tag'] . '", '; } ?> ], tokenSeparators: [","], containerCss: { width: '50%' } }); <?php } ?> }); </script> <?php } else { // TODO: Move logic out of the template $catalog = new \PressBooks\Catalog(); $user_id = $catalog->getUserId(); $p = $catalog->getProfile(); ?> <h2><?php echo get_current_user_id() != $user_id ? ucfirst(get_userdata(absint($user_id))->user_login) : __('My Catalog Profile', 'pressbooks'); ?> </h2> <form method="post" action="<?php echo $user_catalog_form_url; ?> " enctype="multipart/form-data" > <input type="hidden" name="action" value="edit_profile" /> <input type="hidden" name="user_id" value="<?php echo $user_id;