[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> class-wp-terms-list-table.php (source)

   1  <?php
   2  /**
   3   * List Table API: WP_Terms_List_Table class
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   * @since 3.1.0
   8   */
   9  
  10  /**
  11   * Core class used to implement displaying terms in a list table.
  12   *
  13   * @since 3.1.0
  14   * @access private
  15   *
  16   * @see WP_List_Table
  17   */
  18  class WP_Terms_List_Table extends WP_List_Table {
  19  
  20      public $callback_args;
  21  
  22      private $level;
  23  
  24      /**
  25       * Constructor.
  26       *
  27       * @since 3.1.0
  28       *
  29       * @see WP_List_Table::__construct() for more information on default arguments.
  30       *
  31       * @global string $post_type
  32       * @global string $taxonomy
  33       * @global string $action
  34       * @global object $tax
  35       *
  36       * @param array $args An associative array of arguments.
  37       */
  38  	public function __construct( $args = array() ) {
  39          global $post_type, $taxonomy, $action, $tax;
  40  
  41          parent::__construct(
  42              array(
  43                  'plural'   => 'tags',
  44                  'singular' => 'tag',
  45                  'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
  46              )
  47          );
  48  
  49          $action    = $this->screen->action;
  50          $post_type = $this->screen->post_type;
  51          $taxonomy  = $this->screen->taxonomy;
  52  
  53          if ( empty( $taxonomy ) ) {
  54              $taxonomy = 'post_tag';
  55          }
  56  
  57          if ( ! taxonomy_exists( $taxonomy ) ) {
  58              wp_die( __( 'Invalid taxonomy.' ) );
  59          }
  60  
  61          $tax = get_taxonomy( $taxonomy );
  62  
  63          // @todo Still needed? Maybe just the show_ui part.
  64          if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) {
  65              $post_type = 'post';
  66          }
  67  
  68      }
  69  
  70      /**
  71       * @return bool
  72       */
  73  	public function ajax_user_can() {
  74          return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
  75      }
  76  
  77      /**
  78       */
  79  	public function prepare_items() {
  80          $tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' );
  81  
  82          if ( 'post_tag' === $this->screen->taxonomy ) {
  83              /**
  84               * Filters the number of terms displayed per page for the Tags list table.
  85               *
  86               * @since 2.8.0
  87               *
  88               * @param int $tags_per_page Number of tags to be displayed. Default 20.
  89               */
  90              $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
  91  
  92              /**
  93               * Filters the number of terms displayed per page for the Tags list table.
  94               *
  95               * @since 2.7.0
  96               * @deprecated 2.8.0 Use edit_tags_per_page instead.
  97               *
  98               * @param int $tags_per_page Number of tags to be displayed. Default 20.
  99               */
 100              $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page );
 101          } elseif ( 'category' === $this->screen->taxonomy ) {
 102              /**
 103               * Filters the number of terms displayed per page for the Categories list table.
 104               *
 105               * @since 2.8.0
 106               *
 107               * @param int $tags_per_page Number of categories to be displayed. Default 20.
 108               */
 109              $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
 110          }
 111  
 112          $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
 113  
 114          $args = array(
 115              'search' => $search,
 116              'page'   => $this->get_pagenum(),
 117              'number' => $tags_per_page,
 118          );
 119  
 120          if ( ! empty( $_REQUEST['orderby'] ) ) {
 121              $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
 122          }
 123  
 124          if ( ! empty( $_REQUEST['order'] ) ) {
 125              $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
 126          }
 127  
 128          $this->callback_args = $args;
 129  
 130          $this->set_pagination_args(
 131              array(
 132                  'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ),
 133                  'per_page'    => $tags_per_page,
 134              )
 135          );
 136      }
 137  
 138      /**
 139       * @return bool
 140       */
 141  	public function has_items() {
 142          // todo: populate $this->items in prepare_items()
 143          return true;
 144      }
 145  
 146      /**
 147       */
 148  	public function no_items() {
 149          echo get_taxonomy( $this->screen->taxonomy )->labels->not_found;
 150      }
 151  
 152      /**
 153       * @return array
 154       */
 155  	protected function get_bulk_actions() {
 156          $actions = array();
 157  
 158          if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) {
 159              $actions['delete'] = __( 'Delete' );
 160          }
 161  
 162          return $actions;
 163      }
 164  
 165      /**
 166       * @return string
 167       */
 168  	public function current_action() {
 169          if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) {
 170              return 'bulk-delete';
 171          }
 172  
 173          return parent::current_action();
 174      }
 175  
 176      /**
 177       * @return array
 178       */
 179  	public function get_columns() {
 180          $columns = array(
 181              'cb'          => '<input type="checkbox" />',
 182              'name'        => _x( 'Name', 'term name' ),
 183              'description' => __( 'Description' ),
 184              'slug'        => __( 'Slug' ),
 185          );
 186  
 187          if ( 'link_category' === $this->screen->taxonomy ) {
 188              $columns['links'] = __( 'Links' );
 189          } else {
 190              $columns['posts'] = _x( 'Count', 'Number/count of items' );
 191          }
 192  
 193          return $columns;
 194      }
 195  
 196      /**
 197       * @return array
 198       */
 199  	protected function get_sortable_columns() {
 200          return array(
 201              'name'        => 'name',
 202              'description' => 'description',
 203              'slug'        => 'slug',
 204              'posts'       => 'count',
 205              'links'       => 'count',
 206          );
 207      }
 208  
 209      /**
 210       */
 211  	public function display_rows_or_placeholder() {
 212          $taxonomy = $this->screen->taxonomy;
 213  
 214          $args = wp_parse_args(
 215              $this->callback_args,
 216              array(
 217                  'taxonomy'   => $taxonomy,
 218                  'page'       => 1,
 219                  'number'     => 20,
 220                  'search'     => '',
 221                  'hide_empty' => 0,
 222              )
 223          );
 224  
 225          $page = $args['page'];
 226  
 227          // Set variable because $args['number'] can be subsequently overridden.
 228          $number = $args['number'];
 229  
 230          $offset         = ( $page - 1 ) * $number;
 231          $args['offset'] = $offset;
 232  
 233          // Convert it to table rows.
 234          $count = 0;
 235  
 236          if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
 237              // We'll need the full set of terms then.
 238              $args['number'] = 0;
 239              $args['offset'] = $args['number'];
 240          }
 241  
 242          $terms = get_terms( $args );
 243  
 244          if ( empty( $terms ) || ! is_array( $terms ) ) {
 245              echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
 246              $this->no_items();
 247              echo '</td></tr>';
 248              return;
 249          }
 250  
 251          if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
 252              if ( ! empty( $args['search'] ) ) {// Ignore children on searches.
 253                  $children = array();
 254              } else {
 255                  $children = _get_term_hierarchy( $taxonomy );
 256              }
 257              // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake
 258              $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
 259          } else {
 260              foreach ( $terms as $term ) {
 261                  $this->single_row( $term );
 262              }
 263          }
 264      }
 265  
 266      /**
 267       * @param string $taxonomy
 268       * @param array $terms
 269       * @param array $children
 270       * @param int   $start
 271       * @param int   $per_page
 272       * @param int   $count
 273       * @param int   $parent
 274       * @param int   $level
 275       */
 276  	private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {
 277  
 278          $end = $start + $per_page;
 279  
 280          foreach ( $terms as $key => $term ) {
 281  
 282              if ( $count >= $end ) {
 283                  break;
 284              }
 285  
 286              if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) {
 287                  continue;
 288              }
 289  
 290              // If the page starts in a subtree, print the parents.
 291              if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
 292                  $my_parents = array();
 293                  $parent_ids = array();
 294                  $p          = $term->parent;
 295                  while ( $p ) {
 296                      $my_parent    = get_term( $p, $taxonomy );
 297                      $my_parents[] = $my_parent;
 298                      $p            = $my_parent->parent;
 299                      if ( in_array( $p, $parent_ids ) ) { // Prevent parent loops.
 300                          break;
 301                      }
 302                      $parent_ids[] = $p;
 303                  }
 304                  unset( $parent_ids );
 305  
 306                  $num_parents = count( $my_parents );
 307                  while ( $my_parent = array_pop( $my_parents ) ) {
 308                      echo "\t";
 309                      $this->single_row( $my_parent, $level - $num_parents );
 310                      $num_parents--;
 311                  }
 312              }
 313  
 314              if ( $count >= $start ) {
 315                  echo "\t";
 316                  $this->single_row( $term, $level );
 317              }
 318  
 319              ++$count;
 320  
 321              unset( $terms[ $key ] );
 322  
 323              if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) {
 324                  $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 );
 325              }
 326          }
 327      }
 328  
 329      /**
 330       * @global string $taxonomy
 331       * @param WP_Term $tag Term object.
 332       * @param int $level
 333       */
 334  	public function single_row( $tag, $level = 0 ) {
 335          global $taxonomy;
 336          $tag = sanitize_term( $tag, $taxonomy );
 337  
 338          $this->level = $level;
 339  
 340          if ( $tag->parent ) {
 341              $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
 342              $level = 'level-' . $count;
 343          } else {
 344              $level = 'level-0';
 345          }
 346  
 347          echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">';
 348          $this->single_row_columns( $tag );
 349          echo '</tr>';
 350      }
 351  
 352      /**
 353       * @param WP_Term $tag Term object.
 354       * @return string
 355       */
 356  	public function column_cb( $tag ) {
 357          if ( current_user_can( 'delete_term', $tag->term_id ) ) {
 358              return sprintf(
 359                  '<label class="screen-reader-text" for="cb-select-%1$s">%2$s</label>' .
 360                  '<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />',
 361                  $tag->term_id,
 362                  /* translators: %s: Taxonomy term name. */
 363                  sprintf( __( 'Select %s' ), $tag->name )
 364              );
 365          }
 366  
 367          return '&nbsp;';
 368      }
 369  
 370      /**
 371       * @param WP_Term $tag Term object.
 372       * @return string
 373       */
 374  	public function column_name( $tag ) {
 375          $taxonomy = $this->screen->taxonomy;
 376  
 377          $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
 378  
 379          /**
 380           * Filters display of the term name in the terms list table.
 381           *
 382           * The default output may include padding due to the term's
 383           * current level in the term hierarchy.
 384           *
 385           * @since 2.5.0
 386           *
 387           * @see WP_Terms_List_Table::column_name()
 388           *
 389           * @param string $pad_tag_name The term name, padded if not top-level.
 390           * @param WP_Term $tag         Term object.
 391           */
 392          $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
 393  
 394          $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
 395  
 396          $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
 397  
 398          $edit_link = get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type );
 399  
 400          if ( $edit_link ) {
 401              $edit_link = add_query_arg(
 402                  'wp_http_referer',
 403                  urlencode( wp_unslash( $uri ) ),
 404                  $edit_link
 405              );
 406              $name      = sprintf(
 407                  '<a class="row-title" href="%s" aria-label="%s">%s</a>',
 408                  esc_url( $edit_link ),
 409                  /* translators: %s: Taxonomy term name. */
 410                  esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
 411                  $name
 412              );
 413          }
 414  
 415          $out = sprintf(
 416              '<strong>%s</strong><br />',
 417              $name
 418          );
 419  
 420          $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
 421          $out .= '<div class="name">' . $qe_data->name . '</div>';
 422  
 423          /** This filter is documented in wp-admin/edit-tag-form.php */
 424          $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>';
 425          $out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
 426  
 427          return $out;
 428      }
 429  
 430      /**
 431       * Gets the name of the default primary column.
 432       *
 433       * @since 4.3.0
 434       *
 435       * @return string Name of the default primary column, in this case, 'name'.
 436       */
 437  	protected function get_default_primary_column_name() {
 438          return 'name';
 439      }
 440  
 441      /**
 442       * Generates and displays row action links.
 443       *
 444       * @since 4.3.0
 445       *
 446       * @param WP_Term $tag         Tag being acted upon.
 447       * @param string  $column_name Current column name.
 448       * @param string  $primary     Primary column name.
 449       * @return string Row actions output for terms.
 450       */
 451  	protected function handle_row_actions( $tag, $column_name, $primary ) {
 452          if ( $primary !== $column_name ) {
 453              return '';
 454          }
 455  
 456          $taxonomy = $this->screen->taxonomy;
 457          $tax      = get_taxonomy( $taxonomy );
 458          $uri      = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
 459  
 460          $edit_link = add_query_arg(
 461              'wp_http_referer',
 462              urlencode( wp_unslash( $uri ) ),
 463              get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
 464          );
 465  
 466          $actions = array();
 467          if ( current_user_can( 'edit_term', $tag->term_id ) ) {
 468              $actions['edit'] = sprintf(
 469                  '<a href="%s" aria-label="%s">%s</a>',
 470                  esc_url( $edit_link ),
 471                  /* translators: %s: Taxonomy term name. */
 472                  esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
 473                  __( 'Edit' )
 474              );
 475              $actions['inline hide-if-no-js'] = sprintf(
 476                  '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
 477                  /* translators: %s: Taxonomy term name. */
 478                  esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
 479                  __( 'Quick&nbsp;Edit' )
 480              );
 481          }
 482          if ( current_user_can( 'delete_term', $tag->term_id ) ) {
 483              $actions['delete'] = sprintf(
 484                  '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>',
 485                  wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ),
 486                  /* translators: %s: Taxonomy term name. */
 487                  esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
 488                  __( 'Delete' )
 489              );
 490          }
 491          if ( is_taxonomy_viewable( $tax ) ) {
 492              $actions['view'] = sprintf(
 493                  '<a href="%s" aria-label="%s">%s</a>',
 494                  get_term_link( $tag ),
 495                  /* translators: %s: Taxonomy term name. */
 496                  esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
 497                  __( 'View' )
 498              );
 499          }
 500  
 501          /**
 502           * Filters the action links displayed for each term in the Tags list table.
 503           *
 504           * @since 2.8.0
 505           * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
 506           *
 507           * @param string[] $actions An array of action links to be displayed. Default
 508           *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 509           * @param WP_Term  $tag     Term object.
 510           */
 511          $actions = apply_filters( 'tag_row_actions', $actions, $tag );
 512  
 513          /**
 514           * Filters the action links displayed for each term in the terms list table.
 515           *
 516           * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 517           *
 518           * @since 3.0.0
 519           *
 520           * @param string[] $actions An array of action links to be displayed. Default
 521           *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 522           * @param WP_Term  $tag     Term object.
 523           */
 524          $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
 525  
 526          return $this->row_actions( $actions );
 527      }
 528  
 529      /**
 530       * @param WP_Term $tag Term object.
 531       * @return string
 532       */
 533  	public function column_description( $tag ) {
 534          if ( $tag->description ) {
 535              return $tag->description;
 536          } else {
 537              return '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . __( 'No description' ) . '</span>';
 538          }
 539      }
 540  
 541      /**
 542       * @param WP_Term $tag Term object.
 543       * @return string
 544       */
 545  	public function column_slug( $tag ) {
 546          /** This filter is documented in wp-admin/edit-tag-form.php */
 547          return apply_filters( 'editable_slug', $tag->slug, $tag );
 548      }
 549  
 550      /**
 551       * @param WP_Term $tag Term object.
 552       * @return string
 553       */
 554  	public function column_posts( $tag ) {
 555          $count = number_format_i18n( $tag->count );
 556  
 557          $tax = get_taxonomy( $this->screen->taxonomy );
 558  
 559          $ptype_object = get_post_type_object( $this->screen->post_type );
 560          if ( ! $ptype_object->show_ui ) {
 561              return $count;
 562          }
 563  
 564          if ( $tax->query_var ) {
 565              $args = array( $tax->query_var => $tag->slug );
 566          } else {
 567              $args = array(
 568                  'taxonomy' => $tax->name,
 569                  'term'     => $tag->slug,
 570              );
 571          }
 572  
 573          if ( 'post' != $this->screen->post_type ) {
 574              $args['post_type'] = $this->screen->post_type;
 575          }
 576  
 577          if ( 'attachment' === $this->screen->post_type ) {
 578              return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
 579          }
 580  
 581          return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
 582      }
 583  
 584      /**
 585       * @param WP_Term $tag Term object.
 586       * @return string
 587       */
 588  	public function column_links( $tag ) {
 589          $count = number_format_i18n( $tag->count );
 590          if ( $count ) {
 591              $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
 592          }
 593          return $count;
 594      }
 595  
 596      /**
 597       * @param WP_Term $tag Term object.
 598       * @param string $column_name
 599       * @return string
 600       */
 601  	public function column_default( $tag, $column_name ) {
 602          /**
 603           * Filters the displayed columns in the terms list table.
 604           *
 605           * The dynamic portion of the hook name, `$this->screen->taxonomy`,
 606           * refers to the slug of the current taxonomy.
 607           *
 608           * @since 2.8.0
 609           *
 610           * @param string $string      Blank string.
 611           * @param string $column_name Name of the column.
 612           * @param int    $term_id     Term ID.
 613           */
 614          return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
 615      }
 616  
 617      /**
 618       * Outputs the hidden row displayed when inline editing
 619       *
 620       * @since 3.1.0
 621       */
 622  	public function inline_edit() {
 623          $tax = get_taxonomy( $this->screen->taxonomy );
 624  
 625          if ( ! current_user_can( $tax->cap->edit_terms ) ) {
 626              return;
 627          }
 628          ?>
 629  
 630      <form method="get"><table style="display: none"><tbody id="inlineedit">
 631          <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
 632  
 633              <fieldset>
 634                  <legend class="inline-edit-legend"><?php _e( 'Quick Edit' ); ?></legend>
 635                  <div class="inline-edit-col">
 636                  <label>
 637                      <span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
 638                      <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
 639                  </label>
 640          <?php if ( ! global_terms_enabled() ) { ?>
 641                  <label>
 642                      <span class="title"><?php _e( 'Slug' ); ?></span>
 643                      <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
 644                  </label>
 645      <?php } ?>
 646              </div></fieldset>
 647          <?php
 648  
 649          $core_columns = array(
 650              'cb'          => true,
 651              'description' => true,
 652              'name'        => true,
 653              'slug'        => true,
 654              'posts'       => true,
 655          );
 656  
 657          list( $columns ) = $this->get_column_info();
 658  
 659          foreach ( $columns as $column_name => $column_display_name ) {
 660              if ( isset( $core_columns[ $column_name ] ) ) {
 661                  continue;
 662              }
 663  
 664              /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
 665              do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
 666          }
 667  
 668          ?>
 669  
 670          <div class="inline-edit-save submit">
 671              <button type="button" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></button>
 672              <button type="button" class="save button button-primary alignright"><?php echo $tax->labels->update_item; ?></button>
 673              <span class="spinner"></span>
 674              <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
 675              <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
 676              <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
 677              <br class="clear" />
 678              <div class="notice notice-error notice-alt inline hidden">
 679                  <p class="error"></p>
 680              </div>
 681          </div>
 682          </td></tr>
 683          </tbody></table></form>
 684          <?php
 685      }
 686  }


Generated: Sat Sep 21 01:00:03 2019 Cross-referenced by PHPXref 0.7.1