コード例 #1
0
    public function options_page()
    {
        $option_keys = $this->option_keys();
        $this->options = $this->get_option();
        $title = __('StaticPress S3 Option', self::TEXT_DOMAIN);
        // Get S3 Object
        $s3 = new S3_helper(isset($this->options['access_key']) ? $this->options['access_key'] : null, isset($this->options['secret_key']) ? $this->options['secret_key'] : null, isset($this->options['region']) ? $this->options['region'] : null);
        $regions = $this->regions;
        $buckets = false;
        if ($s3) {
            $regions = $s3->get_regions();
            $buckets = $s3->list_buckets();
        }
        if (!$buckets) {
            unset($option_keys['bucket']);
            unset($option_keys['s3_url']);
        }
        ?>
		<div class="wrap">
		<h2><?php 
        echo esc_html($title);
        ?>
</h2>
		<form method="post" action="<?php 
        echo $this->admin_action;
        ?>
">
		<?php 
        echo wp_nonce_field(self::NONCE_ACTION, self::NONCE_NAME, true, false) . "\n";
        ?>
		<table class="wp-list-table fixed"><tbody>
		<?php 
        foreach ($option_keys as $field => $label) {
            $this->input_field($field, $label, array('regions' => $regions, 'buckets' => $buckets));
        }
        ?>
		</tbody></table>
		<?php 
        submit_button();
        ?>
		</form>
		</div>
<?php 
    }