PageRenderTime 23ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/system/pyrocms/modules/pages/details.php

https://github.com/coderm/pyrocms
PHP | 206 lines | 198 code | 5 blank | 3 comment | 7 complexity | a536adba3ac4713be2fb205ebc2c283b MD5 | raw file
  1. <?php defined('BASEPATH') or exit('No direct script access allowed');
  2. class Module_Pages extends Module {
  3. public $version = '1.1';
  4. public function info()
  5. {
  6. return array(
  7. 'name' => array(
  8. 'sl' => 'Strani',
  9. 'en' => 'Pages',
  10. 'nl' => 'Pagina&apos;s',
  11. 'es' => 'Páginas',
  12. 'fr' => 'Pages',
  13. 'de' => 'Seiten',
  14. 'pl' => 'Strony',
  15. 'pt' => 'Páginas',
  16. 'zh' => '頁面',
  17. 'it' => 'Pagine',
  18. 'ru' => 'Страницы',
  19. 'ar' => 'الصفحات',
  20. 'cs' => 'Stránky',
  21. 'fi' => 'Sivut',
  22. 'el' => 'Σελίδες',
  23. 'he' => 'דפים',
  24. 'lt' => 'Puslapiai'
  25. ),
  26. 'description' => array(
  27. 'sl' => 'Dodaj stran s kakršno koli vsebino želite.',
  28. 'en' => 'Add custom pages to the site with any content you want.',
  29. 'nl' => "Voeg aangepaste pagina&apos;s met willekeurige inhoud aan de site toe.",
  30. 'pl' => 'Dodaj własne strony z dowolną treścią do witryny.',
  31. 'es' => 'Agrega páginas customizadas al sitio con cualquier contenido que tu quieras.',
  32. 'fr' => "Permet d'ajouter sur le site des pages personalisées avec le contenu que vous souhaitez.",
  33. 'de' => 'Füge eigene Seiten mit anpassbaren Inhalt hinzu.',
  34. 'pt' => 'Adicionar páginas personalizadas ao site com qualquer conteúdo que você queira.',
  35. 'zh' => '為您的網站新增自定的頁面。',
  36. 'it' => 'Aggiungi pagine personalizzate al sito con qualsiesi contenuto tu voglia.',
  37. 'ru' => 'Управление информационными страницами сайта, с произвольным содержимым.',
  38. 'ar' => 'إضافة صفحات مُخصّصة إلى الموقع تحتوي أية مُحتوى تريده.',
  39. 'cs' => 'Přidávejte vlastní stránky na web s jakýmkoliv obsahem budete chtít.',
  40. 'fi' => 'Lisää mitä tahansa sisältöä sivustollesi.',
  41. 'el' => 'Προσθέστε δικές σας σελίδες στον ιστότοπό σας με ό,τι περιεχόμενο θέλετε.',
  42. 'he' => 'ניהול דפי תוכן האתר',
  43. 'lt' => 'Pridėkite nuosavus puslapius betkokio turinio'
  44. ),
  45. 'frontend' => TRUE,
  46. 'backend' => TRUE,
  47. 'skip_xss' => TRUE,
  48. 'menu' => 'content',
  49. 'roles' => array(
  50. 'put_live', 'edit_live', 'delete_live'
  51. )
  52. );
  53. }
  54. public function install()
  55. {
  56. $this->dbforge->drop_table('page_layouts');
  57. $this->dbforge->drop_table('pages');
  58. $this->dbforge->drop_table('revisions');
  59. $page_layouts = "
  60. CREATE TABLE `page_layouts` (
  61. `id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  62. `title` VARCHAR( 60 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  63. `body` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  64. `css` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  65. `js` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  66. `theme_layout` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'default',
  67. `updated_on` INT( 11 ) NOT NULL
  68. ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Store shared page layouts & CSS';
  69. ";
  70. $pages = "
  71. CREATE TABLE `pages` (
  72. `id` int(11) unsigned NOT NULL auto_increment,
  73. `slug` varchar(255) collate utf8_unicode_ci NOT NULL default '',
  74. `title` varchar(255) collate utf8_unicode_ci NOT NULL default '',
  75. `uri` text COLLATE utf8_unicode_ci,
  76. `parent_id` int(11) default '0',
  77. `revision_id` varchar(255) collate utf8_unicode_ci NOT NULL default '1',
  78. `layout_id` varchar(255) collate utf8_unicode_ci NOT NULL,
  79. `css` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  80. `js` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  81. `meta_title` varchar(255) collate utf8_unicode_ci NOT NULL default '',
  82. `meta_keywords` varchar(255) collate utf8_unicode_ci NOT NULL default '',
  83. `meta_description` text collate utf8_unicode_ci,
  84. `rss_enabled` INT(1) NOT NULL default '0',
  85. `comments_enabled` INT(1) NOT NULL default '0',
  86. `status` ENUM( 'draft', 'live' ) collate utf8_unicode_ci NOT NULL DEFAULT 'draft',
  87. `created_on` INT(11) NOT NULL default '0',
  88. `updated_on` INT(11) NOT NULL default '0',
  89. `restricted_to` VARCHAR(255) collate utf8_unicode_ci DEFAULT NULL,
  90. `is_home` TINYINT(1) NOT NULL default '0',
  91. `order` INT(11) NOT NULL default '0',
  92. PRIMARY KEY (`id`),
  93. UNIQUE KEY `Unique` (`slug`,`parent_id`),
  94. KEY `slug` (`slug`),
  95. KEY `parent` (`parent_id`)
  96. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='User Editable Pages';
  97. ";
  98. $revisions = "
  99. CREATE TABLE `revisions` (
  100. `id` int(11) NOT NULL AUTO_INCREMENT,
  101. `owner_id` int(11) NOT NULL,
  102. `table_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'pages',
  103. `body` text COLLATE utf8_unicode_ci,
  104. `revision_date` int(11) NOT NULL,
  105. `author_id` int(11) NOT NULL default 0,
  106. PRIMARY KEY (`id`),
  107. KEY `Owner ID` (`owner_id`)
  108. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
  109. ";
  110. $default_page_layouts = "
  111. INSERT INTO `page_layouts` (`id`, `title`, `body`, `css`, `js`, `updated_on`) VALUES
  112. (1, 'Default', '<h2>{pyro:page:title}</h2>\n\n\n{pyro:page:body}', '', '', ".time().");
  113. ";
  114. $default_pages = "
  115. INSERT INTO `pages` (`id`, `slug`, `title`, `uri`, `revision_id`, `parent_id`, `layout_id`, `status`, `created_on`, `updated_on`, `restricted_to`, is_home) VALUES
  116. ('1','home', 'Home', 'home', 1, 0, 1, 'live', ".time().", ".time().", '', 1),
  117. ('2', '404', 'Page missing', '404', 2, 0, '1', 'live', ".time().", ".time().", '', 0),
  118. ('3','contact', 'Contact', 'contact', 3, 0, 1, 'live', ".time().", ".time().", '', 0);
  119. ";
  120. $default_revisions = "
  121. INSERT INTO `revisions` (`id`, `owner_id`, `body`, `revision_date`) VALUES
  122. ('1', '1', '<p>Welcome to our homepage. We have not quite finished setting up our website yet, but please add us to your bookmarks and come back soon.</p>', ".time()."),
  123. ('2', '2', '<p>We cannot find the page you are looking for, please click <a title=\"Home\" href=\"{pyro:pages:url id=\'1\'}\">here</a> to go to the homepage.</p>', ".time()."),
  124. ('3', '3', '<p>To contact us please fill out the form below.</p> {pyro:contact:form}', ".time().");
  125. ";
  126. if($this->db->query($page_layouts) &&
  127. $this->db->query($pages) &&
  128. $this->db->query($revisions) &&
  129. $this->db->query($default_page_layouts) &&
  130. $this->db->query($default_pages) &&
  131. $this->db->query($default_revisions))
  132. {
  133. return TRUE;
  134. }
  135. }
  136. public function uninstall()
  137. {
  138. //it's a core module, lets keep it around
  139. return FALSE;
  140. }
  141. public function upgrade($old_version)
  142. {
  143. // Your Upgrade Logic
  144. return TRUE;
  145. }
  146. public function help()
  147. {
  148. // Return a string containing help info
  149. // You could include a file and return it here.
  150. return "<h4>Overview</h4>
  151. <p>The pages module is a simple but powerful way to manage static content on your site.
  152. Page layouts can be managed and widgets embedded without ever editing the template files.</p>
  153. <h4>Managing Pages</h4><hr>
  154. <h6>Page Content</h6>
  155. <p>When choosing your page title remember that the default page layout will display the page title
  156. above the page content. Now create your page content
  157. using the WYSIWYG editor. When you are ready for the page to be visible to visitors set the
  158. status to Live and it will be accessible at the URL shown. <strong>You must also go to Design -> Navigation and create a new
  159. navigation link if you want your page to show up in the menu.</strong></p>
  160. <h6>Meta data</h6>
  161. <p>The meta title is generally used as the title in search results and is believed to carry significant weight in page rank.<br />
  162. Meta keywords are words that describe your site content and are for the benefit of search engines only.<br />
  163. The meta description is a short description of this page and may be used as the search snippet if the search engine deems it relevant to the search.</p>
  164. <h6>Design</h6>
  165. <p>The design tab allows you to select a custom page layout and optionally apply different css styles to it on this page only. Refer to the Page Layouts
  166. section below for instructions on how to best use Page Layouts.</p>
  167. <h6>Script</h6>
  168. <p>You may place javascript here that you would like appended to the < head > of the page.</p>
  169. <h6>Options</h6>
  170. <p>Allows you to turn on comments and an rss feed for this page. If the rss feed is enabled a visitor can subscribe to this page and they
  171. will receive each child page in their rss reader.</p>
  172. <h6>Revisions</h6>
  173. <p>Revisions is a very powerful and handy feature for editing an existing page. Let's say a new employee really messes up a page edit. Just select a date that you would
  174. like to revert the page to and click Save! You can even compare revisions to see what has changed.</p>
  175. <h4>Page Layouts</h4><hr>
  176. <p>Page layouts allows you to control the layout of the page without modifying the theme files. You can embed tags into the page layout
  177. instead of placing them in every page. For example: If you have a twitter feed widget that you want to display at the bottom of every page you can just place
  178. the widget tag in the page layout:
  179. <pre><code>
  180. {pyro:page:title}
  181. {pyro:page:body}
  182. < div class=\"my-twitter-widget\" >
  183. {pyro:widgets:instance id=\"1\"}
  184. < /div >
  185. </code></pre>
  186. Now you can apply css styling to the \"my-twitter-widget\" class in the CSS tab.</p>";
  187. }
  188. }
  189. /* End of file details.php */