| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 2 |
|
| 3 |
|
| 4 |
class zotpressLib |
| 5 |
{ |
| 6 |
/** |
| 7 |
* Creates a HTML-formatted library for the selected account. |
| 8 |
* |
| 9 |
* @return str the HTML-formatted subcollections |
| 10 |
*/ |
| 11 |
|
| 12 |
private $account = ""; |
| 13 |
private $type = false; |
| 14 |
private $filters = false; |
| 15 |
private $minlength = false; |
| 16 |
private $maxresults = false; |
| 17 |
private $maxperpage = false; |
| 18 |
private $tag = false; |
| 19 |
private $maxtags = 100; |
| 20 |
private $style = false; |
| 21 |
private $sortby = false; |
| 22 |
private $order = false; |
| 23 |
private $citeable = false; |
| 24 |
private $collection = false; |
| 25 |
private $downloadable = false; |
| 26 |
private $showtags = false; |
| 27 |
private $showimage = false; |
| 28 |
private $is_admin = false; |
| 29 |
private $urlwrap = false; |
| 30 |
private $toplevel = false; |
| 31 |
private $target = false; |
| 32 |
private $maxpages = 10; // not in shortcode yet |
| 33 |
private $browsebar = true; |
| 34 |
|
| 35 |
public function __construct() |
| 36 |
{ |
| 37 |
// Called automatically when an instance is instantiated |
| 38 |
} |
| 39 |
|
| 40 |
public function setAccount($account) |
| 41 |
{ |
| 42 |
$this->account = $account; |
| 43 |
} |
| 44 |
|
| 45 |
public function getAccount() |
| 46 |
{ |
| 47 |
return $this->account; |
| 48 |
} |
| 49 |
|
| 50 |
public function setType($type) |
| 51 |
{ |
| 52 |
if ( $type === false |
| 53 |
|| $type == "basic" ) { |
| 54 |
$type = "dropdown"; |
| 55 |
} |
| 56 |
$this->type = $type; |
| 57 |
} |
| 58 |
|
| 59 |
public function setFilters($filters) |
| 60 |
{ |
| 61 |
$this->filters = $filters; |
| 62 |
} |
| 63 |
|
| 64 |
public function setMinLength($minlength) |
| 65 |
{ |
| 66 |
$this->minlength = $minlength; |
| 67 |
} |
| 68 |
|
| 69 |
public function getMinLength() |
| 70 |
{ |
| 71 |
return $this->minlength; |
| 72 |
} |
| 73 |
|
| 74 |
public function setMaxResults($maxresults) |
| 75 |
{ |
| 76 |
$this->maxresults = $maxresults; |
| 77 |
} |
| 78 |
|
| 79 |
public function getMaxResults() |
| 80 |
{ |
| 81 |
return $this->maxresults; |
| 82 |
} |
| 83 |
|
| 84 |
public function setMaxPerPage($maxperpage) |
| 85 |
{ |
| 86 |
$this->maxperpage = $maxperpage; |
| 87 |
} |
| 88 |
|
| 89 |
public function getMaxPerPage() |
| 90 |
{ |
| 91 |
return $this->maxperpage; |
| 92 |
} |
| 93 |
|
| 94 |
public function setTag($tag) |
| 95 |
{ |
| 96 |
$this->tag = $tag; |
| 97 |
} |
| 98 |
|
| 99 |
public function setMaxTags($maxtags) |
| 100 |
{ |
| 101 |
$this->maxtags = $maxtags; |
| 102 |
} |
| 103 |
|
| 104 |
public function setCiteable($citeable) |
| 105 |
{ |
| 106 |
$this->citeable = $citeable; |
| 107 |
} |
| 108 |
|
| 109 |
public function setStyle($style) |
| 110 |
{ |
| 111 |
$this->style = strtolower( $style ); |
| 112 |
} |
| 113 |
|
| 114 |
public function setCollection($collection_id) |
| 115 |
{ |
| 116 |
$this->collection = $collection_id; |
| 117 |
} |
| 118 |
|
| 119 |
public function setSortBy($sortby) |
| 120 |
{ |
| 121 |
$this->sortby = strtolower( $sortby ); |
| 122 |
} |
| 123 |
|
| 124 |
public function setOrder($order) |
| 125 |
{ |
| 126 |
$this->order = strtolower( $order ); |
| 127 |
} |
| 128 |
|
| 129 |
public function setDownloadable($download) |
| 130 |
{ |
| 131 |
$this->downloadable = $download; |
| 132 |
} |
| 133 |
|
| 134 |
public function setShowTags($showtags) |
| 135 |
{ |
| 136 |
$showtags = $showtags == "yes" || $showtags == "true" || $showtags === true; |
| 137 |
|
| 138 |
$this->showtags = $showtags; |
| 139 |
} |
| 140 |
|
| 141 |
public function setShowImage($showimage) |
| 142 |
{ |
| 143 |
$showimage = $showimage == "yes" || $showimage == "true" || $showimage === true; |
| 144 |
|
| 145 |
$this->showimage = $showimage; |
| 146 |
} |
| 147 |
|
| 148 |
public function setAdmin($setAdmin) |
| 149 |
{ |
| 150 |
$this->is_admin = $setAdmin; |
| 151 |
} |
| 152 |
|
| 153 |
public function setURLWrap($urlwrap) |
| 154 |
{ |
| 155 |
$this->urlwrap = $urlwrap; |
| 156 |
} |
| 157 |
|
| 158 |
public function setTopLevel($toplevel) |
| 159 |
{ |
| 160 |
$this->toplevel = $toplevel; |
| 161 |
} |
| 162 |
|
| 163 |
public function setTarget($target) |
| 164 |
{ |
| 165 |
$this->target = $target; |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
public function setMaxPages($maxpages) |
| 170 |
{ |
| 171 |
$this->maxpages = $maxpages; |
| 172 |
} |
| 173 |
public function getMaxPages() |
| 174 |
{ |
| 175 |
return $this->maxpages; |
| 176 |
} |
| 177 |
|
| 178 |
public function setBrowseBar($browsebar) |
| 179 |
{ |
| 180 |
if ( $browsebar == "show" || $browsebar == "active" || $browsebar == "visible" || $browsebar == "yes" || $browsebar == "true" || $browsebar === true || $browsebar == 1 ) $browsebar = true; |
| 181 |
else $browsebar = false; |
| 182 |
|
| 183 |
$this->browsebar = $browsebar; |
| 184 |
} |
| 185 |
|
| 186 |
public function getLib() |
| 187 |
{ |
| 188 |
global $wpdb; |
| 189 |
global $post; |
| 190 |
|
| 191 |
$content = ""; |
| 192 |
|
| 193 |
// Turn on/off minified versions if testing/live |
| 194 |
$minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; |
| 195 |
|
| 196 |
// Enqueue scripts |
| 197 |
if ( $this->type == "dropdown" ) |
| 198 |
{ |
| 199 |
wp_enqueue_script( 'zotpress.lib'.$minify.'.js' ); |
| 200 |
wp_enqueue_script( 'zotpress.lib.dropdown'.$minify.'.js' ); |
| 201 |
} |
| 202 |
else |
| 203 |
{ |
| 204 |
wp_enqueue_script( 'jquery-ui-autocomplete' ); |
| 205 |
wp_enqueue_script( 'zotpress.lib'.$minify.'.js' ); |
| 206 |
wp_enqueue_script( 'zotpress.lib.searchbar'.$minify.'.js' ); |
| 207 |
} |
| 208 |
|
| 209 |
// API User ID |
| 210 |
global $api_user_id; |
| 211 |
|
| 212 |
if ( isset($_GET['page']) |
| 213 |
&& $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? |
| 214 |
&& isset($_GET['account_id']) |
| 215 |
&& preg_match("/^\\d+\$/", sanitize_text_field(wp_unslash($_GET['account_id']))) ) |
| 216 |
{ |
| 217 |
// $api_user_id = $wpdb->get_var("SELECT nickname FROM ".$wpdb->prefix."zotpress WHERE id='".$_GET['account_id']."'", OBJECT); |
| 218 |
$api_user_id = $wpdb->get_var( |
| 219 |
$wpdb->prepare( |
| 220 |
" |
| 221 |
SELECT `nickname` FROM `".$wpdb->prefix."zotpress` |
| 222 |
WHERE `id`=%s |
| 223 |
", |
| 224 |
array( sanitize_text_field(wp_unslash($_GET['account_id'])) ) |
| 225 |
), OBJECT |
| 226 |
); |
| 227 |
} |
| 228 |
else |
| 229 |
{ |
| 230 |
$api_user_id = $this->getAccount()->api_user_id; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
// Collection ID |
| 236 |
global $collection_id; |
| 237 |
|
| 238 |
if ( isset($_GET['page']) |
| 239 |
&& $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? |
| 240 |
&& isset($_GET['collection_id']) |
| 241 |
&& preg_match("/^[0-9a-zA-Z]+$/", sanitize_text_field(wp_unslash($_GET['collection_id']))) ) |
| 242 |
{ |
| 243 |
$collection_id = trim(sanitize_text_field(wp_unslash($_GET['collection_id']))); |
| 244 |
} |
| 245 |
elseif ( isset($_GET['page']) |
| 246 |
&& $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? |
| 247 |
&& isset($_GET['subcollection_id']) |
| 248 |
&& preg_match("/^[0-9a-zA-Z]+$/", sanitize_text_field(wp_unslash($_GET['subcollection_id']))) ) |
| 249 |
{ |
| 250 |
$collection_id = trim(sanitize_text_field(wp_unslash($_GET['subcollection_id']))); |
| 251 |
} |
| 252 |
else |
| 253 |
{ |
| 254 |
$collection_id = $this->collection; // from false |
| 255 |
} |
| 256 |
|
| 257 |
// Collection Name |
| 258 |
global $collection_name; |
| 259 |
|
| 260 |
// if ( isset($_GET['page']) |
| 261 |
// && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? |
| 262 |
// && isset($_GET['collection_name']) ) |
| 263 |
// if ( strpos( $_GET['collection_name'], "- " ) == 0 ) |
| 264 |
// $collection_name = stripslashes(htmlentities(wp_strip_all_tags(preg_replace( "/- /", "", urldecode($_GET['collection_name']), 1 )))); |
| 265 |
// else |
| 266 |
// $collection_name = stripslashes(htmlentities(wp_strip_all_tags(urldecode(trim($_GET['collection_name']))))); |
| 267 |
// else |
| 268 |
if ( isset($_GET['subcollection_name']) ) |
| 269 |
if ( strpos( sanitize_text_field(wp_unslash($_GET['subcollection_name'])), "- " ) == 0 ) |
| 270 |
$collection_name = preg_replace( "/- /", "", wp_strip_all_tags(trim(sanitize_text_field(urldecode(wp_unslash($_GET['subcollection_name']))))), 1 ); |
| 271 |
// $collection_name = stripslashes(htmlentities(wp_strip_all_tags(preg_replace( "/- /", "", urldecode(trim(sanitize_text_field(wp_unslash($_GET['subcollection_name'])))), 1 )))); |
| 272 |
else |
| 273 |
$collection_name = stripslashes(htmlentities(wp_strip_all_tags(trim(sanitize_text_field(urldecode(wp_unslash($_GET['subcollection_name']))))))); |
| 274 |
else |
| 275 |
$collection_name = false; |
| 276 |
|
| 277 |
// Top Level |
| 278 |
if ( isset($_GET['page']) |
| 279 |
&& $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? |
| 280 |
&& isset($_GET['toplevel']) ) |
| 281 |
$this->toplevel = "toplevel"; |
| 282 |
|
| 283 |
|
| 284 |
// Tag Name |
| 285 |
global $tag_id; |
| 286 |
|
| 287 |
// if ( isset($_GET['page']) |
| 288 |
// && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? |
| 289 |
// && isset($_GET['tag_id']) |
| 290 |
// && strlen(trim($_GET['tag_id'])) > 0 ) |
| 291 |
// $tag_id = htmlentities(wp_strip_all_tags(trim($_GET['tag_id']))); |
| 292 |
// else if |
| 293 |
if ( isset($_GET['lib_tag']) |
| 294 |
&& strlen(trim(sanitize_text_field(wp_unslash($_GET['lib_tag'])))) > 0 ) |
| 295 |
$tag_id = urldecode(htmlentities(wp_strip_all_tags(trim(sanitize_text_field(wp_unslash($_GET['lib_tag'])))))); |
| 296 |
else |
| 297 |
$tag_id = false; |
| 298 |
|
| 299 |
// Remove default collection if tag selected |
| 300 |
// REVIEW: But we want tags within collections ... I think? |
| 301 |
// if ( $tag_id ) { |
| 302 |
// $collection_id = false; |
| 303 |
// $collection_name = false; |
| 304 |
// } |
| 305 |
|
| 306 |
|
| 307 |
// Browse instance ID |
| 308 |
// REVIEW: Added post ID |
| 309 |
if ( ! $post |
| 310 |
|| ( $post && ! property_exists($post, "ID") ) ) |
| 311 |
$post = (object) array('ID' => 0); |
| 312 |
|
| 313 |
$instance_id = "zotpress-lib-" |
| 314 |
.md5( |
| 315 |
$post->ID |
| 316 |
.$api_user_id |
| 317 |
.$collection_id |
| 318 |
.$collection_name |
| 319 |
.$this->type |
| 320 |
.$tag_id |
| 321 |
.$this->style |
| 322 |
.$this->sortby |
| 323 |
.$this->order |
| 324 |
.$this->citeable |
| 325 |
.$this->downloadable |
| 326 |
.$this->showtags |
| 327 |
.$this->showimage |
| 328 |
.$this->toplevel |
| 329 |
.$this->target |
| 330 |
.$this->urlwrap |
| 331 |
.$this->is_admin |
| 332 |
.$this->minlength |
| 333 |
.$this->maxresults |
| 334 |
.$this->maxperpage |
| 335 |
.$this->maxtags |
| 336 |
.$this->maxpages |
| 337 |
.$this->filters |
| 338 |
.$this->browsebar |
| 339 |
); |
| 340 |
|
| 341 |
$content .= "<a name=\"".$instance_id."\"></a>\n"; |
| 342 |
$content .= "<div id=\"".$instance_id."\" class=\"zp-Library zp-Browse\">\n"; |
| 343 |
$content .= '<span class="ZP_API_USER_ID ZP_ATTR">' .$api_user_id . '</span>'; |
| 344 |
$content .= "\n"; |
| 345 |
if ( $collection_id ) $content .= '<span class="ZP_COLLECTION_ID ZP_ATTR">'.$collection_id.'</span>'; |
| 346 |
if ( $collection_name ) $content .= '<span class="ZP_COLLECTION_NAME ZP_ATTR">'.$collection_name.'</span>'; |
| 347 |
if ( $tag_id ) $content .= '<span class="ZP_TAG_ID ZP_ATTR">'.$tag_id.'</span>'; |
| 348 |
$content .= "\n"; |
| 349 |
$content .= '<span class="ZP_MAXTAGS ZP_ATTR">'.$this->maxtags.'</span>'; |
| 350 |
$content .= "\n"; |
| 351 |
$content .= '<span class="ZP_STYLE ZP_ATTR">'.$this->style.'</span>'; |
| 352 |
$content .= "\n"; |
| 353 |
$content .= '<span class="ZP_SORTBY ZP_ATTR">'.$this->sortby.'</span>'; |
| 354 |
$content .= "\n"; |
| 355 |
$content .= '<span class="ZP_ORDER ZP_ATTR">'.$this->order.'</span>'; |
| 356 |
$content .= "\n"; |
| 357 |
$content .= '<span class="ZP_CITEABLE ZP_ATTR">'.$this->citeable.'</span>'; |
| 358 |
$content .= "\n"; |
| 359 |
$content .= '<span class="ZP_DOWNLOADABLE ZP_ATTR">'.$this->downloadable.'</span>'; |
| 360 |
$content .= "\n"; |
| 361 |
$content .= '<span class="ZP_SHOWTAGS ZP_ATTR">'.$this->showtags.'</span>'; |
| 362 |
$content .= "\n"; |
| 363 |
$content .= '<span class="ZP_SHOWIMAGE ZP_ATTR">'.$this->showimage.'</span>'; |
| 364 |
$content .= "\n"; |
| 365 |
if ( $this->toplevel ) $content .= '<span class="ZP_TOPLEVEL ZP_ATTR">'.$this->toplevel.'</span>'; |
| 366 |
$content .= '<span class="ZP_TARGET ZP_ATTR">'.$this->target.'</span>'; |
| 367 |
$content .= "\n"; |
| 368 |
$content .= '<span class="ZP_URLWRAP ZP_ATTR">'.$this->urlwrap.'</span>'; |
| 369 |
if ( $this->is_admin ) $content .= '<span class="ZP_ISADMIN ZP_ATTR">'.$this->is_admin.'</span>'; |
| 370 |
$content .= '<span class="ZP_BROWSEBAR ZP_ATTR">'.$this->browsebar.'</span>'; |
| 371 |
$content .= "\n"; |
| 372 |
|
| 373 |
$maxperpage = 10; if ( $this->getMaxPerPage() !== false ) $maxperpage = (int) $this->getMaxPerPage(); |
| 374 |
$content .= '<input type="hidden" class="ZOTPRESS_AC_MAXPERPAGE" name="ZOTPRESS_AC_MAXPERPAGE" value="'.$maxperpage.'">'; |
| 375 |
$content .= "\n"; |
| 376 |
|
| 377 |
// Deal with Browse Bar by Type |
| 378 |
if ( $this->type == "dropdown" ): |
| 379 |
|
| 380 |
if ( $this->browsebar ): |
| 381 |
|
| 382 |
$content .= '<div class="zp-Browse-Bar">'; |
| 383 |
$content .= '<div class="zp-Browse-Collections">'; |
| 384 |
$content .= "<div class='zp-Browse-Select'>\n"; |
| 385 |
$content .= "<select class='zp-Browse-Collections-Select loading'>\n"; |
| 386 |
|
| 387 |
// Set default option |
| 388 |
$content .= "<option class='loading' value='loading'>".__('Loading','zotpress')." ...</option>"; |
| 389 |
if ( $tag_id ) |
| 390 |
$content .= "<option value='blank'>--".__('No Collection Selected','zotpress')."--</option>"; |
| 391 |
// if ( ! $tag_id && ! $collection_id ) $content .= "<option value='toplevel'>".__('Top Level','zotpress')."</option>"; |
| 392 |
// REVIEW: Uhhhh |
| 393 |
if ( ! $tag_id |
| 394 |
&& ! $collection_id ) |
| 395 |
// if ( ( ! $tag_id && ! $collection_id ) |
| 396 |
// || ( $tag_id && ! $collection_id ) ) |
| 397 |
if ( $this->toplevel == "toplevel" |
| 398 |
|| $this->toplevel === false ) |
| 399 |
$content .= "<option value='blank' class='blank'>".__('Top Level','zotpress')."</option>"; |
| 400 |
else if ( $this->toplevel != "toplevel" ) |
| 401 |
$content .= "<option value='blank' class='blank'>".__('Default Collection','zotpress')."</option>"; |
| 402 |
$content .= "</select>\n"; |
| 403 |
$content .= "</div>\n\n"; |
| 404 |
$content .= '</div><!-- .zp-Browse-Collections -->'; |
| 405 |
$content .= "\n"; |
| 406 |
|
| 407 |
$content .= '<div class="zp-Browse-Tags">'; |
| 408 |
$content .= "<div class='zp-Browse-Select'>\n"; |
| 409 |
$content .= '<select class="zp-List-Tags" name="zp-List-Tags" class="loading">'; |
| 410 |
$content .= "\n<option class='loading' value='loading'>".__('Loading','zotpress')." ...</option>\n"; |
| 411 |
$content .= "</select>\n"; |
| 412 |
$content .= "</div>\n\n"; |
| 413 |
$content .= '</div><!-- .zp-Browse-Tags -->'; |
| 414 |
$content .= "\n"; |
| 415 |
$content .= '</div><!-- .zp-Browse-Bar -->'; |
| 416 |
|
| 417 |
endif; // if Browse Bar |
| 418 |
|
| 419 |
else: // Search Bar needs the Browse Bar / search input to function |
| 420 |
|
| 421 |
$content .= '<div class="zp-Browse-Bar">'; |
| 422 |
$content .= '<div class="zp-Zotpress-SearchBox">'; |
| 423 |
$content .= '<input class="zp-Zotpress-SearchBox-Input" class="help" type="text" placeholder="'.__('Type to search','zotpress').'" />'; |
| 424 |
|
| 425 |
if ( $this->filters ): |
| 426 |
|
| 427 |
$content .= "<div class='zp-SearchBy-Container'>"; |
| 428 |
$content .= "<span class=\"zp-SearchBy\">".__('Search by','zotpress').":</span>"; |
| 429 |
|
| 430 |
// Turn filter string into array |
| 431 |
$filters = explode( ",", $this->filters ); |
| 432 |
|
| 433 |
foreach ( $filters as $id => $filter ) |
| 434 |
{ |
| 435 |
// Account for singular words |
| 436 |
$filter = $filter == "tags" ? "tag" : "item"; |
| 437 |
|
| 438 |
$content .= '<div class="zpSearchFilterContainer">'; |
| 439 |
$content .= '<input type="radio" name="zpSearchFilters" class="'.$filter.'" value="'.$filter.'"'; |
| 440 |
if ( $id == 0 || count($filters) == 1 ) $content .= ' checked="checked"'; |
| 441 |
$content .= '><label for="'.$filter.'">'.$filter.'</label>'; |
| 442 |
$content .= '</div>'; |
| 443 |
$content .= "\n"; |
| 444 |
} |
| 445 |
$content .= "</div>\n\n"; |
| 446 |
|
| 447 |
endif; // Filters |
| 448 |
|
| 449 |
|
| 450 |
// Min Length |
| 451 |
$minlength = 3; if ( $this->getMinLength() !== false ) $minlength = (int) $this->getMinLength(); |
| 452 |
$content .= '<input type="hidden" class="ZOTPRESS_AC_MINLENGTH" name="ZOTPRESS_AC_MINLENGTH" value="'.$minlength.'" />'; |
| 453 |
|
| 454 |
// Max Results per Request |
| 455 |
$maxresults = 50; if ( $this->getMaxResults() !== false ) $maxresults = (int) $this->getMaxResults(); |
| 456 |
$content .= '<input type="hidden" class="ZOTPRESS_AC_MAXRESULTS" name="ZOTPRESS_AC_MAXRESULTS" value="'.$maxresults.'" />'; |
| 457 |
|
| 458 |
// // Max Per Page |
| 459 |
// REVIEW: Need this in the dropdown, too, so moving up |
| 460 |
// $maxperpage = 10; if ( $this->getMaxPerPage() !== false ) $maxperpage = (int) $this->getMaxPerPage(); |
| 461 |
// $content .= '<input type="hidden" class="ZOTPRESS_AC_MAXPERPAGE" name="ZOTPRESS_AC_MAXPERPAGE" value="'.$maxperpage.'" />'; |
| 462 |
|
| 463 |
// Max Pages |
| 464 |
$maxpages = (int) $this->getMaxPages(); |
| 465 |
$content .= '<input type="hidden" class="ZOTPRESS_AC_MAXPAGES" name="ZOTPRESS_AC_MAXPAGES" value="'.$maxpages.'" />'; |
| 466 |
|
| 467 |
// Downloadable, Citeable, Showimages |
| 468 |
$downloadable = false; if ( $this->downloadable ) $downloadable = $this->downloadable; |
| 469 |
$citeable = false; if ( $this->citeable ) $citeable = $this->citeable; |
| 470 |
$showimages = false; if ( $this->showimage ) $showimages = $this->showimage; |
| 471 |
|
| 472 |
$content .= '<input type="hidden" class="ZOTPRESS_AC_DOWNLOAD" name="ZOTPRESS_AC_DOWNLOAD" value="'.$downloadable.'" />'; |
| 473 |
$content .= '<input type="hidden" class="ZOTPRESS_AC_CITE" name="ZOTPRESS_AC_CITE" value="'.$citeable.'" />'; |
| 474 |
if ( $showimages ) $content .= '<input type="hidden" class="ZOTPRESS_AC_IMAGES" name="ZOTPRESS_AC_IMAGES" value="true" />'; |
| 475 |
|
| 476 |
$content .= '<input type="hidden" class="ZOTPRESS_PLUGIN_URL" name="ZOTPRESS_PLUGIN_URL" value="'. ZOTPRESS_PLUGIN_URL.'" />'; |
| 477 |
$content .= '<input type="hidden" class="ZOTPRESS_USER" name="ZOTPRESS_USER" value="'.$this->getAccount()->api_user_id.'" />'; |
| 478 |
$content .= '</div>'; |
| 479 |
$content .= "\n"; |
| 480 |
|
| 481 |
$content .= '</div><!-- .zp-Browse-Bar -->'; |
| 482 |
|
| 483 |
endif; // Type |
| 484 |
|
| 485 |
$content .= "\n\n"; |
| 486 |
|
| 487 |
|
| 488 |
$content .= '<div class="zp-List'; |
| 489 |
|
| 490 |
if ( $this->type == "dropdown" ) |
| 491 |
{ |
| 492 |
$content .= ' loading">'; |
| 493 |
|
| 494 |
// Display title on dropdown version |
| 495 |
if ($collection_id) { |
| 496 |
$content .= "<div class='zp-Collection-Title'>"; |
| 497 |
$content .= "<span class='name'>"; |
| 498 |
if ( $collection_name ) |
| 499 |
$content .= $collection_name; |
| 500 |
else |
| 501 |
$content .= esc_html__('Collection items','zotpress').":"; |
| 502 |
$content .= "</span>"; |
| 503 |
if ( is_admin() ) |
| 504 |
$content .= " <label for='item_key'>".__('Collection Key','zotpress').":</label> <span class='collection_item_key'>".$collection_id."</span>\n"; |
| 505 |
// $content .= " <label for='item_key'>".__('Collection Key','zotpress').":</label> <span>".$collection_id."</span> <input type='text' name='item_key' class='item_key' value='".$collection_id."'>\n"; |
| 506 |
$content .= "</div>\n"; |
| 507 |
} elseif ($tag_id) { |
| 508 |
// Top Level |
| 509 |
$content .= "<div class='zp-Collection-Title'>".__('Viewing items tagged','zotpress')." \"<strong>".str_replace("+", " ", $tag_id)."</strong>\"</div>\n"; |
| 510 |
} elseif ($this->toplevel == "toplevel" || $this->toplevel === false) { |
| 511 |
$content .= "<div class='zp-Collection-Title'>".__('Top Level Items','zotpress')."</div>\n"; |
| 512 |
} else { |
| 513 |
$content .= "<div class='zp-Collection-Title'>".__('Default Collection Items','zotpress')."</div>\n"; |
| 514 |
} |
| 515 |
} |
| 516 |
|
| 517 |
// Searchbar |
| 518 |
else |
| 519 |
{ |
| 520 |
$content .= "\">"; |
| 521 |
|
| 522 |
// Autocomplete will fill this up |
| 523 |
$content .= '<img class="zpSearchLoading" src="'.ZOTPRESS_PLUGIN_URL.'/images/loading_default.gif" alt="thinking">'; |
| 524 |
} |
| 525 |
|
| 526 |
// Container for results |
| 527 |
$content .= '<div class="zpSearchResultsContainer"></div>'; |
| 528 |
|
| 529 |
// Pagination |
| 530 |
$content .= '<div class="zpSearchResultsPagingContainer">'; |
| 531 |
$content .= '<div class="zpSearchResultsPagingContainerInner">'; |
| 532 |
$content .= '<div class="zpSearchResultsPagingCrop">'; |
| 533 |
$content .= '<div class="zpSearchResultsPaging">'; |
| 534 |
$content .= '</div></div></div></div>'; |
| 535 |
|
| 536 |
$content .= '</div><!-- .zp-List -->'; |
| 537 |
$content .= "\n"; |
| 538 |
|
| 539 |
$content .= '</div><!-- .zp-Browse -->'; |
| 540 |
|
| 541 |
return $content . "\n\n"; |
| 542 |
} |
| 543 |
} |
| 544 |
|
| 545 |
?> |
| 546 |
|