コード例 #1
0
ファイル: hooks.php プロジェクト: pressbooks/pressbooks
    add_action('init', function () {
        $taxonomy_version = get_option('pressbooks_taxonomy_version', 0);
        if ($taxonomy_version < \Pressbooks\Taxonomy::$currentVersion) {
            $taxonomy = new \Pressbooks\Taxonomy();
            $taxonomy->upgrade($taxonomy_version);
            update_option('pressbooks_taxonomy_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);
}
// -------------------------------------------------------------------------------------------------------------------
コード例 #2
0
ファイル: catalog.php プロジェクト: pressbooks/pressbooks
			$("#tags_<?php 
        echo $i;
        ?>
").select2({
				tags: true,
				tokenSeparators: [","]
			});
			<?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;