Skip to content

Commit fbce909

Browse files
committed
DOM
1 parent 9e9b0fc commit fbce909

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ This project is licensed under the GPL3 License.
279279
* Feature: Toot Content Filter
280280
* Feature: Date Filter
281281
* Feature: Image Filter
282+
* Changed: DOM Structure
283+
* Renamed: CSS Classes
282284
* Security: Better Output Escaping
283285

284286
### 0.4 "Cassie Lang"

tootpress_blog.php

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,37 @@ function tootpress_paint_image($tootid){
7777
// Amount of Images
7878
$amount_of_images=sizeof($toot_image);
7979

80-
for($i=0;$i<$amount_of_images;$i++) {
80+
// DOM Structure
81+
$image_html.='<div class="toot-image">';
82+
$image_html.='<div class="';
83+
if($amount_of_images>1) {
84+
$image_html.='toot-gallery ';
85+
$image_html.='toot-gallery-size-'.(int) $amount_of_images;
86+
} else {
87+
$image_html.='toot-image-single';
88+
}
89+
$image_html.='">';
8190

82-
// Image Content
83-
$image_html.='<div class="toot-image ';
91+
for($i=0;$i<$amount_of_images;$i++) {
8492

8593
// Classes
8694
if($amount_of_images>1) {
8795
// Galleries
88-
$image_html.='toot-image-gallery ';
89-
$image_html.='toot-image-gallery-'.(int) $amount_of_images.' ';
90-
$image_html.='toot-image-'.(int) ($i+1);
91-
} else {
92-
// Single Images
93-
$image_html.='toot-image-single ';
94-
}
96+
$image_html.='<div class="';
97+
$image_html.='toot-gallery-image toot-gallery-image-'.(int) ($i+1);
98+
$image_html.='">';
99+
}
95100

96-
$image_html.='">';
101+
// Image Tag
97102
$image_html.=tootpress_paint_image_tag($toot_image[$i]['attachment_file'],$toot_image[$i]['attachment_description'],$toot_image[$i]['attachment_width'],$toot_image[$i]['attachment_height'],$amount_of_images,($i+1));
98-
$image_html.='</div>';
103+
104+
// Galleries
105+
if($amount_of_images>1) {$image_html.='</div>';}
99106

100107
}
101108

109+
$image_html.='</div></div>';
110+
102111
return $image_html;
103112
}
104113

@@ -118,6 +127,10 @@ function tootpress_paint_image($tootid){
118127

119128
function tootpress_paint_image_tag($filename, $description, $width, $height, $amount_of_images, $image_number) {
120129

130+
// ALT
131+
if($description==FALSE) {$description='Sorry! No image description created.';}
132+
133+
// Image Tag
121134
$image_tag='<img ';
122135
$image_tag.='src="';
123136
$image_tag.=esc_url(tootpress_get_url_image_directory());
@@ -133,6 +146,7 @@ function tootpress_paint_image_tag($filename, $description, $width, $height, $am
133146
//$image_html.=$toot_image[0]['attachment_height'];
134147
$image_tag.='" />';
135148

149+
// Filter
136150
$image_tag=tootpress_image_filter_apply($image_tag,$filename,$description, $width,$height,tootpress_get_url_image_directory(),$amount_of_images,$image_number);
137151

138152
return $image_tag;
@@ -153,7 +167,7 @@ function tootpress_paint_image_tag($filename, $description, $width, $height, $am
153167

154168
function tootpress_paint_elephant( $instance, $account, $mastodon_id, $backlink) {
155169

156-
$elephant_html='';
170+
$elephant_html='<div class="toot-symbol">';
157171
$url='https://'.$instance.'/@'.$account.'/'.$mastodon_id;
158172

159173
if($backlink) {
@@ -163,14 +177,16 @@ function tootpress_paint_elephant( $instance, $account, $mastodon_id, $backlink)
163177
}
164178

165179
// The Elephant
166-
$elephant_img='<img class="tootpress-toot-symbol" src="'.esc_url(plugins_url()).'/tootpress/tootpress_toot.png" alt="Toot Symbol" width="35" height="37"/>';
180+
$elephant_img='<img src="'.esc_url(plugins_url()).'/tootpress/tootpress_toot.png" alt="Toot Symbol" width="35" height="37"/>';
167181
$elephant_img=tootpress_mastodon_logo_filter_apply($elephant_img);
168182
$elephant_html.=$elephant_img;
169183

170184
if($backlink) {
171185
$elephant_html.='</a>';
172186
}
173187

188+
$elephant_html.='</div>';
189+
174190
return $elephant_html;
175191

176192
}

tootpress_toots.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TootPress CSS @ Blog
77
clear:both;
88
}
99

10-
.tootpress-toot-symbol {
10+
.toot-symbol {
1111
float:left !important;
1212
margin-top:5px;
1313
}
@@ -32,7 +32,7 @@ TootPress CSS @ Blog
3232
max-width: 100%;
3333
}
3434

35-
.toot-image-gallery {
35+
.toot-gallery-image {
3636
margin-bottom:5px;
3737
}
3838

0 commit comments

Comments
 (0)