コード例 #1
0
    /**
     * Output the contents of a cached item into a textarea
     *
     * @since 2.0.0
     *
     * @param  string  $key
     * @param  string  $group
     */
    public function do_item($key, $group)
    {
        // Get results directly from cache
        $cache = wp_cache_get($key, $group);
        $full = wp_cache_get_key($key, $group);
        $code = wp_cache_get_result_code();
        $message = wp_cache_get_result_message();
        // @todo Something prettier with cached value
        $value = is_array($cache) || is_object($cache) ? serialize($cache) : $cache;
        // Not found?
        if (false === $value) {
            $value = 'ERR';
        }
        // Combine results
        $results = sprintf(esc_html__('Key:     %s', 'wp-spider-cache'), $key) . "\n" . sprintf(esc_html__('Group:   %s', 'wp-spider-cache'), $group) . "\n" . sprintf(esc_html__('Full:    %s', 'wp-spider-cache'), $full) . "\n" . sprintf(esc_html__('Code:    %s - %s', 'wp-spider-cache'), $code, $message) . "\n" . sprintf(esc_html__('Value:   %s', 'wp-spider-cache'), $value);
        ?>

		<textarea class="sc-item" class="widefat" rows="10" cols="35"><?php 
        echo esc_textarea($results);
        ?>
</textarea>

		<?php 
    }
コード例 #2
0
    /**
     * Output the contents of a cached item into a textarea
     *
     * @since 2.0.0
     *
     * @param  string  $key
     * @param  string  $group
     */
    public function do_item($key, $group)
    {
        // Require pretty var_dump()
        require_once __DIR__ . '/wp-spider-cache/includes/class-var-dump.php';
        // Get results directly from cache
        $cache = wp_cache_get($key, $group);
        $full = wp_cache_get_key($key, $group);
        $code = wp_cache_get_result_code();
        $message = wp_cache_get_result_message();
        // Not found?
        if (false === $cache) {
            $cache = 'ERR';
        }
        ?>

		<table class="form-table sc-item">
			<tbody>
				<tr>
					<th><?php 
        esc_html_e('Key', 'wp-spider-cache');
        ?>
</th>
					<td><pre><?php 
        echo esc_html($key);
        ?>
</pre></td>
				</tr>
				<tr>
					<th><?php 
        esc_html_e('Group', 'wp-spider-cache');
        ?>
</th>
					<td><pre><?php 
        echo esc_html($group);
        ?>
</pre></td>
				</tr>
				<tr>
					<th><?php 
        esc_html_e('Full', 'wp-spider-cache');
        ?>
</th>
					<td><pre><?php 
        echo esc_html($full);
        ?>
</pre></td>
				</tr>
				<tr>
					<th><?php 
        esc_html_e('Code', 'wp-spider-cache');
        ?>
</th>
					<td><pre><?php 
        echo esc_html("{$code} - {$message}");
        ?>
</pre></td>
				</tr>
				<tr>
					<th><?php 
        esc_html_e('Value', 'wp-spider-cache');
        ?>
</th>
					<td><?php 
        WP_Spider_Cache_Var_Dump::dump($cache);
        ?>
</td>
				</tr>
			</tbody>
		</table>

		<?php 
    }