コード例 #1
0
function bb_get_current_theme_data($property = 'all')
{
    if (!$property) {
        $property = 'all';
    }
    $directory = bb_get_active_theme_directory();
    $stylesheet = $directory . 'style.css';
    if (file_exists($stylesheet)) {
        $data = bb_get_theme_data($stylesheet);
    }
    if ($property == 'all') {
        return $data;
    } elseif (isset($data[$property])) {
        return $data[$property];
    } else {
        return false;
    }
}
コード例 #2
0
ファイル: themes.php プロジェクト: danielcoats/schoolpress
function bb_admin_theme_row($theme, $position)
{
    $theme_directory = bb_get_theme_directory($theme);
    $theme_data = file_exists($theme_directory . 'style.css') ? bb_get_theme_data($theme) : false;
    $screen_shot = file_exists($theme_directory . 'screenshot.png') ? esc_url(bb_get_theme_uri($theme) . 'screenshot.png') : false;
    $activation_url = bb_get_uri('bb-admin/themes.php', array('theme' => urlencode($theme)), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
    $activation_url = esc_url(bb_nonce_url($activation_url, 'switch-theme'));
    if (1 === $position || 0 === $position) {
        echo '<tr>';
    }
    ?>
	<td class="position-<?php 
    echo (int) $position;
    ?>
">
		<div class="screen-shot"><?php 
    if ($screen_shot) {
        ?>
<a href="<?php 
        echo $activation_url;
        ?>
" title="<?php 
        echo esc_attr(sprintf(__('Activate "%s"'), $theme_data['Title']));
        ?>
"><img alt="<?php 
        echo esc_attr($theme_data['Title']);
        ?>
" src="<?php 
        echo $screen_shot;
        ?>
" /></a><?php 
    }
    ?>
</div>
		<div class="description">
			<h3 class="themes">
<?php 
    printf(__('%1$s %2$s by <cite>%3$s</cite>'), $theme_data['Title'], $theme_data['Version'], $theme_data['Author']);
    ?>
			</h3>
			
<?php 
    if ($theme_data['Porter']) {
        ?>
			<p>
<?php 
        printf(__('Ported by <cite>%s</cite>'), $theme_data['Porter']);
        ?>
			</p>
<?php 
    }
    ?>
			
			<?php 
    echo $theme_data['Description'];
    // Description is autop'ed
    if (0 !== $position) {
        ?>
			<div class="actions">
				<a href="<?php 
        echo $activation_url;
        ?>
" title="<?php 
        echo esc_attr(sprintf(__('Activate "%s"'), $theme_data['Title']));
        ?>
"><?php 
        _e('Activate');
        ?>
</a>
			</div>
<?php 
    }
    ?>
			<p class="location"><?php 
    printf(__('All of this theme\'s files are located in the "%s" themes directory.'), $theme_data['Location']);
    ?>
</p>
		</div>
	</td>
<?php 
    if (3 === $position || 0 === $position) {
        echo '</tr>';
    }
}