Code Duplication    Length = 26-29 lines in 2 locations

admin_pages/venues/Venues_Admin_Page.core.php 1 location

@@ 1416-1441 (lines=26) @@
1413
1414
1415
1416
	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1417
1418
		//testing term stuff
1419
		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1420
		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1421
		$limit = ($current_page-1)*$per_page;
1422
		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1423
		if ( isset( $this->_req_data['s'] ) ) {
1424
			$sstr = '%' . $this->_req_data['s'] . '%';
1425
			$where['OR'] = array(
1426
				'Term.name' => array( 'LIKE', $sstr),
1427
				'description' => array( 'LIKE', $sstr )
1428
				);
1429
		}
1430
1431
		$query_params = array(
1432
			$where,
1433
			'order_by' => array( $orderby => $order ),
1434
			'limit' => $limit . ',' . $per_page,
1435
			'force_join' => array('Term')
1436
			);
1437
1438
		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1439
1440
		return $categories;
1441
	}
1442
1443
1444
	/* end category stuff */

admin_pages/events/Events_Admin_Page.core.php 1 location

@@ 2276-2304 (lines=29) @@
2273
2274
2275
2276
	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2277
		global $wpdb;
2278
2279
		//testing term stuff
2280
		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2282
		$limit = ($current_page-1)*$per_page;
2283
2284
		$where = array( 'taxonomy' => 'espresso_event_categories' );
2285
2286
		if ( isset( $this->_req_data['s'] ) ) {
2287
			$sstr = '%' . $this->_req_data['s'] . '%';
2288
			$where['OR'] = array(
2289
				'Term.name' => array( 'LIKE', $sstr),
2290
				'description' => array( 'LIKE', $sstr )
2291
				);
2292
		}
2293
2294
		$query_params = array(
2295
			$where ,
2296
			'order_by' => array( $orderby => $order ),
2297
			'limit' => $limit . ',' . $per_page,
2298
			'force_join' => array('Term')
2299
			);
2300
2301
		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2302
2303
		return $categories;
2304
	}
2305
2306
2307