Commit 5e9a8d09 authored by jcnventura's avatar jcnventura

Fix #735260: Disable named anchors in URL list by default

parent 93971ee7
......@@ -42,6 +42,13 @@ function print_main_settings() {
t('Note that you can enable/disable the URL list for each content type individually from the !url.', array('!url' => l(t('Content Types page'), 'admin/build/types'))),
);
$form['settings']['print_urls_anchors'] = array(
'#type' => 'checkbox',
'#title' => t('Include named anchors in printer-friendly URLs list'),
'#default_value' => variable_get('print_urls_anchors', PRINT_URLS_ANCHORS_DEFAULT),
'#description' => t('If set, the list of the URLs at the bottom of the page will include anchors links on the same page.'),
);
$form['settings']['print_comments'] = array(
'#type' => 'checkbox',
'#title' => t('Include comments in printer-friendly version'),
......
......@@ -34,6 +34,7 @@ function print_uninstall() {
variable_del('print_logo_options');
variable_del('print_css');
variable_del('print_urls');
variable_del('print_urls_anchors');
variable_del('print_comments');
variable_del('print_newwindow');
variable_del('print_sourceurl_enabled');
......
......@@ -47,6 +47,7 @@ define('PRINT_FOOTER_OPTIONS_DEFAULT', 1);
define('PRINT_FOOTER_USER_DEFAULT', '');
define('PRINT_CSS_DEFAULT', '');
define('PRINT_URLS_DEFAULT', 1);
define('PRINT_URLS_ANCHORS_DEFAULT', 0);
define('PRINT_COMMENTS_DEFAULT', 0);
define('PRINT_NEWWINDOW_DEFAULT', 1);
......
......@@ -360,6 +360,8 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
function _print_rewrite_urls($matches) {
global $base_url, $base_root, $_print_urls;
$include_anchors = variable_get('print_urls_anchors', PRINT_URLS_ANCHORS_DEFAULT);
// first, split the html into the different tag attributes
$pattern = '!\s*(\w+\s*=\s*"(?:\\\"|[^"])*")\s*|\s*(\w+\s*=\s*\'(?:\\\\\'|[^\'])*\')\s*|\s*(\w+\s*=\s*\w+)\s*|\s+!';
$attribs = preg_split($pattern, $matches[1], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
......@@ -380,7 +382,7 @@ function _print_rewrite_urls($matches) {
else {
if ($url[0] == '#') {
// URL is an anchor tag
if (!empty($_print_urls)) {
if ($include_anchors && (!empty($_print_urls))) {
$path = explode('/', $_GET['q']);
unset($path[0]);
$path = implode('/', $path);
......
......@@ -38,6 +38,7 @@ function print_mail_uninstall() {
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');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_mail\_display\_%'");
foreach ($settings as $variable) {
......
......@@ -39,9 +39,9 @@ function print_pdf_uninstall() {
variable_del('print_pdf_link_text');
variable_del('print_pdf_link_use_alias');
variable_del('print_pdf_filename');
variable_del('print_pdf_wkhtmltopdf_xdisplay');
variable_del('print_pdf_autoconfig');
variable_del('print_pdf_dompdf_unicode');
variable_del('print_pdf_wkhtmltopdf_options');
variable_del('print_pdf_xvfb_options');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_pdf\_display\_%'");
foreach ($settings as $variable) {
variable_del($variable->name);
......
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