Commit 1f41c7f8 authored by JohnAlbin's avatar JohnAlbin
Browse files

Updated files from 5.x branch.

parent 12a03814
Page Title 5.x-1.1
* Added Russian translation by SadhooKlay.
* Removed inaccurate package description from .info file.
Page Title 5.x-1.0
* Initial release.
******************************************************************** ********************************************************************
D R U P A L M O D U L E P A G E T I T L E M O D U L E
******************************************************************** ********************************************************************
Name: Page title module Original Author: Robert Douglass
Version: 0.1 Current Maintainers: Nicholas Thompson and John Wilkins
Author: Robert Douglass
Email: rob ad robshouse dot net
Last update: February 21, 2006
Drupal: 4.7
******************************************************************** ********************************************************************
DESCRIPTION: DESCRIPTION:
* This module gives you control over the page title. It gives you the chance This module gives you control over the page title. It gives you the chance
* to provide templates for how the title should be structured, and on node to provide templates for how the title should be structured, and on node
* pages, gives you the chance to specify the page title rather than defaulting pages, gives you the chance to specify the page title rather than defaulting
* to the node title. to the node title.
******************************************************************** ********************************************************************
PERMISSIONS: PERMISSIONS:
This module defines the "set page title" permission. This permission determines This module defines the "set page title" permission. This permission
whether a user will se the "Page title" field on node edit forms. determines whether a user will see the "Page title" field on node edit forms.
********************************************************************
SYSTEM REQUIREMENTS:
Drupal: 4.7
******************************************************************** ********************************************************************
INSTALLATION: INSTALLATION:
...@@ -48,7 +39,7 @@ INSTALLATION: ...@@ -48,7 +39,7 @@ INSTALLATION:
`nid` INT NOT NULL , `nid` INT NOT NULL ,
`page_title` VARCHAR( 128 ) NOT NULL , `page_title` VARCHAR( 128 ) NOT NULL ,
PRIMARY KEY ( `nid` ) PRIMARY KEY ( `nid` )
) TYPE = MYISAM /*!40100 DEFAULT CHARACTER SET utf8 */; ) /*!40100 DEFAULT CHARACTER SET utf8 */;
3. Optionally configure the two variations of page title by visiting: 3. Optionally configure the two variations of page title by visiting:
...@@ -63,19 +54,23 @@ function _phptemplate_variables($hook, $vars) { ...@@ -63,19 +54,23 @@ function _phptemplate_variables($hook, $vars) {
$vars = array(); $vars = array();
if ($hook == 'page') { if ($hook == 'page') {
// This is the only important line // These are the only important lines
if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title(); $vars['head_title'] = page_title_page_get_title();
}
} }
return $vars; return $vars;
} }
As you can see from the code comment, there is only one important line As you can see from the code comment, there are only three important lines
of code: of code:
if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title(); $vars['head_title'] = page_title_page_get_title();
}
This line needs to be added to the 'page' hook of the _phptemplate_variables These lines need to be added to the 'page' hook of the _phptemplate_variables
function. function.
Alternately, you can call page_title_page_get_title() from page.tpl.php Alternately, you can call page_title_page_get_title() from page.tpl.php
......
; $Id$ ; $Id$
name = Page Title name = Page Title
description = "Enhanced control over the page title (in the <head> tag)." description = "Enhanced control over the page title (in the <head> tag)."
package = Content
<?php <?php
// $Id$
function page_title_install() { function page_title_install() {
switch ($GLOBALS['db_type']) { switch ($GLOBALS['db_type']) {
......
<?php <?php
// $Id$
/** /**
* @file
* Enhanced control over the page title (in the head tag).
*
* This module gives you control over the page title. It gives you the chance * This module gives you control over the page title. It gives you the chance
* to provide templates for how the title should be structured, and on node * to provide templates for how the title should be structured, and on node
* pages, gives you the chance to specify the page title rather than defaulting * pages, gives you the chance to specify the page title rather than defaulting
* to the node title. * to the node title.
*/ */
define(MODULE_DESCRIPTION, 'Enhanced control over the page title (in the &lt;head&gt; tag).');
function page_title_help($section) { function page_title_help($section) {
switch ($section) { switch ($section) {
case 'admin/modules#description': case 'admin/modules#description':
$output = t(MODULE_DESCRIPTION); $output = t('Enhanced control over the page title (in the &lt;head&gt; tag).');
break; break;
case 'admin/help#page_title': case 'admin/help#page_title':
$output = t('<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p> $output = t('<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>
...@@ -23,7 +25,7 @@ function page_title_help($section) { ...@@ -23,7 +25,7 @@ function page_title_help($section) {
<ol><li><em>page title</em> | <em>site name</em></li> <ol><li><em>page title</em> | <em>site name</em></li>
<li><em>site name</em> | <em>site slogan</em></li></ol> <li><em>site name</em> | <em>site slogan</em></li></ol>
<p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p> <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>
<p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>@page_title</code> placeholder. If left blank, <code>@page_title</code> will be the node's title, as is now the case.</p>"); <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>!page_title</code> placeholder. If left blank, <code>!page_title</code> will be the node's title, as is now the case.</p>");
break; break;
} }
return $output; return $output;
...@@ -44,7 +46,7 @@ function page_title_menu($may_cache) { ...@@ -44,7 +46,7 @@ function page_title_menu($may_cache) {
$items[] = array( $items[] = array(
'path' => 'admin/settings/page_title', 'path' => 'admin/settings/page_title',
'title' => t('Page title'), 'title' => t('Page title'),
'description' => t(MODULE_DESCRIPTION), 'description' => t('Enhanced control over the page title (in the &lt;head&gt; tag).'),
'callback' => 'drupal_get_form', 'callback' => 'drupal_get_form',
'callback arguments' => 'page_title_admin_settings', 'callback arguments' => 'page_title_admin_settings',
'access' => user_access('administer site configuration'), 'access' => user_access('administer site configuration'),
...@@ -62,16 +64,16 @@ function page_title_admin_settings() { ...@@ -62,16 +64,16 @@ function page_title_admin_settings() {
$form['page_title']['page_title_individual'] = array( $form['page_title']['page_title_individual'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Pattern for individual pages'), '#title' => t('Pattern for individual pages'),
'#default_value' => variable_get('page_title_individual', '@page_title | @site_name'), '#default_value' => variable_get('page_title_individual', '!page_title | !site_name'),
'#maxlength' => 128, '#maxlength' => 128,
'#description' => t('Available placeholders: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>.'), '#description' => t('Available placeholders: <code>!page_title</code>, <code>!site_name</code>, <code>!site_slogan</code>.'),
); );
$form['page_title']['page_title_front'] = array( $form['page_title']['page_title_front'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Pattern for front page'), '#title' => t('Pattern for front page'),
'#default_value' => variable_get('page_title_front', '@site_name | @site_slogan'), '#default_value' => variable_get('page_title_front', '!site_name | !site_slogan'),
'#maxlength' => 128, '#maxlength' => 128,
'#description' => t('Available placeholders: <code>@site_name</code>, <code>@site_slogan</code>.'), '#description' => t('Available placeholders: <code>!site_name</code>, <code>!site_slogan</code>.'),
); );
return system_settings_form($form); return system_settings_form($form);
} }
...@@ -148,23 +150,28 @@ function page_title_node_get_title($nid) { ...@@ -148,23 +150,28 @@ function page_title_node_get_title($nid) {
* the page hook of function _phptemplate_variables in template.php. * the page hook of function _phptemplate_variables in template.php.
*/ */
function page_title_page_get_title() { function page_title_page_get_title() {
$page_title_individual = variable_get('page_title_individual', '@page_title | @site_name'); static $title = NULL;
$page_title_front = variable_get('page_title_front', '@site_name | @site_slogan');
if (is_null($title)) {
$page_title_individual = variable_get('page_title_individual', '!page_title | !site_name');
$page_title_front = variable_get('page_title_front', '!site_name | !site_slogan');
// this is the normal title. For node pages it is $node->title // this is the normal title. For node pages it is $node->title
$drupal_title = drupal_get_title(); $drupal_title = drupal_get_title();
// this is the custom page title. For node pages it is $node->page_title. // this is the custom page title. For node pages it is $node->page_title.
$page_title = (page_title_set_title()) ? strip_tags(page_title_set_title()) : $drupal_title; $page_title = (page_title_set_title()) ? page_title_set_title() : $drupal_title;
$page_title = strip_tags($page_title);
$site_name = variable_get('site_name', 'drupal'); $site_name = variable_get('site_name', 'drupal');
$site_slogan = variable_get('site_slogan', ''); $site_slogan = variable_get('site_slogan', '');
if ($drupal_title) { if (drupal_is_front_page() || !$drupal_title) {
$title = t($page_title_individual, array('@page_title' => $page_title, '@site_name' => $site_name, '@site_slogan' => $site_slogan)); $title = t($page_title_front, array('!site_name' => $site_name, '!site_slogan' => $site_slogan));
} }
else { else {
$title = t($page_title_front, array('@site_name' => $site_name, '@site_slogan' => $site_slogan)); $title = t($page_title_individual, array('!page_title' => $page_title, '!site_name' => $site_name, '!site_slogan' => $site_slogan));
}
} }
return $title; return $title;
} }
# $Id$
#
# LANGUAGE translation of Drupal (page_title.module)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# page_title.install,v 1.2.2.1 2007/07/10 07:19:49 johnalbin
# page_title.info,v 1.1.2.1 2007/06/20 13:32:02 robertDouglass
# page_title.module,v 1.2.2.5 2007/07/10 07:58:02 johnalbin
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2007-07-10 02:29-0700\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: page_title.install:30
msgid "Page title module installed successfully."
msgstr ""
#: page_title.install:33
msgid "Table installation for the Page title module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries."
msgstr ""
#: page_title.info:0
msgid "Page Title"
msgstr ""
#: page_title.info:0
msgid "Enhanced control over the page title (in the &lt;head> tag)."
msgstr ""
#: page_title.module:17;49
msgid "Enhanced control over the page title (in the &lt;head&gt; tag)."
msgstr ""
#: page_title.module:20
msgid "<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>\n <p>Allows for better global configuration of the page title.</p>"
msgstr ""
#: page_title.module:24
msgid "<p>The default page title follows one of two patterns:\n <ol><li><em>page title</em> | <em>site name</em></li>\n <li><em>site name</em> | <em>site slogan</em></li></ol>\n <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>\n <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>!page_title</code> placeholder. If left blank, <code>!page_title</code> will be the node's title, as is now the case.</p>"
msgstr ""
#: page_title.module:48;85
msgid "Page title"
msgstr ""
#: page_title.module:62
msgid "Page title templates"
msgstr ""
#: page_title.module:66
msgid "Pattern for individual pages"
msgstr ""
#: page_title.module:69
msgid "Available placeholders: <code>!page_title</code>, <code>!site_name</code>, <code>!site_slogan</code>."
msgstr ""
#: page_title.module:73
msgid "Pattern for front page"
msgstr ""
#: page_title.module:76
msgid "Available placeholders: <code>!site_name</code>, <code>!site_slogan</code>."
msgstr ""
#: page_title.module:38
msgid "set page title"
msgstr ""
#: page_title.module:0
msgid "page_title"
msgstr ""
...@@ -13,11 +13,11 @@ msgstr "" ...@@ -13,11 +13,11 @@ msgstr ""
"X-Poedit-Country: RUSSIAN FEDERATION\n" "X-Poedit-Country: RUSSIAN FEDERATION\n"
"X-Poedit-SourceCharset: utf-8\n" "X-Poedit-SourceCharset: utf-8\n"
#: page_title.install:29 #: page_title.install:30
msgid "Page title module installed successfully." msgid "Page title module installed successfully."
msgstr "Модуль Page Title установлен успешно." msgstr "Модуль Page Title установлен успешно."
#: page_title.install:32 #: page_title.install:33
msgid "Table installation for the Page title module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries." msgid "Table installation for the Page title module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries."
msgstr "Создание таблицы в базе данных для модуля Page Title не увенчалось успехом. Таблицы должны быть созданы в ручную. Просмотрите сценарии установки в файле README.txt ." msgstr "Создание таблицы в базе данных для модуля Page Title не увенчалось успехом. Таблицы должны быть созданы в ручную. Просмотрите сценарии установки в файле README.txt ."
...@@ -29,60 +29,43 @@ msgstr "Заголовки страниц" ...@@ -29,60 +29,43 @@ msgstr "Заголовки страниц"
msgid "Enhanced control over the page title (in the &lt;head> tag)." msgid "Enhanced control over the page title (in the &lt;head> tag)."
msgstr "Расширенное управление заголовком страницы (тэг &lt;title> в &lt;head>)" msgstr "Расширенное управление заголовком страницы (тэг &lt;title> в &lt;head>)"
#: page_title.info:0 #: page_title.module:17;49
msgid "Content"
msgstr "Содержание"
#: page_title.module:10
msgid "Enhanced control over the page title (in the &lt;head&gt; tag)." msgid "Enhanced control over the page title (in the &lt;head&gt; tag)."
msgstr "Расширенное управление заголовком страницы (тэг &lt;title> в &lt;head>)" msgstr "Расширенное управление заголовком страницы (тэг &lt;title> в &lt;head>)"
#: page_title.module:18 #: page_title.module:20
msgid "" msgid "<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>\n <p>Allows for better global configuration of the page title.</p>"
"<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>\n"
" <p>Allows for better global configuration of the page title.</p>"
msgstr "Добавляет расширение при создании / редактирования материала в виде формы позволяющей дать странице специфичный заголовок. Позволяет улучшить глобальные настройки заголовков страниц." msgstr "Добавляет расширение при создании / редактирования материала в виде формы позволяющей дать странице специфичный заголовок. Позволяет улучшить глобальные настройки заголовков страниц."
#: page_title.module:22 #: page_title.module:24
msgid "" msgid "<p>The default page title follows one of two patterns:\n <ol><li><em>page title</em> | <em>site name</em></li>\n <li><em>site name</em> | <em>site slogan</em></li></ol>\n <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>\n <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>!page_title</code> placeholder. If left blank, <code>!page_title</code> will be the node's title, as is now the case.</p>"
"<p>The default page title follows one of two patterns:\n" msgstr "<p>Заголовки страниц по умолчанию назначаются по одной из двух схем:\n <ol><li><em>Заголовок страницы</em> | <em>Название сайта</em></li>\n <li><em>Название сайта</em> | <em>Слоган сайта</em></li></ol>\n<p>#1 - общий случай, когда посетитель просматривает какие то конкретные страницы</p><p>#2 - используется по умолчанию по крайней мере на главной странице (<em>материала</em>)</p>\n<p>Модуль page_title.module позволяет менять эти значения двумя способами. Во-первых, вы можете настроить показ этих заголовков с помощью шаблонов приведенных ниже. Этот способ изменит заголовок страницы созданный по умолчанию. Во вторых, при создании материала у вас присутствует форма, где вы можете ввести название которое будет отображаться в заголовке страницы при просмотре этого материала. Если значение которое вы введете в поле редактирования шаблонов, предоставляется материалом оно может быть использовано для генерации заголовка страницы. Если левая часть шаблона пуста, в качестве заголовка страницы с материалом будет использовано значение по умолчанию.</p>"
" <ol><li><em>page title</em> | <em>site name</em></li>\n"
" <li><em>site name</em> | <em>site slogan</em></li></ol>\n" #: page_title.module:48;85
" <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>\n"
" <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>@page_title</code> placeholder. If left blank, <code>@page_title</code> will be the node's title, as is now the case.</p>"
msgstr ""
"<p>Заголовки страниц по умолчанию назначаются по одной из двух схем:\n"
" <ol><li><em>Заголовок страницы</em> | <em>Название сайта</em></li>\n"
" <li><em>Название сайта</em> | <em>Слоган сайта</em></li></ol>\n"
"<p>#1 - общий случай, когда посетитель просматривает какие то конкретные страницы</p><p>#2 - используется по умолчанию по крайней мере на главной странице (<em>материала</em>)</p>\n"
"<p>Модуль page_title.module позволяет менять эти значения двумя способами. Во-первых, вы можете настроить показ этих заголовков с помощью шаблонов приведенных ниже. Этот способ изменит заголовок страницы созданный по умолчанию. Во вторых, при создании материала у вас присутствует форма, где вы можете ввести название которое будет отображаться в заголовке страницы при просмотре этого материала. Если значение которое вы введете в поле редактирования шаблонов, предоставляется материалом оно может быть использовано для генерации заголовка страницы. Если левая часть шаблона пуста, в качестве заголовка страницы с материалом будет использовано значение по умолчанию.</p>"
#: page_title.module:46
#: ;83
msgid "Page title" msgid "Page title"
msgstr "Заголовки страниц" msgstr "Заголовки страниц"
#: page_title.module:60 #: page_title.module:62
msgid "Page title templates" msgid "Page title templates"
msgstr "Шаблоны заголовков страниц" msgstr "Шаблоны заголовков страниц"
#: page_title.module:64 #: page_title.module:66
msgid "Pattern for individual pages" msgid "Pattern for individual pages"
msgstr "Шаблон для отдельных страниц" msgstr "Шаблон для отдельных страниц"
#: page_title.module:67 #: page_title.module:69
msgid "Available placeholders: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>." msgid "Available placeholders: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>."
msgstr "Доступные шаблоны: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>." msgstr "Доступные шаблоны: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>."
#: page_title.module:71 #: page_title.module:73
msgid "Pattern for front page" msgid "Pattern for front page"
msgstr "Шаблон для главной страницы" msgstr "Шаблон для главной страницы"
#: page_title.module:74 #: page_title.module:76
msgid "Available placeholders: <code>@site_name</code>, <code>@site_slogan</code>." msgid "Available placeholders: <code>@site_name</code>, <code>@site_slogan</code>."
msgstr "Доступные шаблоны: <code>@site_name</code>, <code>@site_slogan</code>." msgstr "Доступные шаблоны: <code>@site_name</code>, <code>@site_slogan</code>."
#: page_title.module:36 #: page_title.module:38
msgid "set page title" msgid "set page title"
msgstr "устанавливать заголовки страницам" msgstr "устанавливать заголовки страницам"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
function _phptemplate_variables($hook, $vars) { function _phptemplate_variables($hook, $vars) {
$vars = array(); $vars = array();
if ($hook == 'page') { if ($hook == 'page') {
if (module_exist('page_title')) { if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title(); $vars['head_title'] = page_title_page_get_title();
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment