Textpattern | PHP Cross Reference | Content Management Systems |
Description: Tag builder.
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * https://textpattern.com/ 6 * 7 * Copyright (C) 2020 The Textpattern Development Team 8 * 9 * This file is part of Textpattern. 10 * 11 * Textpattern is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation, version 2. 14 * 15 * Textpattern is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Textpattern. If not, see <https://www.gnu.org/licenses/>. 22 */ 23 24 /** 25 * Tag builder. 26 * 27 * @package Admin\Tag 28 */ 29 30 namespace Textpattern\Tag; 31 32 if (!defined('txpinterface')) { 33 die('txpinterface is undefined.'); 34 } 35 36 $tagName = gps('tag_name'); 37 $panel = gps('panel'); 38 39 if ($tagName) { 40 echo \Txp::get('\Textpattern\Tag\BuilderTags')->renderTagHelp($tagName, $panel); 41 } elseif ($panel) { 42 echo \Txp::get('\Textpattern\Tag\BuilderTags')->tagbuildDialog($panel); 43 } 44 45 /** 46 * Collection of tag builder functions. 47 * 48 * @package Admin\Tag 49 */ 50 51 class BuilderTags 52 { 53 /** 54 * HTML block for the header portion of the form tag. 55 * 56 * @var string 57 */ 58 59 private $startblock; 60 61 /** 62 * HTML block for the end of the form tag. 63 * 64 * Includes submit button and hidden form elements. 65 * 66 * @var string 67 */ 68 69 private $endform; 70 71 /** 72 * The name of the tagbuilder tag that is currently being displayed. 73 * 74 * @var string 75 */ 76 77 private $tagname; 78 79 /** 80 * Return a list of tag builder tags for the given event. 81 * 82 * @param $ev The event (type of dialog) to build: page, form 83 * @return HTML 84 */ 85 86 public function tagbuildDialog($ev) 87 { 88 $listActions = graf( 89 href('<span class="ui-icon ui-icon-arrowthickstop-1-s"></span> '.gTxt('expand_all'), '#', array( 90 'class' => 'txp-expand-all', 91 'aria-controls' => 'tagbuild_links', 92 )). 93 href('<span class="ui-icon ui-icon-arrowthickstop-1-n"></span> '.gTxt('collapse_all'), '#', array( 94 'class' => 'txp-collapse-all', 95 'aria-controls' => 'tagbuild_links', 96 )), array('class' => 'txp-actions') 97 ); 98 99 $tagbuild_items = array(); 100 101 // Generate the tagbuilder links. 102 // Format of each entry is popTagLink -> array ( gTxt string, class/ID ). 103 switch ($ev) { 104 case "form": 105 $tagbuild_items = array( 106 'article' => array('articles', 'article-tags'), 107 'link' => array('links', 'link-tags'), 108 'comment' => array('comments', 'comment-tags'), 109 'comment_details' => array('comment_details', 'comment-detail-tags'), 110 'comment_form' => array('comment_form', 'comment-form-tags'), 111 'search_result' => array('search_results_form', 'search-result-tags'), 112 'file_download' => array('file_download_tags', 'file-tags'), 113 'category' => array('category_tags', 'category-tags'), 114 'section' => array('section_tags', 'section-tags'), 115 ); 116 break; 117 case "page": 118 $tagbuild_items = array( 119 'page_article' => array('page_article_hed', 'article-tags'), 120 'page_article_nav' => array('page_article_nav_hed', 'article-nav-tags'), 121 'page_nav' => array('page_nav_hed', 'nav-tags'), 122 'page_xml' => array('page_xml_hed', 'xml-tags'), 123 'page_misc' => array('page_misc_hed', 'misc-tags'), 124 'page_file' => array('page_file_hed', 'file-tags'), 125 ); 126 break; 127 } 128 129 $tagbuild_links = ''; 130 131 foreach ($tagbuild_items as $tb => $item) { 132 $tagbuild_links .= wrapRegion($item[1].'_group', $this->popTagLinks($tb, $ev), $item[1], $item[0], $item[1]); 133 } 134 135 // Tag builder dialog. 136 if ($tagbuild_links) { 137 return $listActions.$tagbuild_links; 138 } 139 140 return false; 141 } 142 143 /** 144 * List of tags in their corresponding groups. 145 * 146 * @see popTagLinks() 147 * @return array 148 */ 149 150 protected function tagbuildGroups() 151 { 152 return array( 153 'article_tags' => array( 154 'permlink', 155 'posted', 156 'title', 157 'body', 158 'excerpt', 159 'section', 160 'category1', 161 'category2', 162 'article_image', 163 'comments_invite', 164 'author', 165 ), 166 'link_tags' => array( 167 'link', 168 'linkdesctitle', 169 'link_name', 170 'link_description', 171 'link_category', 172 'link_date', 173 ), 174 'comment_tags' => array( 175 'comments', 176 'comments_form', 177 'comments_preview', 178 ), 179 'comment_details_tags' => array( 180 'comment_permlink', 181 'comment_name', 182 'comment_email', 183 'comment_web', 184 'comment_time', 185 'comment_message', 186 ), 187 'comment_form_tags' => array( 188 'comment_name_input', 189 'comment_email_input', 190 'comment_web_input', 191 'comment_message_input', 192 'comment_remember', 193 'comment_preview', 194 'comment_submit', 195 ), 196 'search_result_tags' => array( 197 'search_result_title', 198 'search_result_excerpt', 199 'search_result_date', 200 'search_result_url', 201 ), 202 'file_download_tags' => array( 203 'file_download_link', 204 'file_download_name', 205 'file_download_description', 206 'file_download_category', 207 'file_download_created', 208 'file_download_modified', 209 'file_download_size', 210 'file_download_downloads', 211 ), 212 'category_tags' => array( 213 'category', 214 'if_category', 215 ), 216 'section_tags' => array( 217 'section', 218 'if_section', 219 ), 220 'page_article_tags' => array( 221 'article', 222 'article_custom', 223 ), 224 'page_article_nav_tags' => array( 225 'prev_title', 226 'next_title', 227 'link_to_prev', 228 'link_to_next', 229 'older', 230 'newer', 231 ), 232 'page_nav_tags' => array( 233 'link_to_home', 234 'section_list', 235 'category_list', 236 'popup', 237 'recent_articles', 238 'recent_comments', 239 'related_articles', 240 'search_input', 241 ), 242 'page_xml_tags' => array( 243 'feed_link', 244 'link_feed_link', 245 ), 246 'page_misc_tags' => array( 247 'page_title', 248 'css', 249 'site_name', 250 'site_slogan', 251 'breadcrumb', 252 'search_input', 253 'email', 254 'linklist', 255 'password_protect', 256 'output_form', 257 'lang', 258 ), 259 'page_file_tags' => array( 260 'file_download_list', 261 'file_download', 262 'file_download_link', 263 ), 264 ); 265 } 266 267 /** 268 * Return a list of tag builder links. 269 * 270 * @param string $type Tag type 271 * @param string $panel The panel (event) on which the builder is displayed 272 * @return string HTML 273 */ 274 275 protected function popTagLinks($type, $panel) 276 { 277 $tagGroups = $this->tagbuildGroups(); 278 $arname = $type.'_tags'; 279 280 $out = array(); 281 282 if (isset($tagGroups[$arname])) { 283 foreach ($tagGroups[$arname] as $a) { 284 $out[] = tag(popTag($a, gTxt('tag_'.$a), array('panel' => $panel)), 'li'); 285 } 286 } 287 288 return n.tag(n.join(n, $out).n, 'ul', array('class' => 'plain-list')); 289 } 290 291 /** 292 * Return a single tag handler instance. 293 * 294 * @param string $name The tag 295 * @param string $panel The panel from which the tag was invoked 296 * @return string|bool HTML or FALSE on error 297 */ 298 299 public function renderTagHelp($name, $panel) 300 { 301 $this->tagname = (string)$name; 302 $method = 'tag_'.$this->tagname; 303 304 if (method_exists($this, $method)) { 305 $backLink = ''; 306 307 if ($panel) { 308 $backLink = graf( 309 href( 310 gTxt('go_back'), 311 array('event' => 'tag', 'panel' => $panel), 312 array('class' => 'txp-tagbuilder-link') 313 ), 314 array('class' => 'txp-actions') 315 ); 316 } 317 318 $this->startblock = $backLink. 319 hed(gTxt('tag_'.$this->tagname), 2). 320 href( 321 gTxt('documentation').sp.span(gTxt('opens_external_link'), array('class' => 'ui-icon ui-icon-extlink')), 322 'https://docs.textpattern.com/tags/'.$this->tagname, 323 array( 324 'class' => 'txp-tagbuilder-docs-link', 325 'rel' => 'external noopener', 326 'target' => '_blank', 327 ) 328 ); 329 330 $this->endform = graf( 331 fInput('submit', '', gTxt('build')) 332 ). 333 eInput('tag'). 334 sInput('build'). 335 hInput('tag_name', $this->tagname). 336 hInput('panel', $panel); 337 338 return $this->$method($this->tagname); 339 } 340 341 return false; 342 } 343 344 /** 345 * Render a form tag with the given content. 346 * 347 * @param string $content The HTML form contents 348 * @return string HTML 349 */ 350 351 private function tagbuildForm($content) 352 { 353 return form($content, '', '', 'post', 'asynchtml txp-tagbuilder', 'txp-tagbuilder-output'); 354 } 355 356 /** 357 * Render an input widget. 358 * 359 * @param string $label The label reference to use (will be subject to l10n) 360 * @param string $thing Content 361 * @return string HTML 362 */ 363 364 private function widget($label, $thing) 365 { 366 // TODO: Link to attribute help? 367 return inputLabel( 368 $label, 369 $thing, 370 $label 371 ); 372 } 373 374 /** 375 * Render a set of input widgets. 376 * 377 * @param array $widgets List of label => content pairs 378 * @return string HTML 379 */ 380 381 private function widgets($widgets = array()) 382 { 383 $out = ''; 384 385 // Common global attributes 386 /* 387 $widgets += array( 388 'escape' => $this->tbInput('escape', gps('escape'), INPUT_REGULAR), 389 'wraptag' => $this->tbInput('wraptag', gps('wraptag')), 390 'class' => $this->tbInput('class', gps('class'), INPUT_REGULAR), 391 'html_id' => $this->tbInput('html_id', gps('html_id'), INPUT_REGULAR), 392 'label' => $this->tbInput('label', gps('label')), 393 'labeltag' => $this->tbInput('labeltag', gps('labeltag')) 394 ); 395 */ 396 397 // TODO: Link to attribute help? 398 foreach ($widgets as $label => $thing) { 399 $out .= $this->widget($label, $thing); 400 } 401 402 return $out; 403 } 404 405 /** 406 * Generate a parameter-less Textpattern tag. 407 * 408 * @return string <txp:tag /> 409 */ 410 411 private function tbNoAtts() 412 { 413 return $this->tagbuildForm($this->startblock.$this->widgets().$this->endform).$this->tdb($this->tb($this->tagname)); 414 } 415 416 /** 417 * Generate a Textpattern tag from the given attributes and content. 418 * 419 * @param string $tag Tag name 420 * @param string $atts_list List of attribute => value pairs 421 * @param string $thing Tag container content 422 * @return string <txp:tag ...> 423 */ 424 425 private function tb($tag, $atts_list = array(), $thing = '') 426 { 427 $atts = array(); 428 429 // Common global attributes 430 /* 431 $atts_list += gpsa(array('escape', 'wraptag', 'class', 'html_id', 'label', 'labeltag')); 432 */ 433 434 foreach ($atts_list as $att => $val) { 435 if ($val or $val === '0' or $val === '{att_empty}') { 436 $val = str_replace('{att_empty}', '', $val); 437 $atts[] = ' '.$att.'="'.$val.'"'; 438 } 439 } 440 441 $atts = ($atts) ? join('', $atts) : ''; 442 443 return !empty($thing) ? 444 '<txp:'.$tag.$atts.'>'.$thing.'</txp:'.$tag.'>' : 445 '<txp:'.$tag.$atts.' />'; 446 } 447 448 /** 449 * Render a textarea to hold the built content. 450 * 451 * @param string $thing Content 452 * @return string HTML 453 */ 454 455 private function tdb($thing) 456 { 457 return graf(text_area( 458 'txp-tagbuilder-output', 459 '', 460 '', 461 $thing, 462 'txp-tagbuilder-output', 463 TEXTAREA_HEIGHT_SMALL, 464 INPUT_LARGE 465 )); 466 } 467 468 /** 469 * Assemble the tag output container. 470 * 471 * @param array $atts Attribute key => value pairs 472 * @param string $thing Tag container content 473 * @return string HTML 474 */ 475 476 private function build($atts, $thing = '') 477 { 478 global $step; 479 480 $out = ''; 481 482 if ($step === 'build') { 483 $out = $this->tdb($this->tb($this->tagname, $atts, $thing)); 484 } 485 486 return $out; 487 } 488 489 /** 490 * Render a HTML <select> list of time ranges. 491 * 492 * @param string $time Currently selected value 493 * @return string HTML 494 */ 495 496 private function tbTimePop($time) 497 { 498 $vals = array( 499 'past' => gTxt('time_past'), 500 'future' => gTxt('time_future'), 501 'any' => gTxt('time_any'), 502 ); 503 504 return ' '.selectInput('time', $vals, $time, true, '', 'time'); 505 } 506 507 /** 508 * Render HTML boolean <select> options. 509 * 510 * @param string $name Input name/ID 511 * @param string $value Currently selected value 512 * @return string HTML 513 */ 514 515 private function tbYesNoPop($select_name, $value) 516 { 517 $vals = array( 518 1 => gTxt('yes'), 519 0 => gTxt('no'), 520 ); 521 522 if (is_numeric($value)) { 523 $value = (int)$value; 524 } 525 526 return ' '.selectInput($select_name, $vals, $value, true, '', $select_name, true); 527 } 528 529 /** 530 * Render a HTML <select> list of article status options. 531 * 532 * @param string $value Currently selected value 533 * @param string $type The flavor of status to return. article=full set, file=limited set 534 * @return string HTML 535 */ 536 537 private function tbStatusPop($value, $type = 'article') 538 { 539 $vals = array( 540 STATUS_LIVE => gTxt('live'), 541 STATUS_STICKY => gTxt('sticky'), 542 STATUS_PENDING => gTxt('pending'), 543 STATUS_DRAFT => gTxt('draft'), 544 STATUS_HIDDEN => gTxt('hidden'), 545 ); 546 547 if ($type !== 'article') { 548 unset($vals[STATUS_DRAFT], $vals[STATUS_STICKY]); 549 } 550 551 return ' '.selectInput('status', $vals, $value, true, '', 'status'); 552 } 553 554 /** 555 * Render a HTML <select> list of sort options. 556 * 557 * @param string $value Currently selected value 558 * @return string HTML 559 */ 560 561 private function tbSortPop($value) 562 { 563 $asc = ' ('.gTxt('ascending').')'; 564 $desc = ' ('.gTxt('descending').')'; 565 566 $vals = array( 567 'Title asc' => gTxt('title').$asc, 568 'Title desc' => gTxt('title').$desc, 569 'Posted asc' => gTxt('posted').$asc, 570 'Posted desc' => gTxt('posted').$desc, 571 'LastMod asc' => gTxt('last_modification').$asc, 572 'LastMod desc' => gTxt('last_modification').$desc, 573 'Section asc' => gTxt('section').$asc, 574 'Section desc' => gTxt('section').$desc, 575 'Category1 asc' => gTxt('category1').$asc, 576 'Category1 desc' => gTxt('category1').$desc, 577 'Category2 asc' => gTxt('category2').$asc, 578 'Category2 desc' => gTxt('category2').$desc, 579 'rand()' => gTxt('random'), 580 ); 581 582 return ' '.selectInput('sort', $vals, $value, true, '', 'sort'); 583 } 584 585 /** 586 * Render a HTML <select> list of comment sort options. 587 * 588 * @param string $value Currently selected value 589 * @return string HTML 590 */ 591 592 private function tbDiscussSortPop($value) 593 { 594 $asc = ' ('.gTxt('ascending').')'; 595 $desc = ' ('.gTxt('descending').')'; 596 597 $vals = array( 598 'posted asc' => gTxt('posted').$asc, 599 'posted desc' => gTxt('posted').$desc, 600 ); 601 602 return ' '.selectInput('sort', $vals, $value, true, '', 'sort'); 603 } 604 605 /** 606 * Render a HTML <select> list of article sort options. 607 * 608 * @param string $value Currently selected value 609 * @return string HTML 610 */ 611 612 private function tbListSortPop($value) 613 { 614 $asc = ' ('.gTxt('ascending').')'; 615 $desc = ' ('.gTxt('descending').')'; 616 617 $vals = array( 618 'title asc' => gTxt('title').$asc, 619 'title desc' => gTxt('title').$desc, 620 'name asc' => gTxt('name').$asc, 621 'name desc' => gTxt('name').$desc, 622 ); 623 624 return ' '.selectInput('sort', $vals, $value, true, '', 'sort'); 625 } 626 627 /** 628 * Render a HTML <select> list of authors/users. 629 * 630 * @param string $value Currently selected value 631 * @return string HTML 632 */ 633 634 private function tbAuthorPop($value) 635 { 636 $vals = array(); 637 638 $rs = safe_rows_start("name", 'txp_users', "1 = 1 ORDER BY name"); 639 640 if ($rs) { 641 while ($a = nextRow($rs)) { 642 extract($a); 643 644 $vals[$name] = $name; 645 } 646 647 return ' '.selectInput('author', $vals, $value, true, '', 'author'); 648 } 649 } 650 651 /** 652 * Render a HTML <select> list of Sections. 653 * 654 * @param string $select_name Input name/ID 655 * @param string $value Currently selected value 656 * @return string HTML 657 */ 658 659 private function tbSectionPop($select_name, $value) 660 { 661 $vals = array(); 662 663 $rs = safe_rows_start("name, title", 'txp_section', "name != 'default' ORDER BY name"); 664 665 if ($rs && numRows($rs) > 0) { 666 while ($a = nextRow($rs)) { 667 extract($a); 668 669 $vals[$name] = $title; 670 } 671 672 return ' '.selectInput($select_name, $vals, $value, true, '', $select_name); 673 } 674 675 return gTxt('no_sections_available'); 676 } 677 678 /** 679 * Render a HTML <select> list of Categories. 680 * 681 * @param string $value Currently selected value 682 * @param string $type Context to which the category applies 683 * @return string HTML 684 */ 685 686 private function tbCategoryPop($value, $type = 'article') 687 { 688 $vals = getTree('root', $type); 689 690 if ($vals) { 691 return ' '.treeSelectInput('category', $vals, $value, 'category'); 692 } 693 694 return gTxt('no_categories_available'); 695 } 696 697 /** 698 * Render a HTML <select> list of category match options. 699 * 700 * @param string $value Currently selected value 701 * @return string HTML 702 */ 703 704 private function tbMatchCatPop($value) 705 { 706 $vals = array( 707 'Category' => gTxt('category1').' '.gTxt('or').' '.gTxt('category2'), 708 'Category1,Category2' => gTxt('category1').' '.gTxt('and').' '.gTxt('category2'), 709 'Category1' => gTxt('category1'), 710 'Category2' => gTxt('category2'), 711 ); 712 713 return ' '.selectInput('match', $vals, $value, true, '', 'match'); 714 } 715 716 /** 717 * Render a HTML <select> list of pattern match types. 718 * 719 * @param string $value Currently selected value 720 * @return string HTML 721 */ 722 723 private function tbPatternPop($value) 724 { 725 $vals = array( 726 'exact' => gTxt('exact'), 727 'any' => gTxt('any'), 728 'all' => gTxt('all'), 729 ); 730 731 return ' '.selectInput('match', $vals, $value, false, '', 'match'); 732 } 733 734 /** 735 * Render a HTML <select> list of context types. 736 * 737 * @param string $value Currently selected value 738 * @return string HTML 739 */ 740 741 private function tbTypePop($value) 742 { 743 $vals = array( 744 'article' => gTxt('article'), 745 'image' => gTxt('image'), 746 'file' => gTxt('file'), 747 'link' => gTxt('link'), 748 ); 749 750 return ' '.selectInput('type', $vals, $value, true, '', 'type'); 751 } 752 753 /** 754 * Render a HTML <select> list of Themes. 755 * 756 * @param string $value Currently selected value 757 * @return string | bool HTML | false on error 758 */ 759 760 private function tbThemePop($value) 761 { 762 $vals = array(); 763 764 $rs = safe_rows_start("name, title", 'txp_skin', "1 = 1 ORDER BY name, title"); 765 766 if ($rs) { 767 while ($a = nextRow($rs)) { 768 extract($a); 769 770 $vals[$name] = $title; 771 } 772 773 return ' '.selectInput('theme', $vals, $value, true, '', 'theme'); 774 } 775 776 return false; 777 } 778 779 /** 780 * Render a HTML <select> list of forms. 781 * 782 * @param string $select_name Input name/ID 783 * @param string $type Form type 784 * @param string $value Currently selected value 785 * @return string HTML 786 */ 787 788 private function tbFormPop($select_name, $type = '', $value) 789 { 790 $vals = array(); 791 792 $type = ($type) ? "type = '".doSlash($type)."'" : "1 = 1"; 793 794 $rs = safe_rows_start("name", 'txp_form', "$type ORDER BY name"); 795 796 if ($rs and numRows($rs) > 0) { 797 while ($a = nextRow($rs)) { 798 extract($a); 799 800 $vals[$name] = $name; 801 } 802 803 return ' '.selectInput($select_name, $vals, $value, true, '', $select_name); 804 } 805 806 return gTxt('no_forms_available'); 807 } 808 809 /** 810 * Render a HTML <select> list of Stylesheets. 811 * 812 * @param string $value Currently selected value 813 * @return string | bool HTML | false on error 814 */ 815 816 private function tbCssPop($value) 817 { 818 $vals = array(); 819 820 $rs = safe_rows_start("name", 'txp_css', "1 = 1 ORDER BY name"); 821 822 if ($rs) { 823 while ($a = nextRow($rs)) { 824 extract($a); 825 826 $vals[$name] = $name; 827 } 828 829 return ' '.selectInput('name', $vals, $value, true, '', 'name'); 830 } 831 832 return false; 833 } 834 835 /** 836 * Render a HTML <select> list of CSS formats. 837 * 838 * @param string $value Currently selected value 839 * @return string HTML 840 */ 841 842 private function tbCssFormatPop($value) 843 { 844 $vals = array( 845 'link' => '<link rel...', 846 'url' => 'css.php?...', 847 ); 848 849 return ' '.selectInput('format', $vals, $value, true, '', 'format'); 850 } 851 852 /** 853 * Render a HTML <select> list of escape options. 854 * 855 * @param string $value Currently selected value 856 * @return string HTML 857 */ 858 859 private function tbEscapePop($value) 860 { 861 $vals = array( 862 '{att_empty}' => '', 863 'html' => 'HTML', 864 ); 865 866 return ' '.selectInput('escape', $vals, $value, false, '', 'escape'); 867 } 868 869 /** 870 * Render a HTML <select> list of feed flavours. 871 * 872 * @param string $value Currently selected value 873 * @return string HTML 874 */ 875 876 private function tbFeedFlavorPop($value) 877 { 878 $vals = array( 879 'atom' => 'Atom 1.0', 880 'rss' => 'RSS 2.0', 881 ); 882 883 return ' '.selectInput('flavor', $vals, $value, true, '', 'flavor'); 884 } 885 886 /** 887 * Render a HTML <select> list of feed formats. 888 * 889 * @param string $value Currently selected value 890 * @return string HTML 891 */ 892 893 private function tbFeedFormatPop($value) 894 { 895 $vals = array( 896 'a' => '<a href...', 897 'link' => '<link rel...', 898 ); 899 900 return ' '.selectInput('format', $vals, $value, true, '', 'format'); 901 } 902 903 /** 904 * Render a HTML <select> list of author formats. 905 * 906 * @param string $value Currently selected value 907 * @return string HTML 908 */ 909 910 private function tbAuthorFormatPop($value) 911 { 912 $vals = array( 913 'link' => '<a href...', 914 'url' => gTxt('url'), 915 ); 916 917 return ' '.selectInput('format', $vals, $value, true, '', 'format'); 918 } 919 920 /** 921 * Render a HTML <input> tag. 922 * 923 * @param string $name Input name 924 * @param string $value Input value 925 * @param string $size Input size in characters 926 * @param string $id Input HTML ID. Uses $name if omitted 927 * @return string HTML 928 */ 929 930 private function tbInput($name, $value, $size = INPUT_SMALL, $id = null) 931 { 932 return fInput('text', $name, $value, '', '', '', $size, '', (($id === null) ? $name : $id)); 933 } 934 935 /** 936 * Tag builder <txp:article> tag. 937 */ 938 939 function tag_article() 940 { 941 $atts = gpsa(array( 942 'allowoverride', 943 'break', 944 'class', 945 'form', 946 'frontpage', 947 'keywords', 948 'label', 949 'labeltag', 950 'limit', 951 'listform', 952 'offset', 953 'pageby', 954 'pgonly', 955 'searchall', 956 'searchform', 957 'searchsticky', 958 'sort', 959 'status', 960 'time', 961 'wraptag', 962 )); 963 964 extract($atts); 965 966 $out = $this->tagbuildForm( 967 $this->startblock. 968 $this->widgets(array( 969 'status' => $this->tbStatusPop($status), 970 'time' => $this->tbTimePop($time), 971 'searchall' => $this->tbYesNoPop('searchall', $searchall), 972 'searchsticky' => $this->tbYesNoPop('searchsticky', $searchsticky), 973 'on_front_page' => $this->tbYesNoPop('frontpage', $frontpage), 974 'keywords' => '<textarea name="keywords" id="keywords">'.txpspecialchars($keywords).'</textarea>', 975 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 976 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 977 'pageby' => $this->tbInput('pageby', $pageby, INPUT_TINY), 978 'sort' => $this->tbSortPop($sort), 979 'pgonly' => $this->tbYesNoPop('pgonly', $pgonly), 980 'allowoverride' => $this->tbYesNoPop('allowoverride', $allowoverride), 981 'label' => $this->tbInput('label', $label), 982 'labeltag' => $this->tbInput('labeltag', $labeltag), 983 'wraptag' => $this->tbInput('wraptag', $wraptag), 984 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 985 'break' => $this->tbInput('break', $break), 986 'form' => $this->tbFormPop('form', 'article', $form), 987 'listform' => $this->tbFormPop('listform', 'article', $listform), 988 'searchform' => $this->tbFormPop('searchform', 'article', $searchform), 989 )). 990 $this->endform 991 ). 992 $this->build($atts); 993 994 return $out; 995 } 996 997 /** 998 * Tag builder <txp:article_custom> tag. 999 */ 1000 1001 function tag_article_custom() 1002 { 1003 $atts = gpsa(array( 1004 'allowoverride', 1005 'author', 1006 'break', 1007 'category', 1008 'class', 1009 'excerpted', 1010 'exclude', 1011 'expired', 1012 'form', 1013 'frontpage', 1014 'id', 1015 'keywords', 1016 'label', 1017 'labeltag', 1018 'limit', 1019 'match', 1020 'month', 1021 'offset', 1022 'section', 1023 'sort', 1024 'status', 1025 'time', 1026 'wraptag', 1027 )); 1028 1029 extract($atts); 1030 1031 $out = $this->tagbuildForm( 1032 $this->startblock. 1033 $this->widgets(array( 1034 'id' => $this->tbInput('id', $id), 1035 'status' => $this->tbStatusPop($status), 1036 'section' => $this->tbSectionPop('section', $section), 1037 'category' => $this->tbCategoryPop($category), 1038 'match_type' => $this->tbMatchCatPop($match), 1039 'exclude' => $this->tbInput('exclude', $exclude, INPUT_REGULAR), 1040 'time' => $this->tbTimePop($time), 1041 'month' => fInput( 1042 'text', 1043 'month', 1044 $month, 1045 '', 1046 '', 1047 '', 1048 7, 1049 '', 1050 'month' 1051 ).' ('.gTxt('yyyy-mm').')', 1052 'keywords' => '<textarea name="keywords" id="keywords">'.txpspecialchars($keywords).'</textarea>', 1053 'has_excerpt' => $this->tbYesNoPop('excerpted', $excerpted), 1054 'frontpage' => $this->tbYesNoPop('frontpage', $frontpage), 1055 'expired' => $this->tbYesNoPop('expired', $expired), 1056 'author' => $this->tbAuthorPop($author), 1057 'sort' => $this->tbSortPop($sort), 1058 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 1059 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 1060 'allowoverride' => $this->tbYesNoPop('allowoverride', $allowoverride), 1061 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 1062 'labeltag' => $this->tbInput('labeltag', $labeltag), 1063 'wraptag' => $this->tbInput('wraptag', $wraptag), 1064 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1065 'break' => $this->tbInput('break', $break), 1066 'form' => $this->tbFormPop('form', 'article', $form), 1067 )). 1068 $this->endform 1069 ). 1070 $this->build($atts); 1071 1072 return $out; 1073 } 1074 1075 /** 1076 * Tag builder <txp:article_image> tag. 1077 */ 1078 1079 function tag_article_image() 1080 { 1081 $atts = gpsa(array( 1082 'class', 1083 'escape', 1084 'height', 1085 'html_id', 1086 'style', 1087 'thumbnail', 1088 'width', 1089 'wraptag', 1090 )); 1091 1092 extract($atts); 1093 1094 $out = $this->tagbuildForm( 1095 $this->startblock. 1096 $this->widgets(array( 1097 'use_thumbnail' => $this->tbYesNoPop('thumbnail', $thumbnail), 1098 'escape' => $this->tbEscapePop($escape), 1099 'html_id' => $this->tbInput('html_id', $html_id, INPUT_REGULAR), 1100 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1101 'inline_style' => $this->tbInput('style', $style, INPUT_REGULAR, 'inline_style'), 1102 'wraptag' => $this->tbInput('wraptag', $wraptag), 1103 'width' => $this->tbInput('width', $width, INPUT_SMALL), 1104 'height' => $this->tbInput('height', $height, INPUT_SMALL), 1105 )). 1106 $this->endform 1107 ). 1108 $this->build($atts); 1109 1110 return $out; 1111 } 1112 1113 /** 1114 * Tag builder <txp:author> tag. 1115 */ 1116 1117 function tag_author() 1118 { 1119 $atts = gpsa(array( 1120 'escape', 1121 'format', 1122 'link', 1123 'section', 1124 'this_section', 1125 'title', 1126 )); 1127 1128 extract($atts); 1129 1130 $out = $this->tagbuildForm( 1131 $this->startblock. 1132 $this->widgets(array( 1133 'escape' => $this->tbEscapePop($escape), 1134 'format' => $this->tbAuthorFormatPop($format), 1135 'link_to_this_author' => $this->tbYesNoPop('link', $link), 1136 'section' => $this->tbSectionPop('section', $section), 1137 'this_section' => $this->tbYesNoPop('this_section', $this_section), 1138 'title' => $this->tbYesNoPop('title', $title), 1139 )). 1140 $this->endform 1141 ). 1142 $this->build($atts); 1143 1144 return $out; 1145 } 1146 1147 /** 1148 * Tag builder <txp:body> tag. 1149 */ 1150 1151 function tag_body() 1152 { 1153 return $this->tbNoAtts(); 1154 } 1155 1156 /** 1157 * Tag builder <txp:breadcrumb> tag. 1158 */ 1159 1160 function tag_breadcrumb() 1161 { 1162 $atts = gpsa(array( 1163 'category', 1164 'class', 1165 'label', 1166 'limit', 1167 'link', 1168 'linkclass', 1169 'offset', 1170 'section', 1171 'separator', 1172 'title', 1173 'type', 1174 'wraptag', 1175 )); 1176 1177 extract($atts); 1178 1179 $out = $this->tagbuildForm( 1180 $this->startblock. 1181 $this->widgets(array( 1182 'breadcrumb_separator' => $this->tbInput('separator', $separator, INPUT_XSMALL, 'breadcrumb_separator'), 1183 'breadcrumb_linked' => $this->tbYesNoPop('link', $link), 1184 'linkclass' => $this->tbInput('linkclass', $linkclass, INPUT_REGULAR), 1185 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 1186 'title' => $this->tbInput('title', $title, INPUT_REGULAR), 1187 'type' => $this->tbTypePop($type), 1188 'category' => $this->tbInput('category', $category), 1189 'section' => $this->tbSectionPop('section', $section), 1190 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 1191 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 1192 'wraptag' => $this->tbInput('wraptag', $wraptag), 1193 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1194 )). 1195 $this->endform 1196 ). 1197 $this->build($atts); 1198 1199 return $out; 1200 } 1201 1202 /** 1203 * Tag builder <txp:category> tag. 1204 */ 1205 1206 function tag_category() 1207 { 1208 $atts = gpsa(array( 1209 'class', 1210 'link', 1211 'name', 1212 'section', 1213 'this_section', 1214 'title', 1215 'type', 1216 'url', 1217 'wraptag', 1218 )); 1219 1220 extract($atts); 1221 1222 $out = $this->tagbuildForm( 1223 $this->startblock. 1224 $this->widgets(array( 1225 'name' => $this->tbInput('name', $name, INPUT_REGULAR), 1226 'link_to_this_category' => $this->tbYesNoPop('link', $link), 1227 'section' => $this->tbSectionPop('section', $section), 1228 'this_section' => $this->tbYesNoPop('this_section', $this_section), 1229 'title' => $this->tbYesNoPop('title', $title), 1230 'type' => $this->tbTypePop($type), 1231 'url' => $this->tbYesNoPop('url', $url), 1232 'wraptag' => $this->tbInput('wraptag', $wraptag), 1233 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1234 )). 1235 $this->endform 1236 ). 1237 $this->build($atts); 1238 1239 return $out; 1240 } 1241 1242 /** 1243 * Tag builder <txp:category_list> tag. 1244 */ 1245 1246 function tag_category_list() 1247 { 1248 $atts = gpsa(array( 1249 'active_class', 1250 'break', 1251 'categories', 1252 'children', 1253 'class', 1254 'exclude', 1255 'form', 1256 'html_id', 1257 'label', 1258 'labeltag', 1259 'limit', 1260 'offset', 1261 'parent', 1262 'section', 1263 'sort', 1264 'this_section', 1265 'type', 1266 'wraptag', 1267 )); 1268 1269 if (!isset($_POST['label'])) { 1270 $atts['label'] = gTxt('categories'); 1271 } 1272 1273 extract($atts); 1274 1275 $out = $this->tagbuildForm( 1276 $this->startblock. 1277 $this->widgets(array( 1278 'type' => $this->tbTypePop($type), 1279 'parent' => $this->tbInput('parent', $parent, INPUT_REGULAR), 1280 'categories' => $this->tbInput('categories', $categories, INPUT_REGULAR), 1281 'exclude' => $this->tbInput('exclude', $exclude, INPUT_REGULAR), 1282 'this_section' => $this->tbYesNoPop('this_section', $this_section), 1283 'category_list_section' => $this->tbSectionPop('section', $section), 1284 'depth' => $this->tbInput('children', $children, INPUT_TINY), 1285 'form' => $this->tbFormPop('form', '', $form), 1286 'sort' => $this->tbListSortPop($sort), 1287 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 1288 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 1289 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 1290 'labeltag' => $this->tbInput('labeltag', $labeltag), 1291 'wraptag' => $this->tbInput('wraptag', $wraptag), 1292 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1293 'active_class' => $this->tbInput('active_class', $active_class, INPUT_REGULAR), 1294 'html_id' => $this->tbInput('html_id', $html_id, INPUT_REGULAR), 1295 'break' => $this->tbInput('break', $break), 1296 )). 1297 $this->endform 1298 ). 1299 $this->build($atts); 1300 1301 return $out; 1302 } 1303 1304 /** 1305 * Tag builder <txp:category1> tag. 1306 */ 1307 1308 function tag_category1() 1309 { 1310 $atts = gpsa(array( 1311 'class', 1312 'link', 1313 'title', 1314 'section', 1315 'this_section', 1316 'wraptag', 1317 )); 1318 1319 extract($atts); 1320 1321 $out = $this->tagbuildForm( 1322 $this->startblock. 1323 $this->widgets(array( 1324 'title' => $this->tbYesNoPop('title', $title), 1325 'link_to_this_category' => $this->tbYesNoPop('link', $link), 1326 'section' => $this->tbSectionPop('section', $section), 1327 'this_section' => $this->tbYesNoPop('this_section', $this_section), 1328 'wraptag' => $this->tbInput('wraptag', $wraptag), 1329 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1330 )). 1331 $this->endform 1332 ). 1333 $this->build($atts); 1334 1335 return $out; 1336 } 1337 1338 /** 1339 * Tag builder <txp:category2> tag. 1340 */ 1341 1342 function tag_category2() 1343 { 1344 $atts = gpsa(array( 1345 'class', 1346 'link', 1347 'title', 1348 'section', 1349 'this_section', 1350 'wraptag', 1351 )); 1352 1353 extract($atts); 1354 1355 $out = $this->tagbuildForm( 1356 $this->startblock. 1357 $this->widgets(array( 1358 'title' => $this->tbYesNoPop('title', $title), 1359 'link_to_this_category' => $this->tbYesNoPop('link', $link), 1360 'section' => $this->tbSectionPop('section', $section), 1361 'this_section' => $this->tbYesNoPop('this_section', $this_section), 1362 'wraptag' => $this->tbInput('wraptag', $wraptag), 1363 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1364 )). 1365 $this->endform 1366 ). 1367 $this->build($atts); 1368 1369 return $out; 1370 } 1371 1372 /** 1373 * Tag builder <txp:comment_email> tag. 1374 */ 1375 1376 function tag_comment_email() 1377 { 1378 return $this->tbNoAtts(); 1379 } 1380 1381 /** 1382 * Tag builder <txp:comment_email_input> tag. 1383 */ 1384 1385 function tag_comment_email_input() 1386 { 1387 $atts = gpsa(array( 1388 'aria_label', 1389 'class', 1390 'placeholder', 1391 'size', 1392 )); 1393 1394 extract($atts); 1395 1396 $out = $this->tagbuildForm( 1397 $this->startblock. 1398 $this->widgets(array( 1399 'input_size' => $this->tbInput('size', $size, INPUT_TINY), 1400 'class' => $this->tbInput('class', $class), 1401 'placeholder' => $this->tbInput('placeholder', $placeholder), 1402 'aria_label' => $this->tbInput('aria_label', $aria_label), 1403 )). 1404 $this->endform 1405 ). 1406 $this->build($atts); 1407 1408 return $out; 1409 } 1410 1411 /** 1412 * Tag builder <txp:comment_message> tag. 1413 */ 1414 1415 function tag_comment_message() 1416 { 1417 return $this->tbNoAtts(); 1418 } 1419 1420 /** 1421 * Tag builder <txp:comment_message_input> tag. 1422 */ 1423 1424 function tag_comment_message_input() 1425 { 1426 $atts = gpsa(array( 1427 'cols', 1428 'rows', 1429 'aria_label', 1430 'class', 1431 'placeholder', 1432 )); 1433 1434 extract($atts); 1435 1436 $out = $this->tagbuildForm( 1437 $this->startblock. 1438 $this->widgets(array( 1439 'msgcols' => $this->tbInput('cols', $cols, INPUT_TINY), 1440 'msgrows' => $this->tbInput('rows', $rows, INPUT_TINY), 1441 'class' => $this->tbInput('class', $class), 1442 'placeholder' => $this->tbInput('placeholder', $placeholder), 1443 'aria_label' => $this->tbInput('aria_label', $aria_label), 1444 )). 1445 $this->endform 1446 ). 1447 $this->build($atts); 1448 1449 return $out; 1450 } 1451 1452 /** 1453 * Tag builder <txp:comment_name> tag. 1454 */ 1455 1456 function tag_comment_name() 1457 { 1458 $atts = gpsa(array( 1459 'link', 1460 )); 1461 1462 extract($atts); 1463 1464 $out = $this->tagbuildForm( 1465 $this->startblock. 1466 $this->widget('comment_name_link', $this->tbYesNoPop('link', $link)). 1467 $this->endform 1468 ). 1469 $this->build($atts); 1470 1471 return $out; 1472 } 1473 1474 /** 1475 * Tag builder <txp:comment_name_input> tag. 1476 */ 1477 1478 function tag_comment_name_input() 1479 { 1480 $atts = gpsa(array( 1481 'aria_label', 1482 'class', 1483 'placeholder', 1484 'size', 1485 )); 1486 1487 extract($atts); 1488 1489 $out = $this->tagbuildForm( 1490 $this->startblock. 1491 $this->widgets(array( 1492 'input_size' => $this->tbInput('size', $size, INPUT_TINY), 1493 'class' => $this->tbInput('class', $class), 1494 'placeholder' => $this->tbInput('placeholder', $placeholder), 1495 'aria_label' => $this->tbInput('aria_label', $aria_label), 1496 )). 1497 $this->endform 1498 ). 1499 $this->build($atts); 1500 1501 return $out; 1502 } 1503 1504 /** 1505 * Tag builder <txp:comment_permlink> tag. 1506 */ 1507 1508 function tag_comment_permlink() 1509 { 1510 return $this->tbNoAtts(); 1511 } 1512 1513 /** 1514 * Tag builder <txp:comment_preview> tag. 1515 */ 1516 1517 function tag_comment_preview() 1518 { 1519 $atts = gpsa(array( 1520 'label', 1521 'class', 1522 )); 1523 1524 extract($atts); 1525 1526 $out = $this->tagbuildForm( 1527 $this->startblock. 1528 $this->widgets(array( 1529 'class' => $this->tbInput('class', $class), 1530 'label' => $this->tbInput('label', $label), 1531 )). 1532 $this->endform 1533 ). 1534 $this->build($atts); 1535 1536 return $out; 1537 } 1538 1539 /** 1540 * Tag builder <txp:comment_remember> tag. 1541 */ 1542 1543 function tag_comment_remember() 1544 { 1545 return $this->tbNoAtts(); 1546 } 1547 1548 /** 1549 * Tag builder <txp:comment_submit> tag. 1550 */ 1551 1552 function tag_comment_submit() 1553 { 1554 $atts = gpsa(array( 1555 'label', 1556 'class', 1557 )); 1558 1559 extract($atts); 1560 1561 $out = $this->tagbuildForm( 1562 $this->startblock. 1563 $this->widgets(array( 1564 'class' => $this->tbInput('class', $class), 1565 'label' => $this->tbInput('label', $label), 1566 )). 1567 $this->endform 1568 ). 1569 $this->build($atts); 1570 1571 return $out; 1572 } 1573 1574 /** 1575 * Tag builder <txp:comment_time> tag. 1576 */ 1577 1578 function tag_comment_time() 1579 { 1580 $atts = gpsa(array( 1581 'format', 1582 'gmt', 1583 'lang', 1584 )); 1585 1586 extract($atts); 1587 1588 $out = $this->tagbuildForm( 1589 $this->startblock. 1590 $this->widgets(array( 1591 'time_format' => $this->tbInput('format', $format, INPUT_MEDIUM, 'time_format'), 1592 'gmt' => $this->tbYesNoPop('gmt', $gmt), 1593 'locale' => $this->tbInput('lang', $lang, INPUT_MEDIUM, 'locale'), 1594 )). 1595 $this->endform 1596 ). 1597 $this->build($atts); 1598 1599 return $out; 1600 } 1601 1602 /** 1603 * Tag builder <txp:comment_web> tag. 1604 */ 1605 1606 function tag_comment_web() 1607 { 1608 return $this->tbNoAtts(); 1609 } 1610 1611 /** 1612 * Tag builder <txp:comment_web_input> tag. 1613 */ 1614 1615 function tag_comment_web_input() 1616 { 1617 $atts = gpsa(array( 1618 'aria_label', 1619 'class', 1620 'placeholder', 1621 'size', 1622 )); 1623 1624 extract($atts); 1625 1626 $out = $this->tagbuildForm( 1627 $this->startblock. 1628 $this->widgets(array( 1629 'input_size' => $this->tbInput('size', $size, INPUT_TINY), 1630 'class' => $this->tbInput('class', $class), 1631 'placeholder' => $this->tbInput('placeholder', $placeholder), 1632 'aria_label' => $this->tbInput('aria_label', $aria_label), 1633 )). 1634 $this->endform 1635 ). 1636 $this->build($atts); 1637 1638 return $out; 1639 } 1640 1641 /** 1642 * Tag builder <txp:comments> tag. 1643 */ 1644 1645 function tag_comments() 1646 { 1647 $atts = gpsa(array( 1648 'break', 1649 'class', 1650 'form', 1651 'limit', 1652 'offset', 1653 'sort', 1654 'wraptag', 1655 )); 1656 1657 extract($atts); 1658 1659 $out = $this->tagbuildForm( 1660 $this->startblock. 1661 $this->widgets(array( 1662 'form' => $this->tbFormPop('form', 'comment', $form), 1663 'sort' => $this->tbDiscussSortPop($sort), 1664 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 1665 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 1666 'wraptag' => $this->tbInput('wraptag', $wraptag), 1667 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1668 'break' => $this->tbInput('break', $break), 1669 )). 1670 $this->endform 1671 ). 1672 $this->build($atts); 1673 1674 return $out; 1675 } 1676 1677 /** 1678 * Tag builder <txp:comments_form> tag. 1679 */ 1680 1681 function tag_comments_form() 1682 { 1683 $atts = gpsa(array( 1684 'class', 1685 'form', 1686 'wraptag', 1687 )); 1688 1689 extract($atts); 1690 1691 $out = $this->tagbuildForm( 1692 $this->startblock. 1693 $this->widgets(array( 1694 'class' => $this->tbInput('class', $class), 1695 'form' => $this->tbFormPop('form', 'comment', $form), 1696 'wraptag' => $this->tbInput('wraptag', $wraptag), 1697 )). 1698 $this->endform 1699 ). 1700 $this->build($atts); 1701 1702 return $out; 1703 } 1704 1705 /** 1706 * Tag builder <txp:comments_invite> tag. 1707 */ 1708 1709 function tag_comments_invite() 1710 { 1711 $atts = gpsa(array( 1712 'class', 1713 'showcount', 1714 'textonly', 1715 'wraptag', 1716 )); 1717 1718 extract($atts); 1719 1720 $out = $this->tagbuildForm( 1721 $this->startblock. 1722 $this->widgets(array( 1723 'textonly' => $this->tbYesNoPop('textonly', $textonly), 1724 'showcount' => $this->tbYesNoPop('showcount', $showcount), 1725 'wraptag' => $this->tbInput('wraptag', $wraptag), 1726 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1727 )). 1728 $this->endform 1729 ). 1730 $this->build($atts); 1731 1732 return $out; 1733 } 1734 1735 /** 1736 * Tag builder <txp:comments_preview> tag. 1737 */ 1738 1739 function tag_comments_preview() 1740 { 1741 $atts = gpsa(array( 1742 'class', 1743 'form', 1744 'wraptag', 1745 )); 1746 1747 extract($atts); 1748 1749 $out = $this->tagbuildForm( 1750 $this->startblock. 1751 $this->widgets(array( 1752 'form' => $this->tbFormPop('form', 'comment', $form), 1753 'wraptag' => $this->tbInput('wraptag', $wraptag), 1754 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1755 )). 1756 $this->endform 1757 ). 1758 $this->build($atts); 1759 1760 return $out; 1761 } 1762 1763 /** 1764 * Tag builder <txp:css> tag. 1765 */ 1766 1767 function tag_css() 1768 { 1769 $atts = gpsa(array( 1770 'format', 1771 'media', 1772 'name', 1773 'rel', 1774 'theme', 1775 'title', 1776 )); 1777 1778 extract($atts); 1779 1780 $out = $this->tagbuildForm( 1781 $this->startblock. 1782 $this->widgets(array( 1783 'name' => $this->tbCssPop($name), 1784 'skin' => $this->tbThemePop($theme), 1785 'format' => $this->tbCssFormatPop($format), 1786 'media' => $this->tbInput('media', $media, INPUT_REGULAR), 1787 'rel' => $this->tbInput('rel', $rel, INPUT_REGULAR), 1788 'title' => $this->tbInput('title', $title, INPUT_REGULAR), 1789 )). 1790 $this->endform 1791 ). 1792 $this->build($atts); 1793 1794 return $out; 1795 } 1796 1797 /** 1798 * Tag builder <txp:email> tag. 1799 */ 1800 1801 function tag_email() 1802 { 1803 $atts = gpsa(array( 1804 'email', 1805 'linktext', 1806 'title', 1807 )); 1808 1809 extract($atts); 1810 1811 $out = $this->tagbuildForm( 1812 $this->startblock. 1813 $this->widgets(array( 1814 'email_address' => $this->tbInput('email', $email, INPUT_REGULAR, 'email_address'), 1815 'tooltip' => $this->tbInput('title', $title, INPUT_REGULAR, 'tooltip'), 1816 'link_text' => $this->tbInput('linktext', $linktext, INPUT_REGULAR, 'link_text'), 1817 )). 1818 $this->endform 1819 ). 1820 $this->build($atts); 1821 1822 return $out; 1823 } 1824 1825 /** 1826 * Tag builder <txp:excerpt> tag. 1827 */ 1828 1829 function tag_excerpt() 1830 { 1831 return $this->tbNoAtts(); 1832 } 1833 1834 /** 1835 * Tag builder <txp:feed_link> tag. 1836 */ 1837 1838 function tag_feed_link() 1839 { 1840 $atts = gpsa(array( 1841 'category', 1842 'class', 1843 'flavor', 1844 'format', 1845 'label', 1846 'limit', 1847 'section', 1848 'title', 1849 'wraptag', 1850 )); 1851 1852 extract($atts); 1853 1854 $label = $label ? $label : 'XML'; 1855 1856 $out = $this->tagbuildForm( 1857 $this->startblock. 1858 $this->widgets(array( 1859 'flavor' => $this->tbFeedFlavorPop($flavor), 1860 'format' => $this->tbFeedFormatPop($format), 1861 'section' => $this->tbSectionPop('section', $section), 1862 'category' => $this->tbCategoryPop($category), 1863 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 1864 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 1865 'title' => $this->tbInput('title', $title, INPUT_REGULAR), 1866 'wraptag' => $this->tbInput('wraptag', $wraptag), 1867 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1868 )). 1869 $this->endform 1870 ). 1871 $this->build($atts); 1872 1873 return $out; 1874 } 1875 1876 /** 1877 * Tag builder <txp:file_download> tag. 1878 */ 1879 1880 function tag_file_download() 1881 { 1882 $atts = gpsa(array( 1883 'filename', 1884 'form', 1885 'id', 1886 )); 1887 1888 extract($atts); 1889 1890 $out = $this->tagbuildForm( 1891 $this->startblock. 1892 $this->widgets(array( 1893 'id' => $this->tbInput('id', $id), 1894 'filename' => $this->tbInput('filename', $filename, INPUT_REGULAR), 1895 'form' => $this->tbFormPop('form', 'file', $form), 1896 )). 1897 $this->endform 1898 ). 1899 $this->build($atts); 1900 1901 return $out; 1902 } 1903 1904 /** 1905 * Tag builder <txp:file_download_category> tag. 1906 */ 1907 1908 function tag_file_download_category() 1909 { 1910 $atts = gpsa(array( 1911 'class', 1912 'escape', 1913 'title', 1914 'wraptag', 1915 )); 1916 1917 extract($atts); 1918 1919 $out = $this->tagbuildForm( 1920 $this->startblock. 1921 $this->widgets(array( 1922 'title' => $this->tbYesNoPop('title', $title), 1923 'escape' => $this->tbEscapePop($escape), 1924 'wraptag' => $this->tbInput('wraptag', $wraptag), 1925 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1926 )). 1927 $this->endform 1928 ). 1929 $this->build($atts); 1930 1931 return $out; 1932 } 1933 1934 /** 1935 * Tag builder <txp:file_download_created> tag. 1936 */ 1937 1938 function tag_file_download_created() 1939 { 1940 $atts = gpsa(array( 1941 'format', 1942 )); 1943 1944 extract($atts); 1945 1946 $out = $this->tagbuildForm( 1947 $this->startblock. 1948 $this->widget('time_format', $this->tbInput('format', $format, INPUT_MEDIUM, 'time_format')). 1949 $this->endform 1950 ). 1951 $this->build($atts); 1952 1953 return $out; 1954 } 1955 1956 /** 1957 * Tag builder <txp:file_download_description> tag. 1958 */ 1959 1960 function tag_file_download_description() 1961 { 1962 $atts = gpsa(array( 1963 'class', 1964 'escape', 1965 'wraptag', 1966 )); 1967 1968 extract($atts); 1969 1970 $out = $this->tagbuildForm( 1971 $this->startblock. 1972 $this->widgets(array( 1973 'escape' => $this->tbEscapePop($escape), 1974 'wraptag' => $this->tbInput('wraptag', $wraptag), 1975 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 1976 )). 1977 $this->endform 1978 ). 1979 $this->build($atts); 1980 1981 return $out; 1982 } 1983 1984 /** 1985 * Tag builder <txp:file_download_downloads> tag. 1986 */ 1987 1988 function tag_file_download_downloads() 1989 { 1990 return $this->tbNoAtts(); 1991 } 1992 1993 /** 1994 * Tag builder <txp:file_download_link> tag. 1995 */ 1996 1997 function tag_file_download_link() 1998 { 1999 global $step, $permlink_mode; 2000 2001 $atts = gpsa(array( 2002 'filename', 2003 'id', 2004 'linktext', 2005 'type', 2006 'description', 2007 )); 2008 2009 if (!isset($_POST['type'])) { 2010 $atts['type'] = 'textpattern'; 2011 } 2012 2013 extract($atts); 2014 2015 $types = array( 2016 'textile' => 'Textile', 2017 'textpattern' => 'Textpattern', 2018 'html' => 'HTML', 2019 ); 2020 2021 $out = $this->tagbuildForm( 2022 $this->startblock. 2023 $this->widgets(array( 2024 'type' => ''.selectInput('type', $types, $type, false, '', 'type'), 2025 'id' => $this->tbInput('id', $id), 2026 'filename' => $this->tbInput('filename', $filename, INPUT_REGULAR), 2027 'link_text' => $this->tbInput('linktext', ($linktext ? $linktext : ''), INPUT_REGULAR, 'link_text'), 2028 'description' => '<textarea id="description" name="description" cols="'.INPUT_REGULAR.'" rows="'.TEXTAREA_HEIGHT_SMALL.'">'.txpspecialchars($description).'</textarea>', 2029 )). 2030 $this->endform 2031 ); 2032 2033 if ($step === 'build') { 2034 $desc = str_replace('&', '&', txpspecialchars($description)); 2035 $urlinfo = parse_url(hu); 2036 $url = ($permlink_mode === 'messy') 2037 ? $urlinfo['path'].'index.php?s=file_download'.($type === 'textile' ? '&' : a).'id='.$id 2038 : $urlinfo['path'].'file_download'.'/'.$id.($filename ? '/'.urlencode($filename) : ''); 2039 2040 switch ($type) { 2041 case 'textile': 2042 $link = ($linktext) ? $linktext : $filename; 2043 $desc = ($desc) ? ' ('.$desc.')' : ''; 2044 $out .= $this->tdb('"'.$link.$desc.'":'.$url); 2045 break; 2046 case 'html': 2047 $link = ($linktext) ? $linktext : $filename; 2048 $desc = ($desc) ? ' title="'.$desc.'"' : ''; 2049 $out .= $this->tdb(href($link, $url, $desc)); 2050 break; 2051 case 'textpattern': 2052 default: 2053 $atts = array('id' => $id); 2054 $link = ($linktext) ? $linktext : '<txp:file_download_name />'; 2055 $out .= $this->build($atts, $link); 2056 break; 2057 } 2058 } 2059 2060 return $out; 2061 } 2062 2063 /** 2064 * Tag builder <txp:file_download_list> tag. 2065 * 2066 * Not adding realname attribute as it's pretty much the same as author. 2067 */ 2068 2069 function tag_file_download_list() 2070 { 2071 $atts = gpsa(array( 2072 'author', 2073 'auto_detect', 2074 'break', 2075 'category', 2076 'id', 2077 'form', 2078 'label', 2079 'labeltag', 2080 'limit', 2081 'offset', 2082 'pageby', 2083 'sort', 2084 'status', 2085 'wraptag', 2086 )); 2087 2088 $asc = ' ('.gTxt('ascending').')'; 2089 $desc = ' ('.gTxt('descending').')'; 2090 2091 $sorts = array( 2092 'filename asc' => gTxt('file_name').$asc, 2093 'filename desc' => gTxt('file_name').$desc, 2094 'downloads asc' => gTxt('downloads').$asc, 2095 'downloads desc' => gTxt('downloads').$desc, 2096 'rand()' => 'Random', 2097 ); 2098 2099 extract($atts); 2100 2101 $out = $this->tagbuildForm( 2102 $this->startblock. 2103 $this->widgets(array( 2104 'author' => $this->tbAuthorPop($author), 2105 'category' => $this->tbCategoryPop($category, 'file'), 2106 'id' => $this->tbInput('id', $id), 2107 'status' => $this->tbStatusPop($status, 'file'), 2108 'sort' => ' '.selectInput('sort', $sorts, $sort, true), 2109 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 2110 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 2111 'pageby' => $this->tbInput('pageby', $pageby, INPUT_TINY), 2112 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 2113 'labeltag' => $this->tbInput('labeltag', $labeltag), 2114 'wraptag' => $this->tbInput('wraptag', $wraptag), 2115 'break' => $this->tbInput('break', $break), 2116 'form' => $this->tbFormPop('form', 'file', $form), 2117 'match_type' => $this->tbInput('auto_detect', $auto_detect, INPUT_REGULAR), 2118 )). 2119 $this->endform 2120 ). 2121 $this->build($atts); 2122 2123 return $out; 2124 } 2125 2126 /** 2127 * Tag builder <txp:file_download_modified> tag. 2128 */ 2129 2130 function tag_file_download_modified() 2131 { 2132 $atts = gpsa(array( 2133 'format', 2134 )); 2135 2136 extract($atts); 2137 2138 $out = $this->tagbuildForm( 2139 $this->startblock. 2140 $this->widget( 2141 'time_format', 2142 $this->tbInput('format', $format, INPUT_MEDIUM, 'time_format') 2143 ). 2144 $this->endform 2145 ). 2146 $this->build($atts); 2147 2148 return $out; 2149 } 2150 2151 /** 2152 * Tag builder <txp:file_download_name> tag. 2153 */ 2154 2155 function tag_file_download_name() 2156 { 2157 return $this->tbNoAtts(); 2158 } 2159 2160 /** 2161 * Tag builder <txp:file_download_size> tag. 2162 */ 2163 2164 function tag_file_download_size() 2165 { 2166 $atts = gpsa(array( 2167 'decimals', 2168 'format', 2169 )); 2170 2171 $formats = array( 2172 'b' => 'Bytes', 2173 'k' => 'Kilobytes', 2174 'm' => 'Megabytes', 2175 'g' => 'Gigabytes', 2176 't' => 'Terabytes', 2177 'p' => 'Petabytes', 2178 'e' => 'Exabytes', 2179 'z' => 'Zettabytes', 2180 'y' => 'Yottabytes', 2181 ); 2182 2183 extract($atts); 2184 2185 $out = $this->tagbuildForm( 2186 $this->startblock. 2187 $this->widgets(array( 2188 'size_format' => ' '.selectInput('format', $formats, $format, true, '', 'size_format'), 2189 'decimals' => $this->tbInput('decimals', $decimals, INPUT_XSMALL), 2190 )). 2191 $this->endform 2192 ). 2193 $this->build($atts); 2194 2195 return $out; 2196 } 2197 2198 /** 2199 * Tag builder <txp:if_category> tag. 2200 */ 2201 2202 function tag_if_category() 2203 { 2204 $atts = gpsa(array( 2205 'category', 2206 'name', 2207 'parent', 2208 'type', 2209 )); 2210 2211 extract($atts); 2212 2213 $out = $this->tagbuildForm( 2214 $this->startblock. 2215 $this->widgets(array( 2216 'category' => $this->tbInput('category', $category, INPUT_REGULAR), 2217 'parent' => $this->tbInput('parent', $parent, INPUT_REGULAR), 2218 'name' => $this->tbInput('name', $name, INPUT_REGULAR), 2219 'type' => $this->tbTypePop($type), 2220 )). 2221 $this->endform 2222 ). 2223 $this->build($atts, gTxt('...')); 2224 2225 return $out; 2226 } 2227 2228 /** 2229 * Tag builder <txp:if_section> tag. 2230 */ 2231 2232 function tag_if_section() 2233 { 2234 $atts = gpsa(array( 2235 'name', 2236 )); 2237 2238 extract($atts); 2239 2240 $out = $this->tagbuildForm( 2241 $this->startblock. 2242 $this->widget('name', $this->tbSectionPop('name', $name)). 2243 $this->endform 2244 ). 2245 $this->build($atts, gTxt('...')); 2246 2247 return $out; 2248 } 2249 2250 /** 2251 * Tag builder <txp:image> tag. 2252 */ 2253 2254 function tag_image() 2255 { 2256 global $step; 2257 2258 $atts = gpsa(array( 2259 'alt', 2260 'caption', 2261 'class', 2262 'escape', 2263 'ext', 2264 'h', 2265 'html_id', 2266 'id', 2267 'name', 2268 'style', 2269 'type', 2270 'w', 2271 'wraptag', 2272 )); 2273 2274 if (!isset($_POST['type'])) { 2275 $atts['type'] = 'textpattern'; 2276 } 2277 2278 extract($atts); 2279 2280 $types = array( 2281 'textile' => 'Textile', 2282 'textpattern' => 'Textpattern', 2283 'html' => 'HTML', 2284 ); 2285 2286 $out = $this->tagbuildForm( 2287 $this->startblock. 2288 $this->widgets(array( 2289 'type' => ''.selectInput( 2290 'type', 2291 $types, 2292 $type, 2293 false, 2294 '', 2295 'type' 2296 ), 2297 'escape' => $this->tbEscapePop($escape), 2298 'html_id' => $this->tbInput('html_id', $html_id, INPUT_REGULAR), 2299 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2300 'inline_style' => $this->tbInput('style', $style, INPUT_REGULAR, 'inline_style'), 2301 'wraptag' => $this->tbInput('wraptag', $wraptag), 2302 )). 2303 hInput('id', $id). 2304 hInput('ext', $ext). 2305 hInput('w', $w). 2306 hInput('h', $h). 2307 hInput('alt', $alt). 2308 hInput('caption', $caption). 2309 $this->endform 2310 ); 2311 2312 $alt = urldecode($alt); 2313 $caption = urldecode($caption); 2314 2315 if ($step === 'build') { 2316 $url = imagesrcurl($id, $ext); 2317 2318 switch ($type) { 2319 case 'textile': 2320 $alternate = ($alt) ? ' ('.$alt.')' : ''; 2321 $modifiers = ''; 2322 2323 if ($class) { 2324 $modifiers .= '('.$class; 2325 2326 if ($html_id) { 2327 $modifiers .= '#'.$html_id; 2328 } 2329 2330 $modifiers .= ')'; 2331 } elseif ($html_id) { 2332 $modifiers .= "(#$html_id)"; 2333 } 2334 2335 if ($style) { 2336 $modifiers .= '{'.$style.'}'; 2337 } 2338 2339 $wrap = ($wraptag) ? $wraptag.$modifiers.'. ' : ''; 2340 2341 $out .= $this->tdb( 2342 (($wrap) ? $wrap : '').'!'.(($wrap) ? '' : $modifiers).$url.$alternate.'!' 2343 ); 2344 break; 2345 case 'html': 2346 $alternate = ' alt="'.txpspecialchars($alt).'"'; 2347 $cap = ($caption) ? ' title="'.txpspecialchars($caption).'"' : ''; 2348 $cls = ($class) ? ' class="'.$class.'"' : ''; 2349 $htmlid = ($html_id) ? ' id="'.$html_id.'"' : ''; 2350 $inlinestyle = ($style) ? ' style="'.$style.'"' : ''; 2351 2352 $out .= $this->tdb( 2353 ($wraptag ? "<$wraptag>" : ''). 2354 '<img src="'.$url.'" width="'.$w.'" height="'.$h.'"'.$alternate.$cap.$htmlid.$cls.$inlinestyle.' />'. 2355 ($wraptag ? "</$wraptag>" : '') 2356 ); 2357 break; 2358 case 'textpattern': 2359 default: 2360 $atts = array( 2361 'class' => $class, 2362 'escape' => $escape, 2363 'html_id' => $html_id, 2364 'id' => $id, 2365 'style' => $style, 2366 'wraptag' => $wraptag, 2367 ); 2368 $out .= $this->build($atts); 2369 break; 2370 } 2371 } 2372 2373 return $out; 2374 } 2375 2376 /** 2377 * Tag builder <txp:lang> tag. 2378 */ 2379 2380 function tag_lang() 2381 { 2382 return $this->tbNoAtts(); 2383 } 2384 2385 /** 2386 * Tag builder <txp:link> tag. 2387 */ 2388 2389 function tag_link() 2390 { 2391 $atts = gpsa(array( 2392 'id', 2393 'name', 2394 'rel', 2395 )); 2396 2397 extract($atts); 2398 2399 $out = $this->tagbuildForm( 2400 $this->startblock. 2401 $this->widgets(array( 2402 'id' => $this->tbInput('id', $id), 2403 'name' => $this->tbInput('name', $name, INPUT_REGULAR), 2404 'rel' => $this->tbInput('rel', $rel, INPUT_REGULAR), 2405 )). 2406 $this->endform 2407 ). 2408 $this->build($atts); 2409 2410 return $out; 2411 } 2412 2413 /** 2414 * Tag builder <txp:link_category> tag. 2415 */ 2416 2417 function tag_link_category() 2418 { 2419 $atts = gpsa(array( 2420 'class', 2421 'label', 2422 'labeltag', 2423 'title', 2424 'wraptag', 2425 )); 2426 2427 extract($atts); 2428 2429 $out = $this->tagbuildForm( 2430 $this->startblock. 2431 $this->widgets(array( 2432 'title' => $this->tbYesNoPop('title', $title), 2433 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 2434 'labeltag' => $this->tbInput('labeltag', $labeltag), 2435 'wraptag' => $this->tbInput('wraptag', $wraptag), 2436 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2437 )). 2438 $this->endform 2439 ). 2440 $this->build($atts); 2441 2442 return $out; 2443 } 2444 2445 /** 2446 * Tag builder <txp:link_date> tag. 2447 */ 2448 2449 function tag_link_date() 2450 { 2451 $atts = gpsa(array( 2452 'format', 2453 'gmt', 2454 'lang', 2455 )); 2456 2457 extract($atts); 2458 2459 $out = $this->tagbuildForm( 2460 $this->startblock. 2461 $this->widgets(array( 2462 'time_format' => $this->tbInput('format', $format, INPUT_MEDIUM, 'time_format'), 2463 'gmt' => $this->tbYesNoPop('gmt', $gmt), 2464 'locale' => $this->tbInput('lang', $lang, INPUT_MEDIUM, 'locale'), 2465 )). 2466 $this->endform 2467 ). 2468 $this->build($atts); 2469 2470 return $out; 2471 } 2472 2473 /** 2474 * Tag builder <txp:link_description> tag. 2475 */ 2476 2477 function tag_link_description() 2478 { 2479 $atts = gpsa(array( 2480 'class', 2481 'escape', 2482 'label', 2483 'labeltag', 2484 'wraptag', 2485 )); 2486 2487 extract($atts); 2488 2489 $out = $this->tagbuildForm( 2490 $this->startblock. 2491 $this->widgets(array( 2492 'escape' => $this->tbEscapePop($escape), 2493 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 2494 'labeltag' => $this->tbInput('labeltag', $labeltag), 2495 'wraptag' => $this->tbInput('wraptag', $wraptag), 2496 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2497 )). 2498 $this->endform 2499 ). 2500 $this->build($atts); 2501 2502 return $out; 2503 } 2504 2505 /** 2506 * Tag builder <txp:link_feed_link> tag. 2507 */ 2508 2509 function tag_link_feed_link() 2510 { 2511 $atts = gpsa(array( 2512 'category', 2513 'class', 2514 'flavor', 2515 'format', 2516 'label', 2517 'title', 2518 'wraptag', 2519 )); 2520 2521 extract($atts); 2522 2523 $label = (!$label) ? 'XML' : $label; 2524 2525 $out = $this->tagbuildForm( 2526 $this->startblock. 2527 $this->widgets(array( 2528 'flavor' => $this->tbFeedFlavorPop($flavor), 2529 'format' => $this->tbFeedFormatPop($format), 2530 'category' => $this->tbCategoryPop($category, 'link'), 2531 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 2532 'title' => $this->tbInput('title', $title, INPUT_REGULAR), 2533 'wraptag' => $this->tbInput('wraptag', $wraptag), 2534 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2535 )). 2536 $this->endform 2537 ). 2538 $this->build($atts); 2539 2540 return $out; 2541 } 2542 2543 /** 2544 * Tag builder <txp:link_name> tag. 2545 */ 2546 2547 function tag_link_name() 2548 { 2549 $atts = gpsa(array( 2550 'escape', 2551 )); 2552 2553 extract($atts); 2554 2555 $out = $this->tagbuildForm( 2556 $this->startblock. 2557 $this->widget('escape', $this->tbEscapePop($escape)). 2558 $this->endform 2559 ). 2560 $this->build($atts); 2561 2562 return $out; 2563 } 2564 2565 /** 2566 * Tag builder <txp:link_to_home> tag. 2567 */ 2568 2569 function tag_link_to_home() 2570 { 2571 $atts = gpsa(array( 2572 'class', 2573 )); 2574 2575 extract($atts); 2576 2577 $linktext = isset($_POST['linktext']) ? ps('linktext') : gTxt('tag_home'); 2578 2579 $out = $this->tagbuildForm( 2580 $this->startblock. 2581 $this->widgets(array( 2582 'link_text' => $this->tbInput( 2583 'linktext', 2584 $linktext, 2585 INPUT_REGULAR, 2586 'link_text' 2587 ), 2588 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2589 )). 2590 $this->endform 2591 ). 2592 $this->build($atts, $linktext); 2593 2594 return $out; 2595 } 2596 2597 /** 2598 * Tag builder <txp:link_to_next> tag. 2599 */ 2600 2601 function tag_link_to_next() 2602 { 2603 $atts = gpsa(array( 2604 'showalways', 2605 )); 2606 2607 extract($atts); 2608 2609 $linktext = isset($_POST['linktext']) ? ps('linktext') : '<txp:next_title />'; 2610 2611 $out = $this->tagbuildForm( 2612 $this->startblock. 2613 $this->widgets(array( 2614 'link_text' => $this->tbInput( 2615 'linktext', 2616 $linktext, 2617 INPUT_REGULAR, 2618 'link_text' 2619 ), 2620 'showalways' => $this->tbYesNoPop('showalways', $showalways), 2621 )). 2622 $this->endform 2623 ). 2624 $this->build($atts, $linktext); 2625 2626 return $out; 2627 } 2628 2629 /** 2630 * Tag builder <txp:link_to_prev> tag. 2631 */ 2632 2633 function tag_link_to_prev() 2634 { 2635 $atts = gpsa(array( 2636 'showalways', 2637 )); 2638 2639 extract($atts); 2640 2641 $linktext = isset($_POST['linktext']) ? ps('linktext') : '<txp:prev_title />'; 2642 2643 $out = $this->tagbuildForm( 2644 $this->startblock. 2645 $this->widgets(array( 2646 'link_text' => $this->tbInput( 2647 'linktext', 2648 $linktext, 2649 INPUT_REGULAR, 2650 'link_text' 2651 ), 2652 'showalways' => $this->tbYesNoPop('showalways', $showalways), 2653 )). 2654 $this->endform 2655 ). 2656 $this->build($atts, $linktext); 2657 2658 return $out; 2659 } 2660 2661 /** 2662 * Tag builder <txp:linkdesctitle> tag. 2663 */ 2664 2665 function tag_linkdesctitle() 2666 { 2667 $atts = gpsa(array( 2668 'rel', 2669 )); 2670 2671 extract($atts); 2672 2673 $out = $this->tagbuildForm( 2674 $this->startblock. 2675 $this->widget('rel', $this->tbInput('rel', $rel, INPUT_REGULAR)). 2676 $this->endform 2677 ). 2678 $this->build($atts); 2679 2680 return $out; 2681 } 2682 2683 /** 2684 * Tag builder <txp:linklist> tag. 2685 * 2686 * Not adding realname attribute as it's pretty much the same as author. 2687 */ 2688 2689 function tag_linklist() 2690 { 2691 $atts = gpsa(array( 2692 'author', 2693 'auto_detect', 2694 'break', 2695 'category', 2696 'class', 2697 'form', 2698 'id', 2699 'label', 2700 'labeltag', 2701 'limit', 2702 'offset', 2703 'pageby', 2704 'sort', 2705 'wraptag', 2706 )); 2707 2708 $asc = ' ('.gTxt('ascending').')'; 2709 $desc = ' ('.gTxt('descending').')'; 2710 2711 $sorts = array( 2712 'linksort asc' => gTxt('name').$asc, 2713 'linksort desc' => gTxt('name').$desc, 2714 'category asc' => gTxt('category').$asc, 2715 'category desc' => gTxt('category').$desc, 2716 'date asc' => gTxt('date').$asc, 2717 'date desc' => gTxt('date').$desc, 2718 'rand()' => gTxt('random'), 2719 ); 2720 2721 extract($atts); 2722 2723 $out = $this->tagbuildForm( 2724 $this->startblock. 2725 $this->widgets(array( 2726 'author' => $this->tbAuthorPop($author), 2727 'category' => $this->tbCategoryPop($category, 'link'), 2728 'id' => $this->tbInput('id', $id), 2729 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 2730 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 2731 'pageby' => $this->tbInput('pageby', $pageby, INPUT_TINY), 2732 'sort' => ' '.selectInput('sort', $sorts, $sort, false, '', 'sort'), 2733 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 2734 'labeltag' => $this->tbInput('labeltag', $labeltag), 2735 'wraptag' => $this->tbInput('wraptag', $wraptag), 2736 'class' => $this->tbInput('class', $class), 2737 'break' => $this->tbInput('break', $break), 2738 'form' => $this->tbFormPop('form', 'link', $form), 2739 'match_type' => $this->tbInput('auto_detect', $auto_detect, INPUT_REGULAR), 2740 )). 2741 $this->endform 2742 ). 2743 $this->build($atts); 2744 2745 return $out; 2746 } 2747 2748 /** 2749 * Tag builder <txp:newer> tag. 2750 */ 2751 2752 function tag_newer() 2753 { 2754 $linktext = isset($_POST['linktext']) ? ps('linktext') : '<txp:text item="newer" />'; 2755 2756 $out = $this->tagbuildForm( 2757 $this->startblock. 2758 $this->widget( 2759 'link_text', 2760 $this->tbInput( 2761 'linktext', 2762 $linktext, 2763 INPUT_REGULAR, 2764 'link_text' 2765 ) 2766 ). 2767 $this->endform 2768 ). 2769 $this->build(array(), $linktext); 2770 2771 return $out; 2772 } 2773 2774 /** 2775 * Tag builder <txp:next_title> tag. 2776 */ 2777 2778 function tag_next_title() 2779 { 2780 return $this->tbNoAtts(); 2781 } 2782 2783 /** 2784 * Tag builder <txp:older> tag. 2785 */ 2786 2787 function tag_older() 2788 { 2789 $linktext = isset($_POST['linktext']) ? ps('linktext') : '<txp:text item="older" />'; 2790 2791 $out = $this->tagbuildForm( 2792 $this->startblock. 2793 $this->widget( 2794 'link_text', 2795 $this->tbInput( 2796 'linktext', 2797 $linktext, 2798 INPUT_REGULAR, 2799 'link_text' 2800 ) 2801 ). 2802 $this->endform 2803 ). 2804 $this->build(array(), $linktext); 2805 2806 return $out; 2807 } 2808 2809 /** 2810 * Tag builder <txp:output_form> tag. 2811 */ 2812 2813 function tag_output_form() 2814 { 2815 $atts = gpsa(array( 2816 'form', 2817 )); 2818 2819 extract($atts); 2820 2821 $out = $this->tagbuildForm( 2822 $this->startblock. 2823 $this->widget( 2824 'form', 2825 $this->tbFormPop('form', 'misc', $form) 2826 ). 2827 $this->endform 2828 ). 2829 $this->build($atts); 2830 2831 return $out; 2832 } 2833 2834 /** 2835 * Tag builder <txp:page_title> tag. 2836 */ 2837 2838 function tag_page_title() 2839 { 2840 $atts = gpsa(array( 2841 'separator', 2842 )); 2843 2844 extract($atts); 2845 2846 $out = $this->tagbuildForm( 2847 $this->startblock. 2848 $this->widget( 2849 'title_separator', 2850 $this->tbInput('separator', $separator, INPUT_XSMALL, 'title_separator') 2851 ). 2852 $this->endform 2853 ). 2854 $this->build($atts); 2855 2856 return $out; 2857 } 2858 2859 /** 2860 * Tag builder <txp:password_protect> tag. 2861 */ 2862 2863 function tag_password_protect() 2864 { 2865 $atts = gpsa(array( 2866 'login', 2867 'pass', 2868 )); 2869 2870 extract($atts); 2871 2872 $out = $this->tagbuildForm( 2873 $this->startblock. 2874 $this->widgets(array( 2875 'login' => $this->tbInput('login', $login, INPUT_REGULAR), 2876 'password' => $this->tbInput('pass', $pass, INPUT_REGULAR, 'password'), 2877 )). 2878 $this->endform 2879 ). 2880 $this->build($atts); 2881 2882 return $out; 2883 } 2884 2885 /** 2886 * Tag builder <txp:permlink> tag. 2887 */ 2888 2889 function tag_permlink() 2890 { 2891 $atts = gpsa(array( 2892 'class', 2893 'id', 2894 'style', 2895 'title', 2896 )); 2897 2898 extract($atts); 2899 2900 $linktext = isset($_POST['linktext']) ? ps('linktext') : '<txp:title />'; 2901 2902 $out = $this->tagbuildForm( 2903 $this->startblock. 2904 $this->widgets(array( 2905 'id' => $this->tbInput('id', $id), 2906 'link_text' => $this->tbInput( 2907 'linktext', 2908 $linktext, 2909 INPUT_REGULAR, 2910 'link_text' 2911 ), 2912 'title' => $this->tbInput('title', $title, INPUT_REGULAR), 2913 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2914 'inline_style' => $this->tbInput('style', $style, INPUT_REGULAR, 'inline_style'), 2915 )). 2916 $this->endform 2917 ). 2918 $this->build($atts, $linktext); 2919 2920 return $out; 2921 } 2922 2923 /** 2924 * Tag builder <txp:popup> tag. 2925 */ 2926 2927 function tag_popup() 2928 { 2929 $atts = gpsa(array( 2930 'class', 2931 'label', 2932 'section', 2933 'this_section', 2934 'type', 2935 'wraptag', 2936 )); 2937 2938 if (!isset($_POST['label'])) { 2939 $atts['label'] = gTxt('browse'); 2940 } 2941 2942 extract($atts); 2943 2944 $types = array( 2945 'c' => gTxt('category'), 2946 's' => gTxt('section'), 2947 ); 2948 2949 $out = $this->tagbuildForm( 2950 $this->startblock. 2951 $this->widgets(array( 2952 'type' => ' '.selectInput('type', $types, $type, true, '', 'type'), 2953 'section' => $this->tbSectionPop('section', $section), 2954 'this_section' => $this->tbYesNoPop('this_section', $this_section), 2955 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 2956 'wraptag' => $this->tbInput('wraptag', $wraptag), 2957 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 2958 )). 2959 $this->endform 2960 ). 2961 $this->build($atts); 2962 2963 return $out; 2964 } 2965 2966 /** 2967 * Tag builder <txp:posted> tag. 2968 */ 2969 2970 function tag_posted() 2971 { 2972 $atts = gpsa(array( 2973 'format', 2974 'gmt', 2975 'lang', 2976 )); 2977 2978 extract($atts); 2979 2980 $out = $this->tagbuildForm( 2981 $this->startblock. 2982 $this->widgets(array( 2983 'time_format' => $this->tbInput('format', $format, INPUT_MEDIUM, 'time_format'), 2984 'gmt' => $this->tbYesNoPop('gmt', $gmt), 2985 'locale' => $this->tbInput('lang', $lang, INPUT_MEDIUM, 'locale'), 2986 )). 2987 $this->endform 2988 ). 2989 $this->build($atts); 2990 2991 return $out; 2992 } 2993 2994 /** 2995 * Tag builder <txp:prev_title> tag. 2996 */ 2997 2998 function tag_prev_title() 2999 { 3000 return $this->tbNoAtts(); 3001 } 3002 3003 /** 3004 * Tag builder <txp:recent_articles> tag. 3005 */ 3006 3007 function tag_recent_articles() 3008 { 3009 $atts = gpsa(array( 3010 'break', 3011 'category', 3012 'class', 3013 'label', 3014 'labeltag', 3015 'limit', 3016 'offset', 3017 'section', 3018 'sort', 3019 'wraptag', 3020 )); 3021 3022 if (!isset($_POST['label'])) { 3023 $atts['label'] = gTxt('recent_articles'); 3024 } 3025 3026 extract($atts); 3027 3028 $out = $this->tagbuildForm( 3029 $this->startblock. 3030 $this->widgets(array( 3031 'section' => $this->tbSectionPop('section', $section), 3032 'category' => $this->tbCategoryPop($category), 3033 'sort' => $this->tbSortPop($sort), 3034 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 3035 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 3036 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 3037 'labeltag' => $this->tbInput('labeltag', $labeltag), 3038 'wraptag' => $this->tbInput('wraptag', $wraptag), 3039 'class' => $this->tbInput('class', $class), 3040 'break' => $this->tbInput('break', $break), 3041 )). 3042 $this->endform 3043 ). 3044 $this->build($atts); 3045 3046 return $out; 3047 } 3048 3049 /** 3050 * Tag builder <txp:recent_comments> tag. 3051 */ 3052 3053 function tag_recent_comments() 3054 { 3055 $atts = gpsa(array( 3056 'break', 3057 'class', 3058 'form', 3059 'label', 3060 'labeltag', 3061 'limit', 3062 'offset', 3063 'sort', 3064 'wraptag', 3065 )); 3066 3067 if (!isset($_POST['label'])) { 3068 $atts['label'] = gTxt('recent_comments'); 3069 } 3070 3071 extract($atts); 3072 3073 $out = $this->tagbuildForm( 3074 $this->startblock. 3075 $this->widgets(array( 3076 'sort' => $this->tbDiscussSortPop($sort), 3077 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 3078 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 3079 'label' => $this->tbInput('label', ($label ? $label : gTxt('recent_comments')), INPUT_REGULAR), 3080 'labeltag' => $this->tbInput('labeltag', $labeltag), 3081 'wraptag' => $this->tbInput('wraptag', $wraptag), 3082 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 3083 'break' => $this->tbInput('break', $break), 3084 'form' => $this->tbFormPop('form', 'comment', $form), 3085 )). 3086 $this->endform 3087 ). 3088 $this->build($atts); 3089 3090 return $out; 3091 } 3092 3093 /** 3094 * Tag builder <txp:related_articles> tag. 3095 */ 3096 3097 function tag_related_articles() 3098 { 3099 $atts = gpsa(array( 3100 'break', 3101 'class', 3102 'form', 3103 'label', 3104 'labeltag', 3105 'limit', 3106 'match', 3107 'offset', 3108 'section', 3109 'sort', 3110 'wraptag', 3111 )); 3112 3113 if (!isset($_POST['label'])) { 3114 $atts['label'] = gTxt('related_articles'); 3115 } 3116 3117 extract($atts); 3118 3119 $out = $this->tagbuildForm( 3120 $this->startblock. 3121 $this->widgets(array( 3122 'section' => $this->tbSectionPop('section', $section), 3123 'match_type' => $this->tbMatchCatPop($match), 3124 'sort' => $this->tbSortPop($sort), 3125 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 3126 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 3127 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 3128 'labeltag' => $this->tbInput('labeltag', $labeltag), 3129 'wraptag' => $this->tbInput('wraptag', $wraptag), 3130 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 3131 'break' => $this->tbInput('break', $break), 3132 'form' => $this->tbFormPop('form', 'article', $form), 3133 )). 3134 $this->endform 3135 ). 3136 $this->build($atts); 3137 3138 return $out; 3139 } 3140 3141 /** 3142 * Tag builder <txp:search_input> tag. 3143 */ 3144 3145 function tag_search_input() 3146 { 3147 $atts = gpsa(array( 3148 'button', 3149 'class', 3150 'form', 3151 'html_id', 3152 'label', 3153 'match', 3154 'section', 3155 'size', 3156 'wraptag', 3157 )); 3158 3159 if (!isset($_POST['label'])) { 3160 $atts['label'] = gTxt('search'); 3161 } 3162 3163 extract($atts); 3164 3165 $out = $this->tagbuildForm( 3166 $this->startblock. 3167 $this->widgets(array( 3168 'match_type' => $this->tbPatternPop($match), 3169 'section' => $this->tbSectionPop('section', $section), 3170 'button_text' => $this->tbInput('button', $button, INPUT_REGULAR, 'button_text'), 3171 'input_size' => $this->tbInput('size', $size, INPUT_TINY, 'input_size'), 3172 'html_id' => $this->tbInput('html_id', $html_id, INPUT_REGULAR), 3173 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 3174 'wraptag' => $this->tbInput('wraptag', $wraptag), 3175 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 3176 'form' => $this->tbFormPop('form', 'misc', $form), 3177 )). 3178 $this->endform 3179 ). 3180 $this->build($atts); 3181 3182 return $out; 3183 } 3184 3185 /** 3186 * Tag builder <txp:search_result_date> tag. 3187 */ 3188 3189 function tag_search_result_date() 3190 { 3191 $atts = gpsa(array( 3192 'format', 3193 'gmt', 3194 'lang', 3195 )); 3196 3197 extract($atts); 3198 3199 $out = $this->tagbuildForm( 3200 $this->startblock. 3201 $this->widgets(array( 3202 'time_format' => $this->tbInput('format', $format, INPUT_MEDIUM, 'time_format'), 3203 'gmt' => $this->tbYesNoPop('gmt', $gmt), 3204 'locale' => $this->tbInput('lang', $lang, INPUT_MEDIUM, 'locale'), 3205 )). 3206 $this->endform 3207 ). 3208 $this->build($atts); 3209 3210 return $out; 3211 } 3212 3213 /** 3214 * Tag builder <txp:search_result_excerpt> tag. 3215 */ 3216 3217 function tag_search_result_excerpt() 3218 { 3219 $atts = gpsa(array( 3220 'separator', 3221 'hilight', 3222 'limit', 3223 )); 3224 3225 extract($atts); 3226 3227 $out = $this->tagbuildForm( 3228 $this->startblock. 3229 $this->widgets(array( 3230 'hilight' => $this->tbInput('hilight', $hilight), 3231 'hilight_limit' => $this->tbInput('limit', $limit, INPUT_TINY, 'hilight_limit'), 3232 'separator' => $this->tbInput('separator', $separator), 3233 )). 3234 $this->endform 3235 ). 3236 $this->build($atts); 3237 3238 return $out; 3239 } 3240 3241 /** 3242 * Tag builder <txp:search_result_title> tag. 3243 */ 3244 3245 function tag_search_result_title() 3246 { 3247 return $this->tbNoAtts(); 3248 } 3249 3250 /** 3251 * Tag builder <txp:search_result_url> tag. 3252 */ 3253 3254 function tag_search_result_url() 3255 { 3256 return $this->tbNoAtts(); 3257 } 3258 3259 /** 3260 * Tag builder <txp:section> tag. 3261 */ 3262 3263 function tag_section() 3264 { 3265 $atts = gpsa(array( 3266 'class', 3267 'link', 3268 'name', 3269 'title', 3270 'url', 3271 'wraptag', 3272 )); 3273 3274 extract($atts); 3275 3276 $out = $this->tagbuildForm( 3277 $this->startblock. 3278 $this->widgets(array( 3279 'name' => $this->tbSectionPop('name', $name), 3280 'link_to_this_section' => $this->tbYesNoPop('link', $link), 3281 'url' => $this->tbYesNoPop('url', $url), 3282 'wraptag' => $this->tbInput('wraptag', $wraptag), 3283 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 3284 'title' => $this->tbYesNoPop('title', $title), 3285 )). 3286 $this->endform 3287 ). 3288 $this->build($atts); 3289 3290 return $out; 3291 } 3292 3293 /** 3294 * Tag builder <txp:section_list> tag. 3295 */ 3296 3297 function tag_section_list() 3298 { 3299 $atts = gpsa(array( 3300 'active_class', 3301 'break', 3302 'class', 3303 'default_title', 3304 'exclude', 3305 'form', 3306 'html_id', 3307 'include_default', 3308 'label', 3309 'labeltag', 3310 'limit', 3311 'offset', 3312 'sections', 3313 'sort', 3314 'wraptag', 3315 )); 3316 3317 extract($atts); 3318 3319 $out = $this->tagbuildForm( 3320 $this->startblock. 3321 $this->widgets(array( 3322 'include_default' => $this->tbYesNoPop('include_default', $include_default), 3323 'sort' => $this->tbListSortPop($sort), 3324 'default_title' => $this->tbInput('default_title', $default_title, INPUT_REGULAR), 3325 'sections' => $this->tbInput('sections', $sections, INPUT_REGULAR), 3326 'exclude' => $this->tbInput('exclude', $exclude, INPUT_REGULAR), 3327 'html_id' => $this->tbInput('html_id', $html_id, INPUT_REGULAR), 3328 'limit' => $this->tbInput('limit', $limit, INPUT_TINY), 3329 'offset' => $this->tbInput('offset', $offset, INPUT_TINY), 3330 'label' => $this->tbInput('label', $label, INPUT_REGULAR), 3331 'labeltag' => $this->tbInput('labeltag', $labeltag), 3332 'wraptag' => $this->tbInput('wraptag', $wraptag), 3333 'class' => $this->tbInput('class', $class, INPUT_REGULAR), 3334 'active_class' => $this->tbInput('active_class', $active_class, INPUT_REGULAR), 3335 'break' => $this->tbInput('break', $break), 3336 'form' => $this->tbFormPop('form', 'misc', $form), 3337 )). 3338 $this->endform 3339 ). 3340 $this->build($atts); 3341 3342 return $out; 3343 } 3344 3345 /** 3346 * Tag builder <txp:site_name> tag. 3347 */ 3348 3349 function tag_site_name() 3350 { 3351 return $this->tbNoAtts(); 3352 } 3353 3354 /** 3355 * Tag builder <txp:site_slogan> tag. 3356 */ 3357 3358 function tag_site_slogan() 3359 { 3360 return $this->tbNoAtts(); 3361 } 3362 3363 /** 3364 * Tag builder <txp:title> tag. 3365 */ 3366 3367 function tag_title() 3368 { 3369 return $this->tbNoAtts(); 3370 } 3371 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title