コード例 #1
0
<?php

/**
 * Admin config template.
 * @author dligthart <*****@*****.**>
 * @version 1.2
 * @package wp-stats-dashboard
 */
$cache_path = wpsd_get_cache_path();
$img_path = WPSD_PLUGIN_URL . '/resources/images/icons/';
$types = wpsd_get_metrics_types();
$checked = ' checked="checked"';
function wpsd_create_cb($id, $title, $form2)
{
    if (!$id) {
        return false;
    }
    $key = 'wpsd_option_' . $id;
    if (isset($form2->{$key})) {
        $value = $form2->{$key};
    }
    $checked = ' checked="checked"';
    ?>

<style type="text/css">
.wrap input[type=text] {width:80%;}
.wrap input[type=password] {width:80%;}
</style>

<div class="ckb_column" style="width:200px; overflow:hidden; vertical-align:top; display:inline-block; margin-bottom:5px;">
  <input type="checkbox" id="<?php 
コード例 #2
0
ファイル: WPSDUtils.php プロジェクト: billadams/forever-frame
/**
 * wpsd_get_cache_dir function.
 * 
 * @access public
 * @return void
 */
function wpsd_get_cache_dir()
{
    $cache_path = wpsd_get_cache_path();
    $cache_dir = $cache_path . 'wp-stats-dashboard';
    return $cache_dir . '/';
}
コード例 #3
0
ファイル: sidebar.php プロジェクト: billadams/forever-frame
          <div class="inside">
            <ul>
            <?php 
$check = wpsd_get_img('check', 'float:left;margin:0px 5px 0px 0px;');
$uncheck = wpsd_get_img('uncheck', 'float:left;margin:0px 5px 0px 0px;');
echo '<li>';
echo ini_get('safe_mode') ? $uncheck . __('Safe mode: on', 'wpsd') : $check . __('Safe mode: off', 'wpsd');
echo '</li>';
echo '<li>';
echo function_exists('curl_init') ? $check . __('Curl installed: yes', 'wpsd') : $uncheck . __('Curl installed: no', 'wpsd');
echo '</li>';
echo '<li>';
echo function_exists('stats_get_api_key') || defined('JETPACK__API_VERSION') ? $check . __('Stats plugin: installed', 'wpsd') : $uncheck . __('Stats plugin: <a href="http://wordpress.org/extend/plugins/jetpack/" target="_blank" title="Install the WordPress.com Jetpack plugin">not installed</a>', 'wpsd');
echo '</li>';
echo '<li>';
echo is_writable(wpsd_get_cache_path()) ? $check . __('Cache directory writable: yes', 'wpsd') : $uncheck . __('Cache directory writable: no', 'wpsd');
echo '</li>';
$base = get_template_directory();
$theme_data = implode('', file($base . DIRECTORY_SEPARATOR . 'footer.php'));
echo '<li>';
echo file_exists($base . DIRECTORY_SEPARATOR . 'footer.php') && strpos($theme_data, 'wp_footer') === false ? $uncheck . __('wp_footer in footer.php found: <a href="http://codex.wordpress.org/Theme_Development" target="_blank" title="Theme development documentation">no</a>', 'wpsd') : $check . __('wp_footer in footer.php found: yes', 'wpsd');
echo '</li>';
?>
  
            </ul>
          </div>
        </div>
        <!--  /Sidebar widget -->
        
        <!--  Sidebar widget -->
        <div class="wpsd postbox">
コード例 #4
0
 function login()
 {
     $blog_id = get_option('wpsd_blog_id');
     $cookie_filename = md5($blog_id);
     $cache_path = wpsd_get_cache_path();
     $cache_dir = $cache_path . 'wp-stats-dashboard';
     $url = 'https://dashboard.wordpress.com/wp-login.php';
     $this->cookie = $cache_dir . '/' . $cookie_filename;
     // Login and set cookie.
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 60);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
     curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie);
     curl_setopt($ch, CURLOPT_REFERER, get_bloginfo('wpurl') . '/wp-admin/index.php?page=stats');
     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
     curl_setopt($ch, CURLOPT_POSTFIELDS, "log={$this->un}&pwd={$this->pw}&testcookie=1");
     curl_exec($ch);
     // Login.
     curl_close($ch);
     // close connection.
     unset($ch);
     // clear channel.
     return true;
 }