system.php 2.41 KB
<?php
class Flora_Api_Service_System extends Flora_Api_Service
{
    const API_LANGUAGES_BYID = "system/language";
    const API_LANGUAGES_LIST = "system/languages";
    const API_PAGE_BYID = "system/page";
    const API_SNIPPET_BYID = "system/snippet";
    const API_PAGES_LIST = "system/pages";
    const API_IP_INFO = "system/ipinfo";
    const API_FEEDBACK = "system/feedback";
    const API_INFLECT = "system/inflect";
    const API_INFLECT_COUNT = "system/inflectcount";
    const API_SITE_MAP = "system/sitemap";

    /**
     * @param $id
     * @return Flora_Model_Language
     */
    public function getLanguageById($id)
    {
        return $this->call(self::API_LANGUAGES_BYID, array("id" => $id));
    }

    /**
     * @return Flora_Collection|Flora_Model_Language[]
     */
    public function getLanguagesList()
    {
        return $this->call(self::API_LANGUAGES_LIST);
    }

    /**
     * @param $id
     * @return Flora_Model_Page
     */
    public function getPageById($id)
    {
        return $this->call(self::API_PAGE_BYID, array("id" => $id));
    }

    /**
     * @param $id
     * @return Flora_Model_Snippet
     */
    public function getSnippetById($id)
    {
        return $this->call(self::API_SNIPPET_BYID, array("id" => $id));
    }

    /**
     * @param $category
     * @return Flora_Model_Page[]|Flora_Collection
     */
    public function getPagesList($category = '')
    {
        return $this->call(self::API_PAGES_LIST, array("category" => $category));
    }

    /**
     * @param $email
     * @param $text
     * @return bool
     */
    public function sendFeedback($email, $text)
    {
        return $this->call(self::API_FEEDBACK, array(), array('email' => $email, 'text' => $text));
    }

    /**
     * @param $word
     * @return Flora_Model_Inflect
     */
    public function getInflect($word)
    {
        return $this->call(self::API_INFLECT, array('word' => $word), array());
    }

    /**
     * @param $word
     * @param $count
     * @return Flora_Model_Inflect_Count
     */
    public function getInflectCount($word, $count)
    {
        return $this->call(self::API_INFLECT_COUNT, array('word' => $word, 'count' => $count), array());
    }

    /**
     * @param string $key
     * @param string $data
     * @return array
     */
    public function getSiteMap($key = 'id', $data = 'bouquets')
    {
        return $this->call(self::API_SITE_MAP, ['key' => $key, 'data' => $data]);
    }
}