File: D:/HostingSpaces/RDamen/damenbeletteringen.nl/wwwroot/admin/system/cms/modules/blog/details.php
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* Blog module
*
* @author PyroCMS Dev Team
* @package PyroCMS\Core\Modules\Blog
*/
class Module_Blog extends Module
{
public $version = '2.0.0';
public function info()
{
$info = array(
'name' => array(
'en' => 'Blog',
'ar' => 'المدوّنة',
'br' => 'Blog',
'pt' => 'Blog',
'el' => 'Ιστολόγιο',
'fa' => 'بلاگ',
'he' => 'בלוג',
'id' => 'Blog',
'lt' => 'Blogas',
'pl' => 'Blog',
'ru' => 'Блог',
'tw' => '文章',
'cn' => '文章',
'hu' => 'Blog',
'fi' => 'Blogi',
'th' => 'บล็อก',
'se' => 'Blogg',
),
'description' => array(
'en' => 'Post blog entries.',
'ar' => 'أنشر المقالات على مدوّنتك.',
'br' => 'Escrever publicações de blog',
'pt' => 'Escrever e editar publicações no blog',
'cs' => 'Publikujte nové články a příspěvky na blog.', #update translation
'da' => 'Skriv blogindlæg',
'de' => 'Veröffentliche neue Artikel und Blog-Einträge', #update translation
'sl' => 'Objavite blog prispevke',
'fi' => 'Kirjoita blogi artikkeleita.',
'el' => 'Δημιουργήστε άρθρα και εγγραφές στο ιστολόγιο σας.',
'es' => 'Escribe entradas para los artículos y blog (web log).', #update translation
'fa' => 'مقالات منتشر شده در بلاگ',
'fr' => 'Poster des articles d\'actualités.',
'he' => 'ניהול בלוג',
'id' => 'Post entri blog',
'it' => 'Pubblica notizie e post per il blog.', #update translation
'lt' => 'Rašykite naujienas bei blog\'o įrašus.',
'nl' => 'Post nieuwsartikelen en blogs op uw site.',
'pl' => 'Dodawaj nowe wpisy na blogu',
'ru' => 'Управление записями блога.',
'tw' => '發表新聞訊息、部落格等文章。',
'cn' => '发表新闻讯息、部落格等文章。',
'th' => 'โพสต์รายการบล็อก',
'hu' => 'Blog bejegyzések létrehozása.',
'se' => 'Inlägg i bloggen.',
),
'frontend' => true,
'backend' => true,
'skip_xss' => true,
'menu' => 'content',
'roles' => array(
'put_live', 'edit_live', 'delete_live'
),
'sections' => array(
'posts' => array(
'name' => 'blog:posts_title',
'uri' => 'admin/blog',
'shortcuts' => array(
array(
'name' => 'blog:create_title',
'uri' => 'admin/blog/create',
'class' => 'add',
),
),
),
'categories' => array(
'name' => 'cat:list_title',
'uri' => 'admin/blog/categories',
'shortcuts' => array(
array(
'name' => 'cat:create_title',
'uri' => 'admin/blog/categories/create',
'class' => 'add',
),
),
),
),
);
if (function_exists('group_has_role'))
{
if(group_has_role('blog', 'admin_blog_fields'))
{
$info['sections']['fields'] = array(
'name' => 'global:custom_fields',
'uri' => 'admin/blog/fields',
'shortcuts' => array(
'create' => array(
'name' => 'streams:add_field',
'uri' => 'admin/blog/fields/create',
'class' => 'add'
)
)
);
}
}
return $info;
}
public function install()
{
$this->dbforge->drop_table('blog_categories');
$this->load->driver('Streams');
$this->streams->utilities->remove_namespace('blogs');
// Just in case.
$this->dbforge->drop_table('blog');
if ($this->db->table_exists('data_streams'))
{
$this->db->where('stream_namespace', 'blogs')->delete('data_streams');
}
// Create the blog categories table.
$this->install_tables(array(
'blog_categories' => array(
'id' => array('type' => 'INT', 'constraint' => 11, 'auto_increment' => true, 'primary' => true),
'slug' => array('type' => 'VARCHAR', 'constraint' => 100, 'null' => false, 'unique' => true, 'key' => true),
'title' => array('type' => 'VARCHAR', 'constraint' => 100, 'null' => false, 'unique' => true),
),
));
$this->streams->streams->add_stream(
'lang:blog:blog_title',
'blog',
'blogs',
null,
null
);
// Add the intro field.
// This can be later removed by an admin.
$intro_field = array(
'name' => 'lang:blog:intro_label',
'slug' => 'intro',
'namespace' => 'blogs',
'type' => 'wysiwyg',
'assign' => 'blog',
'extra' => array('editor_type' => 'simple', 'allow_tags' => 'y'),
'required' => true
);
$this->streams->fields->add_field($intro_field);
// Ad the rest of the blog fields the normal way.
$blog_fields = array(
'title' => array('type' => 'VARCHAR', 'constraint' => 200, 'null' => false, 'unique' => true),
'slug' => array('type' => 'VARCHAR', 'constraint' => 200, 'null' => false),
'category_id' => array('type' => 'INT', 'constraint' => 11, 'key' => true),
'body' => array('type' => 'TEXT'),
'parsed' => array('type' => 'TEXT'),
'keywords' => array('type' => 'VARCHAR', 'constraint' => 32, 'default' => ''),
'author_id' => array('type' => 'INT', 'constraint' => 11, 'default' => 0),
'created_on' => array('type' => 'INT', 'constraint' => 11),
'updated_on' => array('type' => 'INT', 'constraint' => 11, 'default' => 0),
'comments_enabled' => array('type' => 'ENUM', 'constraint' => array('no','1 day','1 week','2 weeks','1 month', '3 months', 'always'), 'default' => '3 months'),
'status' => array('type' => 'ENUM', 'constraint' => array('draft', 'live'), 'default' => 'draft'),
'type' => array('type' => 'SET', 'constraint' => array('html', 'markdown', 'wysiwyg-advanced', 'wysiwyg-simple')),
'preview_hash' => array('type' => 'CHAR', 'constraint' => 32, 'default' => ''),
);
return $this->dbforge->add_column('blog', $blog_fields);
}
public function uninstall()
{
// This is a core module, lets keep it around.
return false;
}
public function upgrade($old_version)
{
return true;
}
}