Commit 8f1e9731 authored by jcnventura's avatar jcnventura

Issue #1123786: remove print links from RSS feeds.

parent 754ad323
......@@ -348,7 +348,7 @@ function print_help($path, $arg) {
function print_node_view($node, $view_mode) {
$print_html_link_pos = variable_get('print_html_link_pos', array(PRINT_HTML_LINK_POS_DEFAULT => PRINT_HTML_LINK_POS_DEFAULT));
$print_html_link_use_alias = variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT);
$allowed_type = print_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($view_mode == 'teaser')));
$allowed_type = print_link_allowed(array('type' => 'node', 'node' => $node, 'view_mode' => $view_mode));
if (($allowed_type === PRINT_ALLOW_NORMAL_LINK) && !isset($node->book) && !empty($print_html_link_pos['link'])) {
drupal_add_css(drupal_get_path('module', 'print') . '/css/printlinks.css');
$links = array();
......@@ -789,8 +789,9 @@ function _print_page_match($visibility, $path, $pages) {
* PRINT_ALLOW_BOOK_LINK if a link is allowed in a book node
*/
function print_link_allowed($args) {
if ((!empty($args['teaser']) && !variable_get('print_html_link_teaser', PRINT_HTML_LINK_TEASER_DEFAULT))
|| !user_access('access print')) {
$view_mode = isset($args['view_mode']) ? $args['view_mode'] : '';
if ((($view_mode == 'teaser') && !variable_get('print_html_link_teaser', PRINT_HTML_LINK_TEASER_DEFAULT))
|| !in_array($view_mode, array('full', 'teaser')) || !user_access('access print')) {
// If the teaser link is disabled or the user is not allowed
return FALSE;
}
......
......@@ -136,7 +136,7 @@ function print_mail_block_view($delta = 0) {
function print_mail_node_view($node, $view_mode) {
$print_mail_link_pos = variable_get('print_mail_link_pos', array(PRINT_MAIL_LINK_POS_DEFAULT => PRINT_MAIL_LINK_POS_DEFAULT));
$print_mail_link_use_alias = variable_get('print_mail_link_use_alias', PRINT_MAIL_LINK_USE_ALIAS_DEFAULT);
$allowed_type = print_mail_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($view_mode == 'teaser')));
$allowed_type = print_mail_link_allowed(array('type' => 'node', 'node' => $node, 'view_mode' => $view_mode));
if (($allowed_type) && !empty($print_mail_link_pos['link'])) {
drupal_add_css(drupal_get_path('module', 'print') . '/css/printlinks.css');
$links = array();
......@@ -481,8 +481,9 @@ function print_mail_insert_link($path = NULL, $node = NULL) {
* PRINT_ALLOW_BOOK_LINK if a link is allowed in a book node
*/
function print_mail_link_allowed($args) {
if ((!empty($args['teaser']) && !variable_get('print_mail_link_teaser', PRINT_MAIL_LINK_TEASER_DEFAULT))
|| !user_access('access send to friend')) {
$view_mode = isset($args['view_mode']) ? $args['view_mode'] : '';
if ((($view_mode == 'teaser') && !variable_get('print_mail_link_teaser', PRINT_MAIL_LINK_TEASER_DEFAULT))
|| !in_array($view_mode, array('full', 'teaser')) || !user_access('access send to friend')) {
// If the teaser link is disabled or the user is not allowed
return FALSE;
}
......
......@@ -239,7 +239,7 @@ function print_pdf_requirements($phase) {
function print_pdf_node_view($node, $view_mode) {
$print_pdf_link_pos = variable_get('print_pdf_link_pos', array(PRINT_PDF_LINK_POS_DEFAULT => PRINT_PDF_LINK_POS_DEFAULT));
$print_pdf_link_use_alias = variable_get('print_pdf_link_use_alias', PRINT_PDF_LINK_USE_ALIAS_DEFAULT);
$allowed_type = print_pdf_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($view_mode == 'teaser')));
$allowed_type = print_pdf_link_allowed(array('type' => 'node', 'node' => $node, 'view_mode' => $view_mode));
if (($allowed_type) && !empty($print_pdf_link_pos['link'])) {
drupal_add_css(drupal_get_path('module', 'print') . '/css/printlinks.css');
$links = array();
......@@ -536,9 +536,10 @@ function print_pdf_insert_link($path = NULL, $node = NULL) {
* PRINT_ALLOW_BOOK_LINK if a link is allowed in a book node
*/
function print_pdf_link_allowed($args) {
$view_mode = isset($args['view_mode']) ? $args['view_mode'] : '';
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
if ((!empty($args['teaser']) && !variable_get('print_pdf_link_teaser', PRINT_PDF_LINK_TEASER_DEFAULT))
|| !user_access('access PDF version') || (empty($print_pdf_pdf_tool))) {
if ((($view_mode == 'teaser') && !variable_get('print_pdf_link_teaser', PRINT_PDF_LINK_TEASER_DEFAULT))
|| !in_array($view_mode, array('full', 'teaser')) || !user_access('access PDF version') || (empty($print_pdf_pdf_tool))) {
// If the teaser link is disabled or the user is not allowed
return FALSE;
}
......
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