Ticket #3485: HelpHub_first_iteration.3.patch
| File HelpHub_first_iteration.3.patch, 93.1 KB (added by , 8 years ago) |
|---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-front-page-blocks/helphub-front-page-blocks.php
1 <?php 2 /** 3 * Create linkable blocks on the front page of support pages. 4 * 5 * @package HelpHub 6 */ 7 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; // Exit if accessed directly. 10 } 11 12 require_once( __DIR__ . '/includes/class-support-helphub-front-page-blocks-widget.php' ); 13 14 function helphub_register_front_page_blocks_widget() { 15 register_widget( 'Support_HelpHub_Front_Page_Blocks_Widget' ); 16 } 17 add_action( 'widgets_init', 'helphub_register_front_page_blocks_widget' ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-front-page-blocks/includes/class-support-helphub-front-page-blocks-widget.php
1 <?php 2 /** 3 * Class for creationg front page blocks in HelpHub. 4 * 5 * @package HelpHub 6 */ 7 8 /** 9 * Class Support_HelpHub_Front_Page_blocks_Widget 10 */ 11 class Support_HelpHub_Front_Page_Blocks_Widget extends WP_Widget { 12 public function __construct() { 13 $widget_options = array( 14 'classname' => 'helphub-front-page-block', 15 'description' => __( 'Add a link block to support pages', 'wporg-forums' ), 16 ); 17 18 parent::__construct( 'helphub_front_page_block', __( '(HelpHub) Link block', 'wporg-forums' ), $widget_options ); 19 } 20 21 /** 22 * Output the widget on the front end. 23 * 24 * @param array $args The widget arguments, passed on from the themes widget area. 25 * @param array $instance This individual widgets settings. 26 * 27 * @return void 28 */ 29 public function widget( $args, $instance ) { 30 include( __DIR__ . '/widget-front-end.php' ); 31 } 32 33 /** 34 * Generate the widget settings. 35 * 36 * @param array $instance The widget instance and arguments. 37 * 38 * @return void 39 */ 40 public function form( $instance ) { 41 include( __DIR__ . '/widget-back-end.php' ); 42 } 43 44 /** 45 * Save the widget settings from the admin. 46 * 47 * @param array $new_instance The old widget instance, for comparison. 48 * @param array $old_instance The new widget instance, to be saved. 49 * 50 * @return array 51 */ 52 public function update( $new_instance, $old_instance ) { 53 $save_instance = array(); 54 55 $save_instance['icon'] = ( ! empty( $new_instance['icon'] ) ? strip_tags( $new_instance['icon'] ) : '' ); 56 $save_instance['title'] = ( ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '' ); 57 $save_instance['description'] = ( ! empty( $new_instance['description'] ) ? strip_tags( $new_instance['description'] ) : '' ); 58 $save_instance['menu'] = ( ! empty( $new_instance['menu'] ) ? strip_tags( $new_instance['menu'] ) : '' ); 59 60 return $save_instance; 61 } 62 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-front-page-blocks/includes/widget-back-end.php
1 <?php 2 /** 3 * Back-end output for the widget. 4 * 5 * @package HelpHub 6 */ 7 8 ?> 9 10 <p> 11 <label for="<?php echo esc_attr( $this->get_field_id( 'icon' ) ); ?>"> 12 <?php esc_html_e( 'icon (dashicon name)', 'wporg-forums' ); ?> 13 </label> 14 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'icon' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'icon' ) ); ?>" type="text" value="<?php echo ( isset( $instance['icon'] ) && ! empty( $instance['icon'] ) ? esc_attr( $instance['icon'] ) : '' ); ?>"> 15 </p> 16 17 <p> 18 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> 19 <?php esc_html_e( 'Title', 'wporg-forums' ); ?> 20 </label> 21 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo ( isset( $instance['title'] ) && ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : esc_attr__( 'Title', 'wporg-forums' ) ); ?>"> 22 </p> 23 24 <p> 25 <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"> 26 <?php esc_html_e( 'Description', 'wporg-forums' ); ?> 27 </label> 28 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" type="text" value="<?php echo ( isset( $instance['description'] ) && ! empty( $instance['description'] ) ? esc_attr( $instance['description'] ) : esc_attr__( 'Block description', 'wporg-forums' ) ); ?>"> 29 </p> 30 31 <p> 32 <label for="<?php echo esc_attr( $this->get_field_id( 'menu' ) ); ?>"> 33 <?php esc_html_e( 'Link menu', 'wporg-forums' ); ?> 34 </label> 35 <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'menu' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'menu' ) ); ?>"> 36 <?php 37 $nav_menus = wp_get_nav_menus(); 38 39 foreach ( $nav_menus as $nav_menu ) { 40 printf( 41 '<option value="%s" %s>%s</option>', 42 esc_attr( $nav_menu->term_id ), 43 ( isset( $instance['menu'] ) && ! empty( $instance['menu'] ) && $nav_menu->term_id === $instance['menu'] ? 'selected="selected"' : '' ), 44 esc_html( $nav_menu->name ) 45 ); 46 } 47 ?> 48 </select> 49 </p> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-front-page-blocks/includes/widget-front-end.php
1 <?php 2 /** 3 * Front-end output for the widget. 4 * 5 * @package HelpHub 6 */ 7 8 ?> 9 <?php 10 echo $args['before_widget']; // WPCS: XSS OK. 11 ?> 12 13 <div class="info-box"> 14 <span class="dashicons 15 <?php echo esc_attr( $instance['icon'] ); ?> 16 "></span> 17 <h3><?php echo esc_html( $instance['title'] ); ?></h3> 18 <p><?php echo esc_html( $instance['description'] ); ?></p> 19 20 <ul class="meta-list"> 21 <?php 22 $menu_items = wp_get_nav_menu_items( $instance['menu'] ); 23 foreach ( $menu_items as $menu_item ) { 24 printf( 25 '<li><a href="%s">%s</a></li>', 26 esc_url( $menu_item->url ), 27 esc_html( $menu_item->title ) 28 ); 29 } 30 ?> 31 </ul> 32 33 </div> 34 35 36 <?php 37 echo $args['after_widget']; // WPCS: XSS OK. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/assets/css/admin.css
1 .post-type.edit-php table.wp-list-table .column-image { 2 width: 120px; 3 text-align: center; 4 } 5 6 .post-type.edit-php table.wp-list-table .column-image img { 7 width: 60px; 8 height: auto; 9 } 10 11 12 /*! 13 * jQuery UI CSS Framework 1.12.1 14 * http://jqueryui.com 15 * 16 * Copyright jQuery Foundation and other contributors 17 * Released under the MIT license. 18 * http://jquery.org/license 19 * 20 * http://api.jqueryui.com/category/theming/ 21 */ 22 23 24 /* Component containers 25 ----------------------------------*/ 26 .ui-widget { 27 font-family: Arial, Helvetica, sans-serif; 28 font-size: 1em; 29 } 30 31 .ui-widget .ui-widget { 32 font-size: 1em; 33 } 34 35 .ui-widget input, 36 .ui-widget select, 37 .ui-widget textarea, 38 .ui-widget button { 39 font-family: Arial, Helvetica, sans-serif; 40 font-size: 1em; 41 } 42 43 .ui-widget.ui-widget-content { 44 border: 1px solid #c5c5c5; 45 } 46 47 .ui-widget-content { 48 border: 1px solid #ddd; 49 background: #fff; 50 color: #333; 51 } 52 53 .ui-widget-content a { 54 color: #333; 55 } 56 57 .ui-widget-header { 58 border: 1px solid #ddd; 59 background: #e9e9e9; 60 color: #333; 61 font-weight: 700; 62 } 63 64 .ui-widget-header a { 65 color: #333; 66 } 67 68 /* Interaction states 69 ----------------------------------*/ 70 .ui-state-default, 71 .ui-widget-content .ui-state-default, 72 .ui-widget-header .ui-state-default, 73 .ui-button, 74 /* We use html here because we need a greater specificity to make sure 75 disabled works properly when clicked or hovered */ 76 html .ui-button.ui-state-disabled:hover, 77 html .ui-button.ui-state-disabled:active { 78 border: 1px solid #c5c5c5; 79 background: #f6f6f6; 80 font-weight: 400; 81 color: #454545; 82 } 83 84 .ui-state-default a, 85 .ui-state-default a:link, 86 .ui-state-default a:visited, 87 a.ui-button, 88 a:link.ui-button, 89 a:visited.ui-button, 90 .ui-button { 91 color: #454545; 92 text-decoration: none; 93 } 94 95 .ui-state-hover, 96 .ui-widget-content .ui-state-hover, 97 .ui-widget-header .ui-state-hover, 98 .ui-state-focus, 99 .ui-widget-content .ui-state-focus, 100 .ui-widget-header .ui-state-focus, 101 .ui-button:hover, 102 .ui-button:focus { 103 border: 1px solid #ccc; 104 background: #ededed; 105 font-weight: 400; 106 color: #2b2b2b; 107 } 108 109 .ui-state-hover a, 110 .ui-state-hover a:hover, 111 .ui-state-hover a:link, 112 .ui-state-hover a:visited, 113 .ui-state-focus a, 114 .ui-state-focus a:hover, 115 .ui-state-focus a:link, 116 .ui-state-focus a:visited, 117 a.ui-button:hover, 118 a.ui-button:focus { 119 color: #2b2b2b; 120 text-decoration: none; 121 } 122 123 .ui-visual-focus { 124 box-shadow: 0 0 3px 1px rgb(94, 158, 214); 125 } 126 127 .ui-state-active, 128 .ui-widget-content .ui-state-active, 129 .ui-widget-header .ui-state-active, 130 a.ui-button:active, 131 .ui-button:active, 132 .ui-button.ui-state-active:hover { 133 border: 1px solid #003eff; 134 background: #007fff; 135 font-weight: 400; 136 color: #fff; 137 } 138 139 .ui-icon-background, 140 .ui-state-active .ui-icon-background { 141 border: #003eff; 142 background-color: #fff; 143 } 144 145 .ui-state-active a, 146 .ui-state-active a:link, 147 .ui-state-active a:visited { 148 color: #fff; 149 text-decoration: none; 150 } 151 152 /* Interaction Cues 153 ----------------------------------*/ 154 .ui-state-highlight, 155 .ui-widget-content .ui-state-highlight, 156 .ui-widget-header .ui-state-highlight { 157 border: 1px solid #dad55e; 158 background: #fffa90; 159 color: #777620; 160 } 161 162 .ui-state-checked { 163 border: 1px solid #dad55e; 164 background: #fffa90; 165 } 166 167 .ui-state-highlight a, 168 .ui-widget-content .ui-state-highlight a, 169 .ui-widget-header .ui-state-highlight a { 170 color: #777620; 171 } 172 173 .ui-state-error, 174 .ui-widget-content .ui-state-error, 175 .ui-widget-header .ui-state-error { 176 border: 1px solid #f1a899; 177 background: #fddfdf; 178 color: #5f3f3f; 179 } 180 181 .ui-state-error a, 182 .ui-widget-content .ui-state-error a, 183 .ui-widget-header .ui-state-error a { 184 color: #5f3f3f; 185 } 186 187 .ui-state-error-text, 188 .ui-widget-content .ui-state-error-text, 189 .ui-widget-header .ui-state-error-text { 190 color: #5f3f3f; 191 } 192 193 .ui-priority-primary, 194 .ui-widget-content .ui-priority-primary, 195 .ui-widget-header .ui-priority-primary { 196 font-weight: 700; 197 } 198 199 .ui-priority-secondary, 200 .ui-widget-content .ui-priority-secondary, 201 .ui-widget-header .ui-priority-secondary { 202 opacity: 0.7; 203 filter: alpha(opacity=70); /* support: IE8 */ 204 font-weight: 400; 205 } 206 207 .ui-state-disabled, 208 .ui-widget-content .ui-state-disabled, 209 .ui-widget-header .ui-state-disabled { 210 opacity: 0.35; 211 filter: alpha(opacity=35); /* support: IE8 */ 212 background-image: none; 213 } 214 215 .ui-state-disabled .ui-icon { 216 filter: alpha(opacity=35); /* support: IE8 - See #6059 */ 217 } 218 219 /* Icons 220 ----------------------------------*/ 221 222 /* states and images */ 223 .ui-icon { 224 width: 16px; 225 height: 16px; 226 } 227 228 /* positioning */ 229 .ui-icon-blank { 230 background-position: 16px 16px; 231 } 232 233 .ui-icon-caret-1-n { 234 background-position: 0 px; 235 } 236 237 .ui-icon-caret-1-ne { 238 background-position: -16px px; 239 } 240 241 .ui-icon-caret-1-e { 242 background-position: -32px px; 243 } 244 245 .ui-icon-caret-1-se { 246 background-position: -48px px; 247 } 248 249 .ui-icon-caret-1-s { 250 background-position: -65px px; 251 } 252 253 .ui-icon-caret-1-sw { 254 background-position: -80px px; 255 } 256 257 .ui-icon-caret-1-w { 258 background-position: -96px px; 259 } 260 261 .ui-icon-caret-1-nw { 262 background-position: -112px px; 263 } 264 265 .ui-icon-caret-2-n-s { 266 background-position: -128px px; 267 } 268 269 .ui-icon-caret-2-e-w { 270 background-position: -144px px; 271 } 272 273 .ui-icon-triangle-1-n { 274 background-position: 0 -16px; 275 } 276 277 .ui-icon-triangle-1-ne { 278 background-position: -16px -16px; 279 } 280 281 .ui-icon-triangle-1-e { 282 background-position: -32px -16px; 283 } 284 285 .ui-icon-triangle-1-se { 286 background-position: -48px -16px; 287 } 288 289 .ui-icon-triangle-1-s { 290 background-position: -65px -16px; 291 } 292 293 .ui-icon-triangle-1-sw { 294 background-position: -80px -16px; 295 } 296 297 .ui-icon-triangle-1-w { 298 background-position: -96px -16px; 299 } 300 301 .ui-icon-triangle-1-nw { 302 background-position: -112px -16px; 303 } 304 305 .ui-icon-triangle-2-n-s { 306 background-position: -128px -16px; 307 } 308 309 .ui-icon-triangle-2-e-w { 310 background-position: -144px -16px; 311 } 312 313 .ui-icon-arrow-1-n { 314 background-position: 0 -32px; 315 } 316 317 .ui-icon-arrow-1-ne { 318 background-position: -16px -32px; 319 } 320 321 .ui-icon-arrow-1-e { 322 background-position: -32px -32px; 323 } 324 325 .ui-icon-arrow-1-se { 326 background-position: -48px -32px; 327 } 328 329 .ui-icon-arrow-1-s { 330 background-position: -65px -32px; 331 } 332 333 .ui-icon-arrow-1-sw { 334 background-position: -80px -32px; 335 } 336 337 .ui-icon-arrow-1-w { 338 background-position: -96px -32px; 339 } 340 341 .ui-icon-arrow-1-nw { 342 background-position: -112px -32px; 343 } 344 345 .ui-icon-arrow-2-n-s { 346 background-position: -128px -32px; 347 } 348 349 .ui-icon-arrow-2-ne-sw { 350 background-position: -144px -32px; 351 } 352 353 .ui-icon-arrow-2-e-w { 354 background-position: -160px -32px; 355 } 356 357 .ui-icon-arrow-2-se-nw { 358 background-position: -176px -32px; 359 } 360 361 .ui-icon-arrowstop-1-n { 362 background-position: -192px -32px; 363 } 364 365 .ui-icon-arrowstop-1-e { 366 background-position: -208px -32px; 367 } 368 369 .ui-icon-arrowstop-1-s { 370 background-position: -224px -32px; 371 } 372 373 .ui-icon-arrowstop-1-w { 374 background-position: -240px -32px; 375 } 376 377 .ui-icon-arrowthick-1-n { 378 background-position: 1px -48px; 379 } 380 381 .ui-icon-arrowthick-1-ne { 382 background-position: -16px -48px; 383 } 384 385 .ui-icon-arrowthick-1-e { 386 background-position: -32px -48px; 387 } 388 389 .ui-icon-arrowthick-1-se { 390 background-position: -48px -48px; 391 } 392 393 .ui-icon-arrowthick-1-s { 394 background-position: -64px -48px; 395 } 396 397 .ui-icon-arrowthick-1-sw { 398 background-position: -80px -48px; 399 } 400 401 .ui-icon-arrowthick-1-w { 402 background-position: -96px -48px; 403 } 404 405 .ui-icon-arrowthick-1-nw { 406 background-position: -112px -48px; 407 } 408 409 .ui-icon-arrowthick-2-n-s { 410 background-position: -128px -48px; 411 } 412 413 .ui-icon-arrowthick-2-ne-sw { 414 background-position: -144px -48px; 415 } 416 417 .ui-icon-arrowthick-2-e-w { 418 background-position: -160px -48px; 419 } 420 421 .ui-icon-arrowthick-2-se-nw { 422 background-position: -176px -48px; 423 } 424 425 .ui-icon-arrowthickstop-1-n { 426 background-position: -192px -48px; 427 } 428 429 .ui-icon-arrowthickstop-1-e { 430 background-position: -208px -48px; 431 } 432 433 .ui-icon-arrowthickstop-1-s { 434 background-position: -224px -48px; 435 } 436 437 .ui-icon-arrowthickstop-1-w { 438 background-position: -240px -48px; 439 } 440 441 .ui-icon-arrowreturnthick-1-w { 442 background-position: 0 -64px; 443 } 444 445 .ui-icon-arrowreturnthick-1-n { 446 background-position: -16px -64px; 447 } 448 449 .ui-icon-arrowreturnthick-1-e { 450 background-position: -32px -64px; 451 } 452 453 .ui-icon-arrowreturnthick-1-s { 454 background-position: -48px -64px; 455 } 456 457 .ui-icon-arrowreturn-1-w { 458 background-position: -64px -64px; 459 } 460 461 .ui-icon-arrowreturn-1-n { 462 background-position: -80px -64px; 463 } 464 465 .ui-icon-arrowreturn-1-e { 466 background-position: -96px -64px; 467 } 468 469 .ui-icon-arrowreturn-1-s { 470 background-position: -112px -64px; 471 } 472 473 .ui-icon-arrowrefresh-1-w { 474 background-position: -128px -64px; 475 } 476 477 .ui-icon-arrowrefresh-1-n { 478 background-position: -144px -64px; 479 } 480 481 .ui-icon-arrowrefresh-1-e { 482 background-position: -160px -64px; 483 } 484 485 .ui-icon-arrowrefresh-1-s { 486 background-position: -176px -64px; 487 } 488 489 .ui-icon-arrow-4 { 490 background-position: 0 -80px; 491 } 492 493 .ui-icon-arrow-4-diag { 494 background-position: -16px -80px; 495 } 496 497 .ui-icon-extlink { 498 background-position: -32px -80px; 499 } 500 501 .ui-icon-newwin { 502 background-position: -48px -80px; 503 } 504 505 .ui-icon-refresh { 506 background-position: -64px -80px; 507 } 508 509 .ui-icon-shuffle { 510 background-position: -80px -80px; 511 } 512 513 .ui-icon-transfer-e-w { 514 background-position: -96px -80px; 515 } 516 517 .ui-icon-transferthick-e-w { 518 background-position: -112px -80px; 519 } 520 521 .ui-icon-folder-collapsed { 522 background-position: 0 -96px; 523 } 524 525 .ui-icon-folder-open { 526 background-position: -16px -96px; 527 } 528 529 .ui-icon-document { 530 background-position: -32px -96px; 531 } 532 533 .ui-icon-document-b { 534 background-position: -48px -96px; 535 } 536 537 .ui-icon-note { 538 background-position: -64px -96px; 539 } 540 541 .ui-icon-mail-closed { 542 background-position: -80px -96px; 543 } 544 545 .ui-icon-mail-open { 546 background-position: -96px -96px; 547 } 548 549 .ui-icon-suitcase { 550 background-position: -112px -96px; 551 } 552 553 .ui-icon-comment { 554 background-position: -128px -96px; 555 } 556 557 .ui-icon-person { 558 background-position: -144px -96px; 559 } 560 561 .ui-icon-print { 562 background-position: -160px -96px; 563 } 564 565 .ui-icon-trash { 566 background-position: -176px -96px; 567 } 568 569 .ui-icon-locked { 570 background-position: -192px -96px; 571 } 572 573 .ui-icon-unlocked { 574 background-position: -208px -96px; 575 } 576 577 .ui-icon-bookmark { 578 background-position: -224px -96px; 579 } 580 581 .ui-icon-tag { 582 background-position: -240px -96px; 583 } 584 585 .ui-icon-home { 586 background-position: 0 -112px; 587 } 588 589 .ui-icon-flag { 590 background-position: -16px -112px; 591 } 592 593 .ui-icon-calendar { 594 background-position: -32px -112px; 595 } 596 597 .ui-icon-cart { 598 background-position: -48px -112px; 599 } 600 601 .ui-icon-pencil { 602 background-position: -64px -112px; 603 } 604 605 .ui-icon-clock { 606 background-position: -80px -112px; 607 } 608 609 .ui-icon-disk { 610 background-position: -96px -112px; 611 } 612 613 .ui-icon-calculator { 614 background-position: -112px -112px; 615 } 616 617 .ui-icon-zoomin { 618 background-position: -128px -112px; 619 } 620 621 .ui-icon-zoomout { 622 background-position: -144px -112px; 623 } 624 625 .ui-icon-search { 626 background-position: -160px -112px; 627 } 628 629 .ui-icon-wrench { 630 background-position: -176px -112px; 631 } 632 633 .ui-icon-gear { 634 background-position: -192px -112px; 635 } 636 637 .ui-icon-heart { 638 background-position: -208px -112px; 639 } 640 641 .ui-icon-star { 642 background-position: -224px -112px; 643 } 644 645 .ui-icon-link { 646 background-position: -240px -112px; 647 } 648 649 .ui-icon-cancel { 650 background-position: 0 -128px; 651 } 652 653 .ui-icon-plus { 654 background-position: -16px -128px; 655 } 656 657 .ui-icon-plusthick { 658 background-position: -32px -128px; 659 } 660 661 .ui-icon-minus { 662 background-position: -48px -128px; 663 } 664 665 .ui-icon-minusthick { 666 background-position: -64px -128px; 667 } 668 669 .ui-icon-close { 670 background-position: -80px -128px; 671 } 672 673 .ui-icon-closethick { 674 background-position: -96px -128px; 675 } 676 677 .ui-icon-key { 678 background-position: -112px -128px; 679 } 680 681 .ui-icon-lightbulb { 682 background-position: -128px -128px; 683 } 684 685 .ui-icon-scissors { 686 background-position: -144px -128px; 687 } 688 689 .ui-icon-clipboard { 690 background-position: -160px -128px; 691 } 692 693 .ui-icon-copy { 694 background-position: -176px -128px; 695 } 696 697 .ui-icon-contact { 698 background-position: -192px -128px; 699 } 700 701 .ui-icon-image { 702 background-position: -208px -128px; 703 } 704 705 .ui-icon-video { 706 background-position: -224px -128px; 707 } 708 709 .ui-icon-script { 710 background-position: -240px -128px; 711 } 712 713 .ui-icon-alert { 714 background-position: 0 -144px; 715 } 716 717 .ui-icon-info { 718 background-position: -16px -144px; 719 } 720 721 .ui-icon-notice { 722 background-position: -32px -144px; 723 } 724 725 .ui-icon-help { 726 background-position: -48px -144px; 727 } 728 729 .ui-icon-check { 730 background-position: -64px -144px; 731 } 732 733 .ui-icon-bullet { 734 background-position: -80px -144px; 735 } 736 737 .ui-icon-radio-on { 738 background-position: -96px -144px; 739 } 740 741 .ui-icon-radio-off { 742 background-position: -112px -144px; 743 } 744 745 .ui-icon-pin-w { 746 background-position: -128px -144px; 747 } 748 749 .ui-icon-pin-s { 750 background-position: -144px -144px; 751 } 752 753 .ui-icon-play { 754 background-position: 0 -160px; 755 } 756 757 .ui-icon-pause { 758 background-position: -16px -160px; 759 } 760 761 .ui-icon-seek-next { 762 background-position: -32px -160px; 763 } 764 765 .ui-icon-seek-prev { 766 background-position: -48px -160px; 767 } 768 769 .ui-icon-seek-end { 770 background-position: -64px -160px; 771 } 772 773 .ui-icon-seek-start { 774 background-position: -80px -160px; 775 } 776 777 /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ 778 .ui-icon-seek-first { 779 background-position: -80px -160px; 780 } 781 782 .ui-icon-stop { 783 background-position: -96px -160px; 784 } 785 786 .ui-icon-eject { 787 background-position: -112px -160px; 788 } 789 790 .ui-icon-volume-off { 791 background-position: -128px -160px; 792 } 793 794 .ui-icon-volume-on { 795 background-position: -144px -160px; 796 } 797 798 .ui-icon-power { 799 background-position: 0 -176px; 800 } 801 802 .ui-icon-signal-diag { 803 background-position: -16px -176px; 804 } 805 806 .ui-icon-signal { 807 background-position: -32px -176px; 808 } 809 810 .ui-icon-battery-0 { 811 background-position: -48px -176px; 812 } 813 814 .ui-icon-battery-1 { 815 background-position: -64px -176px; 816 } 817 818 .ui-icon-battery-2 { 819 background-position: -80px -176px; 820 } 821 822 .ui-icon-battery-3 { 823 background-position: -96px -176px; 824 } 825 826 .ui-icon-circle-plus { 827 background-position: 0 -192px; 828 } 829 830 .ui-icon-circle-minus { 831 background-position: -16px -192px; 832 } 833 834 .ui-icon-circle-close { 835 background-position: -32px -192px; 836 } 837 838 .ui-icon-circle-triangle-e { 839 background-position: -48px -192px; 840 } 841 842 .ui-icon-circle-triangle-s { 843 background-position: -64px -192px; 844 } 845 846 .ui-icon-circle-triangle-w { 847 background-position: -80px -192px; 848 } 849 850 .ui-icon-circle-triangle-n { 851 background-position: -96px -192px; 852 } 853 854 .ui-icon-circle-arrow-e { 855 background-position: -112px -192px; 856 } 857 858 .ui-icon-circle-arrow-s { 859 background-position: -128px -192px; 860 } 861 862 .ui-icon-circle-arrow-w { 863 background-position: -144px -192px; 864 } 865 866 .ui-icon-circle-arrow-n { 867 background-position: -160px -192px; 868 } 869 870 .ui-icon-circle-zoomin { 871 background-position: -176px -192px; 872 } 873 874 .ui-icon-circle-zoomout { 875 background-position: -192px -192px; 876 } 877 878 .ui-icon-circle-check { 879 background-position: -208px -192px; 880 } 881 882 .ui-icon-circlesmall-plus { 883 background-position: 0 -208px; 884 } 885 886 .ui-icon-circlesmall-minus { 887 background-position: -16px -208px; 888 } 889 890 .ui-icon-circlesmall-close { 891 background-position: -32px -208px; 892 } 893 894 .ui-icon-squaresmall-plus { 895 background-position: -48px -208px; 896 } 897 898 .ui-icon-squaresmall-minus { 899 background-position: -64px -208px; 900 } 901 902 .ui-icon-squaresmall-close { 903 background-position: -80px -208px; 904 } 905 906 .ui-icon-grip-dotted-vertical { 907 background-position: 0 -224px; 908 } 909 910 .ui-icon-grip-dotted-horizontal { 911 background-position: -16px -224px; 912 } 913 914 .ui-icon-grip-solid-vertical { 915 background-position: -32px -224px; 916 } 917 918 .ui-icon-grip-solid-horizontal { 919 background-position: -48px -224px; 920 } 921 922 .ui-icon-gripsmall-diagonal-se { 923 background-position: -64px -224px; 924 } 925 926 .ui-icon-grip-diagonal-se { 927 background-position: -80px -224px; 928 } 929 930 931 /* Misc visuals 932 ----------------------------------*/ 933 934 /* Corner radius */ 935 .ui-corner-all, 936 .ui-corner-top, 937 .ui-corner-left, 938 .ui-corner-tl { 939 border-top-left-radius: 3px; 940 } 941 942 .ui-corner-all, 943 .ui-corner-top, 944 .ui-corner-right, 945 .ui-corner-tr { 946 border-top-right-radius: 3px; 947 } 948 949 .ui-corner-all, 950 .ui-corner-bottom, 951 .ui-corner-left, 952 .ui-corner-bl { 953 border-bottom-left-radius: 3px; 954 } 955 956 .ui-corner-all, 957 .ui-corner-bottom, 958 .ui-corner-right, 959 .ui-corner-br { 960 border-bottom-right-radius: 3px; 961 } 962 963 /* Overlays */ 964 .ui-widget-overlay { 965 background: #aaa; 966 opacity: 0.3; 967 filter: alpha(opacity=30); /* support: IE8 */ 968 } 969 970 .ui-widget-shadow { 971 -webkit-box-shadow: 0 0 5px #666; 972 box-shadow: 0 0 5px #666; 973 } 974 975 976 /* Overlays */ 977 .ui-widget-overlay { 978 position: fixed; 979 top: 0; 980 left: 0; 981 width: 100%; 982 height: 100%; 983 } 984 985 .ui-datepicker { 986 width: 17em; 987 padding: 0.2em 0.2em 0; 988 display: none; 989 background-color: #fff; 990 } 991 992 .ui-datepicker .ui-datepicker-header { 993 position: relative; 994 padding: 0.2em 0; 995 } 996 997 .ui-datepicker .ui-datepicker-prev, 998 .ui-datepicker .ui-datepicker-next { 999 position: absolute; 1000 top: 2px; 1001 width: 1.8em; 1002 height: 1.8em; 1003 } 1004 1005 .ui-datepicker .ui-datepicker-prev-hover, 1006 .ui-datepicker .ui-datepicker-next-hover { 1007 top: 1px; 1008 } 1009 1010 .ui-datepicker .ui-datepicker-prev { 1011 left: 2px; 1012 } 1013 1014 .ui-datepicker .ui-datepicker-next { 1015 right: 2px; 1016 } 1017 1018 .ui-datepicker .ui-datepicker-prev-hover { 1019 left: 1px; 1020 } 1021 1022 .ui-datepicker .ui-datepicker-next-hover { 1023 right: 1px; 1024 } 1025 1026 .ui-datepicker .ui-datepicker-prev span, 1027 .ui-datepicker .ui-datepicker-next span { 1028 display: block; 1029 position: absolute; 1030 left: 50%; 1031 margin-left: -8px; 1032 top: 50%; 1033 margin-top: -8px; 1034 } 1035 1036 .ui-datepicker .ui-datepicker-title { 1037 margin: 0 2.3em; 1038 line-height: 1.8; 1039 text-align: center; 1040 } 1041 1042 .ui-datepicker .ui-datepicker-title select { 1043 font-size: 1em; 1044 margin: 1px 0; 1045 } 1046 1047 .ui-datepicker select.ui-datepicker-month, 1048 .ui-datepicker select.ui-datepicker-year { 1049 width: 45%; 1050 } 1051 1052 .ui-datepicker table { 1053 width: 100%; 1054 font-size: 0.9em; 1055 border-collapse: collapse; 1056 margin: 0 0 0.4em; 1057 } 1058 1059 .ui-datepicker th { 1060 padding: 0.7em 0.3em; 1061 text-align: center; 1062 font-weight: 700; 1063 border: 0; 1064 } 1065 1066 .ui-datepicker td { 1067 border: 0; 1068 padding: 1px; 1069 } 1070 1071 .ui-datepicker td span, 1072 .ui-datepicker td a { 1073 display: block; 1074 padding: 0.2em; 1075 text-align: right; 1076 text-decoration: none; 1077 } 1078 1079 .ui-datepicker .ui-datepicker-buttonpane { 1080 background-image: none; 1081 margin: 0.7em 0 0; 1082 padding: 0 0.2em; 1083 border-left: 0; 1084 border-right: 0; 1085 border-bottom: 0; 1086 } 1087 1088 .ui-datepicker .ui-datepicker-buttonpane button { 1089 float: right; 1090 margin: 0.5em 0.2em 0.4em; 1091 cursor: pointer; 1092 padding: 0.2em 0.6em 0.3em; 1093 width: auto; 1094 overflow: visible; 1095 } 1096 1097 .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { 1098 float: left; 1099 } 1100 1101 /* with multiple calendars */ 1102 .ui-datepicker.ui-datepicker-multi { 1103 width: auto; 1104 } 1105 1106 .ui-datepicker-multi .ui-datepicker-group { 1107 float: left; 1108 } 1109 1110 .ui-datepicker-multi .ui-datepicker-group table { 1111 width: 95%; 1112 margin: 0 auto 0.4em; 1113 } 1114 1115 .ui-datepicker-multi-2 .ui-datepicker-group { 1116 width: 50%; 1117 } 1118 1119 .ui-datepicker-multi-3 .ui-datepicker-group { 1120 width: 33.3%; 1121 } 1122 1123 .ui-datepicker-multi-4 .ui-datepicker-group { 1124 width: 25%; 1125 } 1126 1127 .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, 1128 .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { 1129 border-left-width: 0; 1130 } 1131 1132 .ui-datepicker-multi .ui-datepicker-buttonpane { 1133 clear: left; 1134 } 1135 1136 .ui-datepicker-row-break { 1137 clear: both; 1138 width: 100%; 1139 font-size: 0; 1140 } 1141 1142 /* RTL support */ 1143 .ui-datepicker-rtl { 1144 direction: rtl; 1145 } 1146 1147 .ui-datepicker-rtl .ui-datepicker-prev { 1148 right: 2px; 1149 left: auto; 1150 } 1151 1152 .ui-datepicker-rtl .ui-datepicker-next { 1153 left: 2px; 1154 right: auto; 1155 } 1156 1157 .ui-datepicker-rtl .ui-datepicker-prev:hover { 1158 right: 1px; 1159 left: auto; 1160 } 1161 1162 .ui-datepicker-rtl .ui-datepicker-next:hover { 1163 left: 1px; 1164 right: auto; 1165 } 1166 1167 .ui-datepicker-rtl .ui-datepicker-buttonpane { 1168 clear: right; 1169 } 1170 1171 .ui-datepicker-rtl .ui-datepicker-buttonpane button { 1172 float: left; 1173 } 1174 1175 .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, 1176 .ui-datepicker-rtl .ui-datepicker-group { 1177 float: right; 1178 } 1179 1180 .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, 1181 .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { 1182 border-right-width: 0; 1183 border-left-width: 1px; 1184 } 1185 1186 /* Icons */ 1187 .ui-datepicker .ui-icon { 1188 display: block; 1189 text-indent: -99999px; 1190 overflow: hidden; 1191 background-repeat: no-repeat; 1192 left: 0.5em; 1193 top: 0.3em; 1194 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/assets/js/admin.js
1 /* globals HelphubAdmin */ 2 jQuery( document ).ready( function( $ ) { 3 4 // Instantiates the variable that holds the media library frame. 5 var GalleryDataFrame; 6 7 // Runs when the image button is clicked. 8 jQuery( '.postbox' ).on( 'click', '.helphub-upload', function( event ) { 9 10 // Store button object. 11 var $button = $( this ), 12 Title, 13 Button, 14 Library; 15 16 // Prevents the default action from occuring. 17 event.preventDefault(); 18 19 // If the frame already exists, re-open it. 20 if ( GalleryDataFrame ) { 21 GalleryDataFrame.open(); 22 return; 23 } 24 25 Title = $button.data( 'title' ) ? $button.data( 'title' ) : HelphubAdmin.default_title; 26 Button = $button.data( 'button' ) ? $button.data( 'button' ) : HelphubAdmin.default_button; 27 Library = $button.data( 'library' ) ? $button.data( 'library' ) : ''; 28 29 // Sets up the media library frame. 30 GalleryDataFrame = wp.media.frames.gallery_data_frame = wp.media({ 31 title: Title, 32 button: { text: Button }, 33 library: { type: Library } 34 }); 35 36 // Runs when an image is selected. 37 GalleryDataFrame.on( 'select', function() { 38 39 // Grabs the attachment selection and creates a JSON representation of the model. 40 var MediaAttachment = GalleryDataFrame.state().get( 'selection' ).first().toJSON(); 41 42 // Sends the attachment URL to our custom image input field. 43 $button.prev( 'input.helphub-upload-field' ).val( MediaAttachment.url ); 44 45 }); 46 47 // Opens the media library frame. 48 GalleryDataFrame.open(); 49 }); 50 51 if ( $( 'input[type="date"]' ).hasClass( 'helphub-meta-date' ) ) { 52 $( '.helphub-meta-date' ).datepicker({ 53 changeMonth: true, 54 changeYear: true, 55 formatDate: 'MM, dd, yy' 56 }); 57 } // Bust cache. 58 }); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/assets/js/gallery.js
1 /* globals HelphubGallery */ 2 jQuery( document ).ready( function( $ ) { 3 4 // Uploading files 5 var HelphubGalleryFrame; 6 var $GalleryContainer = $( '#helphub_images_container' ); 7 var $ImageGalleryIds = $( '#helphub_image_gallery' ); 8 var $GalleryImages = $GalleryContainer.find( 'ul.product_images' ); 9 var $GalleryUl = $GalleryContainer.find( 'ul li.image' ); 10 11 jQuery( '.add_helphub_images' ).on( 'click', 'a', function( event ) { 12 13 var AttachmentIds = $ImageGalleryIds.val(); 14 15 event.preventDefault(); 16 17 // If the media frame already exists, reopen it. 18 if ( HelphubGalleryFrame ) { 19 HelphubGalleryFrame.open(); 20 return; 21 } 22 23 // Create the media frame. 24 HelphubGalleryFrame = wp.media.frames.downloadable_file = wp.media({ 25 26 // Set the title of the modal. 27 title: HelphubGallery.gallery_title, 28 button: { 29 text: HelphubGallery.gallery_button 30 }, 31 multiple: true 32 }); 33 34 // When an image is selected, run a callback. 35 HelphubGalleryFrame.on( 'select', function() { 36 37 var selection = HelphubGalleryFrame.state().get( 'selection' ); 38 39 selection.map( function( attachment ) { 40 41 attachment = attachment.toJSON(); 42 43 if ( attachment.id ) { 44 AttachmentIds = AttachmentIds ? AttachmentIds + ',' + attachment.id : attachment.id; 45 46 $GalleryImages.append( '<li class="image" data-attachment_id="' + attachment.id + '">' + 47 '<img src="' + attachment.sizes.thumbnail.url + '" />' + 48 '<ul class="actions">' + 49 '<li><a href="#" class="delete" title="' + HelphubGallery.delete_image + '">×</a></li>' + 50 '</ul>' + 51 '</li>' ); 52 } 53 54 } ); 55 56 $ImageGalleryIds.val( AttachmentIds ); 57 }); 58 59 // Finally, open the modal. 60 HelphubGalleryFrame.open(); 61 }); 62 63 // Image ordering 64 $GalleryImages.sortable({ 65 items: 'li.image', 66 cursor: 'move', 67 scrollSensitivity: 40, 68 forcePlaceholderSize: true, 69 forceHelperSize: false, 70 helper: 'clone', 71 opacity: 0.65, 72 placeholder: 'helphub-metabox-sortable-placeholder', 73 start: function( event, ui ) { 74 ui.item.css( 'background-color', '#f6f6f6' ); 75 }, 76 stop: function( event, ui ) { 77 ui.item.removeAttr( 'style' ); 78 }, 79 update: function() { 80 var AttachmentIds = ''; 81 $GalleryContainer.find( 'ul li.image' ).css( 'cursor', 'default' ).each( function() { 82 var AttachmentId = jQuery( this ).attr( 'data-attachment_id' ); 83 AttachmentIds = AttachmentIds + AttachmentId + ','; 84 }); 85 $ImageGalleryIds.val( AttachmentIds ); 86 } 87 }); 88 89 // Remove images 90 $GalleryContainer.on( 'click', 'a.delete', function() { 91 var AttachmentIds = ''; 92 93 $( this ).closest( 'li.image' ).remove(); 94 95 $GalleryUl.css( 'cursor', 'default' ).each( function() { 96 var AttachmentId = jQuery( this ).attr( 'data-attachment_id' ); 97 AttachmentIds = AttachmentIds + AttachmentId + ','; 98 }); 99 100 $ImageGalleryIds.val( AttachmentIds ); 101 102 return false; 103 } ); 104 } ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-post-type.php
1 <?php 2 /** 3 * This file is part of the Helphub Post Types plugin 4 * 5 * @package WordPress 6 * @author Jon Ang 7 */ 8 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; // Exit if accessed directly. 11 } 12 13 /** 14 * Helphub Post Types, Post Type Class 15 * 16 * All functionality pertaining to post types in Helphub Post Types. 17 * 18 * @package WordPress 19 * @subpackage HelpHub_Post_Types 20 * @category Plugin 21 * @author Jon Ang 22 * @since 1.0.0 23 */ 24 class HelpHub_Post_Types_Post_Type { 25 /** 26 * The post type token. 27 * 28 * @access public 29 * @since 1.0.0 30 * @var string 31 */ 32 public $post_type; 33 34 /** 35 * The post type singular label. 36 * 37 * @access public 38 * @since 1.0.0 39 * @var string 40 */ 41 public $singular; 42 43 /** 44 * The post type plural label. 45 * 46 * @access public 47 * @since 1.0.0 48 * @var string 49 */ 50 public $plural; 51 52 /** 53 * The post type args. 54 * 55 * @access public 56 * @since 1.0.0 57 * @var array 58 */ 59 public $args; 60 61 /** 62 * The taxonomies for this post type. 63 * 64 * @access public 65 * @since 1.0.0 66 * @var array 67 */ 68 public $taxonomies; 69 70 /** 71 * Constructor function. 72 * 73 * @access public 74 * @since 1.0.0 75 * 76 * @param string $post_type The post type id/handle. 77 * @param string $singular The singular pronunciation of the post type name. 78 * @param string $plural The plural pronunciation of the post type name. 79 * @param array $args The typical arguments allowed to register a post type. 80 * @param array $taxonomies The list of taxonomies that the post type is associated with. 81 */ 82 public function __construct( $post_type = 'thing', $singular = '', $plural = '', $args = array(), $taxonomies = array() ) { 83 $this->post_type = $post_type; 84 $this->singular = $singular; 85 $this->plural = $plural; 86 $this->args = $args; 87 $this->taxonomies = $taxonomies; 88 89 add_action( 'init', array( $this, 'register_post_type' ) ); 90 add_action( 'init', array( $this, 'register_taxonomy' ) ); 91 92 if ( is_admin() ) { 93 global $pagenow; 94 95 add_action( 'admin_menu', array( $this, 'meta_box_setup' ), 20 ); 96 add_action( 'save_post', array( $this, 'meta_box_save' ), 50 ); 97 add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) ); 98 add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) ); 99 100 if ( 'edit.php' === $pagenow && isset( $_GET['post_type'] ) && $this->post_type === $_GET['post_type'] ) { // WPCS: input var ok; CSRF ok. 101 add_filter( 'manage_edit-' . $this->post_type . '_columns', array( 102 $this, 103 'register_custom_column_headings', 104 ), 10, 1 ); 105 add_action( 'manage_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 ); 106 } 107 } 108 add_action( 'admin_init', array( $this, 'add_menu_order' ) ); 109 add_action( 'after_setup_theme', array( $this, 'ensure_post_thumbnails_support' ) ); 110 } // End __construct() 111 112 /** 113 * Register the post type. 114 * 115 * @access public 116 * @return void 117 */ 118 public function register_post_type() { 119 120 if ( post_type_exists( $this->post_type ) ) { 121 return; 122 } 123 124 $labels = array( 125 'name' => $this->plural, 126 'singular_name' => $this->singular, 127 'add_new' => _x( 'Add New', 'add new helphub post', 'wporg-forums' ), 128 /* translators: %s: Post type name. */ 129 'add_new_item' => sprintf( __( 'Add New %s', 'wporg-forums' ), $this->singular ), 130 /* translators: %s: Post type name. */ 131 'edit_item' => sprintf( __( 'Edit %s', 'wporg-forums' ), $this->singular ), 132 /* translators: %s: Post type name. */ 133 'new_item' => sprintf( __( 'New %s', 'wporg-forums' ), $this->singular ), 134 /* translators: %s: Plural post type name. */ 135 'all_items' => sprintf( __( 'All %s', 'wporg-forums' ), $this->plural ), 136 /* translators: %s: Post type name. */ 137 'view_item' => sprintf( __( 'View %s', 'wporg-forums' ), $this->singular ), 138 /* translators: %s: Plural post type name. */ 139 'search_items' => sprintf( __( 'Search %a', 'wporg-forums' ), $this->plural ), 140 /* translators: %s: Plural post type name. */ 141 'not_found' => sprintf( __( 'No %s Found', 'wporg-forums' ), $this->plural ), 142 /* translators: %s: Plural post type name. */ 143 'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'wporg-forums' ), $this->plural ), 144 'parent_item_colon' => '', 145 'menu_name' => $this->plural, 146 ); 147 148 $single_slug = apply_filters( 'helphub_single_slug', sanitize_title_with_dashes( $this->singular ) ); 149 $archive_slug = apply_filters( 'helphub_archive_slug', sanitize_title_with_dashes( $this->plural ) ); 150 151 $defaults = array( 152 'labels' => $labels, 153 'public' => true, 154 'publicly_queryable' => true, 155 'show_ui' => true, 156 'show_in_menu' => true, 157 'query_var' => true, 158 'rewrite' => array( 159 'slug' => $single_slug, 160 ), 161 'capability_type' => 'post', 162 'has_archive' => $archive_slug, 163 'hierarchical' => false, 164 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', 'revisions' ), 165 'menu_position' => 5, 166 'menu_icon' => 'dashicons-smiley', 167 'show_in_rest' => true, 168 'rest_base' => $archive_slug, 169 'rest_controller_class' => 'WP_REST_Posts_Controller', 170 ); 171 172 $args = wp_parse_args( $this->args, $defaults ); 173 174 register_post_type( $this->post_type, $args ); 175 } // End register_post_type() 176 177 /** 178 * Register the post-type taxonomy. 179 * 180 * @access public 181 * @since 1.3.0 182 * @return void 183 */ 184 public function register_taxonomy() { 185 foreach ( $this->taxonomies as $taxonomy ) { 186 $taxonomy = new HelpHub_Post_Types_Taxonomy( esc_attr( $this->post_type ), $taxonomy, '', '', array() ); // Leave arguments empty, to use the default arguments. 187 $taxonomy->register(); 188 } 189 } // End register_taxonomy() 190 191 /** 192 * Add custom columns for the "manage" screen of this post type. 193 * 194 * @access public 195 * 196 * @param string $column_name The name of the column. 197 * @param int $id The ID. 198 * 199 * @since 1.0.0 200 * @return void 201 */ 202 public function register_custom_columns( $column_name, $id ) { 203 switch ( $column_name ) { 204 case 'image': 205 // Displays img tag. 206 echo $this->get_image( $id, 40 ); 207 /* @codingStandardsIgnoreLine */ 208 break; 209 default: 210 break; 211 } 212 } // End register_custom_columns() 213 214 /** 215 * Add custom column headings for the "manage" screen of this post type. 216 * 217 * @access public 218 * 219 * @param array $defaults The default value. 220 * 221 * @since 1.0.0 222 * @return array $defaults 223 */ 224 public function register_custom_column_headings( $defaults ) { 225 $new_columns = array( 226 'image' => __( 'Image', 'wporg-forums' ), 227 ); 228 229 $last_item = array(); 230 231 if ( isset( $defaults['date'] ) ) { 232 unset( $defaults['date'] ); 233 } 234 235 if ( count( $defaults ) > 2 ) { 236 $last_item = array_slice( $defaults, - 1 ); 237 238 array_pop( $defaults ); 239 } 240 $defaults = array_merge( $defaults, $new_columns ); 241 242 if ( is_array( $last_item ) && 0 < count( $last_item ) ) { 243 foreach ( $last_item as $k => $v ) { 244 $defaults[ $k ] = $v; 245 break; 246 } 247 } 248 249 return $defaults; 250 } // End register_custom_column_headings() 251 252 /** 253 * Update messages for the post type admin. 254 * 255 * @since 1.0.0 256 * 257 * @param array $messages Array of messages for all post types. 258 * 259 * @return array Modified array. 260 */ 261 public function updated_messages( $messages ) { 262 global $post, $post_ID; /* @codingStandardsIgnoreLine */ 263 264 $permalink = get_permalink( $post_ID ); /* @codingStandardsIgnoreLine */ 265 266 $messages[ $this->post_type ] = array( 267 0 => '', 268 // Unused. Messages start at index 1. 269 /* translators: %1$s: Post link tag. %2$s: Close post link tag. %3$s: Post type name. %4$s: Lowercase post type name. */ 270 1 => sprintf( __( '%3$s updated. %1$sView %4$s%2$s', 'wporg-forums' ), '<a href="' . esc_url( $permalink ) . '">', '</a>', $this->singular, strtolower( $this->singular ) ), 271 2 => __( 'Custom field updated.', 'wporg-forums' ), 272 3 => __( 'Custom field deleted.', 'wporg-forums' ), 273 /* translators: %s: Post type name. */ 274 4 => sprintf( __( '%s updated.', 'wporg-forums' ), $this->singular ), 275 /* translators: %s: date and time of the revision */ 276 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'wporg-forums' ), $this->singular, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 277 // WPCS: CSRF ok; input var ok. 278 /* translators: %1$s Post type name. %2$s: Lowercase post type name. %3$s: Post link tag. %4$s: Close post link tag. */ 279 6 => sprintf( __( '%1$s published. %3$sView %2$s%4$s', 'wporg-forums' ), $this->singular, strtolower( $this->singular ), '<a href="' . esc_url( $permalink ) . '">', '</a>' ), 280 /* translators: %s: Post type name. */ 281 7 => sprintf( __( '%s saved.', 'wporg-forums' ), $this->singular ), 282 /* translators: %1$s: Post type name. %2$s: Lowercase post type name. %3$s: Post link tag. %4$s: Close post link tag. */ 283 8 => sprintf( __( '%1$s submitted. %2$sPreview %3$s%4$s', 'wporg-forums' ), $this->singular, strtolower( $this->singular ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', $permalink ) ) . '">', '</a>' ), 284 /* translators: %1$s: Post type name. %2$s: Lowercase post type name. */ 285 9 => sprintf( __( '%1$s scheduled for: %1$s. %2$sPreview %2$s%3$s', 'wporg-forums' ), $this->singular, strtolower( $this->singular ), '<strong>' . date_i18n( __( 'M j, Y @ G:i', 'wporg-forums' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( $permalink ) . '">', '</a>' ), 286 /* translators: %1$s: Post type name. %2$s: Lowercase post type name. %3$s: Close post link tag. %4$s: Close post link tag. */ 287 10 => sprintf( __( '%1$s draft updated. %3$sPreview %2$s%4$s', 'wporg-forums' ), $this->singular, strtolower( $this->singular ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', $permalink ) ) . '">', '</a>' ), 288 ); 289 290 return $messages; 291 } // End updated_messages() 292 293 /** 294 * Setup the meta box. 295 * You can use separate conditions here to add different meta boxes for different post types 296 * 297 * @access public 298 * @since 1.0.0 299 * @return void 300 */ 301 public function meta_box_setup() { 302 if ( 'post' === $this->post_type ) { 303 add_meta_box( $this->post_type . '-display', __( 'Display Settings', 'wporg-forums' ), array( 304 $this, 305 'meta_box_content', 306 ), $this->post_type, 'normal', 'high' ); 307 } elseif ( 'helphub_version' === $this->post_type ) { 308 add_meta_box( $this->post_type . '-version-meta', __( 'Display Settings', 'wporg-forums' ), array( 309 $this, 310 'meta_box_version_content', 311 ), $this->post_type, 'normal', 'high' ); 312 } 313 } // End meta_box_setup() 314 315 /** 316 * The contents of our post meta box. 317 * Duplicate this function for more callbacks 318 * 319 * @access public 320 * @since 1.0.0 321 * @return void 322 */ 323 public function meta_box_content() { 324 $field_data = $this->get_custom_fields_post_display_settings(); 325 $this->meta_box_content_render( $field_data ); 326 } 327 328 /** 329 * The contents of our post meta box. 330 * Duplicate this function for more callbacks 331 * 332 * @access public 333 * @since 1.0.0 334 * @return void 335 */ 336 public function meta_box_version_content() { 337 $field_data = $this->get_custom_fields_version_display_settings(); 338 $this->meta_box_content_render( $field_data ); 339 } 340 341 /** 342 * The rendering of fields in meta boxes 343 * 344 * @access public 345 * @since 1.0.0 346 * 347 * @param array $field_data The field data to populate the rendering function. 348 * 349 * @return void 350 */ 351 public function meta_box_content_render( $field_data ) { 352 global $post_id; 353 $fields = get_post_custom( $post_id ); 354 355 $html = ''; 356 357 $html .= '<input type="hidden" name="helphub_' . $this->post_type . '_noonce" id="helphub_' . $this->post_type . '_noonce" value="' . wp_create_nonce( plugin_basename( dirname( HelpHub_Post_Types()->plugin_path ) ) ) . '" />'; 358 359 if ( 0 < count( $field_data ) ) { 360 $html .= '<table class="form-table">' . "\n"; 361 $html .= '<tbody>' . "\n"; 362 363 foreach ( $field_data as $k => $v ) { 364 $data = $v['default']; 365 if ( isset( $fields[ '_' . $k ] ) && isset( $fields[ '_' . $k ][0] ) ) { 366 $data = $fields[ '_' . $k ][0]; 367 } 368 369 switch ( $v['type'] ) { 370 case 'hidden': 371 $field = '<input name="' . esc_attr( $k ) . '" type="hidden" id="' . esc_attr( $k ) . '" value="' . esc_attr( $data ) . '" />'; 372 $html .= '<tr valign="top">' . $field . "\n"; 373 $html .= '</tr>' . "\n"; 374 break; 375 case 'text': 376 case 'url': 377 $field = '<input name="' . esc_attr( $k ) . '" type="text" id="' . esc_attr( $k ) . '" class="regular-text" value="' . esc_attr( $data ) . '" />'; 378 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 379 if ( isset( $v['description'] ) ) { 380 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 381 } 382 $html .= '</td></tr>' . "\n"; 383 break; 384 case 'textarea': 385 $field = '<textarea name="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '" class="large-text">' . esc_attr( $data ) . '</textarea>'; 386 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 387 if ( isset( $v['description'] ) ) { 388 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 389 } 390 $html .= '</td></tr>' . "\n"; 391 break; 392 case 'editor': 393 ob_start(); 394 wp_editor( $data, $k, array( 395 'media_buttons' => false, 396 'textarea_rows' => 10, 397 ) ); 398 $field = ob_get_contents(); 399 ob_end_clean(); 400 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 401 if ( isset( $v['description'] ) ) { 402 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 403 } 404 $html .= '</td></tr>' . "\n"; 405 break; 406 case 'upload': 407 $data_atts = ''; 408 if ( isset( $v['media-frame']['title'] ) ) { 409 $data_atts .= sprintf( 'data-title="%s" ', esc_attr( $v['media-frame']['title'] ) ); 410 } 411 if ( isset( $v['media-frame']['button'] ) ) { 412 $data_atts .= sprintf( 'data-button="%s" ', esc_attr( $v['media-frame']['button'] ) ); 413 } 414 if ( isset( $v['media-frame']['library'] ) ) { 415 $data_atts .= sprintf( 'data-library="%s" ', esc_attr( $v['media-frame']['library'] ) ); 416 } 417 418 $field = '<input name="' . esc_attr( $k ) . '" type="file" id="' . esc_attr( $k ) . '" class="regular-text helphub-upload-field" />'; 419 $field .= '<button id="' . esc_attr( $k ) . '" class="helphub-upload button" ' . $data_atts . '>' . $v['label'] . '</button>'; 420 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 421 if ( isset( $v['description'] ) ) { 422 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 423 } 424 $html .= '</td></tr>' . "\n"; 425 break; 426 case 'radio': 427 $field = ''; 428 if ( isset( $v['options'] ) && is_array( $v['options'] ) ) { 429 foreach ( $v['options'] as $val => $option ) { 430 $field .= '<p><label for="' . esc_attr( $k . '-' . $val ) . '"><input id="' . esc_attr( $k . '-' . $val ) . '" type="radio" name="' . esc_attr( $k ) . '" value="' . esc_attr( $val ) . '" ' . checked( $val, $data, false ) . ' />' . $option . '</label></p>' . "\n"; 431 } 432 } 433 $html .= '<tr valign="top"><th><label>' . $v['name'] . '</label></th><td>' . $field . "\n"; 434 if ( isset( $v['description'] ) ) { 435 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 436 } 437 $html .= '</td></tr>' . "\n"; 438 break; 439 case 'checkbox': 440 $field = '<p><input id="' . esc_attr( $v['name'] ) . '" type="checkbox" name="' . esc_attr( $k ) . '" value="1" ' . checked( 'yes', $data, false ) . ' / ></p>' . "\n"; 441 if ( isset( $v['description'] ) ) { 442 $field .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 443 } 444 $html .= '<tr valign="top"><th><label for="' . esc_attr( $v['name'] ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 445 $html .= '</td></tr>' . "\n"; 446 break; 447 case 'multicheck': 448 $field = ''; 449 if ( isset( $v['options'] ) && is_array( $v['options'] ) ) { 450 foreach ( $v['options'] as $val => $option ) { 451 $field .= '<p><label for="' . esc_attr( $k . '-' . $val ) . '"><input id="' . esc_attr( $k . '-' . $val ) . '" type="checkbox" name="' . esc_attr( $k ) . '[]" value="' . esc_attr( $val ) . '" ' . checked( 1, in_array( $val, (array) $data, true ), false ) . ' />' . $option . '</label></p>' . "\n"; 452 } 453 } 454 $html .= '<tr valign="top"><th><label>' . $v['name'] . '</label></th><td>' . $field . "\n"; 455 if ( isset( $v['description'] ) ) { 456 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 457 } 458 $html .= '</td></tr>' . "\n"; 459 break; 460 case 'select': 461 $field = '<select name="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '" >' . "\n"; 462 if ( isset( $v['options'] ) && is_array( $v['options'] ) ) { 463 foreach ( $v['options'] as $val => $option ) { 464 $field .= '<option value="' . esc_attr( $val ) . '" ' . selected( $val, $data, false ) . '>' . $option . '</option>' . "\n"; 465 } 466 } 467 $field .= '</select>' . "\n"; 468 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 469 if ( isset( $v['description'] ) ) { 470 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 471 } 472 $html .= '</td></tr>' . "\n"; 473 break; 474 case 'date': 475 if ( ! intval( $data ) ) { 476 $data = time(); 477 } 478 $field = '<input name="' . esc_attr( $k ) . '" type="date" id="' . esc_attr( $k ) . '" class="helphub-meta-date" value="' . esc_attr( date_i18n( 'F d, Y', $data ) ) . '" />'; 479 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 480 if ( isset( $v['description'] ) ) { 481 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 482 } 483 $html .= '</td></tr>' . "\n"; 484 break; 485 default: 486 $field = apply_filters( 'helphub_data_field_type_' . $v['type'], null, $k, $data, $v ); 487 if ( $field ) { 488 $html .= '<tr valign="top"><th><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td>' . $field . "\n"; 489 if ( isset( $v['description'] ) ) { 490 $html .= '<p class="description">' . $v['description'] . '</p>' . "\n"; 491 } 492 $html .= '</td></tr>' . "\n"; 493 } 494 break; 495 } // End switch(). 496 } // End foreach(). 497 498 $html .= '</tbody>' . "\n"; 499 $html .= '</table>' . "\n"; 500 } // End if(). 501 502 echo $html; 503 /* @codingStandardsIgnoreLine */ 504 } // End meta_box_content() 505 506 /** 507 * Save meta box fields. 508 * 509 * @access public 510 * @since 1.0.0 511 * 512 * @param int $post_id The post ID. 513 * 514 * @return int $post_id 515 */ 516 public function meta_box_save( $post_id ) { 517 // Verify. 518 $plugin_basename = plugin_basename( dirname( HelpHub_Post_Types()->plugin_path ) ); 519 $nonce_key = 'helphub_' . $this->post_type . '_noonce'; 520 /* @codingStandardsIgnoreLine */ 521 if ( empty( $_POST[ $nonce_key ] ) || ( get_post_type() != $this->post_type ) || ! wp_verify_nonce( $_POST[ $nonce_key ], $plugin_basename ) ) { 522 return $post_id; 523 } 524 525 if ( isset( $_POST['post_type'] ) && 'page' === $_POST['post_type'] ) { 526 /* @codingStandardsIgnoreLine */ 527 if ( ! current_user_can( 'edit_page', $post_id ) ) { 528 return $post_id; 529 } 530 } else { 531 if ( ! current_user_can( 'edit_post', $post_id ) ) { 532 return $post_id; 533 } 534 } 535 536 $field_data = $this->get_custom_fields_settings(); 537 $fields = array_keys( $field_data ); 538 539 foreach ( $fields as $f ) { 540 541 switch ( $field_data[ $f ]['type'] ) { 542 case 'url': 543 ${$f} = isset( $_POST[ $f ] ) ? esc_url( $_POST[ $f ] ) : ''; 544 /* @codingStandardsIgnoreLine */ 545 break; 546 case 'textarea': 547 case 'editor': 548 ${$f} = isset( $_POST[ $f ] ) ? wp_kses_post( trim( $_POST[ $f ] ) ) : ''; 549 /* @codingStandardsIgnoreLine */ 550 break; 551 case 'checkbox': 552 ${$f} = isset( $_POST[ $f ] ) ? 'yes' : 'no'; 553 /* @codingStandardsIgnoreLine */ 554 break; 555 case 'multicheck': 556 // Ensure checkbox is array and whitelist accepted values against options. 557 ${$f} = isset( $_POST[ $f ] ) && is_array( $field_data[ $f ]['options'] ) ? (array) array_intersect( (array) $_POST[ $f ], array_flip( $field_data[ $f ]['options'] ) ) : ''; 558 /* @codingStandardsIgnoreLine */ 559 break; 560 case 'radio': 561 case 'select': 562 // Whitelist accepted value against options. 563 $values = array(); 564 if ( is_array( $field_data[ $f ]['options'] ) ) { 565 $values = array_keys( $field_data[ $f ]['options'] ); 566 } 567 ${$f} = isset( $_POST[ $f ] ) && in_array( $_POST[ $f ], $values ) ? $_POST[ $f ] : ''; 568 /* @codingStandardsIgnoreLine */ 569 break; 570 case 'date': 571 ${$f} = isset( $_POST[ $f ] ) ? strtotime( wp_strip_all_tags( $_POST[ $f ] ) ) : ''; 572 /* @codingStandardsIgnoreLine */ 573 break; 574 default: 575 ${$f} = isset( $_POST[ $f ] ) ? strip_tags( trim( $_POST[ $f ] ) ) : ''; 576 /* @codingStandardsIgnoreLine */ 577 break; 578 } 579 580 // Save it. 581 if ( 'read_time' !== $f ) { 582 update_post_meta( $post_id, '_' . $f, ${$f} ); 583 } 584 } // End foreach(). 585 586 // Save the project gallery image IDs. 587 if ( isset( $_POST['helphub_image_gallery'] ) ) : /* @codingStandardsIgnoreLine */ 588 $attachment_ids = array_filter( explode( ',', sanitize_text_field( $_POST['helphub_image_gallery'] ) ) ); 589 /* @codingStandardsIgnoreLine */ 590 update_post_meta( $post_id, '_helphub_image_gallery', implode( ',', $attachment_ids ) ); 591 endif; 592 593 return $post_id; 594 } // End meta_box_save() 595 596 /** 597 * Customise the "Enter title here" text. 598 * 599 * @access public 600 * @since 1.0.0 601 * 602 * @param string $title The title. 603 * 604 * @return string $title 605 */ 606 public function enter_title_here( $title ) { 607 if ( get_post_type() === $this->post_type ) { 608 if ( 'post' === get_post_type() ) { 609 $title = __( 'Enter the article title here', 'wporg-forums' ); 610 } 611 } 612 613 return $title; 614 } // End enter_title_here() 615 616 /** 617 * Get the settings for the custom fields. 618 * Use array merge to get a unified fields array 619 * eg. $fields = array_merge( $this->get_custom_fields_post_display_settings(), $this->get_custom_fields_post_advertisement_settings(), $this->get_custom_fields_post_spacer_settings() ); 620 * 621 * @access public 622 * @since 1.0.0 623 * @return array 624 */ 625 public function get_custom_fields_settings() { 626 627 $fields = array(); 628 if ( 'post' === get_post_type() ) { 629 $fields = $this->get_custom_fields_post_display_settings(); 630 } elseif ( 'helphub_version' === get_post_type() ) { 631 $fields = $this->get_custom_fields_version_display_settings(); 632 } 633 634 return $fields; 635 636 } // End get_custom_fields_settings() 637 638 /** 639 * Get the settings for the post display custom fields. 640 * 641 * @access public 642 * @since 1.0.0 643 * @return array 644 */ 645 public function get_custom_fields_post_display_settings() { 646 $fields = array(); 647 648 $fields['read_time'] = array( 649 'name' => __( 'Article Read Time', 'wporg-forums' ), 650 'description' => __( 'Leave this empty, calculation is automatic', 'wporg-forums' ), 651 'type' => 'text', 652 'default' => '', 653 'section' => 'info', 654 ); 655 656 $fields['custom_read_time'] = array( 657 'name' => __( 'Custom Read Time', 'wporg-forums' ), 658 'description' => __( 'Only fill up this field if the automated calculation is incorrect', 'wporg-forums' ), 659 'type' => 'text', 660 'default' => '', 661 'section' => 'info', 662 ); 663 664 return $fields; 665 } 666 667 /** 668 * Get the settings for the post display custom fields. 669 * 670 * @access public 671 * @since 1.0.0 672 * @return array 673 */ 674 public function get_custom_fields_version_display_settings() { 675 $fields = array(); 676 677 $fields['version_date'] = array( 678 'name' => __( 'Date Released', 'wporg-forums' ), 679 'description' => __( 'Date this WordPress Version was released', 'wporg-forums' ), 680 'type' => 'date', 681 'default' => '', 682 'section' => 'info', 683 ); 684 685 $fields['musician_codename'] = array( 686 'name' => __( 'Musician', 'wporg-forums' ), 687 'description' => __( 'The Jazz Musician this release was named after', 'wporg-forums' ), 688 'type' => 'text', 689 'default' => '', 690 'section' => 'info', 691 ); 692 693 return $fields; 694 } 695 696 697 /** 698 * Get the image for the given ID. 699 * 700 * @param int $id The post ID. 701 * @param mixed $size Image dimension. (default: "thing-thumbnail"). 702 * 703 * @since 1.0.0 704 * @return string <img> tag. 705 */ 706 protected function get_image( $id, $size = 'thing-thumbnail' ) { 707 $response = ''; 708 709 if ( has_post_thumbnail( $id ) ) { 710 // If not a string or an array, and not an integer, default to 150x9999. 711 if ( ( is_int( $size ) || ( 0 < intval( $size ) ) ) && ! is_array( $size ) ) { 712 $size = array( intval( $size ), intval( $size ) ); 713 } elseif ( ! is_string( $size ) && ! is_array( $size ) ) { 714 $size = array( 150, 9999 ); 715 } 716 $response = get_the_post_thumbnail( intval( $id ), $size ); 717 } 718 719 return $response; 720 } // End get_image() 721 722 /** 723 * Run on activation. 724 * 725 * @access public 726 * @since 1.0.0 727 */ 728 public function activation() { 729 $this->flush_rewrite_rules(); 730 } // End activation() 731 732 /** 733 * Flush the rewrite rules 734 * 735 * @access public 736 * @since 1.0.0 737 */ 738 private function flush_rewrite_rules() { 739 $this->register_post_type(); 740 flush_rewrite_rules(); 741 } // End flush_rewrite_rules() 742 743 /** 744 * Ensure that "post-thumbnails" support is available for those themes that don't register it. 745 * 746 * @access public 747 * @since 1.0.0 748 */ 749 public function ensure_post_thumbnails_support() { 750 if ( ! current_theme_supports( 'post-thumbnails' ) ) { 751 add_theme_support( 'post-thumbnails' ); 752 } 753 } // End ensure_post_thumbnails_support() 754 755 /** 756 * Add menu order 757 * 758 * @access public 759 * @since 1.0.0 760 */ 761 public function add_menu_order() { 762 add_post_type_support( 'post', 'page-attributes' ); 763 } // End ens 764 765 } // End Class -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-taxonomy.php
1 <?php 2 /** 3 * This file is part of the Helphub Post Types plugin 4 * 5 * @package WordPress 6 * @author Jon Ang 7 */ 8 9 if ( ! defined( 'ABSPATH' ) ) { 10 exit; // Exit if accessed directly. 11 } 12 13 /** 14 * Helphub Post Types Taxonomy Class 15 * 16 * Re-usable class for registering post type taxonomies. 17 * 18 * @package WordPress 19 * @subpackage HelpHub_Post_Types 20 * @category Plugin 21 * @author Jon Ang 22 * @since 1.0.0 23 */ 24 class HelpHub_Post_Types_Taxonomy { 25 /** 26 * The post type to register the taxonomy for. 27 * 28 * @access private 29 * @since 1.3.0 30 * @var array 31 */ 32 private $post_type; 33 34 /** 35 * The key of the taxonomy. 36 * 37 * @access private 38 * @since 1.3.0 39 * @var string 40 */ 41 private $token; 42 43 /** 44 * The singular name for the taxonomy. 45 * 46 * @access private 47 * @since 1.3.0 48 * @var string 49 */ 50 private $singular; 51 52 /** 53 * The plural name for the taxonomy. 54 * 55 * @access private 56 * @since 1.3.0 57 * @var string 58 */ 59 private $plural; 60 61 /** 62 * The arguments to use when registering the taxonomy. 63 * 64 * @access private 65 * @since 1.3.0 66 * @var string 67 */ 68 private $args; 69 70 /** 71 * Class constructor. 72 * 73 * @access public 74 * @since 1.3.0 75 * @param array $post_type The post type key. 76 * @param string $token The taxonomy key. 77 * @param string $singular Singular name. 78 * @param string $plural Plural name. 79 * @param array $args Array of argument overrides. 80 */ 81 public function __construct( $post_type = array(), $token = 'thing-category', $singular = '', $plural = '', $args = array() ) { 82 $this->post_type = $post_type; 83 $this->token = esc_attr( $token ); 84 $this->singular = esc_html( $singular ); 85 $this->plural = esc_html( $plural ); 86 87 if ( '' === $this->singular ) { 88 $this->singular = __( 'Category', 'wporg-forums' ); 89 } 90 if ( '' === $this->plural ) { 91 $this->plural = __( 'Categories', 'wporg-forums' ); 92 } 93 94 $this->args = wp_parse_args( $args, $this->_get_default_args() ); 95 96 add_action( 'init', array( $this, 'register' ) ); 97 } // End __construct() 98 99 /** 100 * Return an array of default arguments. 101 * 102 * @access private 103 * @since 1.3.0 104 * @return array Default arguments. 105 */ 106 private function _get_default_args() { 107 return array( 108 'labels' => $this->_get_default_labels(), 109 'public' => true, 110 'hierarchical' => true, 111 'show_ui' => true, 112 'show_admin_column' => true, 113 'query_var' => true, 114 'show_in_nav_menus' => false, 115 'show_tagcloud' => false, 116 'rewrite' => array( 117 'slug' => str_replace( 'helphub_', '', esc_attr( $this->token ) ), 118 ), 119 ); 120 } // End _get_default_args() 121 122 /** 123 * Return an array of default labels. 124 * 125 * @access private 126 * @since 1.3.0 127 * @return array Default labels. 128 */ 129 private function _get_default_labels() { 130 return array( 131 'name' => sprintf( _x( '%s', 'taxonomy general name', 'wporg-forums' ), $this->plural ), /* @codingStandardsIgnoreLine */ 132 'singular_name' => sprintf( _x( '%s', 'taxonomy singular name', 'wporg-forums' ), $this->singular ), /* @codingStandardsIgnoreLine */ 133 'search_items' => sprintf( __( 'Search %s', 'wporg-forums' ), $this->plural ), 134 /* translators: %s: Plural name of the post type. */ 135 'all_items' => sprintf( __( 'All %s', 'wporg-forums' ), $this->plural ), 136 /* translators: %s: Post type name. */ 137 'parent_item' => sprintf( __( 'Parent %s', 'wporg-forums' ), $this->singular ), 138 /* translators: %s: Post type name. */ 139 'parent_item_colon' => sprintf( __( 'Parent %s:', 'wporg-forums' ), $this->singular ), 140 /* translators: %s: Post type name. */ 141 'edit_item' => sprintf( __( 'Edit %s', 'wporg-forums' ), $this->singular ), 142 /* translators: %s: Post type name. */ 143 'update_item' => sprintf( __( 'Update %s', 'wporg-forums' ), $this->singular ), 144 /* translators: %s: Post type name. */ 145 'add_new_item' => sprintf( __( 'Add New %s', 'wporg-forums' ), $this->singular ), 146 /* translators: %s: Post type name. */ 147 'new_item_name' => sprintf( __( 'New %s Name', 'wporg-forums' ), $this->singular ), 148 'menu_name' => $this->plural, 149 ); 150 } // End _get_default_labels() 151 152 /** 153 * Register the taxonomy. 154 * 155 * @access public 156 * @since 1.3.0 157 * @return void 158 */ 159 public function register() { 160 register_taxonomy( esc_attr( $this->token ), (array) $this->post_type, (array) $this->args ); 161 } // End register() 162 } // End Class -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types.php
1 <?php 2 /** 3 * This file is part of the Helphub Post Types plugin 4 * 5 * @package WordPress 6 */ 7 8 /** 9 * Main HelpHub_Post_Types Class 10 * 11 * @class HelpHub_Post_Types 12 * @version 1.0.0 13 * @since 1.0.0 14 * @package HelpHub_Post_Types 15 * @author Jon Ang 16 */ 17 final class HelpHub_Post_Types { 18 /** 19 * HelpHub_Post_Types The single instance of HelpHub_Post_Types. 20 * 21 * @var object 22 * @access private 23 * @since 1.0.0 24 */ 25 private static $_instance = null; 26 27 /** 28 * The token. 29 * 30 * @var string 31 * @access public 32 * @since 1.0.0 33 */ 34 public $token; 35 36 /** 37 * The version number. 38 * 39 * @var string 40 * @access public 41 * @since 1.0.0 42 */ 43 public $version; 44 45 /** 46 * The plugin directory URL. 47 * 48 * @var string 49 * @access public 50 * @since 1.0.0 51 */ 52 public $plugin_url; 53 54 /** 55 * The plugin directory path. 56 * 57 * @var string 58 * @access public 59 * @since 1.0.0 60 */ 61 public $plugin_path; 62 63 /* Admin - Start */ 64 65 /** 66 * The admin object. 67 * 68 * @var object 69 * @access public 70 * @since 1.0.0 71 */ 72 public $admin; 73 74 /** 75 * The settings object. 76 * 77 * @var object 78 * @access public 79 * @since 1.0.0 80 */ 81 public $settings; 82 83 /* Admin - End */ 84 85 /* Post Types - Start */ 86 87 /** 88 * The post types we're registering. 89 * 90 * @var array 91 * @access public 92 * @since 1.0.0 93 */ 94 public $post_types = array(); 95 96 /* Post Types - End */ 97 98 /* Taxonomies - Start */ 99 100 /** 101 * The taxonomies we're registering. 102 * 103 * @var array 104 * @access public 105 * @since 1.0.0 106 */ 107 public $taxonomies = array(); 108 109 /* Taxonomies - End */ 110 111 112 /** 113 * Constructor function. 114 * 115 * @access public 116 * @since 1.0.0 117 */ 118 public function __construct() { 119 $this->token = 'helphub'; 120 $this->plugin_url = plugin_dir_url( __FILE__ ); 121 $this->plugin_path = plugin_dir_path( __FILE__ ); 122 $this->version = '1.0.0'; 123 124 /* Post Types - Start */ 125 126 require_once( __DIR__ . '/class-helphub-post-types-post-type.php' ); 127 require_once( __DIR__ . '/class-helphub-post-types-taxonomy.php' ); 128 129 $this->post_types['post'] = new HelpHub_Post_Types_Post_Type( 'post', __( 'Post', 'wporg-forums' ), __( 'Posts', 'wporg-forums' ), array( 130 'menu_icon' => 'dashicons-post', 131 ) ); 132 $this->post_types['helphub_article'] = new HelpHub_Post_Types_Post_Type( 'helphub_article', __( 'Article', 'wporg-forums' ), __( 'Articles', 'wporg-forums' ), array( 133 'menu_icon' => 'dashicons-media-document', 134 ) ); 135 $this->post_types['helphub_version'] = new HelpHub_Post_Types_Post_Type( 'helphub_version', __( 'WordPress Version', 'wporg-forums' ), __( 'WordPress Versions', 'wporg-forums' ), array( 136 'menu_icon' => 'dashicons-wordpress', 137 ) ); 138 139 /* Post Types - End */ 140 141 // Register an example taxonomy. To register more taxonomies, duplicate this line. 142 $this->taxonomies['helphub_persona'] = new HelpHub_Post_Types_Taxonomy( array( 'post', 'helphub_article' ), 'helphub_persona', __( 'Persona', 'wporg-forums' ), __( 'Personas', 'wporg-forums' ) ); 143 $this->taxonomies['helphub_experience'] = new HelpHub_Post_Types_Taxonomy( array( 'post', 'helphub_article' ), 'helphub_experience', __( 'Experience', 'wporg-forums' ), __( 'Experiences', 'wporg-forums' ) ); 144 $this->taxonomies['helphub_major_release'] = new HelpHub_Post_Types_Taxonomy( 'helphub_version', 'helphub_major_release', __( 'Major Release', 'wporg-forums' ), __( 'Major Releases', 'wporg-forums' ) ); 145 146 register_activation_hook( __FILE__, array( $this, 'install' ) ); 147 148 add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); 149 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); 150 } // End __construct() 151 152 /** 153 * Main HelpHub_Post_Types Instance 154 * 155 * Ensures only one instance of HelpHub_Post_Types is loaded or can be loaded. 156 * 157 * @since 1.0.0 158 * @static 159 * @see HelpHub_Post_Types() 160 * @return HelpHub_Post_Types instance 161 */ 162 public static function instance() { 163 164 if ( is_null( self::$_instance ) ) { 165 self::$_instance = new self(); 166 } 167 168 return self::$_instance; 169 } // End instance() 170 171 /** 172 * Load the localisation file. 173 * 174 * @access public 175 * @since 1.0.0 176 */ 177 public function load_plugin_textdomain() { 178 load_plugin_textdomain( 'wporg-forums', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 179 } // End load_plugin_textdomain() 180 181 /** 182 * Enqueue post type admin Styles. 183 * 184 * @access public 185 * @since 1.0.0 186 * @return void 187 */ 188 public function enqueue_admin_styles() { 189 global $pagenow; 190 191 wp_enqueue_style( 'helphub-post-types-admin-style', $this->plugin_url . 'assets/css/admin.css', array(), '1.0.0' ); 192 193 if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) ) : 194 if ( array_key_exists( get_post_type(), $this->post_types ) ) : 195 wp_enqueue_script( 'helphub-post-types-admin', $this->plugin_url . 'assets/js/admin.js', array( 'jquery' ), '1.0.1', true ); 196 wp_enqueue_script( 'helphub-post-types-gallery', $this->plugin_url . 'assets/js/gallery.js', array( 'jquery' ), '1.0.0', true ); 197 wp_enqueue_script( 'jquery-ui-datepicker' ); 198 wp_enqueue_style( 'jquery-ui-datepicker' ); 199 endif; 200 endif; 201 wp_localize_script( 'helphub-post-types-admin', 'HelphubAdmin', 202 array( 203 'default_title' => __( 'Upload', 'wporg-forums' ), 204 'default_button' => __( 'Select this', 'wporg-forums' ), 205 ) 206 ); 207 208 wp_localize_script( 'helphub-post-types-gallery', 'HelphubGallery', 209 array( 210 'gallery_title' => __( 'Add Images to Product Gallery', 'wporg-forums' ), 211 'gallery_button' => __( 'Add to gallery', 'wporg-forums' ), 212 'delete_image' => __( 'Delete image', 'wporg-forums' ), 213 ) 214 ); 215 216 } // End enqueue_admin_styles() 217 218 /** 219 * Cloning is forbidden. 220 * 221 * @access public 222 * @since 1.0.0 223 */ 224 public function __clone() { 225 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'wporg-forums' ), '1.0.0' ); 226 } // End __clone() 227 228 /** 229 * Unserializing instances of this class is forbidden. 230 * 231 * @access public 232 * @since 1.0.0 233 */ 234 public function __wakeup() { 235 _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'wporg-forums' ), '1.0.0' ); 236 } // End __wakeup() 237 238 /** 239 * Installation. Runs on activation. 240 * 241 * @access public 242 * @since 1.0.0 243 */ 244 public function install() { 245 $this->_log_version_number(); 246 } // End install() 247 248 /** 249 * Log the plugin version number. 250 * 251 * @access private 252 * @since 1.0.0 253 */ 254 private function _log_version_number() { 255 // Log the version number. 256 update_option( $this->token . '-version', $this->version ); 257 } // End _log_version_number() 258 } // End Class -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/index.php
1 <?php 2 /** 3 * Silence is golden. 4 * @codingStandardsIgnoreFile 5 */ -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/helphub-post-types.php
1 <?php 2 /** 3 * Create Custom Post Types used by HelpHub. 4 * 5 * @package HelpHub 6 */ 7 8 if ( ! defined( 'ABSPATH' ) ) { 9 exit; // Exit if accessed directly. 10 } 11 12 require_once( __DIR__ . '/classes/class-helphub-post-types.php' ); 13 14 /** 15 * Returns the main instance of HelpHub_Post_Types to prevent the need to use globals. 16 * 17 * @since 1.0.0 18 * @return object HelpHub_Post_Types 19 */ 20 function helphub_post_types() { 21 return HelpHub_Post_Types::instance(); 22 } // End HelpHub_Post_Types() 23 24 add_action( 'plugins_loaded', 'helphub_post_types' ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/support-helphub.php
1 <?php 2 /** 3 * Plugin Name: Support HelpHub 4 * Plugin URI: https://wordpress.org/support/ 5 * Description: Introduces HelpHub functionality to the WordPress.org support structure. 6 * Version: 1.0 7 * Author: WordPress.org 8 * Author URI: https://wordpress.org/ 9 * Text Domain: wporg-forums 10 * License: GPLv2 11 * License URI: http://opensource.org/licenses/gpl-2.0.php 12 */ 13 14 namespace WordPressdotorg\HelpHub; 15 16 require_once( __DIR__ . '/inc/helphub-post-types/helphub-post-types.php' ); 17 require_once( __DIR__ . '/inc/helphub-front-page-blocks/helphub-front-page-blocks.php' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/site/_archive.scss
1 body.archive { 2 3 #main { 4 5 article { 6 7 &:before { 8 9 display: block; 10 width: 100%; 11 height: 1px; 12 background-color: #e2dddd; 13 content: ''; 14 margin-top: 20px; 15 } 16 17 &:first-of-type { 18 19 &:before { 20 21 display: none; 22 } 23 } 24 25 .entry-title { 26 27 margin-top: 20px; 28 } 29 } 30 31 .archive-pagination { 32 33 margin-top: 20px; 34 text-align: center; 35 } 36 } 37 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/site/_bbpress.scss
16 16 17 17 @media (min-width: $ms-breakpoint) { 18 18 > div { 19 float:left; 19 display: inline-block; 20 vertical-align: top; 20 21 width:30%; 21 margin-right: 5%;22 margin-right:4.5%; 22 23 font-size:ms(-2); 23 24 &:nth-child(3n) { 24 25 margin-right:0; … … 61 62 @media (min-width: $ms-breakpoint) { 62 63 height: 200px; 63 64 border-bottom: none; 64 margin: 2rem 5% 0 0;65 margin: 2rem 4.5% 0 0; 65 66 66 67 &:nth-child(3n) { 67 68 margin-right:0; … … 667 668 # Homepage 668 669 --------------------------------------------------------------*/ 669 670 671 .forum-archive.wporg-support, 670 672 .home.wporg-support { 671 673 672 674 .info-box { … … 691 693 } 692 694 } 693 695 694 #bbpress-forums div.odd { 695 background: transparent; 696 #bbpress-forums { 697 .bbp-forums { 698 border: none; 699 } 700 701 div.odd { 702 background: transparent; 703 } 696 704 } 697 705 698 706 .col-8 { -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/site/_helphub.scss
1 .three-up { 2 3 &.helphub-front-page { 4 5 p, 6 ul { 7 text-align: left; 8 } 9 10 > div { 11 12 margin-bottom: 5rem; 13 } 14 } 15 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/sass/style.scss
76 76 --------------------------------------------------------------*/ 77 77 @import "site/site"; 78 78 79 /*-------------------------------------------------------------- 80 # Archives 81 --------------------------------------------------------------*/ 82 @import "site/archive"; 83 79 84 /*-------------------------------------------------------------- 80 85 # bbPress Specific 81 86 --------------------------------------------------------------*/ 82 87 @import "site/bbpress"; 83 88 89 /*-------------------------------------------------------------- 90 # HelpHub Specific 91 --------------------------------------------------------------*/ 92 @import "site/helphub"; 93 84 94 /*-------------------------------------------------------------- 85 95 # Infinite scroll 86 96 --------------------------------------------------------------*/ -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/template-parts/bbpress-front.php
1 <?php 2 /** 3 * Template part for displaying bbPress topics on the front page. 4 * 5 * @link https://codex.wordpress.org/Template_Hierarchy 6 * 7 * @package WPBBP 8 */ 9 10 ?> 11 12 <?php do_action( 'bbp_before_main_content' ); ?> 13 14 <?php do_action( 'bbp_template_notices' ); ?> 15 16 <section class="three-up" id="forum-welcome"> 17 <div> 18 <div class="info-box"> 19 <span class="dashicons 20 <?php 21 /* translators: dashicon class name for 'Welcome to Support' section. Do not translate into your own language. */ 22 esc_attr_e( 'dashicons-sos', 'wporg-forums' ); 23 ?> 24 "></span> 25 <h3><?php _e( 'Welcome to Support', 'wporg-forums' ); ?></h3> 26 <p><?php _e( 'Our community-based Support Forums are a great place to learn, share, and troubleshoot.', 'wporg-forums' ); ?></p> 27 <p><?php _e( '<a href="https://wordpress.org/support/welcome/">Get started</a>', 'wporg-forums' ); ?></p> 28 </div> 29 </div> 30 <div> 31 <div class="info-box"> 32 <span class="dashicons 33 <?php 34 /* translators: dashicon class name for 'Documentation' section. Do not translate into your own language. */ 35 esc_attr_e( 'dashicons-portfolio', 'wporg-forums' ); 36 ?> 37 "></span> 38 <h3><?php _e( 'Documentation', 'wporg-forums' ); ?></h3> 39 <p><?php _e( 'Your first stop where you\'ll find information on everything from installing to creating plugins.', 'wporg-forums' ); ?></p> 40 <p><?php _e( '<a href="https://codex.wordpress.org/">Explore documentation</a>', 'wporg-forums' ); ?></p> 41 </div> 42 </div> 43 <div> 44 <div class="info-box"> 45 <span class="dashicons 46 <?php 47 /* translators: dashicon class name for 'Get Involved' section. Do not translate into your own language. */ 48 esc_attr_e( 'dashicons-hammer', 'wporg-forums' ); 49 ?> 50 "></span> 51 <h3><?php _e( 'Get Involved', 'wporg-forums' ); ?></h3> 52 <p><?php _e( 'The Support Handbook is great for tips, tricks, and advice regarding giving the best support possible.', 'wporg-forums' ); ?></p> 53 <p><?php _e( '<a href="https://make.wordpress.org/support/handbook/">Explore the Handbook</a>', 'wporg-forums' ); ?></p> 54 </div> 55 </div> 56 </section> 57 58 <hr /> 59 60 <section> 61 <?php bbp_get_template_part( 'content', 'archive-forum' ); ?> 62 63 <div id="viewdiv"> 64 <ul id="views"> 65 <?php wporg_support_get_views(); ?> 66 </ul> 67 </div><!-- #viewdiv --> 68 </section> 69 70 <?php do_action( 'bbp_after_main_content' ); ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/template-parts/content-archive.php
1 <?php 2 /** 3 * Template part for displaying single posts in an archive list. 4 * 5 * @link https://codex.wordpress.org/Template_Hierarchy 6 * 7 * @package WPBBP 8 */ 9 10 ?> 11 12 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 13 <header class="entry-header"> 14 <h2 class="entry-title"> 15 <a href="<?php echo esc_url( get_the_permalink() ); ?>"> 16 <?php the_title(); ?> 17 </a> 18 </h2> 19 </header><!-- .entry-header --> 20 21 <div class="entry-content"> 22 <div class="container"> 23 <?php the_excerpt(); ?> 24 </div> 25 </div><!-- .entry-content --> 26 </article><!-- #post-## --> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/template-parts/content-single.php
1 <?php 2 /** 3 * Template part for displaying page content in page.php. 4 * 5 * @link https://codex.wordpress.org/Template_Hierarchy 6 * 7 * @package WPBBP 8 */ 9 10 ?> 11 12 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 13 <?php if ( is_page_template( 'page-forums-sidebar.php' ) ) : ?> 14 <?php bbp_breadcrumb(); ?> 15 <?php endif; ?> 16 17 <header class="entry-header"> 18 <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> 19 </header><!-- .entry-header --> 20 21 <div class="entry-content"> 22 <div class="container"> 23 <?php 24 the_content(); 25 26 wp_link_pages( array( 27 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'wporg-forums' ), 28 'after' => '</div>', 29 ) ); 30 ?> 31 </div> 32 </div><!-- .entry-content --> 33 34 <footer class="entry-footer"> 35 <?php 36 edit_post_link( 37 sprintf( 38 /* translators: %s: Name of current post */ 39 esc_html__( 'Edit %s', 'wporg-forums' ), 40 the_title( '<span class="screen-reader-text">"', '"</span>', false ) 41 ), 42 '<span class="edit-link">', 43 '</span>' 44 ); 45 ?> 46 </footer><!-- .entry-footer --> 47 </article><!-- #post-## --> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/archive-forum.php
1 <?php 2 3 /** 4 * Template Name: bbPress - Support (Index) 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 get_header(); ?> 11 12 13 <main id="main" class="site-main" role="main"> 14 15 <?php get_template_part( 'template-parts/bbpress', 'front' ); ?> 16 17 </main> 18 19 20 <?php 21 get_footer(); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/archive.php
1 <?php 2 /** 3 * The catchall archive template. 4 * 5 * If no specific archive layout is defined, we'll go with 6 * a generic simplistic one, like this, just to actually 7 * be able to show some content. 8 * 9 * @package WPBBP 10 */ 11 12 get_header(); ?> 13 14 15 <main id="main" class="site-main" role="main"> 16 <?php 17 while ( have_posts() ) : 18 the_post(); 19 ?> 20 21 <?php get_template_part( 'template-parts/content', 'archive' ); ?> 22 23 <?php endwhile; ?> 24 25 <div class="archive-pagination"> 26 <?php posts_nav_link(); ?> 27 </div> 28 29 </main> 30 31 32 <?php 33 get_footer(); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/front-page.php
1 <?php 2 3 /** 4 * The front page of the site. 5 * 6 * @package WPBBP 7 */ 8 9 get_header(); ?> 10 11 <main id="main" class="site-main" role="main"> 12 13 <?php if ( ! is_active_sidebar( 'front-page-blocks' ) ) : ?> 14 <?php get_template_part( 'template-parts/bbpress', 'front' ); ?> 15 <?php else : ?> 16 <div class="three-up helphub-front-page"> 17 <?php dynamic_sidebar( 'front-page-blocks' ); ?> 18 </div> 19 <?php endif; ?> 20 21 </main> 22 23 <?php 24 get_footer(); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
27 27 } 28 28 add_action( 'wp_enqueue_scripts', 'wporg_support_scripts' ); 29 29 30 /** 31 * Register widget areas used by the theme. 32 * 33 * @uses register_sidebar() 34 */ 35 function wporg_support_register_widget_areas() { 36 register_sidebar( array( 37 'name' => __( 'Front page blocks', 'wporg-forums' ), 38 'id' => 'front-page-blocks', 39 'description' => __( 'Contains blocks to display on the front page of this site', 'wporg-forums' ), 40 'before_widget' => '<div id="%1$s" class="widget %2$s">', 41 'after_widget' => '</div>', 42 ) ); 43 } 44 add_action( 'widgets_init', 'wporg_support_register_widget_areas' ); 45 30 46 /** 31 47 * Customized breadcrumb arguments 32 48 * Breadcrumb Root Text: "WordPress Support" -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/searchform.php
20 20 $placeholder = _x( 'Search this forum', 'placeholder', 'wporg-forums' ); 21 21 $project = wporg_support_get_compat_object(); 22 22 } else { 23 $placeholder = _x( 'Search forums', 'placeholder', 'wporg-forums' );23 $placeholder = _x( 'Search support resources', 'placeholder', 'wporg-forums' ); 24 24 $project = null; 25 25 } 26 26 ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/single.php
1 <?php 2 /** 3 * The template for displaying all single post or CPT entry. 4 * 5 * @package WPBBP 6 */ 7 8 get_header(); ?> 9 10 <main id="main" class="site-main" role="main"> 11 12 <?php 13 while ( have_posts() ) : 14 the_post(); 15 16 get_template_part( 'template-parts/content', 'single' ); 17 endwhile; // End of the loop. 18 ?> 19 20 </main><!-- #main --> 21 22 <?php 23 get_footer();