コード例 #1
0
    /**
     * Builds the admin page
     *
     * @since 1.0
     */
    function admin_panel()
    {
        WPSEO_WooCommerce_Wrappers::admin_header(true, $this->option_instance->group_name, $this->short_name, false);
        // @todo [JRF => whomever] change the form fields so they use the methods as defined in WPSEO_Admin_Pages
        $taxonomies = get_object_taxonomies('product', 'objects');
        echo '<h2>' . __('Twitter Product Cards', 'yoast-woo-seo') . '</h2>';
        echo '<p>' . __('Twitter allows you to display two pieces of data in the Twitter card, pick which two are shown:', 'yoast-woo-seo') . '</p>';
        $i = 1;
        while ($i < 3) {
            echo '
			<label class="select" for="datatype' . $i . '">' . sprintf(__('Data %d', 'yoast-woo-seo'), $i) . ':</label>
			<select class="select" id="datatype' . $i . '" name="' . esc_attr($this->short_name . '[data' . $i . '_type]') . '">' . "\n";
            foreach ($this->option_instance->valid_data_types as $data_type => $translation) {
                $sel = selected($data_type, $this->options['data' . $i . '_type'], false);
                echo '<option value="' . esc_attr($data_type) . '"' . $sel . '>' . esc_html($translation) . "</option>\n";
            }
            unset($sel, $data_type, $translation);
            if (is_array($taxonomies) && $taxonomies !== array()) {
                foreach ($taxonomies as $tax) {
                    $sel = selected(strtolower($tax->name), $this->options['data' . $i . '_type'], false);
                    echo '<option value="' . esc_attr(strtolower($tax->name)) . '"' . $sel . '>' . esc_html($tax->labels->name) . "</option>\n";
                }
                unset($tax, $sel);
            }
            echo '</select>';
            if ($i === 1) {
                echo '<br class="clear"/>';
            }
            $i++;
        }
        echo '<br class="clear"/>
		<h2>' . __('Schema & OpenGraph additions', 'yoast-woo-seo') . '</h2>
		<p>' . __('If you have product attributes for the following types, select them here, the plugin will make sure they\'re used for the appropriate Schema.org and OpenGraph markup.', 'yoast-woo-seo') . '</p>
		<label class="select" for="schema_brand">' . sprintf(__('Brand', 'yoast-woo-seo'), $i) . ':</label>
		<select class="select" id="schema_brand" name="' . esc_attr($this->short_name . '[schema_brand]') . '">
			<option value="">-</option>' . "\n";
        if (is_array($taxonomies) && $taxonomies !== array()) {
            foreach ($taxonomies as $tax) {
                $sel = selected(strtolower($tax->name), $this->options['schema_brand'], false);
                echo '<option value="' . esc_attr(strtolower($tax->name)) . '"' . $sel . '>' . esc_html($tax->labels->name) . "</option>\n";
            }
        }
        unset($tax, $sel);
        echo '
		</select>
		<br class="clear"/>

		<label class="select" for="schema_manufacturer">' . sprintf(__('Manufacturer', 'yoast-woo-seo'), $i) . ':</label>
		<select class="select" id="schema_manufacturer" name="' . esc_attr($this->short_name . '[schema_manufacturer]') . '">
			<option value="">-</option>' . "\n";
        if (is_array($taxonomies) && $taxonomies !== array()) {
            foreach ($taxonomies as $tax) {
                $sel = selected(strtolower($tax->name), $this->options['schema_manufacturer'], false);
                echo '<option value="' . esc_attr(strtolower($tax->name)) . '"' . $sel . '>' . esc_html($tax->labels->name) . "</option>\n";
            }
        }
        unset($tax, $sel);
        echo '
		</select>
		<br class="clear"/>';
        $wpseo_options = WPSEO_Options::get_all();
        if ($wpseo_options['breadcrumbs-enable'] === true) {
            echo '
		<h2>' . __('Breadcrumbs', 'yoast-woo-seo') . '</h2>
		<p>' . sprintf(__('Both WooCommerce and WordPress SEO by Yoast have breadcrumbs functionality. The WP SEO breadcrumbs have a slightly higher chance of being picked up by search engines and you can configure them a bit more, on the %1$sInternal Links settings page%2$s. To enable them, check the box below and the WooCommerce breadcrumbs will be replaced.', 'yoast-woo-seo'), '<a href="' . esc_url(admin_url('admin.php?page=wpseo_internal-links')) . '">', '</a>') . "</p>\n";
            $this->checkbox('breadcrumbs', __('Replace WooCommerce Breadcrumbs', 'yoast-woo-seo'));
        }
        echo '
		<br class="clear"/>
		<h2>' . __('Admin', 'yoast-woo-seo') . '</h2>
		<p>' . __('Both WooCommerce and WordPress SEO by Yoast add columns to the product page, to remove all but the SEO score column from Yoast on that page, check this box.', 'yoast-woo-seo') . "</p>\n";
        $this->checkbox('hide_columns', __('Remove WordPress SEO columns', 'yoast-woo-seo'));
        echo '
		<br class="clear"/>
		<p>' . __('Both WooCommerce and WordPress SEO by Yoast add metaboxes to the edit product page, if you want WooCommerce to be above WordPress SEO, check the box.', 'yoast-woo-seo') . "</p>\n";
        $this->checkbox('metabox_woo_top', __('Move WooCommerce Up', 'yoast-woo-seo'));
        echo '<br class="clear"/>';
        // Submit button and debug info
        WPSEO_WooCommerce_Wrappers::admin_footer(true, false);
    }