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

@@ 2324-2352 (lines=29) @@
2321
2322
2323
2324
	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2325
		global $wpdb;
2326
2327
		//testing term stuff
2328
		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2329
		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2330
		$limit = ($current_page-1)*$per_page;
2331
2332
		$where = array( 'taxonomy' => 'espresso_event_categories' );
2333
2334
		if ( isset( $this->_req_data['s'] ) ) {
2335
			$sstr = '%' . $this->_req_data['s'] . '%';
2336
			$where['OR'] = array(
2337
				'Term.name' => array( 'LIKE', $sstr),
2338
				'description' => array( 'LIKE', $sstr )
2339
				);
2340
		}
2341
2342
		$query_params = array(
2343
			$where ,
2344
			'order_by' => array( $orderby => $order ),
2345
			'limit' => $limit . ',' . $per_page,
2346
			'force_join' => array('Term')
2347
			);
2348
2349
		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2350
2351
		return $categories;
2352
	}
2353
2354
2355