Ejemplo n.º 1
0
function pri($array, $level = 0)
{
    foreach ($array as $key => $val) {
        echo "[" . $key;
        if (is_array($val)) {
            pri($array, $level + 1);
        }
        echo "] => " . $val . "<br>";
    }
}
Ejemplo n.º 2
0
 public function check()
 {
     $feed = new SimplePie();
     $feed->set_feed_url('http://zeenews.india.com/rss/india-national-news.xml');
     $feed->set_cache_location(APPPATH . '/cache');
     $feed->set_output_encoding('ISO-8859-1');
     $feed->init();
     $feed->handle_content_type();
     //        $i = $feed->get_items(0, 500);
     $allFeeds = array();
     foreach ($feed->get_items(0, 100) as $item) {
         if ($author = $item->get_author()) {
             $email = $author->get_email();
             $name = $author->get_name();
             if ($name != '') {
                 $authorname = $name;
             } else {
                 $authorname = $email;
             }
         }
         $date = $item->get_date();
         $singleFeed = array('author' => $item->get_author(), 'authoremail' => $item->get_author(), 'categories' => $item->get_categories(), 'copyright' => $item->get_copyright(), 'content' => $item->get_content(), 'date' => $item->get_date("d.m.Y H:i"), 'description' => $item->get_description(), 'id' => $item->get_id(), 'latitude' => $item->get_latitude(), 'longitude' => $item->get_longitude(), 'permalink' => $item->get_permalink(), 'title' => $item->get_title());
         pri($item);
         array_push($allFeeds, $singleFeed);
         echo $date . '$date<br>';
     }
     die;
 }
Ejemplo n.º 3
0
                    </a>
                </li>
                <li>
                    <a class="filter filter_2" href="javascript: void(0);">
                        <span class="arrow down_arrow"></span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>


<div class="items container clear_fix">
    <?php 
pri($feeds_list);
die;
?>
    <ul class="clear_fix items_list" id="feed_content" style="position: relative;">
        <?php 
$default_image = getDefaultImage();
$count = 1;
if (!empty($feeds_list)) {
    foreach ($feeds_list as $feed) {
        $html = $feed->feed_content;
        preg_match_all('/<img[^>]+>/i', $html, $result);
        $feed_image = $result;
        $date = isset($feed->feed_date) ? $feed->feed_date : date('Y-m-d');
        $feed_image = isset($feed_image[0][0]) ? $feed_image[0][0] : $default_image;
        $feed_title_title = isset($feed->feed_user_title) ? $feed->feed_user_title : '';
        $feed_title = substr($feed_title_title, 0, 40);
	who then uses his open socket connection to the real service (websocket server)
	to transfer the request and return the result from the service to this script.
	The response is then exposed as an application internal resource, that can be easily
	queried by Ajax functions.
	- Christian Fröhlingsdorf, 14.04.2015 EWT ICT Bachelor
	*/
if (!isset($_POST["proxy"])) {
    err("You have not set an action, POST parameter 'proxy' missing!");
}
if (!isset($_POST["delivery"])) {
    $_POST["delivery"] = "";
}
//set to empty string
//callback (anon func PHP 5.0)
$cb = function ($res) {
    pri($res);
};
do_curl_post_request("http://localhost:3536", $_POST["proxy"], $_POST["delivery"], $cb);
//main curl function
function do_curl_get_request($url, $proxy, $delivery, $callback)
{
    $curl = curl_init();
    if (!is_string($proxy)) {
        $proxy = json_encode($proxy);
    }
    if (!is_string($delivery)) {
        $delivery = json_encode($delivery);
    }
    //build the query string
    $url .= "?proxy=" . urlencode($proxy) . "&delivery=" . urlencode($delivery);
    curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => 1));
Ejemplo n.º 5
0
 public function __destruct()
 {
     $feedback = Response::getFeedback();
     if (!empty($feedback)) {
         pri($feedback);
     }
 }
Ejemplo n.º 6
0
function Pre($x, $filter = 1, $se = '', $mh = 200, $sup = 0, $close = '', $log = '')
{
    $nu = 0;
    $m2 = 10;
    $m1 = 0;
    $min = 400;
    $nude = $leg = null;
    #Pre($x,'filter=3&min=300&nude=1');
    if ($y = Param($filter, '&')) {
        extract($y);
    }
    if (is_string($x)) {
        return $x;
    }
    if (is_numeric($x)) {
        return 'numeric:' . $x;
    }
    if (!is_array($x)) {
        return $x;
    }
    if (count($x) == 0) {
        return;
    }
    if ($filter == 3) {
        $m1 = $m2 = 0;
    }
    if ($filter == 2) {
        $mh = 2000;
    }
    if ($filter == 4) {
        $mh = '90%';
    }
    if ($filter) {
        $x = Array_filter($x);
    }
    gt('pre');
    pri($x);
    #preg_replace("~Array\n\t\(~","~Array\n\(\n~"),array("\t",''),$x);
    if ($se and Preg_Match("~{$se}~is", $x)) {
        $x = str_ireplace($se, "<b style='background:#FF0'>{$se}</b>", $x);
        $x = explode("\n", $x);
        #^\[$se^\]
        foreach ($x as $k => $v) {
            if (Preg_Match("~{$se}~is", $v)) {
                $y[$k] = $v;
                unset($x[$k]);
            }
        }
        $x = implode("\n", $y + $x);
        #Highlight search patterns
    }
    #kill("<br>".$y);#print_r($y,1));
    if ($nude) {
        return $x;
    }
    $mt = -10;
    if ($sup) {
        $mt = -4;
    }
    #
    if ($close || $sup) {
        $leg = "<legend style='margin-left:0'>{$close}{$sup}</legend>";
    } else {
        $x = "\n\n" . $x;
    }
    #$m1=10,$m2=21
    $mem = Memuse();
    #if(J9){var_dump($x);kill();}
    if ($nu) {
        return "<pre class='dbpre'>{$x}</pre>";
    }
    return "<fieldset style='min-width:{$min}wpx;border:1px solid #444;padding:0;margin:0 0 0 {$m1};' id='dbf'>{$leg}<pre class='dbpre' style='font:10px courier;white-space:pre-wrap;margin:{$mt} 0 0 {$m2};max-height:{$mh};overflow:auto;'{$log}>" . $x . "</pre></fieldset>";
}