Skip to content

Commit 9bb7adf

Browse files
committed
Merge branch 'develop' into 7.0dev
Conflicts: conf/_application.php inc/files/model/_file.funcs.php
2 parents 51e0feb + aded8da commit 9bb7adf

5 files changed

Lines changed: 107 additions & 40 deletions

File tree

inc/_core/_misc.funcs.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5150,6 +5150,11 @@ function get_icon( $iconKey, $what = 'imgtag', $params = NULL, $include_in_legen
51505150
}
51515151
}
51525152

5153+
if( isset( $params['title'] ) && $params['title'] === false )
5154+
{ // Disable title:
5155+
unset( $params['title'] );
5156+
}
5157+
51535158
// Format title and alt attributes because they may contain the unexpected chars from translatable strings:
51545159
if( isset( $params['title'] ) )
51555160
{
@@ -5240,6 +5245,11 @@ function get_icon( $iconKey, $what = 'imgtag', $params = NULL, $include_in_legen
52405245
}
52415246
}
52425247

5248+
if( isset( $params['title'] ) && $params['title'] === false )
5249+
{ // Disable title:
5250+
unset( $params['title'] );
5251+
}
5252+
52435253
// Format title and alt attributes because they may contain the unexpected chars from translatable strings:
52445254
if( isset( $params['title'] ) )
52455255
{

inc/plugins/_plugin.class.php

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4069,25 +4069,43 @@ function & get_Blog_from_params( $params )
40694069
{
40704070
$setting_Blog = false;
40714071

4072-
if( ! empty( $params['Item'] ) )
4073-
{ // Get Blog from given Item:
4074-
$Item = & $params['Item'];
4075-
$setting_Blog = & $Item->get_Blog();
4076-
}
4077-
elseif( ! empty( $params['Comment'] ) )
4078-
{ // Get Blog from given Comment:
4079-
$Comment = & $params['Comment'];
4080-
$Item = & $Comment->get_Item();
4081-
$setting_Blog = & $Item->get_Blog();
4072+
if( $setting_Item = & $this->get_Item_from_params( $params ) )
4073+
{ // Get Collection from given Item or Comment:
4074+
$setting_Blog = & $setting_Item->get_Blog();
40824075
}
40834076
elseif( ! empty( $params['Blog'] ) )
4084-
{ // Get Blog from params:
4077+
{ // Get Collection from params:
40854078
$setting_Blog = & $params['Blog'];
40864079
}
40874080

40884081
return $setting_Blog;
40894082
}
40904083

4084+
4085+
/**
4086+
* Get Item from given params
4087+
*
4088+
* @param array Params: 'Item', 'Comment'
4089+
* @return object|false Item object or FALSE with wrong params
4090+
*/
4091+
function & get_Item_from_params( $params )
4092+
{
4093+
$setting_Item = false;
4094+
4095+
if( ! empty( $params['Item'] ) && $params['Item'] instanceof Item )
4096+
{ // Use the passed Item:
4097+
$setting_Item = & $params['Item'];
4098+
}
4099+
elseif( ! empty( $params['Comment'] ) && $params['Comment'] instanceof Comment )
4100+
{ // Get Item from given Comment:
4101+
$Comment = & $params['Comment'];
4102+
$setting_Item = & $Comment->get_Item();
4103+
}
4104+
4105+
return $setting_Item;
4106+
}
4107+
4108+
40914109
/**
40924110
* Get a skin specific param value from current Blog
40934111
*

inc/tools/model/_maintenance.funcs.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ function dbm_delete_orphan_files()
590590
$files_SQL->ORDER_BY( 'file_ID' );
591591

592592
$count_files_valid = 0;
593-
$invalid_files = array();
594593
$deleted_files = array();
595594
$cannot_deleted_files = array();
596595

@@ -604,11 +603,6 @@ function dbm_delete_orphan_files()
604603
foreach( $loaded_files as $loaded_file_data )
605604
{
606605
$File = & $FileCache->get_by_ID( $loaded_file_data['file_ID'], false, false );
607-
if( ! $File )
608-
{ // The File object couldn't be created because the db entry is invalid
609-
$invalid_files[] = $loaded_file_data;
610-
continue;
611-
}
612606
if( $File->exists() )
613607
{ // File exists on the disk
614608
$count_files_valid++;
@@ -666,25 +660,6 @@ function dbm_delete_orphan_files()
666660
echo '</ul>';
667661
}
668662
}
669-
670-
$count_files_invalid = count( $invalid_files );
671-
if( $count_files_invalid )
672-
{ // There are invalid files in the database
673-
// Display warning to show that the 'Remove orphan file roots' tool should be also called
674-
$remove_orphan_file_roots = 'href="'.$admin_url.'?ctrl=tools&amp;action=delete_orphan_file_roots&amp;'.url_crumb('tools').'"';
675-
$invalid_files_note = '<div class="text-danger">'.( $count_files_invalid == 1 ? T_('An invalid File object was found in the database') : sprintf( T_('%d invalid File objects were found in the database'), $count_files_invalid ) ).( $count_files_invalid > 0 ? ':' : '.' ).'</div>';
676-
if( $count_files_invalid > 0 )
677-
{ // Print out invalid files:
678-
$invalid_files_note .= '<ul>';
679-
foreach( $invalid_files as $file_data )
680-
{
681-
$invalid_files_note .= '<li>#'.$file_data['file_ID'].' - <code>'.$file_data['file_root_type'].'_'.$file_data['file_root_ID'].':'.$file_data['file_path'].'</code></li>';
682-
}
683-
$invalid_files_note .= '</ul>';
684-
}
685-
echo $invalid_files_note
686-
.'<div class="text-danger">'.sprintf( T_('It is strongly recommended to also execute the &lt;<a %s>Remove orphan file roots</a>&gt; tool to remove invalid files from the database and from the disk as well!'), $remove_orphan_file_roots ).'</div>';
687-
}
688663
}
689664

690665

plugins/_auto_anchors.plugin.php renamed to plugins/auto_anchors_plugin/_auto_anchors.plugin.php

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function get_coll_setting_definitions( & $params )
7777
function get_msg_setting_definitions( & $params )
7878
{
7979
// set params to allow rendering for messages by default
80-
$default_params = array_merge( $params, array( 'default_msg_rendering' => 'opt-in' ) );
80+
$default_params = array_merge( $params, array( 'default_msg_rendering' => 'never' ) );
8181
return parent::get_msg_setting_definitions( $default_params );
8282
}
8383

@@ -91,7 +91,7 @@ function get_msg_setting_definitions( & $params )
9191
function get_email_setting_definitions( & $params )
9292
{
9393
// set params to allow rendering for emails by default:
94-
$default_params = array_merge( $params, array( 'default_email_rendering' => 'opt-in' ) );
94+
$default_params = array_merge( $params, array( 'default_email_rendering' => 'never' ) );
9595
return parent::get_email_setting_definitions( $default_params );
9696
}
9797

@@ -110,13 +110,53 @@ function get_shared_setting_definitions( & $params )
110110
}
111111

112112

113+
/**
114+
* Event handler: Called at the beginning of the skin's HTML HEAD section.
115+
*
116+
* Use this to add any HTML HEAD lines (like CSS styles or links to resource files (CSS, JavaScript, ..)).
117+
*
118+
* @param array Associative array of parameters
119+
*/
120+
function SkinBeginHtmlHead( & $params )
121+
{
122+
global $Collection, $Blog;
123+
124+
if( ! isset( $Blog ) || (
125+
$this->get_coll_setting( 'coll_apply_rendering', $Blog ) == 'never' &&
126+
$this->get_coll_setting( 'coll_apply_comment_rendering', $Blog ) == 'never' ) )
127+
{ // Don't load css/js files when plugin is not enabled:
128+
return;
129+
}
130+
131+
$this->require_css( 'auto_anchors.css' );
132+
}
133+
134+
135+
/**
136+
* Event handler: Called when ending the admin html head section.
137+
*
138+
* @param array Associative array of parameters
139+
* @return boolean did we do something?
140+
*/
141+
function AdminEndHtmlHead( & $params )
142+
{
143+
$this->SkinBeginHtmlHead( $params );
144+
}
145+
146+
113147
/**
114148
* Perform rendering
115149
*/
116150
function RenderItemAsHtml( & $params )
117151
{
118152
$content = & $params['data'];
119153

154+
// Get current Item to render links for anchors:
155+
if( ! ( $this->current_Item = $this->get_Item_from_params( $params ) ) )
156+
{ // Render anchor link only for Item or Comment:
157+
return true;
158+
}
159+
120160
// Load for replace_special_chars():
121161
load_funcs( 'locales/_charset.funcs.php' );
122162

@@ -150,8 +190,19 @@ function callback_auto_anchor( $m )
150190
return $m[0];
151191
}
152192

153-
return $m[1].' id="'.$anchor.'">'.$m[4].$m[5];
154-
//return $m[1].' id="'.$anchor.'">'.$m[4].' <a href="#'.$anchor.'">'.get_icon( 'merge' ).'</a>'.$m[5];
193+
$header_tag_start = $m[1];
194+
if( strpos( $header_tag_start, ' class="' ) !== false )
195+
{ // Append style class to current:
196+
$header_tag_start = str_replace( ' class="', ' class="evo_auto_anchor_header ', $header_tag_start );
197+
}
198+
else
199+
{ // Add new class attribute:
200+
$header_tag_start .= ' class="evo_auto_anchor_header"';
201+
}
202+
203+
$anchor_link = ' <a href="'.$this->current_Item->get_permanent_url().'#'.$anchor.'" class="evo_auto_anchor_link">'.get_icon( 'merge', 'imgtag', array( 'title' => false ) ).'</a>';
204+
205+
return $header_tag_start.' id="'.$anchor.'">'.$m[4].$anchor_link.$m[5];
155206
}
156207
}
157208

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.evo_auto_anchor_header:hover .evo_auto_anchor_link {
2+
visibility: visible;
3+
}
4+
.evo_auto_anchor_link {
5+
visibility: hidden;
6+
color: #999;
7+
}
8+
.evo_auto_anchor_link:hover {
9+
color: inherit;
10+
}
11+
.evo_auto_anchor_link .fa {
12+
font-size: inherit;
13+
}

0 commit comments

Comments
 (0)