Code Duplication    Length = 26-29 lines in 2 locations

admin_pages/venues/Venues_Admin_Page.core.php 1 location

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

admin_pages/events/Events_Admin_Page.core.php 1 location

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