Пример #1
0
        if (strstr($file, 'example') && strstr($file, 'php')) {
            if ($num) {
                $prevNum = $num;
            }
            $num = intval(str_replace(array('example', '.php'), '', basename($file)));
            $n++;
            $bbb = explode('_', basename($file), 2);
            if (isset($bbb[1])) {
                $bbb[1] = str_replace('.php', '', $bbb[1]);
            }
            if (isset($bbb[1])) {
                $thumbName = 'image-zoom_' . $num . '_' . $bbb[1] . '.jpg';
            } else {
                $thumbName = 'image-zoom_' . $num . '.jpg';
            }
            $exampleThumb = checkRemoteFile('http://www.ajax-zoom.com/pic/layout/' . $thumbName);
            $isVario = basename($file) == 'example33_vario.php';
            echo "<a href='examples/" . basename($file) . ($isVario ? '?zoomDir=/pic/zoom/animals' : '') . "' target='_blank' style='display: block; float: left' class='rbox'>\r\n                <div id='example__" . $n . "' class='exampleImg shadow'>\r\n                    <div class='exampleHead shadow'>" . basename($file) . "</div>\r\n                </div>\r\n                </a>";
            ?>
                <script type="text/javascript">
                    $('<img>')
                    .load(function(){$('#example__<?php 
            echo $n;
            ?>
').css('background-image', 'url(<?php 
            echo $exampleThumb;
            ?>
)')})
                    .error(function(){
                        $('#example__<?php 
            echo $n;
Пример #2
0
 public static function getRandomUrl($url)
 {
     //echo $url;
     $originalUrl = $url;
     $url = trim(preg_replace('/\\s\\s+/', ' ', $url));
     $url = str_replace(" ", "", $url);
     $url = str_replace("[ '", "['", $url);
     $url = substr($url, 1, -1);
     $url = str_replace("',\"", "','", $url);
     $url = str_replace("\",\"", "','", $url);
     $url = str_replace("\",'", "','", $url);
     $url = str_replace("','", "','", $url);
     $url = str_replace("','", "','", $url);
     $url = str_replace(",''", "", $url);
     $splits = explode("','", $url);
     //die ($url);
     if (sizeof($splits) == 0) {
         //	echo "going in again";
         return Question::getRandomUrl($url);
     }
     $url = $splits[rand(0, sizeof($splits) - 1)];
     if (substr($url, 0, 1) == "'") {
         $url = substr($url, 1);
     }
     if (substr($url, 0, 1) == "\"") {
         $url = substr($url, 1);
     }
     if (substr($url, -1) == "'") {
         $url = substr($url, 0, -1);
     }
     if (checkRemoteFile($url)) {
         return $url;
     } else {
         return Question::getRandomUrl($url);
     }
 }
Пример #3
0
function csv_to_array($filename = '', $delimiter = ',')
{
    //<--this function converts the csv file into array
    $header = NULL;
    $data = array();
    if (checkRemoteFile($filename)) {
        if (($handle = fopen($filename, 'r')) !== FALSE) {
            while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
                if (!$header) {
                    $header = $row;
                } else {
                    $data[] = array_combine($header, $row);
                }
            }
            fclose($handle);
        }
    }
    return $data;
}
Пример #4
0
-------------------------------------------------------------------------------------------------*/
# This grabs the keyword off the url -- index.php?keyword=Clouds
$keyword = $_GET['keyword'];
# only do this if we've already passed in a keyword (i.e. it's not blank)
if ($keyword != "") {
    # Load the data from Google via cURL
    $curl_handle = curl_init();
    curl_setopt($curl_handle, CURLOPT_URL, "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=" . $keyword);
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    $contents = curl_exec($curl_handle);
    curl_close($curl_handle);
    # Parse out all the images
    while ($image != "" or $cursor == 0) {
        $image = get_string_between($contents, 'unescapedUrl":"', '",');
        # Only display the image if our function verifies it's valid
        if (checkRemoteFile($image)) {
            echo "<img src='" . $image . "' style='width:100px; height:100px'><br/>";
        }
    }
}
/*-------------------------------------------------------------------------------------------------
get_string_between
Allows us to parse out strings from our results
-------------------------------------------------------------------------------------------------*/
function get_string_between($string, $start, $end)
{
    global $cursor;
    $string = " " . $string;
    $ini = strpos($string, $start, $cursor);
    if ($ini == 0) {
        return "";
Пример #5
0
			<div class="story-author">
				Submission by: <?php 
the_author();
?>
			</div>
			<br />

		</div>

		
		<div class="post-content scrollview">
			<?php 
/* display thumbnail if there is one, display default image if error is returned */
if (has_post_thumbnail()) {
    $thumburl = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    $status = checkRemoteFile($thumburl);
    if ($status == true) {
        ct_founder_featured_image();
    } else {
        echo '<div class="featured-image" style="background-image: url(\'' . get_bloginfo("stylesheet_directory") . '/images/default-image.jpg\'' . ')"></div>';
    }
}
?>

	        <?php 
the_content();
?>

	    </div>

		<?php 
Пример #6
0
 * in prior version, this file was not so reliable
 * this time it has complete set of instruction 
 * and proper downloader
 * @Author : Arslan Hassan
 * @License : Attribution Assurance License -- http://www.opensource.org/licenses/attribution.php
 * @Since : 01 July 2009
 */
include "../includes/config.inc.php";
include "../includes/classes/curl/class.curl.php";
error_reporting(E_ALL ^ E_NOTICE);
if (isset($_POST['check_url'])) {
    $url = $_POST['check_url'];
    $types_array = preg_replace('/,/', ' ', strtolower(config('allowed_types')));
    $types_array = explode(' ', $types_array);
    $file_ext = strtolower(getExt(strtolower($url)));
    if (checkRemoteFile($url) && in_array($file_ext, $types_array)) {
        echo json_encode(array('ok' => 'yes'));
    } else {
        echo json_encode(array('err' => 'Invalid remote url'));
    }
    exit;
}
/**
 * Call back function of cURL handlers
 * when it downloads a file, it works with php >= 5.3.0
 * @param $download_size total file size of the file
 * @param $downloaded total file size that has been downloaded
 * @param $upload_size total file size that has to be uploaded
 * @param $uploadsed total file size that is uploaded
 *
 * Writes the log in file