Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
22 / 22 |
Pages | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
22 / 22 |
set_template | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
get_template | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
admin_settings | |
100.00% |
1 / 1 |
1 | |
100.00% |
19 / 19 |
<?php | |
/** | |
* Pages Class | |
* | |
* @category PHP | |
* @package WpWodify | |
* @subpackage Pages | |
* @since File available since release 1.0.x | |
* @author Cory Collier <corycollier@corycollier.com> | |
*/ | |
namespace WpWodify; | |
/** | |
* Pages Class | |
* | |
* @category PHP | |
* @package WpWodify | |
* @subpackage Pages | |
* @since Class available since release 1.0.x | |
* @author Cory Collier <corycollier@corycollier.com> | |
*/ | |
class Pages { | |
/** | |
* Holds an instance of a WpWodify\Template class. | |
* | |
* @var WpWodify\Template | |
*/ | |
protected $template; | |
/** | |
* Setter for the $template var. | |
* | |
* @param WpWodify\Template $template The Template instance. | |
* | |
* @return WpWodify\Pages Returns $this, for object-chaining. | |
*/ | |
public function set_template($template) { | |
$this->template = $template; | |
return $this; | |
} | |
/** | |
* Getter for the $template property. | |
* | |
* @return WpWodify\Template The template instance. | |
*/ | |
public function get_template() { | |
return $this->template; | |
} | |
/** | |
* Page to display admin settings | |
*/ | |
public function admin_settings() { | |
$fields = new Fields; | |
add_settings_section( | |
'section-one', | |
'Section One', | |
null, | |
'wp-wodify-administer' | |
); | |
add_settings_field( | |
'wp-wodify-api-key', | |
'Api Key', | |
array($fields, 'input_field'), | |
'wp-wodify-administer', | |
'section-one', | |
array( | |
'!name' => 'wp-wodify-api-key', | |
'!value' => get_option( 'wp-wodify-api-key' ), | |
) | |
); | |
$template = $this->get_template(); | |
$template->set_script('admin-settings-template.php'); | |
$template->render(); | |
} | |
} |