本文整理汇总了PHP中Post::add_new_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::add_new_type方法的具体用法?PHP Post::add_new_type怎么用?PHP Post::add_new_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::add_new_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
/**
* Set up needed stuff for the plugin
**/
public function install()
{
Post::add_new_type('project');
// Give anonymous users access
$group = UserGroup::get_by_name('anonymous');
$group->grant('post_project', 'read');
}
示例2: action_plugin_activation
/**
* action: plugin_activation
*
* @access public
* @param string $file
* @return void
*/
public function action_plugin_activation($file)
{
if (Plugins::id_from_file($file) != Plugins::id_from_file(__FILE__)) {
return;
}
Post::add_new_type('revision');
}
示例3: action_plugin_activation
public function action_plugin_activation($plugin_file)
{
if (Plugins::id_from_file(__FILE__) == Plugins::id_from_file($plugin_file)) {
Post::add_new_type('photo');
$this->make_default_dirs(false);
}
}
示例4: action_admin_theme_post_admin_cctypes
/**
* Respond to post requests on the admin_cctypes template
*
* @param AdminHandler $handler The admin handler object
* @param Theme $theme The admin theme object
*/
function action_admin_theme_post_admin_cctypes($handler, $theme)
{
$action = Controller::get_var('cct_action');
switch ($action) {
case 'addtype':
Post::add_new_type($_POST['newtype']);
$typeid = Post::type($_POST['newtype']);
$handled = Options::get('cctypes_types');
if (!is_array($handled)) {
$handled = array();
}
$handled[$typeid] = $typeid;
array_unique($handled);
Options::set('cctypes_types', $handled);
Session::notice(_t('Added post type "' . $_POST['newtype'] . '".'));
break;
case 'deletetype':
$typename = Post::type_name($_POST['deltype']);
Post::deactivate_post_type($_POST['deltype']);
$handled = Options::get('cctypes_types');
if (isset($handled[$_POST['deltype']])) {
unset($handled[$_POST['deltype']]);
}
Options::set('cctypes_types', $handled);
Session::notice(_t('Deactivated post type "' . $typename . '".'));
}
Utils::redirect();
}
示例5: action_init
public function action_init()
{
Post::add_new_type('poll');
$this->add_template('widget', dirname(__FILE__) . '/widget.php');
$this->add_template('poll.single', dirname(__FILE__) . '/poll.single.php');
Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
Stack::add('template_stylesheet', array(URL::get_from_filesystem(__FILE__) . '/widget.css', 'screen'), 'pollwigitcss');
}
示例6: install
/**
* install:
* - post type
* - permissions
*/
public static function install()
{
Post::add_new_type('event');
Post::activate_post_type('event');
// Give anonymous users access
$group = UserGroup::get_by_name('anonymous');
$group->grant('post_event', 'read');
}
示例7: action_plugin_activation
/**
* Register content type
**/
public function action_plugin_activation($plugin_file)
{
// add the content type.
Post::add_new_type('event');
// Give anonymous users access
$group = UserGroup::get_by_name('anonymous');
$group->grant('post_event', 'read');
}
示例8: test_delete_content_type
public function test_delete_content_type()
{
Post::add_new_type('test_type');
$params = array('title' => 'A post title', 'content' => 'Some great content. Really.', 'user_id' => $this->user->id, 'status' => Post::status('published'), 'content_type' => Post::type('test_type'), 'pubdate' => DateTime::date_create(time()));
$post = Post::create($params);
$this->assert_true('test_type' == $post->typename, "Post content type should be 'test_type'.");
$this->assert_false(Post::delete_post_type('test_type'), "Post still exists with the content type 'test_type'");
$post->delete();
$this->assert_true(Post::delete_post_type('test_type'), "No posts exist with the content type 'test_type'");
}
示例9: install
/**
* install various stuff we need
*/
public static function install()
{
/**
* Register content type
**/
Post::add_new_type('report');
// Give anonymous users access
$group = UserGroup::get_by_name('anonymous');
$group->grant('post_report', 'read');
}
示例10: install
/**
* install various stuff we need
*/
public static function install()
{
Post::add_new_type('link');
// Give anonymous users access
$group = UserGroup::get_by_name('anonymous');
$group->grant('post_link', 'read');
// Set default settings
Options::set('linkblog__original', '<p><a href="{permalink}">Permalink</a></p>');
Options::set('linkblog__atom_permalink', false);
self::database();
}
示例11: action_plugin_activation
/**
* Set up the podcast content type on activation
* @param string $plugin_file The filename of the plugin being activated, compare to this class' filename
*/
public function action_plugin_activation($plugin_file)
{
if (Plugins::id_from_file(__FILE__) == Plugins::id_from_file($plugin_file)) {
Post::add_new_type('podcast');
}
foreach ($this->default_options as $name => $value) {
$current_value = Options::get(self::OPTIONS_PREFIX . $name);
if (!isset($current_value)) {
Options::set(self::OPTIONS_PREFIX . $name, $value);
}
}
}
示例12: action_plugin_activation
/**
* On plugin activation
*/
public function action_plugin_activation($file)
{
// Don't process other plugins
if (Plugins::id_from_file($file) != Plugins::id_from_file(__FILE__)) {
return;
}
// Insert new post content types
Post::add_new_type('project', true);
Post::add_new_type('client', true);
Post::add_new_type('task', true);
if (DB::exists(DB::table('rewrite_rules'), array('action' => 'display_projects', 'name' => 'display_projects'))) {
return;
// do not keep adding the same rules if user disabled then re-enabled plugin
}
// Create new rewrite rule for showing a project
$rule = RewriteRule::create_url_rule('"project"/{$slug}', 'UserThemeHandler', 'display_project');
$rule->parse_regex = '%project/(?P<slug>[^/]+)/?$%i';
$rule->build_str = 'project/{$slug}';
$rule->description = 'Project Management System - View Project';
$rule->insert();
// Create new rewrite rule for showing a client
$rule = RewriteRule::create_url_rule('"client"/{$slug}', 'UserThemeHandler', 'display_client');
$rule->parse_regex = '%client/(?P<slug>[^/]+)/?$%i';
$rule->build_str = 'client/{$slug}';
$rule->description = 'Project Management System - View Client';
$rule->insert();
// Create new rewrite rule for showing a task
$rule = RewriteRule::create_url_rule('"task"/{$slug}', 'UserThemeHandler', 'display_task');
$rule->parse_regex = '%task/(?P<slug>[^/]+)/?$%i';
$rule->build_str = 'task/{$slug}';
$rule->description = 'Project Management System - View Task';
$rule->insert();
// Create new rewrite rule for showing projects
$rule = RewriteRule::create_url_rule('"project"/{$slug}', 'UserThemeHandler', 'display_projects');
$rule->parse_regex = '%projects/?$%i';
$rule->build_str = 'projects';
$rule->description = 'Project Management System - Projects';
$rule->insert();
// Create new rewrite rule for showing clients
$rule = RewriteRule::create_url_rule('"client"/{$slug}', 'UserThemeHandler', 'display_clients');
$rule->parse_regex = '%clients/?$%i';
$rule->build_str = 'clients';
$rule->description = 'Project Management System - Clients';
$rule->insert();
// Create new rewrite rule for showing tasks
$rule = RewriteRule::create_url_rule('"task"/{$slug}', 'UserThemeHandler', 'display_tasks');
$rule->parse_regex = '%tasks/?$%i';
$rule->build_str = 'task';
$rule->description = 'Project Management System - Tasks';
$rule->insert();
}
示例13: action_init
public function action_init()
{
//$this->add_template('event.single', dirname(__FILE__) . '/event.single.php');
Post::add_new_type('imageset', false);
Post::add_new_type('image', false);
Post::add_new_type('gallery', false);
CpgDb::registerTables();
//Utils::debug('tables registered!');
if (CpgDb::DB_VERSION > CpgOptions::getDbVersion()) {
CpgDb::install();
EventLog::log('Updated CPG.');
CpgOptions::setDbVersion(CpgDb::DB_VERSION);
}
}
示例14: action_plugin_activation
/**
* Hook on activation of this plugin
*/
public function action_plugin_activation()
{
// add the new content types
Post::add_new_type('addon');
// allow reading the new content types
UserGroup::get_by_name('anonymous')->grant('post_addon', 'read');
// create a permissions token
ACL::create_token('manage_versions', _t('Manage Addon Versions', 'addon_catalog'), 'Addon Catalog', false);
// create the addon vocabulary (type)
Vocabulary::add_object_type('addon');
// create the addon vocabulary
$params = array('name' => self::CATALOG_VOCABULARY, 'description' => _t('A vocabulary for addon versions in the addons catalog', 'addon_catalog'));
$vocabulary = Vocabulary::create($params);
// @TODO: notification/log of some sort?
// create the default content
include 'create_core_addons.php';
}
示例15: action_plugin_activation
public function action_plugin_activation($plugin_file)
{
Post::add_new_type('urlbounce');
$group = UserGroup::get_by_name('anonymous');
$group->grant('post_urlbounce', 'read');
}