-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathitem.php
More file actions
269 lines (259 loc) · 15.4 KB
/
Copy pathitem.php
File metadata and controls
269 lines (259 loc) · 15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php
/*
* This file is part of the Bender theme for Shopclass (Mindstellar).
* Copyright (c) 2014 Osclass (original work, licensed under the Apache License 2.0)
* Copyright (c) 2021-2026 Mindstellar Community
*
* Distributed under the GNU General Public License v3.0 or later. The original
* Osclass code it derives from was licensed under the Apache License 2.0.
* See LICENSE for the full GPL-3.0 text.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
// meta tag robots
if( osc_item_is_spam() || osc_premium_is_spam() ) {
osc_add_hook('header','bender_nofollow_construct');
} else {
osc_add_hook('header','bender_follow_construct');
}
osc_register_script('bender-item', osc_asset_url_versioned(osc_current_web_theme_url('js/bender-item.js')));
osc_enqueue_script('bender-item');
bender_add_body_class('item');
osc_add_hook('after-main','sidebar');
function sidebar(){
osc_current_web_theme_path('item-sidebar.php');
}
$location = array();
if( osc_item_city_area() !== '' ) {
$location[] = osc_item_city_area();
}
if( osc_item_city() !== '' ) {
$location[] = osc_item_city();
}
if( osc_item_region() !== '' ) {
$location[] = osc_item_region();
}
if( osc_item_country() !== '' ) {
$location[] = osc_item_country();
}
osc_current_web_theme_path('header.php');
?>
<div id="item-content">
<h1><?php if( osc_price_enabled_at_items() ) { ?><span class="price"><?php echo osc_item_formated_price(); ?></span> <?php } ?><strong><?php echo osc_item_title() . ' ' . osc_item_city(); ?></strong></h1>
<div class="item-header">
<div>
<?php if ( osc_item_pub_date() !== '' ) { printf( __('<strong class="publish">Published date</strong>: %1$s', 'bender'), osc_format_date( osc_item_pub_date() ) ); } ?>
</div>
<div>
<?php if ( osc_item_mod_date() !== '' ) { printf( __('<strong class="update">Modified date:</strong> %1$s', 'bender'), osc_format_date( osc_item_mod_date() ) ); } ?>
</div>
<?php if (count($location)>0) { ?>
<ul id="item_location">
<li><strong><?php _e("Location", 'bender'); ?></strong>: <?php echo implode(', ', $location); ?></li>
</ul>
<?php }; ?>
</div>
<?php if(osc_is_web_user_logged_in() && osc_logged_user_id()==osc_item_user_id()) { ?>
<p id="edit_item_view">
<strong>
<a href="<?php echo osc_item_edit_url(); ?>" rel="nofollow"><?php _e('Edit item', 'bender'); ?></a>
</strong>
</p>
<?php } ?>
<?php if( osc_images_enabled_at_items() ) { ?>
<?php
if( osc_count_item_resources() > 0 ) {
$i = 0;
?>
<div class="item-photos">
<a href="<?php echo osc_resource_url(); ?>" class="main-photo" title="<?php _e('Image', 'bender'); ?> <?php echo $i+1;?> / <?php echo osc_count_item_resources();?>">
<img src="<?php echo osc_resource_url(); ?>" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
</a>
<div class="thumbs">
<?php for ( $i = 0; osc_has_item_resources(); $i++ ) { ?>
<a href="<?php echo osc_resource_url(); ?>" class="fancybox"
data-fancybox-group="group"
title="<?php _e('Image', 'bender'); ?> <?php echo $i+1;?> / <?php echo osc_count_item_resources();?>">
<img src="<?php echo osc_resource_thumbnail_url(); ?>" width="75" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
</a>
<?php } ?>
</div>
</div>
<dialog class="bender-lightbox" id="bender-lightbox" aria-label="<?php echo osc_esc_html(__('Image viewer', 'bender')); ?>">
<button type="button" class="bender-lightbox__close" data-dialog-close aria-label="<?php echo osc_esc_html(__('Close', 'bender')); ?>">×</button>
<button type="button" class="bender-lightbox__nav bender-lightbox__prev" data-lightbox-step="-1" aria-label="<?php echo osc_esc_html(__('Previous image', 'bender')); ?>">‹</button>
<img data-lightbox-img src="" alt="" />
<button type="button" class="bender-lightbox__nav bender-lightbox__next" data-lightbox-step="1" aria-label="<?php echo osc_esc_html(__('Next image', 'bender')); ?>">›</button>
<p class="bender-lightbox__count" data-lightbox-count></p>
</dialog>
<?php } ?>
<?php } ?>
<div id="description">
<p><?php echo osc_item_description(); ?></p>
<div id="custom_fields">
<?php if( osc_count_item_meta() >= 1 ) { ?>
<br />
<div class="meta_list">
<?php while ( osc_has_item_meta() ) { ?>
<?php if(osc_item_meta_value()!='') { ?>
<div class="meta">
<strong><?php echo osc_item_meta_name(); ?>:</strong> <?php echo osc_item_meta_value(); ?>
</div>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
<?php osc_run_hook('item_detail', osc_item() ); ?>
<p class="contact_button">
<?php if( !osc_item_is_expired () ) { ?>
<?php if( !( ( osc_logged_user_id() == osc_item_user_id() ) && osc_logged_user_id() != 0 ) ) { ?>
<?php if(osc_reg_user_can_contact() && osc_is_web_user_logged_in() || !osc_reg_user_can_contact() ) { ?>
<a href="#contact" class="ui-button ui-button-middle ui-button-main .resp-toggle"><?php _e('Contact seller', 'bender'); ?></a>
<?php } ?>
<?php } ?>
<?php } ?>
<a href="#" role="button" class="ui-button ui-button-middle" data-dialog-open="bender-share"><?php _e('Share', 'bender'); ?></a>
</p>
<dialog class="bender-share" id="bender-share" aria-labelledby="bender-share-title">
<button type="button" class="bender-share__close" data-dialog-close aria-label="<?php echo osc_esc_html(__('Close', 'bender')); ?>">×</button>
<h2 id="bender-share-title"><?php _e('Share this listing', 'bender'); ?></h2>
<div class="bender-share__copy">
<input class="bender-share__input" type="text" readonly data-share-url value="<?php echo osc_esc_html(osc_item_url()); ?>" onclick="this.select();" />
<button type="button" class="ui-button" data-share-copy data-copied="<?php echo osc_esc_html(__('Link copied.', 'bender')); ?>"><?php _e('Copy', 'bender'); ?></button>
</div>
<p class="bender-share__status" role="status" data-share-status></p>
<button type="button" class="ui-button ui-button-middle bender-share__native" data-share-native hidden
data-share-title="<?php echo osc_esc_html(osc_item_title()); ?>"
data-share-url="<?php echo osc_esc_html(osc_item_url()); ?>">
<?php _e('Share…', 'bender'); ?>
</button>
<div class="bender-share__targets">
<a class="ui-button" target="_blank" rel="noopener noreferrer" href="https://wa.me/?text=<?php echo rawurlencode(osc_item_title() . "\n" . osc_item_url()); ?>">WhatsApp</a>
<a class="ui-button" target="_blank" rel="noopener noreferrer" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo rawurlencode(osc_item_url()); ?>">Facebook</a>
</div>
</dialog>
<style type="text/css">
.bender-lightbox, .bender-share { border: none; border-radius: 4px; padding: 20px; box-shadow: 0 4px 24px rgba(0,0,0,.3); }
.bender-lightbox::backdrop, .bender-share::backdrop { background: rgba(0,0,0,.75); }
.bender-lightbox { width: 90vw; max-width: 900px; background: #000; text-align: center; position: relative; }
.bender-lightbox img { max-width: 100%; max-height: 78vh; }
.bender-lightbox__count { color: #fff; margin: 10px 0 0; }
.bender-lightbox__close, .bender-share__close { position: absolute; top: 8px; right: 8px; border: none; background: transparent; color: inherit; font-size: 1.4em; line-height: 1; cursor: pointer; }
.bender-lightbox__close { color: #fff; }
.bender-lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); border: none; background: rgba(0,0,0,.4); color: #fff; font-size: 2em; line-height: 1; padding: 6px 14px; cursor: pointer; }
.bender-lightbox__prev { left: 10px; }
.bender-lightbox__next { right: 10px; }
.bender-share { width: 90vw; max-width: 380px; background: #fff; }
.bender-share__copy { display: flex; gap: 6px; margin: 10px 0; }
.bender-share__input { flex: 1; }
.bender-share__status { min-height: 1.2em; font-size: .9em; color: #35C3D9; }
.bender-share__native { display: block; width: 100%; margin-bottom: 10px; }
.bender-share__native[hidden] { display: none; }
.bender-share__targets { display: flex; gap: 8px; }
</style>
<?php osc_run_hook('location'); ?>
</div>
<!-- plugins -->
<div id="useful_info" class="bordered-box">
<h2><?php _e('Useful information', 'bender'); ?></h2>
<ul>
<li><?php _e('Avoid scams by acting locally or paying with PayPal', 'bender'); ?></li>
<li><?php _e('Never pay with Western Union, Moneygram or other anonymous payment services', 'bender'); ?></li>
<li><?php _e('Don\'t buy or sell outside of your country. Don\'t accept cashier cheques from outside your country', 'bender'); ?></li>
<li><?php _e('This site is never involved in any transaction, and does not handle payments, shipping, guarantee transactions, provide escrow services, or offer "buyer protection" or "seller certification"', 'bender'); ?></li>
</ul>
</div>
<?php related_listings(); ?>
<?php if( osc_count_items() > 0 ) { ?>
<div class="similar_ads">
<h2><?php _e('Related listings', 'bender'); ?></h2>
<?php
View::newInstance()->_exportVariableToView("listType", 'items');
osc_current_web_theme_path('loop.php');
?>
<div class="clear"></div>
</div>
<?php } ?>
<?php if( osc_comments_enabled() ) { ?>
<?php if( osc_reg_user_post_comments () && osc_is_web_user_logged_in() || !osc_reg_user_post_comments() ) { ?>
<div id="comments">
<h2><?php _e('Comments', 'bender'); ?></h2>
<ul id="comment_error_list"></ul>
<?php CommentForm::js_validation(); ?>
<?php if( osc_count_item_comments() >= 1 ) { ?>
<div class="comments_list">
<?php while ( osc_has_item_comments() ) { ?>
<div class="comment">
<h3><strong><?php echo osc_comment_title(); ?></strong> <em><?php _e("by", 'bender'); ?> <?php echo osc_comment_author_name(); ?>:</em></h3>
<p><?php echo nl2br( osc_comment_body() ); ?> </p>
<?php if ( osc_comment_user_id() && (osc_comment_user_id() == osc_logged_user_id()) ) { ?>
<p>
<a rel="nofollow" href="<?php echo osc_delete_comment_url(); ?>" title="<?php _e('Delete your comment', 'bender'); ?>"><?php _e('Delete', 'bender'); ?></a>
</p>
<?php } ?>
</div>
<?php } ?>
<div class="paginate" style="text-align: right;">
<?php echo osc_comments_pagination(); ?>
</div>
</div>
<?php } ?>
<div class="form-container form-horizontal">
<div class="header">
<h3><?php _e('Leave your comment (spam and offensive messages will be removed)', 'bender'); ?></h3>
</div>
<div class="resp-wrapper">
<form action="<?php echo osc_base_url(true); ?>" method="post" name="comment_form" id="comment_form">
<fieldset>
<input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="page" value="item" />
<input type="hidden" name="id" value="<?php echo osc_item_id(); ?>" />
<?php if(osc_is_web_user_logged_in()) { ?>
<input type="hidden" name="authorName" value="<?php echo osc_esc_html( osc_logged_user_name() ); ?>" />
<input type="hidden" name="authorEmail" value="<?php echo osc_logged_user_email();?>" />
<?php } else { ?>
<div class="control-group">
<label class="control-label" for="authorName"><?php _e('Your name', 'bender'); ?></label>
<div class="controls">
<?php CommentForm::author_input_text(); ?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="authorEmail"><?php _e('Your e-mail', 'bender'); ?></label>
<div class="controls">
<?php CommentForm::email_input_text(); ?>
</div>
</div>
<?php }; ?>
<div class="control-group">
<label class="control-label" for="title"><?php _e('Title', 'bender'); ?></label>
<div class="controls">
<?php CommentForm::title_input_text(); ?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="body"><?php _e('Comment', 'bender'); ?></label>
<div class="controls textarea">
<?php CommentForm::body_input_textarea(); ?>
</div>
</div>
<?php if( osc_recaptcha_comments_enabled() && osc_captcha_enabled() ) { ?>
<div class="control-group">
<div class="controls">
<?php osc_show_captcha('comments'); ?>
</div>
</div>
<?php } ?>
<div class="actions">
<button type="submit"><?php _e('Send', 'bender'); ?></button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<?php } ?>
<?php } ?>
</div>
<?php osc_current_web_theme_path('footer.php') ; ?>