本文整理汇总了PHP中ConnectionFactory::getDataConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory::getDataConnection方法的具体用法?PHP ConnectionFactory::getDataConnection怎么用?PHP ConnectionFactory::getDataConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionFactory
的用法示例。
在下文中一共展示了ConnectionFactory::getDataConnection方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public function dispatch()
{
$connection = ConnectionFactory::getDataConnection();
$bookmarks = $connection->getBookmarks();
$template = new BookmarksTemplate($bookmarks, "Bookmarks");
$template->showTemplate();
}
示例2: parseFavouriteSites
/**
* Retrieve favourite sites and fill data in template.
*/
private function parseFavouriteSites($template)
{
try {
$connection = ConnectionFactory::getDataConnection();
$favourites = $connection->getWebsiteFavourites();
foreach ($favourites as $id => $favourite) {
$name = $favourite->getName();
$link = SERVER_HOST_AND_PATH . "php/scraper" . $favourite->getLink();
switch ($favourite->getType()) {
case "movie":
$template->setFavouriteMovieWebsite(array($name, $link));
break;
case "serie":
$template->setFavouriteSerieWebsite(array($name, $link));
break;
case "documentary":
$template->setFavouriteDocumentaryWebsite(array($name, $link));
break;
case "anime":
$template->setFavouriteAnimeWebsite(array($name, $link));
break;
}
}
} catch (Exception $e) {
//Ignored exception
}
}
示例3: dispatch
public function dispatch()
{
$connection = ConnectionFactory::getDataConnection();
$scrapers = $connection->getScrapers();
if ($scrapers) {
$template = new WebsitesTemplate($scrapers, "..:: Xtreamer Video on Demand ::....:: xVoD ::..");
//Check for type filter
if (isset($_GET["type"])) {
$template->setShowType($_GET["type"]);
}
$template->showTemplate();
} else {
}
}
示例4: dispatch
public function dispatch()
{
if (isset($_GET["data"])) {
//Save
$bookmarkId = $_GET["data"];
$connection = ConnectionFactory::getDataConnection();
if ($connection->deleteBookmark($bookmarkId)) {
echo "OK";
} else {
echo "ERROR";
}
} else {
echo "ERROR";
}
}
示例5: dispatch
public function dispatch()
{
$subaction = $_GET["subaction"];
switch ($subaction) {
case ViewFavouritePageAction::SUBACTION_FAVOURITE_DELETE:
//--------------------------------
if (isset($_GET["id"])) {
$connection = ConnectionFactory::getDataConnection();
$connection->deleteBookmark($_GET["id"]);
}
break;
}
//Show default template
$template = new FavouriteWebTemplate();
$connection = ConnectionFactory::getDataConnection();
$bookmarks = $connection->getBookmarks();
$template->setFavourites($bookmarks);
$template->show();
}
示例6: dispatch
public function dispatch()
{
if (isset($_GET["id"])) {
//Save
$websiteId = $_GET["id"];
$connection = ConnectionFactory::getDataConnection();
$website = $connection->getScraperById($websiteId);
if ($website) {
$type = $website->getType();
if ($website->getType() == "mixed") {
$type = "movie";
}
var_dump($website);
$connection->addWebsiteFavourite($website->getId(), $type, $website->getName(), $website->getLink());
echo "OK";
} else {
echo "ERROR";
}
} else {
echo "ERROR";
}
}
示例7: dispatch
public function dispatch()
{
if (isset($_GET["data"])) {
//Save
$data = explode("-", $_GET["data"]);
$title = base64_decode($data[0]);
$link = base64_decode($data[1]);
$link = substr($link, strpos($link, "xVoD") + 5);
$image = base64_decode($data[2]);
if ($title && $link) {
$connection = ConnectionFactory::getDataConnection();
if ($connection->getBookmarkByLink($link) == null) {
$connection->addBookmark($title, $description, $link, $image);
}
echo "OK";
} else {
echo "ERROR";
}
} else {
echo "ERROR";
}
}
示例8: rename
<?php
$oldDB = "data/db/xvod.sqlite3.db";
$newDB = "data/db/xvod.sqlite3.new.db";
$configFile = "config/config.php";
if (file_exists($oldDB) && file_exists($newDB)) {
//Get connection
$connection = ConnectionFactory::getDataConnection();
//Get user bookmarks
$bookmarks = $connection->getBookmarks();
//Delete old db and change new one
rename($oldDB, "data/db/xvod.sqlite3.old.db");
rename($newDB, $oldDB);
//Connection to new database
$connection = ConnectionFactory::getDataConnection();
foreach ($bookmarks as $id => $bookmark) {
$connection->addBookmark($bookmark->getName(), $bookmark->getDescription(), $bookmark->getLink(), $bookmark->getImage());
}
//Set updated
$lines = file($configFile);
$out = "";
foreach ($lines as $line) {
if (strpos($line, "UPDATE_DB")) {
$change = strstr($line, "true") ? true : false;
$line = str_replace($change ? "true" : "false", !$change ? "true" : "false", $line);
}
$out .= $line;
}
$f = fopen($configFile, "w");
fwrite($f, $out);
fclose($f);
示例9: showHeader
//.........这里部分代码省略.........
if ( focusidx == getItemInfo(-1,"itemid") ){
"255:192:192";
}else{
"32:32:32";
}
</script>
</backgroundColor>
</text>
<text redraw="yes" offsetXPC="1" offsetYPC="1" widthPC="1" heightPC="6" backgroundColor="0:0:0">
</text>
<text redraw="yes" offsetXPC="98" offsetYPC="1" widthPC="1" heightPC="6" backgroundColor="0:0:0">
</text>
<text redraw="yes" offsetXPC="1" offsetYPC="93" widthPC="1" heightPC="6" backgroundColor="0:0:0">
</text>
<text redraw="yes" offsetXPC="98" offsetYPC="93" widthPC="1" heightPC="6" backgroundColor="0:0:0">
</text>
<text redraw="yes" offsetXPC="36" offsetYPC="0" widthPC="60" heightPC="100" fontSize="12" lines="1"
backgroundColor="-1:-1:-1" foregroundColor="255:255:255">
<script>
getItemInfo(-1,"title");
</script>
<foregroundColor>
<script>
if ( focusidx == getItemInfo(-1,"itemid") ){
"0:0:0";
}else{
"255:255:255";
}
</script>
</foregroundColor>
</text>
<!-- ITEM FAVOURITE ICON -->
<?php
$connection = ConnectionFactory::getDataConnection();
$websites = $connection->getWebsiteFavourites();
foreach ($websites as $id => $favourite) {
switch ($favourite->getType()) {
case "movie":
$movie = $id;
break;
case "serie":
$serie = $id;
break;
case "documentary":
$documentary = $id;
break;
case "anime":
$anime = $id;
break;
}
}
$condition = '( getItemInfo(-1,"scraperid") == "' . $movie . '" ) || ' . '( getItemInfo(-1,"scraperid") == "' . $serie . '" ) || ' . '( getItemInfo(-1,"scraperid") == "' . $documentary . '" ) || ' . '( getItemInfo(-1,"scraperid") == "' . $anime . '" )';
?>
<image redraw="no" offsetXPC="2" offsetYPC="4" widthPC="8" heightPC="92">
<script>
if( <?php
echo $condition;
?>
)
"<?php
echo XTREAMER_IMAGE_PATH;
?>
img/star.png";
else
"";
</script>
示例10: getFavouriteScrapers
/**
* Get scrapers marked as favourites to show it on first xVoD screen.
* @return array Scrapers mark as favourites.
*/
private function getFavouriteScrapers($forceLoad)
{
if (!$forceLoad && isset($_SESSION["webScrapersFavourites"])) {
$favourites = unserialize($_SESSION["webScrapersFavourites"]);
} else {
$connection = ConnectionFactory::getDataConnection();
$favourites = $connection->getWebsiteFavourites();
$_SESSION["webScrapersFavourites"] = serialize($favourites);
}
return $favourites;
}