@@ -22,15 +22,15 @@ |
||
22 | 22 | */ |
23 | 23 | class Wordlift_Activator { |
24 | 24 | |
25 | - /** |
|
26 | - * Short Description. (use period) |
|
27 | - * |
|
28 | - * Long Description. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public static function activate() { |
|
25 | + /** |
|
26 | + * Short Description. (use period) |
|
27 | + * |
|
28 | + * Long Description. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public static function activate() { |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |
@@ -22,15 +22,15 @@ |
||
22 | 22 | */ |
23 | 23 | class Wordlift_Deactivator { |
24 | 24 | |
25 | - /** |
|
26 | - * Short Description. (use period) |
|
27 | - * |
|
28 | - * Long Description. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - public static function deactivate() { |
|
25 | + /** |
|
26 | + * Short Description. (use period) |
|
27 | + * |
|
28 | + * Long Description. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + public static function deactivate() { |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |
@@ -7,6 +7,6 @@ |
||
7 | 7 | */ |
8 | 8 | class Wordlift_Entity_Types_Taxonomy_Service { |
9 | 9 | |
10 | - const TAXONOMY_NAME = 'wl_entity_type'; |
|
10 | + const TAXONOMY_NAME = 'wl_entity_type'; |
|
11 | 11 | |
12 | 12 | } |
@@ -26,38 +26,38 @@ |
||
26 | 26 | */ |
27 | 27 | class Wordlift_i18n { |
28 | 28 | |
29 | - /** |
|
30 | - * The domain specified for this plugin. |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - * @access private |
|
34 | - * @var string $domain The domain identifier for this plugin. |
|
35 | - */ |
|
36 | - private $domain; |
|
37 | - |
|
38 | - /** |
|
39 | - * Load the plugin text domain for translation. |
|
40 | - * |
|
41 | - * @since 1.0.0 |
|
42 | - */ |
|
43 | - public function load_plugin_textdomain() { |
|
44 | - |
|
45 | - load_plugin_textdomain( |
|
46 | - $this->domain, |
|
47 | - false, |
|
48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
49 | - ); |
|
50 | - |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Set the domain equal to that of the specified domain. |
|
55 | - * |
|
56 | - * @since 1.0.0 |
|
57 | - * @param string $domain The domain that represents the locale of this plugin. |
|
58 | - */ |
|
59 | - public function set_domain( $domain ) { |
|
60 | - $this->domain = $domain; |
|
61 | - } |
|
29 | + /** |
|
30 | + * The domain specified for this plugin. |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + * @access private |
|
34 | + * @var string $domain The domain identifier for this plugin. |
|
35 | + */ |
|
36 | + private $domain; |
|
37 | + |
|
38 | + /** |
|
39 | + * Load the plugin text domain for translation. |
|
40 | + * |
|
41 | + * @since 1.0.0 |
|
42 | + */ |
|
43 | + public function load_plugin_textdomain() { |
|
44 | + |
|
45 | + load_plugin_textdomain( |
|
46 | + $this->domain, |
|
47 | + false, |
|
48 | + dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
49 | + ); |
|
50 | + |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Set the domain equal to that of the specified domain. |
|
55 | + * |
|
56 | + * @since 1.0.0 |
|
57 | + * @param string $domain The domain that represents the locale of this plugin. |
|
58 | + */ |
|
59 | + public function set_domain( $domain ) { |
|
60 | + $this->domain = $domain; |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | load_plugin_textdomain( |
46 | 46 | $this->domain, |
47 | 47 | false, |
48 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
48 | + dirname(dirname(plugin_basename(__FILE__))).'/languages/' |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | * @param string $domain The domain that represents the locale of this plugin. |
58 | 58 | */ |
59 | - public function set_domain( $domain ) { |
|
59 | + public function set_domain($domain) { |
|
60 | 60 | $this->domain = $domain; |
61 | 61 | } |
62 | 62 |
@@ -23,107 +23,107 @@ |
||
23 | 23 | */ |
24 | 24 | class Wordlift_Loader { |
25 | 25 | |
26 | - /** |
|
27 | - * The array of actions registered with WordPress. |
|
28 | - * |
|
29 | - * @since 1.0.0 |
|
30 | - * @access protected |
|
31 | - * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
32 | - */ |
|
33 | - protected $actions; |
|
34 | - |
|
35 | - /** |
|
36 | - * The array of filters registered with WordPress. |
|
37 | - * |
|
38 | - * @since 1.0.0 |
|
39 | - * @access protected |
|
40 | - * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
41 | - */ |
|
42 | - protected $filters; |
|
43 | - |
|
44 | - /** |
|
45 | - * Initialize the collections used to maintain the actions and filters. |
|
46 | - * |
|
47 | - * @since 1.0.0 |
|
48 | - */ |
|
49 | - public function __construct() { |
|
50 | - |
|
51 | - $this->actions = array(); |
|
52 | - $this->filters = array(); |
|
53 | - |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * Add a new action to the collection to be registered with WordPress. |
|
58 | - * |
|
59 | - * @since 1.0.0 |
|
60 | - * @param string $hook The name of the WordPress action that is being registered. |
|
61 | - * @param object $component A reference to the instance of the object on which the action is defined. |
|
62 | - * @param string $callback The name of the function definition on the $component. |
|
63 | - * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
64 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
65 | - */ |
|
66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Add a new filter to the collection to be registered with WordPress. |
|
72 | - * |
|
73 | - * @since 1.0.0 |
|
74 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
75 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
76 | - * @param string $callback The name of the function definition on the $component. |
|
77 | - * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
78 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
|
79 | - */ |
|
80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * A utility function that is used to register the actions and hooks into a single |
|
86 | - * collection. |
|
87 | - * |
|
88 | - * @since 1.0.0 |
|
89 | - * @access private |
|
90 | - * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
91 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
92 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
93 | - * @param string $callback The name of the function definition on the $component. |
|
94 | - * @param int $priority The priority at which the function should be fired. |
|
95 | - * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
96 | - * @return array The collection of actions and filters registered with WordPress. |
|
97 | - */ |
|
98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
99 | - |
|
100 | - $hooks[] = array( |
|
101 | - 'hook' => $hook, |
|
102 | - 'component' => $component, |
|
103 | - 'callback' => $callback, |
|
104 | - 'priority' => $priority, |
|
105 | - 'accepted_args' => $accepted_args |
|
106 | - ); |
|
107 | - |
|
108 | - return $hooks; |
|
109 | - |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Register the filters and actions with WordPress. |
|
114 | - * |
|
115 | - * @since 1.0.0 |
|
116 | - */ |
|
117 | - public function run() { |
|
118 | - |
|
119 | - foreach ( $this->filters as $hook ) { |
|
120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
121 | - } |
|
122 | - |
|
123 | - foreach ( $this->actions as $hook ) { |
|
124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
125 | - } |
|
126 | - |
|
127 | - } |
|
26 | + /** |
|
27 | + * The array of actions registered with WordPress. |
|
28 | + * |
|
29 | + * @since 1.0.0 |
|
30 | + * @access protected |
|
31 | + * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
32 | + */ |
|
33 | + protected $actions; |
|
34 | + |
|
35 | + /** |
|
36 | + * The array of filters registered with WordPress. |
|
37 | + * |
|
38 | + * @since 1.0.0 |
|
39 | + * @access protected |
|
40 | + * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
41 | + */ |
|
42 | + protected $filters; |
|
43 | + |
|
44 | + /** |
|
45 | + * Initialize the collections used to maintain the actions and filters. |
|
46 | + * |
|
47 | + * @since 1.0.0 |
|
48 | + */ |
|
49 | + public function __construct() { |
|
50 | + |
|
51 | + $this->actions = array(); |
|
52 | + $this->filters = array(); |
|
53 | + |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * Add a new action to the collection to be registered with WordPress. |
|
58 | + * |
|
59 | + * @since 1.0.0 |
|
60 | + * @param string $hook The name of the WordPress action that is being registered. |
|
61 | + * @param object $component A reference to the instance of the object on which the action is defined. |
|
62 | + * @param string $callback The name of the function definition on the $component. |
|
63 | + * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
64 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
65 | + */ |
|
66 | + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
67 | + $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Add a new filter to the collection to be registered with WordPress. |
|
72 | + * |
|
73 | + * @since 1.0.0 |
|
74 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
75 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
76 | + * @param string $callback The name of the function definition on the $component. |
|
77 | + * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
|
78 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
|
79 | + */ |
|
80 | + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
81 | + $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * A utility function that is used to register the actions and hooks into a single |
|
86 | + * collection. |
|
87 | + * |
|
88 | + * @since 1.0.0 |
|
89 | + * @access private |
|
90 | + * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
91 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
92 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
93 | + * @param string $callback The name of the function definition on the $component. |
|
94 | + * @param int $priority The priority at which the function should be fired. |
|
95 | + * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
96 | + * @return array The collection of actions and filters registered with WordPress. |
|
97 | + */ |
|
98 | + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
99 | + |
|
100 | + $hooks[] = array( |
|
101 | + 'hook' => $hook, |
|
102 | + 'component' => $component, |
|
103 | + 'callback' => $callback, |
|
104 | + 'priority' => $priority, |
|
105 | + 'accepted_args' => $accepted_args |
|
106 | + ); |
|
107 | + |
|
108 | + return $hooks; |
|
109 | + |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Register the filters and actions with WordPress. |
|
114 | + * |
|
115 | + * @since 1.0.0 |
|
116 | + */ |
|
117 | + public function run() { |
|
118 | + |
|
119 | + foreach ( $this->filters as $hook ) { |
|
120 | + add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
121 | + } |
|
122 | + |
|
123 | + foreach ( $this->actions as $hook ) { |
|
124 | + add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
125 | + } |
|
126 | + |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
64 | 64 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
65 | 65 | */ |
66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
66 | + public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
67 | + $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @param int $priority Optional. he priority at which the function should be fired. Default is 10. |
78 | 78 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
79 | 79 | */ |
80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
80 | + public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
81 | + $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param int $accepted_args The number of arguments that should be passed to the $callback. |
96 | 96 | * @return array The collection of actions and filters registered with WordPress. |
97 | 97 | */ |
98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
98 | + private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { |
|
99 | 99 | |
100 | 100 | $hooks[] = array( |
101 | 101 | 'hook' => $hook, |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function run() { |
118 | 118 | |
119 | - foreach ( $this->filters as $hook ) { |
|
120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
119 | + foreach ($this->filters as $hook) { |
|
120 | + add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
121 | 121 | } |
122 | 122 | |
123 | - foreach ( $this->actions as $hook ) { |
|
124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
123 | + foreach ($this->actions as $hook) { |
|
124 | + add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | } |
@@ -7,89 +7,89 @@ |
||
7 | 7 | */ |
8 | 8 | class Wordlift_Log_Service { |
9 | 9 | |
10 | - const MESSAGE_TEMPLATE = '%-6s [%-40.40s] %s'; |
|
10 | + const MESSAGE_TEMPLATE = '%-6s [%-40.40s] %s'; |
|
11 | 11 | |
12 | - const ERROR = 'ERROR'; |
|
13 | - const WARN = 'WARN'; |
|
14 | - const INFO = 'INFO'; |
|
15 | - const DEBUG = 'DEBUG'; |
|
16 | - const TRACE = 'TRACE'; |
|
12 | + const ERROR = 'ERROR'; |
|
13 | + const WARN = 'WARN'; |
|
14 | + const INFO = 'INFO'; |
|
15 | + const DEBUG = 'DEBUG'; |
|
16 | + const TRACE = 'TRACE'; |
|
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * The class related to the logs. |
|
21 | - * |
|
22 | - * @since 1.0.0 |
|
23 | - * @access private |
|
24 | - * @var string $class_name The class related to the logs. |
|
25 | - */ |
|
26 | - private $class_name; |
|
19 | + /** |
|
20 | + * The class related to the logs. |
|
21 | + * |
|
22 | + * @since 1.0.0 |
|
23 | + * @access private |
|
24 | + * @var string $class_name The class related to the logs. |
|
25 | + */ |
|
26 | + private $class_name; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Create an instance of the Log service. |
|
30 | - * @since 1.0.0 |
|
31 | - * |
|
32 | - * @param string $class_name The class related to the logs. |
|
33 | - */ |
|
34 | - public function __construct( $class_name ) { |
|
28 | + /** |
|
29 | + * Create an instance of the Log service. |
|
30 | + * @since 1.0.0 |
|
31 | + * |
|
32 | + * @param string $class_name The class related to the logs. |
|
33 | + */ |
|
34 | + public function __construct( $class_name ) { |
|
35 | 35 | |
36 | - $this->class_name = $class_name; |
|
36 | + $this->class_name = $class_name; |
|
37 | 37 | |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | - public static function get_logger( $class_name ) { |
|
40 | + public static function get_logger( $class_name ) { |
|
41 | 41 | |
42 | - return new Wordlift_Log_Service( $class_name ); |
|
42 | + return new Wordlift_Log_Service( $class_name ); |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Log a message. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * |
|
51 | - * @param string $level The log level. |
|
52 | - * @param string $message The message to log. |
|
53 | - */ |
|
54 | - public function log( $level, $message ) { |
|
46 | + /** |
|
47 | + * Log a message. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * |
|
51 | + * @param string $level The log level. |
|
52 | + * @param string $message The message to log. |
|
53 | + */ |
|
54 | + public function log( $level, $message ) { |
|
55 | 55 | |
56 | - // If we're tracing or debugging, but the debug flag isn't set, then we don't log. |
|
57 | - if ( ( self::TRACE === $level || self::DEBUG === $level ) && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) ) { |
|
58 | - return; |
|
59 | - } |
|
56 | + // If we're tracing or debugging, but the debug flag isn't set, then we don't log. |
|
57 | + if ( ( self::TRACE === $level || self::DEBUG === $level ) && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) ) { |
|
58 | + return; |
|
59 | + } |
|
60 | 60 | |
61 | - error_log( sprintf( self::MESSAGE_TEMPLATE, $level, $this->class_name, $message ) ); |
|
61 | + error_log( sprintf( self::MESSAGE_TEMPLATE, $level, $this->class_name, $message ) ); |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - public function error( $message ) { |
|
65 | + public function error( $message ) { |
|
66 | 66 | |
67 | - $this->log( self::ERROR, $message ); |
|
67 | + $this->log( self::ERROR, $message ); |
|
68 | 68 | |
69 | - } |
|
69 | + } |
|
70 | 70 | |
71 | - public function warn( $message ) { |
|
71 | + public function warn( $message ) { |
|
72 | 72 | |
73 | - $this->log( self::WARN, $message ); |
|
73 | + $this->log( self::WARN, $message ); |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - public function info( $message ) { |
|
77 | + public function info( $message ) { |
|
78 | 78 | |
79 | - $this->log( self::INFO, $message ); |
|
79 | + $this->log( self::INFO, $message ); |
|
80 | 80 | |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - public function debug( $message ) { |
|
83 | + public function debug( $message ) { |
|
84 | 84 | |
85 | - $this->log( self::DEBUG, $message ); |
|
85 | + $this->log( self::DEBUG, $message ); |
|
86 | 86 | |
87 | - } |
|
87 | + } |
|
88 | 88 | |
89 | - public function trace( $message ) { |
|
89 | + public function trace( $message ) { |
|
90 | 90 | |
91 | - $this->log( self::TRACE, $message ); |
|
91 | + $this->log( self::TRACE, $message ); |
|
92 | 92 | |
93 | - } |
|
93 | + } |
|
94 | 94 | |
95 | 95 | } |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param string $class_name The class related to the logs. |
33 | 33 | */ |
34 | - public function __construct( $class_name ) { |
|
34 | + public function __construct($class_name) { |
|
35 | 35 | |
36 | 36 | $this->class_name = $class_name; |
37 | 37 | |
38 | 38 | } |
39 | 39 | |
40 | - public static function get_logger( $class_name ) { |
|
40 | + public static function get_logger($class_name) { |
|
41 | 41 | |
42 | - return new Wordlift_Log_Service( $class_name ); |
|
42 | + return new Wordlift_Log_Service($class_name); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 | |
@@ -51,44 +51,44 @@ discard block |
||
51 | 51 | * @param string $level The log level. |
52 | 52 | * @param string $message The message to log. |
53 | 53 | */ |
54 | - public function log( $level, $message ) { |
|
54 | + public function log($level, $message) { |
|
55 | 55 | |
56 | 56 | // If we're tracing or debugging, but the debug flag isn't set, then we don't log. |
57 | - if ( ( self::TRACE === $level || self::DEBUG === $level ) && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) ) { |
|
57 | + if ((self::TRACE === $level || self::DEBUG === $level) && ( ! defined('WP_DEBUG') || ! WP_DEBUG)) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - error_log( sprintf( self::MESSAGE_TEMPLATE, $level, $this->class_name, $message ) ); |
|
61 | + error_log(sprintf(self::MESSAGE_TEMPLATE, $level, $this->class_name, $message)); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
65 | - public function error( $message ) { |
|
65 | + public function error($message) { |
|
66 | 66 | |
67 | - $this->log( self::ERROR, $message ); |
|
67 | + $this->log(self::ERROR, $message); |
|
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | - public function warn( $message ) { |
|
71 | + public function warn($message) { |
|
72 | 72 | |
73 | - $this->log( self::WARN, $message ); |
|
73 | + $this->log(self::WARN, $message); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | - public function info( $message ) { |
|
77 | + public function info($message) { |
|
78 | 78 | |
79 | - $this->log( self::INFO, $message ); |
|
79 | + $this->log(self::INFO, $message); |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | - public function debug( $message ) { |
|
83 | + public function debug($message) { |
|
84 | 84 | |
85 | - $this->log( self::DEBUG, $message ); |
|
85 | + $this->log(self::DEBUG, $message); |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
89 | - public function trace( $message ) { |
|
89 | + public function trace($message) { |
|
90 | 90 | |
91 | - $this->log( self::TRACE, $message ); |
|
91 | + $this->log(self::TRACE, $message); |
|
92 | 92 | |
93 | 93 | } |
94 | 94 |
@@ -28,8 +28,8 @@ |
||
28 | 28 | */ |
29 | 29 | function wl_caching_remote_request( $url, $args, $refresh = false, $expires_in_seconds = 3600 ) { |
30 | 30 | |
31 | - // Merge the default settings for remote queries. |
|
32 | - $args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), $args ); |
|
31 | + // Merge the default settings for remote queries. |
|
32 | + $args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), $args ); |
|
33 | 33 | |
34 | 34 | // echo $url . "\n"; |
35 | 35 | // print_r( $args ); |
@@ -26,28 +26,28 @@ discard block |
||
26 | 26 | * @param int $expires_in_seconds How many seconds the cache is valid. |
27 | 27 | * @return array The remote response. |
28 | 28 | */ |
29 | -function wl_caching_remote_request( $url, $args, $refresh = false, $expires_in_seconds = 3600 ) { |
|
29 | +function wl_caching_remote_request($url, $args, $refresh = false, $expires_in_seconds = 3600) { |
|
30 | 30 | |
31 | 31 | // Merge the default settings for remote queries. |
32 | - $args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), $args ); |
|
32 | + $args = array_merge_recursive(unserialize(WL_REDLINK_API_HTTP_OPTIONS), $args); |
|
33 | 33 | |
34 | 34 | // echo $url . "\n"; |
35 | 35 | // print_r( $args ); |
36 | 36 | |
37 | 37 | // Create an hash of the request. |
38 | - $hash = wl_caching_hash( $url, $args ); |
|
38 | + $hash = wl_caching_hash($url, $args); |
|
39 | 39 | |
40 | 40 | // If the document is cached, return the cached copy. |
41 | - if ( ! $refresh && false !== ( $response = wl_caching_get( $hash ) ) ) { |
|
41 | + if ( ! $refresh && false !== ($response = wl_caching_get($hash))) { |
|
42 | 42 | return $response; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Make the request, put the response in the cache and return it to the client. |
46 | - $response = wp_remote_request( $url, $args ); |
|
46 | + $response = wp_remote_request($url, $args); |
|
47 | 47 | |
48 | 48 | // Cache only valid responses. |
49 | - if ( ! is_wp_error( $response ) && 200 === (int)$response['response']['code'] ) { |
|
50 | - wl_caching_put( $hash, $response, $expires_in_seconds ); |
|
49 | + if ( ! is_wp_error($response) && 200 === (int) $response['response']['code']) { |
|
50 | + wl_caching_put($hash, $response, $expires_in_seconds); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $response; |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param string $args The request parameters. |
64 | 64 | * @return string The hash. |
65 | 65 | */ |
66 | -function wl_caching_hash( $url, $args ) { |
|
66 | +function wl_caching_hash($url, $args) { |
|
67 | 67 | |
68 | - return hash( 'md5', $url ) . '-' . hash( 'md5', serialize( $args ) ); |
|
68 | + return hash('md5', $url).'-'.hash('md5', serialize($args)); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @param string $hash The hash. |
82 | 82 | * @return string|false The cache filename or false if not found. |
83 | 83 | */ |
84 | -function wl_caching_get_filename( $hash ) { |
|
84 | +function wl_caching_get_filename($hash) { |
|
85 | 85 | |
86 | - $files = glob( wl_caching_get_temp_path( $hash ) . '_*' ); |
|
87 | - if ( ! is_array( $files ) || 0 === sizeof( $files ) ) { |
|
86 | + $files = glob(wl_caching_get_temp_path($hash).'_*'); |
|
87 | + if ( ! is_array($files) || 0 === sizeof($files)) { |
|
88 | 88 | return false; |
89 | 89 | } |
90 | 90 | |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | |
94 | 94 | // Return false if the filename doesn't conform. |
95 | 95 | $matches = array(); |
96 | - if ( 1 !== preg_match( '/_(\d+)$/', $filename, $matches ) ) { |
|
96 | + if (1 !== preg_match('/_(\d+)$/', $filename, $matches)) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | 99 | |
100 | 100 | // echo 'time: ' . time() . ' > expires at: ' . (int)$matches[1] . "\n"; |
101 | 101 | |
102 | 102 | // Delete the file and return false if it's expired. |
103 | - if ( time() >= (int)$matches[1] ) { |
|
104 | - wl_caching_delete_file( $filename ); |
|
103 | + if (time() >= (int) $matches[1]) { |
|
104 | + wl_caching_delete_file($filename); |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - wl_write_log( "[ wl_caching ] Found a cached response [ filename :: $filename ]" ); |
|
108 | + wl_write_log("[ wl_caching ] Found a cached response [ filename :: $filename ]"); |
|
109 | 109 | |
110 | 110 | return $filename; |
111 | 111 | |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | * @param string $hash The document hash |
124 | 124 | * @return array|false The cached response or false if the document is not found in the cache. |
125 | 125 | */ |
126 | -function wl_caching_get( $hash ) { |
|
126 | +function wl_caching_get($hash) { |
|
127 | 127 | |
128 | - if ( false !== ( $filename = wl_caching_get_filename( $hash ) ) ) { |
|
129 | - return json_decode( file_get_contents( $filename ), true ); |
|
128 | + if (false !== ($filename = wl_caching_get_filename($hash))) { |
|
129 | + return json_decode(file_get_contents($filename), true); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return false; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param array $response The response. |
144 | 144 | * @param int $expires_in_seconds How many seconds the cache is valid. |
145 | 145 | */ |
146 | -function wl_caching_put( $hash, $response, $expires_in_seconds = 3600 ) { |
|
146 | +function wl_caching_put($hash, $response, $expires_in_seconds = 3600) { |
|
147 | 147 | |
148 | 148 | // Add the cached flag. |
149 | 149 | $now = time(); |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | |
156 | 156 | // According to http://stackoverflow.com/questions/804045/preferred-method-to-store-php-arrays-json-encode-vs-serialize |
157 | 157 | // the fastest serialization/deserialization function is json_encode/json_decode |
158 | - $filename = wl_caching_get_temp_path( $hash ) . '_' . $expires_at; |
|
159 | - $pathname = dirname( $filename ); |
|
158 | + $filename = wl_caching_get_temp_path($hash).'_'.$expires_at; |
|
159 | + $pathname = dirname($filename); |
|
160 | 160 | |
161 | - if ( ! file_exists( dirname( $pathname ) ) ) { |
|
161 | + if ( ! file_exists(dirname($pathname))) { |
|
162 | 162 | mkdir($pathname, 0777, true); |
163 | 163 | } |
164 | 164 | |
165 | - file_put_contents( $filename, json_encode( $response ) ); |
|
165 | + file_put_contents($filename, json_encode($response)); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | function wl_caching_get_cache_folder() { |
178 | 178 | |
179 | 179 | $temp_dir = sys_get_temp_dir(); |
180 | - $temp_dir .= ( '/' === substr( $temp_dir, -1, 1 ) ? '' : '/' ); // add a trailing slash |
|
181 | - return $temp_dir . 'wordlift.tmp/cache/'; |
|
180 | + $temp_dir .= ('/' === substr($temp_dir, -1, 1) ? '' : '/'); // add a trailing slash |
|
181 | + return $temp_dir.'wordlift.tmp/cache/'; |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * @param string $hash The hash. |
194 | 194 | * @return string The full path to the file. |
195 | 195 | */ |
196 | -function wl_caching_get_temp_path( $hash ) { |
|
196 | +function wl_caching_get_temp_path($hash) { |
|
197 | 197 | |
198 | 198 | // By chunking the hash we ensure we don't put too many files in the same folder |
199 | - return wl_caching_get_cache_folder() . chunk_split( substr( $hash, 0, 15 ), 3, '/' ) . $hash; |
|
199 | + return wl_caching_get_cache_folder().chunk_split(substr($hash, 0, 15), 3, '/').$hash; |
|
200 | 200 | |
201 | 201 | } |
202 | 202 | |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @param string $hash The hash file. |
212 | 212 | */ |
213 | -function wl_caching_delete( $hash ) { |
|
213 | +function wl_caching_delete($hash) { |
|
214 | 214 | |
215 | 215 | // Delete all cached versions of the provided hash. |
216 | - while ( false !== ( $filename = wl_caching_get_filename( $hash ) ) ) { |
|
217 | - wl_caching_delete_file( $filename ); |
|
216 | + while (false !== ($filename = wl_caching_get_filename($hash))) { |
|
217 | + wl_caching_delete_file($filename); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | } |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @param string $filename The cache file to delete. |
228 | 228 | */ |
229 | -function wl_caching_delete_file( $filename ) { |
|
229 | +function wl_caching_delete_file($filename) { |
|
230 | 230 | |
231 | 231 | $cache_folder = wl_caching_get_cache_folder(); |
232 | 232 | |
233 | - if ( file_exists( $filename ) ) { |
|
234 | - unlink( $filename ); |
|
233 | + if (file_exists($filename)) { |
|
234 | + unlink($filename); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // Delete folders contained in the cache folder - rmdir is safe: it doesn't delete non-empty folders. |
238 | - while ( 0 === strpos( $filename = dirname( $filename ), $cache_folder ) ) { |
|
239 | - @rmdir( $filename ); |
|
238 | + while (0 === strpos($filename = dirname($filename), $cache_folder)) { |
|
239 | + @rmdir($filename); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | } |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | * @param array $response The response structure. |
251 | 251 | * @return bool True if cached otherwise false. |
252 | 252 | */ |
253 | -function wl_caching_response_is_cached( $response ) { |
|
253 | +function wl_caching_response_is_cached($response) { |
|
254 | 254 | |
255 | - return ( is_array( $response ) && isset( $response['wl_cached'] ) && true === $response['wl_cached'] ); |
|
255 | + return (is_array($response) && isset($response['wl_cached']) && true === $response['wl_cached']); |
|
256 | 256 | |
257 | 257 | } |
258 | 258 | \ No newline at end of file |
@@ -7,50 +7,50 @@ discard block |
||
7 | 7 | |
8 | 8 | if ( class_exists( 'SU_Module' ) ) { |
9 | 9 | |
10 | - class SU_Configuration extends SU_Module { |
|
11 | - static function get_module_title() { |
|
12 | - return __( 'WordLift Configuration', 'wordlift' ); |
|
13 | - } |
|
10 | + class SU_Configuration extends SU_Module { |
|
11 | + static function get_module_title() { |
|
12 | + return __( 'WordLift Configuration', 'wordlift' ); |
|
13 | + } |
|
14 | 14 | |
15 | - static function get_menu_title() { |
|
16 | - return __( 'WordLift Configuration', 'wordlift' ); |
|
17 | - } |
|
15 | + static function get_menu_title() { |
|
16 | + return __( 'WordLift Configuration', 'wordlift' ); |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * This method is called to display the admin page inside of SEO Ultimate. |
|
21 | - * |
|
22 | - * @since 3.0.0 |
|
23 | - * |
|
24 | - * @uses wl_configuration_admin_menu_callback() to display the admin page. |
|
25 | - */ |
|
26 | - function admin_page_contents() { |
|
19 | + /** |
|
20 | + * This method is called to display the admin page inside of SEO Ultimate. |
|
21 | + * |
|
22 | + * @since 3.0.0 |
|
23 | + * |
|
24 | + * @uses wl_configuration_admin_menu_callback() to display the admin page. |
|
25 | + */ |
|
26 | + function admin_page_contents() { |
|
27 | 27 | |
28 | - if ($this->should_show_sdf_theme_promo()) { |
|
29 | - echo "\n\n<div class='row'>\n"; |
|
30 | - echo "\n\n<div class='col-sm-8 col-md-9'>\n"; |
|
31 | - } |
|
28 | + if ($this->should_show_sdf_theme_promo()) { |
|
29 | + echo "\n\n<div class='row'>\n"; |
|
30 | + echo "\n\n<div class='col-sm-8 col-md-9'>\n"; |
|
31 | + } |
|
32 | 32 | |
33 | - wl_configuration_admin_menu_callback( false ); |
|
33 | + wl_configuration_admin_menu_callback( false ); |
|
34 | 34 | |
35 | - if ($this->should_show_sdf_theme_promo()) { |
|
36 | - echo "\n\n</div>\n"; |
|
37 | - echo "\n\n<div class='col-sm-4 col-md-3'>\n"; |
|
38 | - $this->promo_sdf_banners(); |
|
39 | - echo "\n\n</div>\n"; |
|
40 | - echo "\n\n</div>\n"; |
|
41 | - } |
|
35 | + if ($this->should_show_sdf_theme_promo()) { |
|
36 | + echo "\n\n</div>\n"; |
|
37 | + echo "\n\n<div class='col-sm-4 col-md-3'>\n"; |
|
38 | + $this->promo_sdf_banners(); |
|
39 | + echo "\n\n</div>\n"; |
|
40 | + echo "\n\n</div>\n"; |
|
41 | + } |
|
42 | 42 | |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - function add_help_tabs( $screen ) { |
|
45 | + function add_help_tabs( $screen ) { |
|
46 | 46 | |
47 | - // TODO: write some help text here. |
|
48 | - $screen->add_help_tab( array( |
|
49 | - 'id' => 'wl-configuration-overview' |
|
50 | - , |
|
51 | - 'title' => __( 'Overview', 'seo-ultimate' ) |
|
52 | - , |
|
53 | - 'content' => __( " |
|
47 | + // TODO: write some help text here. |
|
48 | + $screen->add_help_tab( array( |
|
49 | + 'id' => 'wl-configuration-overview' |
|
50 | + , |
|
51 | + 'title' => __( 'Overview', 'seo-ultimate' ) |
|
52 | + , |
|
53 | + 'content' => __( " |
|
54 | 54 | <ul> |
55 | 55 | <li><strong>What it does:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li> |
56 | 56 | <li><strong>Why it helps:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li> |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | <p>If there are no 404 errors in the log, this is good and means there's no action required on your part.</p> |
61 | 61 | ", 'seo-ultimate' ) |
62 | - ) ); |
|
62 | + ) ); |
|
63 | 63 | |
64 | - } |
|
65 | - } |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | * @since 3.0.0 |
6 | 6 | */ |
7 | 7 | |
8 | -if ( class_exists( 'SU_Module' ) ) { |
|
8 | +if (class_exists('SU_Module')) { |
|
9 | 9 | |
10 | 10 | class SU_Configuration extends SU_Module { |
11 | 11 | static function get_module_title() { |
12 | - return __( 'WordLift Configuration', 'wordlift' ); |
|
12 | + return __('WordLift Configuration', 'wordlift'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | static function get_menu_title() { |
16 | - return __( 'WordLift Configuration', 'wordlift' ); |
|
16 | + return __('WordLift Configuration', 'wordlift'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | echo "\n\n<div class='col-sm-8 col-md-9'>\n"; |
31 | 31 | } |
32 | 32 | |
33 | - wl_configuration_admin_menu_callback( false ); |
|
33 | + wl_configuration_admin_menu_callback(false); |
|
34 | 34 | |
35 | 35 | if ($this->should_show_sdf_theme_promo()) { |
36 | 36 | echo "\n\n</div>\n"; |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | - function add_help_tabs( $screen ) { |
|
45 | + function add_help_tabs($screen) { |
|
46 | 46 | |
47 | 47 | // TODO: write some help text here. |
48 | - $screen->add_help_tab( array( |
|
48 | + $screen->add_help_tab(array( |
|
49 | 49 | 'id' => 'wl-configuration-overview' |
50 | 50 | , |
51 | - 'title' => __( 'Overview', 'seo-ultimate' ) |
|
51 | + 'title' => __('Overview', 'seo-ultimate') |
|
52 | 52 | , |
53 | - 'content' => __( " |
|
53 | + 'content' => __(" |
|
54 | 54 | <ul> |
55 | 55 | <li><strong>What it does:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li> |
56 | 56 | <li><strong>Why it helps:</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li> |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | </ul> |
59 | 59 | |
60 | 60 | <p>If there are no 404 errors in the log, this is good and means there's no action required on your part.</p> |
61 | -", 'seo-ultimate' ) |
|
62 | - ) ); |
|
61 | +", 'seo-ultimate') |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | } |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Include constants |
4 | -require_once( 'wordlift_core_constants.php' ); |
|
4 | +require_once('wordlift_core_constants.php'); |
|
5 | 5 | |
6 | 6 | // Include methods that deal with post/entity relations |
7 | -require_once( 'wordlift_core_post_entity_relations.php' ); |
|
7 | +require_once('wordlift_core_post_entity_relations.php'); |
|
8 | 8 | |
9 | 9 | // Include wl_schema api |
10 | -require_once( 'wordlift_core_schema_api.php' ); |
|
10 | +require_once('wordlift_core_schema_api.php'); |
|
11 | 11 | |
12 | 12 | // Include the Entity API which allow to query for entity posts. |
13 | -require_once( 'wordlift_core_entity_api.php' ); |
|
13 | +require_once('wordlift_core_entity_api.php'); |
|
14 | 14 | |
15 | 15 | // Include methods for Wordlift plugin install |
16 | -require_once( 'wordlift_core_install.php' ); |
|
16 | +require_once('wordlift_core_install.php'); |
|
17 | 17 | |
18 | 18 | // Include utility global functions |
19 | -require_once( 'wordlift_core_functions.php' ); |
|
20 | 19 | \ No newline at end of file |
20 | +require_once('wordlift_core_functions.php'); |
|
21 | 21 | \ No newline at end of file |