function bnc_get_title_image()
{
    $ids = bnc_wp_touch_get_menu_pages();
    $title_image = $ids['main_title'];
    if (file_exists(compat_get_plugin_dir('wptouch') . '/images/icon-pool/' . $title_image)) {
        $image = compat_get_plugin_url('wptouch') . '/images/icon-pool/' . $title_image;
    } else {
        if (file_exists(compat_get_upload_dir() . '/wptouch/custom-icons/' . $title_image)) {
            $image = compat_get_upload_url() . '/wptouch/custom-icons/' . $title_image;
        }
    }
    return $image;
}
function bnc_get_icon_locations()
{
    $locations = array('default' => array(compat_get_plugin_dir('wptouch') . '/images/icon-pool', compat_get_plugin_url('wptouch') . '/images/icon-pool'), 'custom' => array(compat_get_upload_dir() . '/wptouch/custom-icons', compat_get_upload_url() . '/wptouch/custom-icons'));
    return $locations;
}
Beispiel #3
0
<?php

$max_size = 128 * 4096;
// 512k
$directory_list = array();
if (current_user_can('upload_files')) {
    check_ajax_referer('wptouch-upload');
    $upload_dir = compat_get_upload_dir() . "/wptouch/custom-icons" . ltrim($dir[1], '/');
    $dir_paths = explode('/', $upload_dir);
    $dir = '';
    foreach ($dir_paths as $path) {
        $dir = $dir . "/" . $path;
        if (!file_exists($dir)) {
            @mkdir($dir, 0755);
        }
    }
    if (isset($_FILES['submitted_file'])) {
        $f = $_FILES['submitted_file'];
        if ($f['size'] <= $max_size) {
            if ($f['type'] == 'image/png' || $f['type'] == 'image/jpeg' || $f['type'] == 'image/gif' || $f['type'] == 'image/x-png' || $f['type'] == 'image/pjpeg') {
                @move_uploaded_file($f['tmp_name'], $upload_dir . "/" . $f['name']);
                if (!file_exists($upload_dir . "/" . $f['name'])) {
                    echo __('<p style="color:red; padding-top:10px">There seems to have been an error.<p>Please try your upload again.</p>', 'wptouch');
                } else {
                    echo __('<p style="color:green; padding-top:10px">File has been saved and added to the pool.</p>', 'wptouch');
                }
            } else {
                echo __('<p style="color:orange; padding-top:10px">Sorry, only PNG, GIF and JPG images are supported.</p>', 'wptouch');
            }
        } else {
            echo __('<p style="color:orange; padding-top:10px">Image too large. try something like 59x60.</p>', 'wptouch');
Beispiel #4
0
<?php

$max_size = 128 * 4096;
// 512k
$directory_list = array();
if (current_user_can('upload_files')) {
    $nonce = $_REQUEST['_ajax_nonce'];
    if (!wp_verify_nonce($nonce, 'wptouch-upload')) {
        die('Nonce error');
    }
    $upload_dir = compat_get_upload_dir() . "/wptouch/custom-icons";
    $dir_paths = explode('/', $upload_dir);
    $dir = '';
    foreach ($dir_paths as $path) {
        $dir = $dir . "/" . $path;
        if (!file_exists($dir)) {
            @mkdir($dir, 0755);
        }
    }
    if (isset($_FILES['submitted_file'])) {
        $f = $_FILES['submitted_file'];
        if ($f['size'] <= $max_size) {
            $current_file = $f['name'];
            $path_parts = pathinfo($current_file);
            if (preg_match('#^(gif|jpg|jpeg|jpe|png)$#i', $path_parts['extension'])) {
                @move_uploaded_file($f['tmp_name'], $upload_dir . "/" . $f['name']);
                if (!file_exists($upload_dir . "/" . $f['name'])) {
                    echo __('<p style="color:red; padding-top:10px">There seems to have been an error.<p>Please try your upload again.</p>', 'wptouch');
                } else {
                    echo __('<p style="color:green; padding-top:10px">File has been saved and added to the pool.</p>', 'wptouch');
                }
?>
</p>
				<strong><?php 
_e("Logo/Bookmark Icons", "wptouch");
?>
</strong>
				<p><?php 
_e("If you're adding a logo icon, the best dimensions for it are 59x60px when used as a bookmark icon.", "wptouch");
?>
</p>
				<p><?php 
echo sprintf(__("Need help? You can use %sthis easy online icon generator%s to make one.", "wptouch"), "<a href='http://www.flavorstudios.com/iphone-icon-generator' target='_blank'>", "</a>");
?>
</p>
				<p><?php 
echo sprintf(__("These files will be stored in the<br />%s%s/wptouch/custom-icons%s<br />folder we create.", "wptouch"), "<strong>", str_replace(ABSPATH, "", compat_get_upload_dir()), "</strong>");
?>
</p>
				<p><?php 
echo sprintf(__("If an upload fails (usually it's a permission problem) create the folder yourself using FTP and try again.", "wptouch"), "<strong>", "</strong>");
?>
</p>
						
				<div id="upload_button"></div>

				<!-- <div id="extras_button">
					<a href="#" onclick="alert('This does nothing yet');return false;"><img src="<?php 
echo compat_get_plugin_url('wptouch') . '/images/extras.png';
?>
" alt="extras" /></a>
				</div> -->