| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin functions for post types |
| 4 |
* |
| 5 |
* @author PropertyHive |
| 6 |
* @category Admin |
| 7 |
* @package PropertyHive/Admin/Post Types |
| 8 |
* @version 1.0.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 12 |
|
| 13 |
if ( ! class_exists( 'PH_Admin_CPT' ) ) : |
| 14 |
|
| 15 |
/** |
| 16 |
* PH_Admin_CPT Class |
| 17 |
*/ |
| 18 |
class PH_Admin_CPT { |
| 19 |
|
| 20 |
protected $type = ''; |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor |
| 24 |
*/ |
| 25 |
public function __construct() { |
| 26 |
// Insert into X media browser |
| 27 |
add_filter( 'media_view_strings', array( $this, 'change_insert_into_post' ) ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Change label for insert buttons. |
| 32 |
* @access public |
| 33 |
* @param array $strings |
| 34 |
* @return array |
| 35 |
*/ |
| 36 |
function change_insert_into_post( $strings ) { |
| 37 |
global $post_type; |
| 38 |
|
| 39 |
if ( $post_type == $this->type ) { |
| 40 |
$obj = get_post_type_object( $this->type ); |
| 41 |
|
| 42 |
$strings['insertIntoPost'] = sprintf( |
| 43 |
/* translators: %s: singular post type label */ |
| 44 |
__( 'Insert into %s', 'propertyhive' ), |
| 45 |
$obj->labels->singular_name |
| 46 |
); |
| 47 |
|
| 48 |
$strings['uploadedToThisPost'] = sprintf( |
| 49 |
/* translators: %s: singular post type label */ |
| 50 |
__( 'Uploaded to this %s', 'propertyhive' ), |
| 51 |
$obj->labels->singular_name |
| 52 |
); |
| 53 |
} |
| 54 |
|
| 55 |
return $strings; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
endif; |