View source
<?php
module_load_include("inc", "persiantools", "includes/jalalidate_lib");
function jalalidate_nodes_preprocess_node(&$variables) {
global $language;
if ($language->name == 'Persian') {
$node = $variables['node'];
$time = $variables['created'];
$date = jalalidate_convert($time);
$variables['date'] = $date;
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['submitted'] = t('Submitted by !username on !datetime', array(
'!username' => $variables['name'],
'!datetime' => $variables['date'],
));
}
}
}
function jalalidate_nodes_preprocess_comment(&$variables) {
global $language;
if ($language->name == 'Persian') {
$comment = $variables['elements']['#comment'];
$variables['created'] = jalalidate_convert($comment->created);
$variables['changed'] = jalalidate_convert($comment->changed);
$variables['submitted'] = t('Submitted by !username on !datetime', array(
'!username' => $variables['author'],
'!datetime' => $variables['created'],
));
}
}
function jalalidate_nodes_menu() {
$items['admin/config/jalalidate'] = array(
'title' => 'Jalali Date',
'description' => 'Implements Jalali date for Views module.',
'position' => 'right',
'weight' => -5,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array(
'administer site configuration',
),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/config/jalalidate/settings'] = array(
'title' => 'Jalali Date Settings',
'description' => 'Jalali Date features can be managed here!',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'jalalidate_nodes_admin_settings',
),
'access arguments' => array(
'administer site configuration',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'jalalidate_nodes.admin.inc',
);
return $items;
}