Source of file class-pages.php

Size: 1,851 Bytes - Last Modified: 2016-01-08T15:31:08-05:00

../src/lib/class-pages.php

123456789101112131415161718192021222324252627282930313233343536373839
Covered by 1 test(s):
  • WpWodify\PagesTest::test_set_template
40
Covered by 1 test(s):
  • WpWodify\PagesTest::test_set_template
414243444546474849
Covered by 1 test(s):
  • WpWodify\PagesTest::test_get_template
50515253545556
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
57
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
58
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
59
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
60
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
6162
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
6364
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
65
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
66
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
67
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
68
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
69
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
7071
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
72
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
7374
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
7576
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
77
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
78
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
79
Covered by 1 test(s):
  • WpWodify\PagesTest::test_admin_settings
8081
<?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();
    }

}