Making WordPress.org

Ticket #1079: 1079.2.diff

File 1079.2.diff, 1.9 KB (added by JasonM4563, 9 years ago)

Updated Patch

  • classes/tagregator.php

     
    114114                        add_action( 'init',                  array( $this, 'upgrade' ), 11 );
    115115                        add_action( 'wp_enqueue_scripts',    __CLASS__ . '::load_resources' );
    116116                        add_action( 'admin_enqueue_scripts', __CLASS__ . '::load_resources' );
     117                        add_filter ( 'wp_link_query_args',   array( $this, 'exclude_from_search_results' ) );
    117118                }
    118119
    119120                /**
     121                 * Filters CPTs from search results so it won't clutter up link insert list.
     122                 *
     123                 * @param WP_Query $query
     124                 *
     125                 * @return $query
     126                 */
     127                public static function exclude_from_search_results($query) {
     128                        foreach ( self::get_instance()->media_sources as $source ) {
     129                                $exclude_post_types[] = $source::POST_TYPE_SLUG;
     130                        }
     131
     132                        $query = array_diff($query['post_type'], $exclude_post_types);
     133                        return $query;
     134                }
     135
     136                /**
    120137                 * Initializes variables
    121138                 * @mvc Controller
    122139                 */
  • classes/tggr-media-source.php

     
    337337
    338338                        return $post_timestamp_local;
    339339                }
    340                
     340
    341341                /**
    342342                 * Retrieves the latest post mapped to a given hashtag
    343343                 * @mvc Model
    344                  * 
     344                 *
    345345                 * @param $hashtag
    346                  * @return object|false 
     346                 * @return object|false
    347347                 */
    348348                protected static function get_latest_hashtagged_post( $post_type, $hashtag ) {
    349349                        $latest_post = false;
     
    362362                                                ),
    363363                                        )
    364364                                ) );
    365                                
     365
    366366                                if ( isset( $latest_post[0]->ID ) ) {
    367367                                        $latest_post = $latest_post[0];
    368368                                }
    369369                        }
    370                        
     370
    371371                        return $latest_post;
    372372                }
    373373
     
    461461
    462462                        return $length > self::POST_CONTENT_LENGTH_DISPLAY_LIMIT;
    463463                }
     464
    464465        } // end TGGRModule
    465466}
     467 No newline at end of file