API / Minn\Rest / Settings

Settings final readonly class

Minn\Rest\Settings · public/minn/src/Minn/Rest/Settings.php · 113 lines

The registered settings the Settings views read and write, mapped to the options WordPress stores. Registration order is the payload order.

Constants and properties

privateREGISTRY = array ( 'blog_public' => array ( 0 => 'blog_public', 1 => 'int', ), 'minn_admin_maintenance' => array ( 0 => 'minn_admin_maintenance', 1 => 'bool', ), 'users_can_register' => array ( 0 => 'users_can_register', 1 => 'int', ), 'default_role' => array ( 0 => 'default_role', 1 => 'string', ), 'comment_moderation' => array ( 0 => 'comment_moderation', 1 => 'int', ), 'comment_registration' => array ( 0 => 'comment_registration', 1 => 'int', ), 'show_avatars' => array ( 0 => 'show_avatars', 1 => 'int', ), 'title' => array ( 0 => 'blogname', 1 => 'string', ), 'description' => array ( 0 => 'blogdescription', 1 => 'string', ), 'url' => array ( 0 => 'siteurl', 1 => 'string', ), 'email' => array ( 0 => 'admin_email', 1 => 'string', ), 'timezone' => array ( 0 => 'timezone_string', 1 => 'string', ), 'date_format' => array ( 0 => 'date_format', 1 => 'string', ), 'time_format' => array ( 0 => 'time_format', 1 => 'string', ), 'start_of_week' => array ( 0 => 'start_of_week', 1 => 'int', ), 'language' => array ( 0 => 'WPLANG', 1 => 'language', ), 'use_smilies' => array ( 0 => 'use_smilies', 1 => 'bool', ), 'default_category' => array ( 0 => 'default_category', 1 => 'int', ), 'default_post_format' => array ( 0 => 'default_post_format', 1 => 'string', ), 'posts_per_page' => array ( 0 => 'posts_per_page', 1 => 'int', ), 'show_on_front' => array ( 0 => 'show_on_front', 1 => 'string', ), 'page_on_front' => array ( 0 => 'page_on_front', 1 => 'int', ), 'page_for_posts' => array ( 0 => 'page_for_posts', 1 => 'int', ), 'default_ping_status' => array ( 0 => 'default_ping_status', 1 => 'string', ), 'default_comment_status' => array ( 0 => 'default_comment_status', 1 => 'string', ), 'site_logo' => array ( 0 => 'site_logo', 1 => 'int_or_null', ), 'site_icon' => array ( 0 => 'site_icon', 1 => 'int', ), )

setting key => [option name, type]

constSCHEMA = array ( 'blog_public' => array ( 'title' => '', 'description' => '', 'type' => 'integer', 'required' => false, ), 'minn_admin_maintenance' => array ( 'title' => '', 'description' => '', 'type' => 'boolean', 'required' => false, ), 'users_can_register' => array ( 'title' => '', 'description' => '', 'type' => 'integer', 'required' => false, ), 'default_role' => array ( 'title' => '', 'description' => '', 'type' => 'string', 'required' => false, ), 'comment_moderation' => array ( 'title' => '', 'description' => '', 'type' => 'integer', 'required' => false, ), 'comment_registration' => array ( 'title' => '', 'description' => '', 'type' => 'integer', 'required' => false, ), 'show_avatars' => array ( 'title' => '', 'description' => '', 'type' => 'integer', 'required' => false, ), 'title' => array ( 'title' => 'Title', 'description' => 'Site title.', 'type' => 'string', 'required' => false, ), 'description' => array ( 'title' => 'Tagline', 'description' => 'Site tagline.', 'type' => 'string', 'required' => false, ), 'url' => array ( 'title' => '', 'description' => 'Site URL.', 'type' => 'string', 'format' => 'uri', 'required' => false, ), 'email' => array ( 'title' => '', 'description' => 'This address is used for admin purposes, like new user notification.', 'type' => 'string', 'format' => 'email', 'required' => false, ), 'timezone' => array ( 'title' => '', 'description' => 'A city in the same timezone as you.', 'type' => 'string', 'required' => false, ), 'date_format' => array ( 'title' => '', 'description' => 'A date format for all date strings.', 'type' => 'string', 'required' => false, ), 'time_format' => array ( 'title' => '', 'description' => 'A time format for all time strings.', 'type' => 'string', 'required' => false, ), 'start_of_week' => array ( 'title' => '', 'description' => 'A day number of the week that the week should start on.', 'type' => 'integer', 'required' => false, ), 'language' => array ( 'title' => '', 'description' => 'WordPress locale code.', 'type' => 'string', 'required' => false, ), 'use_smilies' => array ( 'title' => '', 'description' => 'Convert emoticons like :-) and :-P to graphics on display.', 'type' => 'boolean', 'required' => false, ), 'default_category' => array ( 'title' => '', 'description' => 'Default post category.', 'type' => 'integer', 'required' => false, ), 'default_post_format' => array ( 'title' => '', 'description' => 'Default post format.', 'type' => 'string', 'required' => false, ), 'posts_per_page' => array ( 'title' => 'Maximum posts per page', 'description' => 'Blog pages show at most.', 'type' => 'integer', 'required' => false, ), 'show_on_front' => array ( 'title' => 'Show on front', 'description' => 'What to show on the front page', 'type' => 'string', 'required' => false, ), 'page_on_front' => array ( 'title' => 'Page on front', 'description' => 'The ID of the page that should be displayed on the front page', 'type' => 'integer', 'required' => false, ), 'page_for_posts' => array ( 'title' => '', 'description' => 'The ID of the page that should display the latest posts', 'type' => 'integer', 'required' => false, ), 'default_ping_status' => array ( 'title' => '', 'description' => 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.', 'type' => 'string', 'enum' => array ( 0 => 'open', 1 => 'closed', ), 'required' => false, ), 'default_comment_status' => array ( 'title' => 'Allow comments on new posts', 'description' => 'Allow people to submit comments on new posts.', 'type' => 'string', 'enum' => array ( 0 => 'open', 1 => 'closed', ), 'required' => false, ), 'site_logo' => array ( 'title' => 'Logo', 'description' => 'Site logo.', 'type' => 'integer', 'required' => false, ), 'site_icon' => array ( 'title' => 'Icon', 'description' => 'Site icon.', 'type' => 'integer', 'required' => false, ), )

The body of a write, every registered setting by its key, as the reference describes it.

privatereadonly Minn\Content\Site $site

Promoted from the constructor.

Public

new__construct(Minn\Content\Site $site)#
methodpayload(): array#

Every registered setting with its current value.

methodstore(array $body): void#

Writes the registered keys in a body, already validated against SCHEMA, in the stored form; unregistered keys are ignored. Without plugins loaded there is nobody to tell (LiveSettings writes through update_option when there is).