コード例 #1
0
 function __construct($file, $width, $height, $mode = auto, $format = 'png')
 {
     $is_Windows = strtoupper(substr(php_uname('s'), 0, 3)) == 'WIN';
     $slash = $is_Windows ? '\\' : '/';
     $this->info = getimagesize($file);
     if (!is_array($this->info)) {
         return;
     }
     $this->src = $this->open($file);
     // echo '<pre>';
     // var_export($this->info);
     // echo '</pre>';
     $this->options = get_option('wpUI_options');
     if (!isset($this->options) || !isset($this->options['enable_cache'])) {
         return;
     }
     $this->width = imagesx($this->src);
     $this->height = imagesy($this->src);
     if ($this->width / $this->height != 1) {
         $mode = 'crop';
     }
     $filestr = md5(str_replace($slash, '', strrchr($file, $slash)) . '_' . $width . '_' . $height . '_' . $mode);
     $cachedir = wpui_adjust_path(WP_CONTENT_DIR . '/uploads/wp-ui/cache/');
     is_dir($cachedir) || @mkdir($cachedir, 0755, true);
     $storestr = $cachedir . $filestr . '.' . $format;
     if (file_exists($storestr)) {
         $this->output($storestr, $format);
     } else {
         $this->resize($width, $height, $mode);
         $this->save($storestr, 100, $format);
         $this->output($storestr, $format);
     }
 }
コード例 #2
0
/**
 *	Documentation
 */
function wpui_search_for_stylesheets()
{
    $upload_dir = wp_upload_dir();
    $udir = wpui_adjust_path(WP_CONTENT_DIR . '/uploads/wp-ui/');
    $_status = '';
    $someArr = false;
    file_exists($udir) || @mkdir($udir, 0755);
    if (!is_dir($udir)) {
        $someArr = array();
        $someArr['status'] = 'error';
        $someArr['description'] = __('The folder wp-ui was not found and could not be created. Please check the uploads folder permissions.', 'wp-ui');
        $someArr['link'] = $udir;
        echo json_encode($someArr);
        die;
    }
    $upnonce = $_POST['upNonce'];
    if (!wp_verify_nonce($upnonce, 'wpui-jqui-custom-themes')) {
        wp_die('Just what do you think you\'re doing, Dave?');
    }
    $results = wpui_jqui_dirs($udir);
    echo $results;
    die;
}
コード例 #3
0
ファイル: wpui-helpers.php プロジェクト: bdwebteam/wp-ui
/**
 *	Documentation
 */
function wpui_search_for_stylesheets()
{
    if (!isset($_POST)) {
        return;
    }
    $upnonce = $_POST['upNonce'];
    if (!wp_verify_nonce($upnonce, 'wpui-jqui-custom-themes')) {
        wp_die('Just what do you think you\'re doing, Dave?');
    }
    // $upload_dir = wp_upload_dir();
    global $wpui_options;
    $path = WP_CONTENT_DIR . '/uploads/wp-ui/';
    $url = content_url() . '/uploads/wp-ui/';
    if (!empty($wpui_options) && !empty($wpui_options['styles_upload_dirs']) && is_array($wpui_options['styles_upload_dirs'])) {
        if (!empty($wpui_options['styles_upload_dirs']['dir']) && !empty($wpui_options['styles_upload_dirs']['url'])) {
            $path = $wpui_options['styles_upload_dirs']['dir'];
            $url = $wpui_options['styles_upload_dirs']['url'];
        }
    }
    $udir = wpui_adjust_path($path);
    $_status = '';
    $someArr = false;
    file_exists($udir) || @mkdir($udir, 0755);
    if (!is_dir($udir)) {
        $someArr = array();
        $someArr['status'] = 'error';
        $someArr['description'] = __('The folder wp-ui was not found and could not be created. Please check the uploads folder permissions.', 'wp-ui');
        $someArr['link'] = $udir;
        echo json_encode($someArr);
        die;
    }
    $results = wpui_jqui_dirs($udir, $url);
    echo $results;
    die;
}