Completed
Push — master ( e1139d...01ce3b )
by Mike
02:22
created

Plugin::set_definitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace testContent;
3
4
/**
5
 * Class to load hooks and set/get base plugin definitions.
6
 *
7
 * @package    WordPress
8
 * @subpackage Evans
9
 * @author     Old Town Media
10
 */
11
class Plugin{
12
13
	/**
14
	 * Plugin definitions.
15
	 *
16
	 * @var object
17
	 */
18
	protected $definitions;
19
20
21
	/**
22
	 * Retrieve the plugin definitions from the main plugin directory.
23
	 *
24
	 * @return object Defitions
25
	 */
26
	public function get_definitions() {
27
		return $this->definitions;
28
	}
29
30
31
	/**
32
	 * Set the plugin definitions.
33
	 *
34
	 * @param  object $definitions Information about the plugin
35
	 * @return object $this
36
	 */
37
	public function set_definitions( $definitions ) {
38
39
		$this->definitions = $definitions;
40
		return $this;
41
42
	}
43
44
45
	/**
46
	 * Register hook function.
47
	 *
48
	 * @param  object $provider Hook provider.
49
	 * @return object $this
50
	 */
51
	public function register_hooks( $provider ) {
52
53
		if ( method_exists( $provider, 'set_plugin' ) ) {
54
			$provider->set_plugin( $this );
55
		}
56
57
		$provider->hooks();
58
		return $this;
59
60
	}
61
62
	/**
63
	 * Load the textdomain for this plugin if translation is available
64
	 *
65
	 * @see load_plugin_textdomain
66
	 */
67
	public function load_textdomain() {
68
	    load_plugin_textdomain( 'otm-test-content', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' );
69
	}
70
71
}
72