Commit 2831322b authored by jcnventura's avatar jcnventura

Refine link functions

Create upgrade functions to delete old variables and to rename the print_display_type vars to print_html_display_type
parent 2bc194e3
......@@ -193,18 +193,13 @@ function _print_main_settings_validate($form, &$form_state) {
* @ingroup forms
*/
function print_html_settings() {
$link = print_print_link();
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Web page options'),
);
$form['settings']['print_html_link_text'] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => variable_get('print_html_link_text', t('Printer-friendly version')),
'#description' => t('Text used in the link to the printer-friendly version.'),
);
$form['settings']['print_html_new_window'] = array(
'#type' => 'checkbox',
'#title' => t('Open the printer-friendly version in a new window'),
......@@ -226,18 +221,18 @@ function print_html_settings() {
'#description' => t("When the above options are enabled, this option will close the window after its contents are printed."),
);
$form['settings']['print_display_sys_urllist'] = array(
$form['settings']['print_html_display_sys_urllist'] = array(
'#type' => 'checkbox',
'#title' => t('Printer-friendly URLs list in system pages'),
'#default_value' => variable_get('print_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT),
'#default_value' => variable_get('print_html_display_sys_urllist', PRINT_TYPE_SYS_URLLIST_DEFAULT),
'#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
);
$form['settings']['print_robots_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Robots META tags'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
'#title' => t('Robots META tags'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['settings']['print_robots_settings']['print_robots_noindex'] = array(
......@@ -261,5 +256,24 @@ function print_html_settings() {
'#description' => t('Non-standard tag to instruct search engines to not show a "Cached" link for your printer-friendly pages. Recognized by Googlebot.'),
);
$form['settings']['link_text'] = array(
'#type' => 'fieldset',
'#title' => t('Custom link text'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['link_text']['print_html_link_text_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable custom link text'),
'#default_value' => variable_get('print_html_link_text_enabled', PRINT_TYPE_LINK_TEXT_ENABLED_DEFAULT),
);
$form['settings']['link_text']['print_html_link_text'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('print_html_link_text', $link['text']),
'#description' => t('Text used in the link to the printer-friendly version.'),
);
return system_settings_form($form);
}
......@@ -35,46 +35,39 @@ function print_enable() {
* Implements hook_uninstall().
*/
function print_uninstall() {
variable_del('print_settings');
variable_del('print_sourceurl_settings');
variable_del('print_html_settings');
variable_del('print_robot_settings');
variable_del('print_logo_url');
variable_del('print_logo_options');
variable_del('print_comments');
variable_del('print_css');
variable_del('print_footer_options');
variable_del('print_footer_user');
variable_del('print_html_display_sys_urllist');
variable_del('print_html_link_text');
variable_del('print_html_link_text_enabled');
variable_del('print_html_new_window');
variable_del('print_html_sendtoprinter');
variable_del('print_html_windowclose');
variable_del('print_keep_theme_css');
variable_del('print_urls');
variable_del('print_urls_anchors');
variable_del('print_comments');
variable_del('print_logo_options');
variable_del('print_logo_url');
variable_del('print_newwindow');
variable_del('print_sourceurl_enabled');
variable_del('print_robots_noarchive');
variable_del('print_robots_nofollow');
variable_del('print_robots_noindex');
variable_del('print_sourceurl_date');
variable_del('print_sourceurl_enabled');
variable_del('print_sourceurl_forcenode');
variable_del('print_html_show_link');
variable_del('print_urls');
variable_del('print_urls_anchors');
variable_del('print_html_book_link');
variable_del('print_html_link_class');
variable_del('print_html_link_pos');
variable_del('print_html_link_teaser');
variable_del('print_html_node_link_visibility');
variable_del('print_html_node_link_pages');
variable_del('print_html_link_class');
variable_del('print_html_sys_link_visibility');
variable_del('print_html_sys_link_pages');
variable_del('print_html_book_link');
variable_del('print_html_new_window');
variable_del('print_html_sendtoprinter');
variable_del('print_html_windowclose');
variable_del('print_display_sys_urllist');
variable_del('print_robots_noindex');
variable_del('print_robots_nofollow');
variable_del('print_robots_noarchive');
variable_del('print_footer_options');
variable_del('print_footer_user');
variable_del('print_html_link_text');
variable_del('print_html_link_use_alias');
variable_del('print_text_links');
variable_del('print_text_published');
variable_del('print_text_retrieved');
variable_del('print_text_source_url');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
variable_del('print_html_show_link');
variable_del('print_html_sys_link_pages');
variable_del('print_html_sys_link_visibility');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_html\_display\_%'");
foreach ($settings as $variable) {
variable_del($variable->name);
}
......@@ -167,7 +160,27 @@ function print_update_7000(&$sandbox) {
}
/**
* Empty update
* Delete old variables
*/
function print_update_7100(&$sandbox) {
function print_update_7200(&$sandbox) {
variable_del('print_settings');
variable_del('print_sourceurl_settings');
variable_del('print_html_settings');
variable_del('print_robot_settings');
variable_del('print_html_node_link_pages');
variable_del('print_html_node_link_visibility');
variable_del('print_text_links');
variable_del('print_text_published');
variable_del('print_text_retrieved');
variable_del('print_text_source_url');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
foreach ($settings as $variable) {
$name = $variable->name;
variable_set(str_replace('print_', 'print_html_', $name), variable_get($name));
variable_del($name);
}
}
......@@ -46,7 +46,9 @@ define('PRINT_URLS_DEFAULT', 1);
define('PRINT_URLS_ANCHORS_DEFAULT', 0);
define('PRINT_COMMENTS_DEFAULT', 0);
define('PRINT_NEWWINDOW_DEFAULT', 1);
define('PRINT_TYPE_SYS_URLLIST_DEFAULT', 0);
define('PRINT_TYPE_LINK_TEXT_ENABLED_DEFAULT', 0);
define('PRINT_HTML_NEW_WINDOW_DEFAULT', 0);
define('PRINT_HTML_SENDTOPRINTER_DEFAULT', 0);
......@@ -165,16 +167,17 @@ function print_preprocess_print(&$variables) {
* Implements hook_menu().
*/
function print_menu() {
$link = print_print_link();
$items = array();
$items[PRINT_PATH] = array(
$items[$link['path']] = array(
'title' => 'Printer-friendly',
'page callback' => 'print_controller_html',
'access arguments' => array('access print'),
'type' => MENU_CALLBACK,
'file' => 'print.pages.inc',
);
$items[PRINT_PATH . '/' . PRINT_PATH] = array(
$items[$link['path'] . '/' . $link['path']] = array(
'access callback' => FALSE,
);
$items['admin/config/user-interface/print'] = array(
......@@ -236,6 +239,17 @@ function print_block_view($delta = '') {
return $block;
}
/**
* Implements hook_help().
*/
function print_help($path, $arg) {
switch ($path) {
case 'admin/help#print':
// Return a line-break version of the module README
return _filter_autop(file_get_contents(drupal_get_path('module', 'print') . '/README.txt'));
}
}
/**
* Implements hook_node_delete().
*/
......
This diff is collapsed.
......@@ -19,18 +19,13 @@
* @ingroup forms
*/
function print_mail_settings() {
$link = print_mail_print_link();
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Send by email options'),
);
$form['settings']['print_mail_link_text'] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => variable_get('print_mail_link_text', t('Send by email')),
'#description' => t('Text used in the link to the send by-email form.'),
);
$form['settings']['print_mail_hourly_threshold'] = array(
'#type' => 'select',
'#title' => t('Hourly threshold'),
......@@ -83,5 +78,24 @@ function print_mail_settings() {
'#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
);
$form['settings']['link_text'] = array(
'#type' => 'fieldset',
'#title' => t('Custom link text'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['link_text']['print_mail_link_text_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable custom link text'),
'#default_value' => variable_get('print_mail_link_text_enabled', PRINT_TYPE_LINK_TEXT_ENABLED_DEFAULT),
);
$form['settings']['link_text']['print_mail_link_text'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('print_mail_link_text', $link['text']),
'#description' => t('Text used in the link to the send by email form.'),
);
return system_settings_form($form);
}
......@@ -30,13 +30,14 @@ function print_mail_form($form, &$form_state) {
if (empty($path)) {
// If no path was provided, let's try to generate a page for the referer
global $base_url;
$link = print_mail_print_link();
$ref = $_SERVER['HTTP_REFERER'];
$path = preg_replace("!^$base_url/!", '', $ref);
if (($path === $ref) || empty($path)) {
$path = variable_get('site_frontpage', 'node');
}
drupal_goto(PRINTMAIL_PATH . '/' . $path);
drupal_goto($link['path'] . '/' . $path);
}
elseif (ctype_digit($path_arr[1])) {
if (drupal_lookup_path('source', $path)) {
......@@ -165,10 +166,8 @@ function print_mail_form($form, &$form_state) {
$user_name = t('Someone');
}
$site_name = variable_get('site_name', t('an interesting site'));
$print_mail_text_subject = filter_xss(variable_get('print_mail_text_subject', t('!user has sent you a message from !site')));
$form['fld_subject']['#default_value'] = t($print_mail_text_subject, array('!user' => $user_name, '!site' => $site_name, '!title' => $title));
$print_mail_text_content = filter_xss(variable_get('print_mail_text_content', ''));
$form['txt_message']['#default_value'] = t($print_mail_text_content);
$form['fld_subject']['#default_value'] = t('!user has sent you a message from !site', array('!user' => $user_name, '!site' => $site_name, '!title' => $title));
$form['txt_message']['#default_value'] = t('');
return $form;
}
......@@ -262,10 +261,13 @@ function print_mail_form_validate($form, &$form_state) {
/**
* Process the send by-email form submission.
*
* @see print_controller()
* @ingroup forms
*/
function print_mail_form_submit($form, &$form_state) {
if (!array_key_exists('cancel', $form_state['values'])) {
$link = print_mail_print_link();
if (!empty($form_state['values']['fld_from_name'])) {
$from = '"' . mime_header_encode($form_state['values']['fld_from_name']) . '" <' . $form_state['values']['fld_from_addr'] . '>';
}
......@@ -274,10 +276,9 @@ function print_mail_form_submit($form, &$form_state) {
}
$cid = isset($form_state['values']['cid']) ? $form_state['values']['cid'] : NULL;
$print_mail_text_message = filter_xss_admin(variable_get('print_mail_text_message', t('Message from sender')));
$sender_message = $print_mail_text_message . ':<br /><br /><em>' . nl2br(check_plain($form_state['values']['txt_message'])) . '</em>';
$sender_message = t('Message from sender') . ':<br /><br /><em>' . nl2br(check_plain($form_state['values']['txt_message'])) . '</em>';
$print = print_controller($form_state['values']['path'], $cid, PRINT_MAIL_FORMAT, $form_state['values']['chk_teaser'], $sender_message);
$print = print_controller($form_state['values']['path'], $link['format'], $cid, $form_state['values']['chk_teaser'], $sender_message);
// Spaces in img URLs must be replaced with %20
$pattern = '!<(img\s[^>]*?)>!is';
......@@ -293,7 +294,7 @@ function print_mail_form_submit($form, &$form_state) {
$params['title'] = $form_state['values']['title'];
$node = $print['node'];
$params['body'] = theme('print', array('print' => $print, 'type' => PRINT_MAIL_FORMAT, 'node' => $node));
$params['body'] = theme('print', array('print' => $print, 'type' => $link['format'], 'node' => $node));
$ok = FALSE;
if (function_exists('job_queue_add') && variable_get('print_mail_job_queue', PRINT_MAIL_JOB_QUEUE_DEFAULT)) {
......@@ -331,8 +332,7 @@ function print_mail_form_submit($form, &$form_state) {
if ($ok) {
watchdog('print_mail', '%name [%from] sent %page to [%to]', array('%name' => $form_state['values']['fld_from_name'], '%from' => $form_state['values']['fld_from_addr'], '%page' => $form_state['values']['path'], '%to' => $form_state['values']['txt_to_addrs']));
$site_name = variable_get('site_name', t('us'));
$print_mail_text_confirmation = variable_get('print_mail_text_confirmation', t('Thank you for spreading the word about !site.'));
drupal_set_message(check_plain(t($print_mail_text_confirmation, array('!site' => $site_name))));
drupal_set_message(check_plain(t('Thank you for spreading the word about !site.', array('!site' => $site_name))));
$nodepath = drupal_get_normal_path($form_state['values']['path']);
db_update('print_mail_page_counter')
......
......@@ -31,28 +31,24 @@ function print_mail_enable() {
* Implements hook_uninstall().
*/
function print_mail_uninstall() {
variable_del('print_mail_settings');
variable_del('print_mail_show_link');
variable_del('print_mail_link_pos');
variable_del('print_mail_link_teaser');
variable_del('print_mail_node_link_visibility');
variable_del('print_mail_node_link_pages');
variable_del('print_mail_link_class');
variable_del('print_mail_sys_link_visibility');
variable_del('print_mail_sys_link_pages');
variable_del('print_mail_book_link');
variable_del('print_mail_display_sys_urllist');
variable_del('print_mail_hourly_threshold');
variable_del('print_mail_teaser_default');
variable_del('print_mail_teaser_choice');
variable_del('print_mail_job_queue');
variable_del('print_mail_link_text');
variable_del('print_mail_link_text_enabled');
variable_del('print_mail_send_option_default');
variable_del('print_mail_teaser_choice');
variable_del('print_mail_teaser_default');
variable_del('print_mail_book_link');
variable_del('print_mail_link_class');
variable_del('print_mail_link_pos');
variable_del('print_mail_link_teaser');
variable_del('print_mail_link_use_alias');
variable_del('print_mail_text_title');
variable_del('print_mail_text_confirmation');
variable_del('print_mail_text_message');
variable_del('print_mail_text_subject');
variable_del('print_mail_text_content');
variable_del('print_mail_job_queue');
variable_del('print_mail_display_sys_urllist');
variable_del('print_mail_show_link');
variable_del('print_mail_sys_link_pages');
variable_del('print_mail_sys_link_visibility');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_mail\_display\_%'");
foreach ($settings as $variable) {
variable_del($variable->name);
......@@ -181,3 +177,19 @@ function print_mail_update_7101(&$sandbox) {
->condition('permission', 'send unlimited e-mails')
->execute();
}
/**
* Delete old variables
*/
function print_mail_update_7200(&$sandbox) {
variable_del('print_mail_settings');
variable_del('print_mail_node_link_pages');
variable_del('print_mail_node_link_visibility');
variable_del('print_mail_text_title');
variable_del('print_mail_text_confirmation');
variable_del('print_mail_text_message');
variable_del('print_mail_text_subject');
variable_del('print_mail_text_content');
}
......@@ -64,10 +64,11 @@ function print_mail_theme() {
* Implements hook_menu().
*/
function print_mail_menu() {
$link = print_mail_print_link();
$items = array();
$items[PRINTMAIL_PATH] = array(
'title' => variable_get('print_mail_text_title', 'Send page by email'),
$items[$link['path']] = array(
'title' => 'Send by email',
'page callback' => 'drupal_get_form',
'page arguments' => array('print_mail_form'),
'access callback' => '_print_mail_access',
......@@ -75,7 +76,7 @@ function print_mail_menu() {
'type' => MENU_CALLBACK,
'file' => 'print_mail.inc',
);
$items[PRINTMAIL_PATH . '/' . PRINTMAIL_PATH] = array(
$items[$link['path'] . '/' . $link['path']] = array(
'access callback' => FALSE,
);
$items['admin/config/user-interface/print/email'] = array(
......@@ -151,9 +152,10 @@ function print_mail_job_queue_functions() {
* TRUE if the user has permission to view the page, FALSE otherwise
*/
function _print_mail_access($permission) {
$link = print_mail_print_link();
$page_access = TRUE;
$parts = explode('/', $_GET['q']);
if ($parts[0] == PRINTMAIL_PATH) {
if ($parts[0] == $link['path']) {
if (count($parts) > 1) {
unset($parts[0]);
$path = implode('/', $parts);
......@@ -209,7 +211,7 @@ function print_mail_insert_link($path = NULL, $node = NULL) {
*/
function print_mail_mollom_form_list() {
$forms['print_mail_form'] = array(
'title' => t('Send page form'),
'title' => t('Send by email form'),
'entity' => 'print_mail',
);
return $forms;
......
......@@ -20,18 +20,13 @@ function print_pdf_settings() {
$pdf_tools = _print_pdf_tools();
if ($pdf_tools != -1) {
$link = print_pdf_print_link();
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('PDF options'),
);
$form['settings']['print_pdf_link_text'] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => variable_get('print_pdf_link_text', t('PDF version')),
'#description' => t('Text used in the link to the PDF version.'),
);
$form['settings']['print_pdf_pdf_tool'] = array(
'#type' => 'radios',
'#title' => t('PDF generation tool'),
......@@ -116,6 +111,25 @@ function print_pdf_settings() {
'#description' => t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
);
$form['settings']['link_text'] = array(
'#type' => 'fieldset',
'#title' => t('Custom link text'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['link_text']['print_pdf_link_text_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable custom link text'),
'#default_value' => variable_get('print_pdf_link_text_enabled', PRINT_TYPE_LINK_TEXT_ENABLED_DEFAULT),
);
$form['settings']['link_text']['print_pdf_link_text'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('print_pdf_link_text', $link['text']),
'#description' => t('Text used in the link to the PDF version.'),
);
$form['#validate'][] = '_print_pdf_settings_validate';
}
else {
......@@ -144,6 +158,11 @@ function _print_pdf_settings_validate($form, &$form_state) {
* @see _print_pdf_tools()
*/
function print_pdf_tcpdf_settings() {
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('TCPDF options'),
);
$form['settings']['print_pdf_font_family'] = array(
'#type' => 'textfield',
'#title' => t('Font family'),
......@@ -189,6 +208,11 @@ function _print_pdf_tcpdf_settings_validate($form, &$form_state) {
* @see _print_pdf_tools()
*/
function print_pdf_dompdf_settings() {
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('dompdf options'),
);
$form['settings']['print_pdf_dompdf_unicode'] = array(
'#type' => 'checkbox',
'#title' => t("Use dompdf's Unicode Mode"),
......@@ -206,6 +230,11 @@ function print_pdf_dompdf_settings() {
* @see _print_pdf_tools()
*/
function print_pdf_wkhtmltopdf_settings() {
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('wkhtmltopdf options'),
);
$form['settings']['print_pdf_wkhtmltopdf_options'] = array(
'#type' => 'textfield',
'#title' => t('wkhtmltopdf options'),
......
......@@ -27,30 +27,34 @@ function print_pdf_enable() {
* Implements hook_uninstall().
*/
function print_pdf_uninstall() {
variable_del('print_pdf_settings');
variable_del('print_pdf_show_link');
variable_del('print_pdf_link_pos');
variable_del('print_pdf_link_teaser');
variable_del('print_pdf_node_link_visibility');
variable_del('print_pdf_node_link_pages');
variable_del('print_pdf_link_class');
variable_del('print_pdf_sys_link_visibility');
variable_del('print_pdf_sys_link_pages');
variable_del('print_pdf_book_link');
variable_del('print_pdf_pdf_tool');
variable_del('print_pdf_autoconfig');
variable_del('print_pdf_content_disposition');
variable_del('print_pdf_paper_size');
variable_del('print_pdf_page_orientation');
variable_del('print_pdf_display_sys_urllist');
variable_del('print_pdf_filename');
variable_del('print_pdf_images_via_file');
variable_del('print_pdf_font_family');
variable_del('print_pdf_font_size');
variable_del('print_pdf_link_text');
variable_del('print_pdf_link_use_alias');
variable_del('print_pdf_filename');
variable_del('print_pdf_autoconfig');
variable_del('print_pdf_link_text_enabled');
variable_del('print_pdf_page_orientation');
variable_del('print_pdf_paper_size');
variable_del('print_pdf_pdf_tool');
variable_del('print_pdf_dompdf_unicode');
variable_del('print_pdf_font_family');
variable_del('print_pdf_font_size');
variable_del('print_pdf_font_subsetting');
variable_del('print_pdf_wkhtmltopdf_options');
variable_del('print_pdf_display_sys_urllist');
variable_del('print_pdf_book_link');
variable_del('print_pdf_link_class');
variable_del('print_pdf_link_pos');
variable_del('print_pdf_link_teaser');
variable_del('print_pdf_link_use_alias');
variable_del('print_pdf_show_link');
variable_del('print_pdf_sys_link_pages');
variable_del('print_pdf_sys_link_visibility');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_pdf\_display\_%'");
foreach ($settings as $variable) {
variable_del($variable->name);
......@@ -145,3 +149,13 @@ function print_pdf_update_7000(&$sandbox) {
variable_set('print_pdf_filename', '[site:name] - [node:title] - [node:changed:custom:Y-m-d]');
}
}
/**
* Delete old variables
*/
function print_pdf_update_7200(&$sandbox) {
variable_del('print_pdf_settings');
variable_del('print_pdf_node_link_pages');
variable_del('print_pdf_node_link_visibility');
}
......@@ -89,16 +89,17 @@ function print_pdf_theme() {
* Implements hook_menu().
*/
function print_pdf_menu() {
$link = print_pdf_print_link();
$items = array();
$items[PRINTPDF_PATH] = array(
$items[$link['path']] = array(
'title' => 'Printer-friendly PDF',
'page callback' => 'print_pdf_controller',
'access arguments' => array('access PDF version'),
'type' => MENU_CALLBACK,
'file' => 'print_pdf.pages.inc',
);
$items[PRINTPDF_PATH . '/' . PRINTPDF_PATH] = array(
$items[$link['path'] . '/' . $link['path']] = array(
'access callback' => FALSE,
);
$items['admin/config/user-interface/print/pdf'] = array(
......
......@@ -75,7 +75,8 @@ function print_pdf_controller() {
function print_pdf_generate_path($path, $cid = NULL, $pdf_filename = NULL) {
global $base_url;
$print = print_controller($path, $cid, PRINT_PDF_FORMAT);
$link = print_pdf_print_link();
$print = print_controller($path, $link['format'], $cid);
if ($print === FALSE) {
return;
}
......@@ -90,13 +91,13 @@ function print_pdf_generate_path($path, $cid = NULL, $pdf_filename = NULL) {
$print['sendtoprinter'] = '';
$node = $print['node'];
$html = theme('print', array('print' => $print, 'type' => PRINT_PDF_FORMAT, 'node' => $node));
$html = theme('print', array('print' => $print, 'type' => $link['format'], 'node' => $node));
// Convert the a href elements, to make sure no relative links remain
$pattern = '!<(a\s[^>]*?)>!is';
$html = preg_replace_callback($pattern, '_print_rewrite_urls', $html);
// And make anchor links relative again, to permit in-PDF navigation
$html = preg_replace("!${base_url}/" . PRINTPDF_PATH . '/.*?#!', '#', $html);
$html = preg_replace("!${base_url}/" . $link['path'] . '/.*?#!', '#', $html);
return print_pdf_generate_html($print, $html, $pdf_filename);
}
......
......@@ -32,7 +32,7 @@ function print_ui_settings() {
'#title' => t('Link location'),
'#default_value' => variable_get('print_' . $format . '_link_pos', array(PRINT_UI_LINK_POS_DEFAULT => PRINT_UI_LINK_POS_DEFAULT)),
'#options' => array('link' => t('Links area'), 'corner' => t('Content corner'), 'block' => t('Block')),
'#description' => t('Choose the location of the link(s) to the printer-friendly version pages. The Links area is usually below the node content, whereas the Content corner is placed in the upper-right corner of the node content. Unselect all options to disable the link. Even if the link is disabled, you can still go to %path where nid is the numeric id of the node.', array('%path' => PRINT_PATH . '/nid')),
'#description' => t('Choose the location of the link(s) to the printer-friendly version pages. The Links area is usually below the node content, whereas the Content corner is placed in the upper-right corner of the node content. Unselect all options to disable the link. Even if the link is disabled, you can still go to %path where nid is the numeric id of the node.', array('%path' => $link['path'] . '/nid')),
);
$form['settings']['checkboxes']['link_teaser']['print_' . $format . '_link_teaser'] = array(
......@@ -128,8 +128,8 @@ function print_ui_settings() {
* Returns HTML for the link settings page.
*
* @param $variables
* An associative array containing:
* - form: A render element representing the form.
* An associative array containing:
* - form: A render element representing the form.
*
* @ingroup themeable
*/
......
......@@ -2,6 +2,7 @@ name = "Printer-friendly pages UI"
description = "Handles the links to the printer-friendly versions."
core=7.x
package = "Printer, email and PDF versions"
dependencies[] = print
files[] = print_ui.module
files[] = print_ui.admin.inc
configure = admin/config/user-interface/print/ui
This diff is collapsed.
Markdown is supported
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