Description
This PHP file is an addon for our premium plugin Articles. It (yet) requires a bit knowledge of PHP.
Usage
Usage
To get started upload the PHP file to your webserver and add following code at the top of your page:
<?php
include "ArticlesAPI.php";Below that code you set up the connection with the database:
<?php
include "ArticlesAPI.php";
/*
* Init API
*/
$articlesAPI = new ArticlesAPI();
$articlesAPI->connect("DatabaseHost", "DatabasePort", "TableName", "AccessUsername", "AccessPassword");
?>The API provides two main functions:
$articlesAPI->getArticle(ID)
- Returns an instance of Article by the given ID; throws ArticleNotFoundException
$articlesAPI->getArticles()
- Returns an array of articlesArticle Class:
$articlesAPI->getArticle(0)->getID()
- Returns the article's ID
$articlesAPI->getArticle(0)->getCreator()
- Returns the article's creator
$articlesAPI->getArticle(0)->getTitle()
- Returns the article's title
$articlesAPI->getArticle(0)->getComments()
- Returns an array of an article's comments
$articlesAPI->getArticle(0)->getUps()
- Returns the amount of positive ratings the article has recieved
$articlesAPI->getArticle(0)->getDowns()
- Returns the amount of negative ratings the article has recieved
$articlesAPI->getArticle(0)->getAllowed()
- Returns an array with the the players' uuid which are allowed to access the article
$articlesAPI->getArticle(0)->getLines()
- Returns an array with the article's linesComment Class:
Comment->getConent()
- Returns the comment's text
Comment->getCreator()
- Returns the comment's creatorArticleNotFoundException Class:
Inherits all methods of a standart PHP Exception and:
Exception->getID()
- Returns the ID of the article that caused the exceptionDemo Website
<?php
include "ArticlesAPI.php";
/*
* Init API
*/
$articlesAPI = new ArticlesAPI();
$articlesAPI->connect("localhost", "3306", "articles_data", "root", "");
?>
<html>
<body>
<?php
foreach($articlesAPI->getArticles() as $article){
echo "Article #".$article->getID()."<ul><li>Name: ".$article->getCreator()."</li><li>Title: ".$article->getTitle()."</li> <li>Thumbs up: ".$article->getUps()."</li><li>Thumbs down: ".$article->getDowns()."</li></ul>";
}
?>
</body>
</html>Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta