Пример #1
0
 function testNET_API_Blogger()
 {
     $Blogger = new Blogger();
     $Blogger->Login('bcarrdba');
     $res = $Blogger->GetBlogEntries();
     $this->assertTrue(count($res), 'No blogs found');
     $profile = $Blogger->GetProfileByID();
     $this->assertTrue($profile, 'No profile received');
     if ($profile) {
         $details = $profile->GetPersonalDetails();
         $this->assertTrue($details, 'No details received');
     }
     /** end tests */
 }
Пример #2
0
 public static function _list()
 {
     $warning = "";
     if (isset($_POST['delete_post'])) {
         ///check if a user is logged in and if the logged in user is the one that wrote the blog post
         if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $_POST['user_id']) {
             Post::destroy($_POST['id']);
         } else {
             $warning = 'Sorry, you do not have permissions to delete that post';
         }
     }
     if (isset($_POST['update_post'])) {
         ///check if a user is logged in and if the logged in user is the one that wrote the blog post
         if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $_POST['user_id']) {
             Post::edit($_POST, $_POST['id']);
         } else {
             $warning = 'Sorry, you do not have permissions to edit that post';
         }
     }
     if (isset($_POST['create_post'])) {
         ///check if a user is logged in
         if (isset($_SESSION['user_id'])) {
             $_POST['user_id'] = $_SESSION['user_id'];
             Post::create($_POST);
         } else {
             $warning = 'Sorry, you must be logged in to submit a post';
         }
     }
     $posts_array = Post::getAll();
     if ($posts_array) {
         foreach ($posts_array as $post) {
             $blogger = Blogger::getOne($post['user_id']);
             $post['username'] = $blogger['username'];
         }
     }
     return array('posts' => $posts_array, 'warning' => $warning);
 }
Пример #3
0
Файл: blog.php Проект: kvox/TVSS
<?php

require_once "includes/blogger.class.php";
if (file_exists($basepath . "/plugins/blogger/language/" . $language . "/general.php")) {
    require_once $basepath . "/plugins/blogger/language/" . $language . "/general.php";
} else {
    require_once $basepath . "/plugins/blogger/language/" . $default_language . "/general.php";
}
$blogger = new Blogger();
$perpage = 10;
if (!isset($blog_page)) {
    $blog_page = 1;
}
$posts = $blogger->getPosts($blog_page, $perpage, array("language" => $language));
if (!count($posts)) {
    $posts = $blogger->getPosts($blog_page, $perpage);
    $total_posts = $blogger->getPostCount();
    $max_pages = ceil($total_posts / $perpage);
} else {
    $total_posts = $blogger->getPostCount(array("language" => $language));
    $max_pages = ceil($total_posts / $perpage);
}
if (count($posts)) {
    foreach ($posts as $key => $val) {
        $content = $val['content'];
        $content = str_replace("<br />", "\n", $content);
        $content = str_replace("<br/>", "\n", $content);
        $content = strip_tags($content);
        $content = explode("\n", $content);
        $excerpt = '';
        foreach ($content as $content_id => $chunk) {
Пример #4
0
<?php

if (!defined("IN_SCRIPT")) {
    print "<script> window.location = 'index.php'; </script>";
    exit;
}
require_once $basepath . "/plugins/blogger/includes/blogger.class.php";
require_once $basepath . "/plugins/blogger/includes/simplepie.class.php";
$blogger_license_key = $settings->getSetting("blogger_license_key");
if (empty($blogger_license_key)) {
    $blogger_license_key = '';
}
$blogger = new Blogger($blogger_license_key);
if (!$blogger->valid) {
    print "<script> window.location = 'index.php?menu=plugin&plugin=blogger&plugin_menu=blogger_config'; </script>";
    exit;
}
if (isset($delete)) {
    $blogger->deleteFeed($delete);
}
if (isset($_POST['add_feed'])) {
    $params = $_POST;
    $errors = $blogger->validateFeed($params, false);
    if (!count($errors)) {
        $feed = new SimplePie();
        $feed->enable_order_by_date(false);
        $feed->set_feed_url($_POST['url']);
        $feed->set_item_limit(1);
        $feed->set_stupidly_fast(true);
        $feed->enable_cache(false);
        $feed->init();
Пример #5
0
<?php

require_once "includes/blogger.class.php";
if (file_exists($basepath . "/plugins/blogger/language/" . $language . "/general.php")) {
    require_once $basepath . "/plugins/blogger/language/" . $language . "/general.php";
} else {
    require_once $basepath . "/plugins/blogger/language/" . $default_language . "/general.php";
}
$blogger = new Blogger();
$post = $blogger->getPosts(1, 10, array("perma" => $perma));
if (count($post)) {
    foreach ($post as $post_id => $post_data) {
        $post_data['tags'] = $blogger->getTags($post_id);
        if ($post_data['original_url']) {
            $post_data['content'] .= "<div class=\"clear\"></div><br /><a href=\"" . $post_data['original_url'] . "\" target=\"_blank\" class=\"blog_read_more\">(Source)</a><div class=\"clear\"></div>";
        }
        $smarty->assign("post_data", $post_data);
        $smarty->assign("post_id", $post_id);
    }
} else {
    $smarty->assign("post_id", 0);
}
Пример #6
0
<html>
  <head>
    <title></title>
  </head>
  <body>
    <p>
      <?php 
class Person
{
    public static function say()
    {
        echo "Here are my thoughts!";
    }
}
class Blogger extends Person
{
    const cats = 50;
}
echo Blogger::cats;
Blogger::say();
?>
    </p>
  </body>
</html>


Пример #7
0
function post_data($id)
{
    set_time_limit(0);
    require_once "Zend/Loader.php";
    require_once "lib/blogger.php";
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_Query');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    global $wpdb;
    $options = unserialize(get_option("cbrobot_options"));
    try {
        $obj_blogger = new Blogger();
        $param = array();
        $sql = "SELECT * \r\n\t\t\t\t        FROM " . $wpdb->prefix . "cbrobot_queues \r\n\t\t\t\t\t\tWHERE id = '" . $id . "'";
        $row = $wpdb->get_row($sql);
        if ($row) {
            $param['title'] = base64_decode($row->title);
            $param['content'] = base64_decode($row->content);
            $param['blog_id'] = $row->blog_id;
            $param['email'] = $row->blog_email;
            $param['password'] = $row->blog_password;
            if ($obj_blogger->post($param)) {
                echo '<div class="updated"><p>' . __('Post Asin : ' . $row->asin . ' Success.', 'cbrobot') . '</p></div>';
                flush();
                $wpdb->query("UPDATE " . $wpdb->prefix . "cbrobot_queues SET queue_status = 'Y' WHERE id = '" . $id . "'");
                flush();
            }
        }
    } catch (Exception $e) {
        echo '<div class="error"><p>' . __('***' . $e->getMessage() . '***', 'cbrobot') . '</p></div>';
        flush();
    }
}
<?php

class Person
{
    public static function say()
    {
        echo "Here are my thoughts!";
    }
}
class Blogger extends Person
{
    const cats = 50;
}
echo Blogger::say();
echo Blogger::cats;
Пример #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBloggers()
 {
     return $this->hasMany(Blogger::className(), ['author' => 'id']);
 }
Пример #10
0
 public static function _list()
 {
     $warning = "";
     ///delete blogger form controller
     if (isset($_POST['delete_blogger'])) {
         ///check if a user is logged in and if the logged in user is the one trying to delete themselves
         if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $_POST['id']) {
             Blogger::destroy($_POST['id']);
         } else {
             $warning = 'Sorry, you do not have permissions to delete that user';
         }
     }
     //update blogger form controller
     if (isset($_POST['update_blogger'])) {
         ///check if a user is logged in and if the logged in user is the one trying to edit the user
         if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $_POST['id']) {
             //if new password was not sent, edit the blogger's username or email
             if ($_POST['password'] == '') {
                 Blogger::edit($_POST, $_POST['id']);
             } else {
                 if ($_POST['password'] != '' && $_POST['old_password'] != '') {
                     //get old password for blogger and check that it matches
                     $blogger = Blogger::getOne($_POST['id']);
                     $old_password = md5($_POST['old_password'], false);
                     if ($old_password == $blogger['password']) {
                         Blogger::edit($_POST, $_POST['id']);
                     } else {
                         $warning = 'Old password does not match password in the database';
                     }
                 } else {
                     $warning = 'You must provide an old password to change passwords.';
                 }
             }
         } else {
             $warning = 'Sorry, you do not have permissions to edit that user';
         }
     }
     //create blogger form controller
     if (isset($_POST['create_blogger'])) {
         //check if all fields are present
         //NOTE: in most real world application this check would be done in Javascript
         //      in order to avoid refreshing the page and losing the user's data
         if ($_POST['username'] != "" && $_POST['email'] != "" && $_POST['password'] != "" && $_POST['confirm_password'] != "") {
             //check if password and confirm password match
             //NOTE: in most real world application this check would be done in Javascript
             //      in order to avoid refreshing the page and losing the user's data
             if ($_POST['password'] == $_POST['confirm_password']) {
                 Blogger::create($_POST);
             } else {
                 $warning = 'Password and confirm password must match';
             }
         } else {
             $warning = 'Please enter all fields to register a user';
         }
     }
     if (isset($_POST['login_blogger'])) {
         if ($_POST['username'] != '' && $_POST['password'] != '') {
             $blogger = Blogger::login($_POST);
             if ($blogger) {
                 $_SESSION['user_id'] = $blogger['id'];
             } else {
                 $warning = 'No blogger with that username and database exists in our database';
             }
         } else {
             $warning = 'Please enter both username and password';
         }
     }
     if (isset($_POST['logout_blogger'])) {
         unset($_SESSION['user_id']);
     }
     $blogger_array = Blogger::getAll();
     return array('bloggers' => $blogger_array, 'bloggerWarning' => $warning);
 }
Пример #11
0
<?php

require_once "includes/blogger.class.php";
if (file_exists($basepath . "/plugins/blogger/language/" . $language . "/general.php")) {
    require_once $basepath . "/plugins/blogger/language/" . $language . "/general.php";
} else {
    require_once $basepath . "/plugins/blogger/language/" . $default_language . "/general.php";
}
$blogger = new Blogger();
if (!isset($perma)) {
    header("location: {$baseurl}/blog");
    exit;
}
$perpage = 10;
if (!isset($blog_page)) {
    $blog_page = 1;
}
$tag = $blogger->getTagByPerma($perma);
if (!$tag) {
    header("location: {$baseurl}/blog");
    exit;
}
$posts = $blogger->getPostsByTag($perma, $blog_page, $perpage, array("language" => $language));
if (!count($posts)) {
    $posts = $blogger->getPostsByTag($perma, $blog_page, $perpage);
    $total_posts = $blogger->getPostCountByTag($tag['id']);
    $max_pages = ceil($total_posts / $perpage);
} else {
    $total_posts = $blogger->getPostCountByTag($tag['id'], array("language" => $language));
    $max_pages = ceil($total_posts / $perpage);
}
Пример #12
0
<?php

if (!defined("IN_SCRIPT")) {
    print "<script> window.location = 'index.php'; </script>";
    exit;
}
require_once $basepath . "/plugins/blogger/includes/blogger.class.php";
$blogger_license_key = $settings->getSetting("blogger_license_key");
if (empty($blogger_license_key)) {
    $blogger_license_key = '';
}
$blogger = new Blogger($blogger_license_key);
if (!$blogger->valid) {
    print "<script> window.location = 'index.php?menu=plugin&plugin=blogger&plugin_menu=blogger_config'; </script>";
    exit;
}
if (isset($_POST['add_post'])) {
    $params = $_POST;
    $errors = $blogger->validatePost($params);
    if (!count($errors)) {
        $post_id = $blogger->addPost($params);
        $add_success = true;
    }
}
if (isset($_POST['update_post']) && isset($_POST['post_id'])) {
    $params = $_POST;
    $errors = $blogger->validatePost($params);
    if (!count($errors)) {
        $blogger->updatePost($_POST['post_id'], $params);
        $upd_success = true;
    }
Пример #13
0
<?php

if (!defined("IN_SCRIPT")) {
    print "<script> window.location = 'index.php'; </script>";
    exit;
}
require_once $basepath . "/plugins/blogger/includes/blogger.class.php";
$blogger_license_key = $settings->getSetting("blogger_license_key");
if (empty($blogger_license_key)) {
    $blogger_license_key = '';
}
$blogger = new Blogger($blogger_license_key);
if (!$blogger->valid) {
    print "<script> window.location = 'index.php?menu=plugin&plugin=blogger&plugin_menu=blogger_config'; </script>";
    exit;
}
if (isset($_REQUEST['delete_post_id'])) {
    $blogger->deletePost($_REQUEST['delete_post_id']);
}
if (!isset($page) || !$page || !is_numeric($page)) {
    $page = 1;
}
$total = $blogger->getPostCount();
$posts = $blogger->getPosts($page);
?>

<nav>
    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li>
                <a href="index.php"><i class="icon-home"></i></a>
Пример #14
0
@set_time_limit(0);
require_once "../../vars.php";
require_once "./includes/simplepie.class.php";
require_once "./includes/blogger.class.php";
require_once "../../includes/curl.php";
require_once "../../includes/settings.class.php";
/*
$feed_url = "http://ricokerosine.blogspot.com/feeds/posts/default";
$feed_url = "http://feeds.feedburner.com/sorozataddikt";
*/
/*
$feed_data = array();
$feed_data['language'] = "hu";
$feed_data['url'] = "http://feeds.feedburner.com/sorozataddikt";
*/
$blogger = new Blogger();
$curl = new Curl();
$max_items = 10;
$feeds = $blogger->getFeeds();
if (!count($feeds)) {
    print "no feeds\n";
    exit;
}
foreach ($feeds as $feed_id => $feed_data) {
    $now = date("Y-m-d H:i:s");
    if ($now < date("Y-m-d H:i:s", strtotime("+{$feed_data['frequency']} minutes", strtotime($feed_data['last_checked'])))) {
        print "no need to check just yet\t{$feed_data['url']}\n";
        continue;
    }
    $feed = new SimplePie();
    $feed->enable_order_by_date(false);