本文整理汇总了PHP中Publisher类的典型用法代码示例。如果您正苦于以下问题:PHP Publisher类的具体用法?PHP Publisher怎么用?PHP Publisher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Publisher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testToStringUsesDefaultStringFormat
public function testToStringUsesDefaultStringFormat()
{
$author = new Author();
$author->setFirstName('John');
$author->setLastName('Doe');
$expected = <<<EOF
Id: null
FirstName: John
LastName: Doe
Email: null
Age: null
EOF;
$this->assertEquals($expected, (string) $author, 'generated __toString() uses default string format and exportTo()');
$publisher = new Publisher();
$publisher->setId(345345);
$publisher->setName('Peguinoo');
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<Id>345345</Id>
<Name><![CDATA[Peguinoo]]></Name>
</data>
EOF;
$this->assertEquals($expected, (string) $publisher, 'generated __toString() uses default string format and exportTo()');
}
开发者ID:ketheriel,项目名称:ETVA,代码行数:27,代码来源:OMBuilderTest.php
示例2: post_to_endpoints
public function post_to_endpoints(Post $post)
{
$feeds = array(URL::get('atom_feed'));
foreach (Options::get('pubsubhubbub__endpoints') as $endpoint) {
$p = new Publisher($endpoint);
$p->publish_update($feeds);
}
}
开发者ID:ahutchings,项目名称:habari-pubsubhubbub,代码行数:8,代码来源:pubsubhubbub.plugin.php
示例3: testDetachUnattached
/**
* @covers Panadas\Event\Publisher::detach()
* @covers Panadas\Event\Publisher::unsubscribe()
*/
public function testDetachUnattached()
{
$publisher = new Publisher();
$subscriber = new FooBarSubscriber();
$publisher->detach($subscriber);
$events = $publisher->getEvents();
$this->assertFalse($events->has("foo"));
$this->assertFalse($events->has("bar"));
}
开发者ID:panadas,项目名称:event,代码行数:13,代码来源:PublisherTest.php
示例4: pubsub_post
function pubsub_post()
{
require_once mnminclude . 'pubsubhubbub/publisher.php';
global $globals;
if (!$globals['pubsub']) {
return false;
}
$rss = 'http://' . get_server_name() . $globals['base_url'] . 'rss2.php';
$p = new Publisher($globals['pubsub']);
if ($p->publish_update($rss)) {
syslog(LOG_NOTICE, "Meneame: posted to pubsub ({$rss})");
} else {
syslog(LOG_NOTICE, "Meneame: failed to post to pubsub ({$rss})");
}
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:15,代码来源:external_post.php
示例5: publisher_latest_files_show
function publisher_latest_files_show($options)
{
$publisher = Publisher::getInstance();
/**
* $options[0] : Category
* $options[1] : Sort order - datesub | counter
* $options[2] : Number of files to display
* $oprions[3] : bool TRUE to link to the file download, FALSE to link to the article
*/
$block = array();
$sort = $options[1];
$order = PublisherUtils::getOrderBy($sort);
$limit = $options[2];
$directDownload = $options[3];
// creating the files objects
$filesObj = $publisher->getFileHandler()->getAllFiles(0, _PUBLISHER_STATUS_FILE_ACTIVE, $limit, 0, $sort, $order, explode(',', $options[0]));
/* @var $fileObj PublisherFile */
foreach ($filesObj as $fileObj) {
$aFile = array();
$aFile['link'] = $directDownload ? $fileObj->getFileLink() : $fileObj->getItemLink();
if ($sort == "datesub") {
$aFile['new'] = $fileObj->datesub();
} elseif ($sort == "counter") {
$aFile['new'] = $fileObj->getVar('counter');
} elseif ($sort == "weight") {
$aFile['new'] = $fileObj->getVar('weight');
}
$block['files'][] = $aFile;
}
return $block;
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:31,代码来源:latest_files.php
示例6: publisher_items_menu_show
function publisher_items_menu_show($options)
{
$block = array();
$publisher = Publisher::getInstance();
// Getting all top cats
$block_categoriesObj = $publisher->getCategoryHandler()->getCategories(0, 0, 0);
if (count($block_categoriesObj) == 0) {
return $block;
}
// Are we in Publisher ?
$block['inModule'] = $publisher->isCurrentModule();
$catlink_class = 'menuMain';
$categoryid = 0;
if ($block['inModule']) {
// Are we in a category and if yes, in which one ?
$categoryid = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : 0;
if ($categoryid != 0) {
// if we are in a category, then the $categoryObj is already defined in publisher/category.php
$categoryObj = $publisher->getCategoryHandler()->get($categoryid);
$block['currentcat'] = $categoryObj->getCategoryLink('menuTop');
$catlink_class = 'menuSub';
}
}
/* @var $block_categoryObj PublisherCategory */
foreach ($block_categoriesObj as $catid => $block_categoryObj) {
if ($catid != $categoryid) {
$block['categories'][$catid]['categoryLink'] = $block_categoryObj->getCategoryLink($catlink_class);
}
}
return $block;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:items_menu.php
示例7: action
private function action($form)
{
$session = session_currentSession();
$p = new Publisher();
$p->user = $session->id;
$p->label = $form->name;
$p->short_label = $form->shortname;
$p->key = $this->generateKey();
$p->secret = $this->generateSecret();
$p->domain = $form->domain;
// ISO-8601 2005-08-14T16:13:03+0000;
$time = time() + $value;
$p->created = date('c', $time);
$p->save();
header('location:/account/settings');
}
开发者ID:aventurella,项目名称:Galaxy,代码行数:16,代码来源:ApplicationCreate.php
示例8: publisher_date_to_date_show
function publisher_date_to_date_show($options)
{
$myts = MyTextSanitizer::getInstance();
$publisher = Publisher::getInstance();
$block = array();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('datesub', strtotime($options[0]), '>'));
$criteria->add(new Criteria('datesub', strtotime($options[1]), '<'));
$criteria->setSort('datesub');
$criteria->setOrder('DESC');
// creating the ITEM objects that belong to the selected category
$itemsObj = $publisher->getItemHandler()->getItemObjects($criteria);
$totalItems = count($itemsObj);
if ($itemsObj) {
for ($i = 0; $i < $totalItems; ++$i) {
$newItems['itemid'] = $itemsObj[$i]->getVar('itemid');
$newItems['title'] = $itemsObj[$i]->title();
$newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
$newItems['categoryid'] = $itemsObj[$i]->getVar('categoryid');
$newItems['date'] = $itemsObj[$i]->datesub();
$newItems['poster'] = $itemsObj[$i]->linkedPosterName();
$newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
$newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
$block['items'][] = $newItems;
}
$block['lang_title'] = _MB_PUBLISHER_ITEMS;
$block['lang_category'] = _MB_PUBLISHER_CATEGORY;
$block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
$block['lang_date'] = _MB_PUBLISHER_DATE;
$modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
$block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
$block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
}
return $block;
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:35,代码来源:date_to_date.php
示例9: editTemplate
/**
*
* @url GET /editTemplate
*/
public function editTemplate($params)
{
// Action Validations
if (!isset($_REQUEST['TEMPLATE'])) {
$_REQUEST['TEMPLATE'] = '';
}
if ($_REQUEST['TEMPLATE'] == '') {
throw new Exception('The TEMPLATE parameter is empty.');
}
$data = array('CONTENT' => file_get_contents(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE']), 'TEMPLATE' => $_REQUEST['TEMPLATE']);
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/actionsByEmail_FileEdit', '', $data);
G::RenderPage('publish', 'raw');
die;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:20,代码来源:ActionsByEmail.php
示例10: publisher_pagewrap_upload
function publisher_pagewrap_upload(&$errors)
{
$publisher = Publisher::getInstance();
$post_field = 'fileupload';
$max_size = $publisher->getConfig('maximum_filesize');
$max_imgwidth = $publisher->getConfig('maximum_image_width');
$max_imgheight = $publisher->getConfig('maximum_image_height');
if (!is_dir(PublisherUtils::getUploadDir(true, 'content'))) {
mkdir(PublisherUtils::getUploadDir(true, 'content'), 0757);
}
$allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml');
$uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
if ($uploader->fetchMedia($post_field)) {
$uploader->setTargetFileName($uploader->getMediaName());
if ($uploader->upload()) {
return true;
} else {
$errors = array_merge($errors, $uploader->getErrors(false));
return false;
}
} else {
$errors = array_merge($errors, $uploader->getErrors(false));
return false;
}
}
开发者ID:mambax7,项目名称:publisher-26,代码行数:25,代码来源:pw_upload_file.php
示例11: publisher_search
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @since 1.0
* @author trabis <[email protected]>
* @version $Id$
*/
function publisher_search($queryarray, $andor, $limit, $offset, $userid, $categories = array(), $sortby = 0, $searchin = "", $extra = "")
{
$publisher = Publisher::getInstance();
$ret = array();
if ($queryarray == '' || count($queryarray) == 0) {
$hightlight_key = '';
} else {
$keywords = implode('+', $queryarray);
$hightlight_key = "&keywords=" . $keywords;
}
$itemsObjs = $publisher->getItemHandler()->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra);
$withCategoryPath = $publisher->getConfig('search_cat_path');
$usersIds = array();
/* @var $obj PublisherItem */
foreach ($itemsObjs as $obj) {
$item['image'] = "images/item_icon.gif";
$item['link'] = $obj->getItemUrl();
$item['link'] .= !empty($hightlight_key) && strpos($item['link'], '.php?') === false ? "?" . ltrim($hightlight_key, '&') : $hightlight_key;
if ($withCategoryPath) {
$item['title'] = $obj->getCategoryPath(false) . " > " . $obj->title();
} else {
$item['title'] = $obj->title();
}
$item['time'] = $obj->getVar('datesub');
//must go has unix timestamp
$item['uid'] = $obj->getVar('uid');
//"Fulltext search/highlight
$text = $obj->body();
$sanitized_text = "";
$text_i = strtolower($text);
$queryarray = is_array($queryarray) ? $queryarray : array($queryarray);
//@todo look into xoopslocal
foreach ($queryarray as $query) {
$pos = strpos($text_i, strtolower($query));
//xoops_local("strpos", $text_i, strtolower($query));
$start = max($pos - 100, 0);
$length = strlen($query) + 200;
//xoops_local("strlen", $query) + 200;
$context = $obj->highlight(XoopsLocale::substr($text, $start, $length, " [...]"), $query);
$sanitized_text .= "<p>[...] " . $context . "</p>";
}
//End of highlight
$item['text'] = $sanitized_text;
$item['author'] = $obj->getVar('author_alias');
$item['datesub'] = $obj->datesub($publisher->getConfig('format_date'));
$usersIds[$obj->getVar('uid')] = $obj->getVar('uid');
$ret[] = $item;
unset($item, $sanitized_text);
}
$usersNames = XoopsUserUtility::getUnameFromIds($usersIds, $publisher->getConfig('format_realname'), true);
foreach ($ret as $key => $item) {
if ($item["author"] == '') {
$ret[$key]["author"] = @$usersNames[$item["uid"]];
}
}
unset($usersNames, $usersIds);
return $ret;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:66,代码来源:search.inc.php
示例12: Add
public function Add($params)
{
//print_r($_SESSION['user']);
if (user_admin()) {
$this->view->Show('book_add.tpl', array('books' => Book::Find($this->conn, $params['pubId'], $params['catId']), 'pubs' => array(-1 => '- Все -') + Publisher::GetAll($this->conn), 'pubId' => $params['pubId'], 'cats' => array(-1 => '- Все -') + Category::GetAll($this->conn), 'catId' => $params['catId']));
} else {
$this->view->Show('access_denied.tpl', array('mode' => 'Добавление книги'));
}
}
开发者ID:VitalHawk,项目名称:Library,代码行数:9,代码来源:controller_book.php
示例13: getListPublishers
public static function getListPublishers()
{
$models = Publisher::model()->findAll();
$list = array();
foreach ($models as $key => $model) {
$list[$model->id] = $model->name;
}
return $list;
}
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:9,代码来源:Publisher.php
示例14: setUp
protected function setUp()
{
parent::setUp();
$publisher = new Publisher();
$publisher->setId(1234);
$publisher->setName('Penguin');
$author = new Author();
$author->setId(5678);
$author->setFirstName('George');
$author->setLastName('Byron');
$book = new Book();
$book->setId(9012);
$book->setTitle('Don Juan');
$book->setISBN('0140422161');
$book->setPrice(12.99);
$book->setAuthor($author);
$book->setPublisher($publisher);
$this->book = $book;
}
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:19,代码来源:BaseObjectConvertTest.php
示例15: publish_to_hub
function publish_to_hub($post_id)
{
// we want to notify the hub for every feed
$feed_urls = array();
$feed_urls[] = get_bloginfo('atom_url');
$feed_urls[] = get_bloginfo('rss_url');
$feed_urls[] = get_bloginfo('rdf_url');
$feed_urls[] = get_bloginfo('rss2_url');
// remove dups (ie. they all point to feedburner)
$feed_urls = array_unique($feed_urls);
// get the address of the publish endpoint on the hub
$hub_url = get_pubsub_endpoint();
$p = new Publisher($hub_url);
// need better error handling
if (!$p->publish_update($feed_urls, "http_post_wp")) {
print_r($p->last_response());
}
return $post_id;
}
开发者ID:nfiedel,项目名称:Buzz-to-Blogger,代码行数:19,代码来源:pubsubhubbub.php
示例16: afterSave
public function afterSave($event)
{
if (!$this->Owner->isNewRecord) {
$newAttrs = $this->Owner->getAttributes();
$oldAttrs = $this->getOldAttributes();
$isUpdated = false;
foreach ($newAttrs as $key => $value) {
if (!empty($oldAttrs)) {
if ($oldAttrs[$key] != $value) {
$isUpdated = true;
}
}
}
if ($isUpdated) {
if ($oldAttrs['publisher_id'] != $newAttrs['publisher_id']) {
# add a log when dataset publisher is updated
$publisher = Publisher::model()->findByPk($oldAttrs['publisher_id']);
if ($publisher) {
$this->createLog($this->Owner->id, 'Publisher name updated from : ' . $publisher->name);
}
}
if ($oldAttrs['submitter_id'] != $newAttrs['submitter_id']) {
$submitter = User::model()->findByPk($oldAttrs['submitter_id']);
if ($submitter) {
$this->createLog($this->Owner->id, 'Submitter updated from : ' . $submitter->first_name . ' ' . $submitter->last_name);
}
}
if ($oldAttrs['image_id'] != $newAttrs['image_id']) {
# add a log when dataset image is updated
$this->createLog($this->Owner->id, 'Update image');
}
if ($oldAttrs['upload_status'] != 'Published' and $newAttrs['upload_status'] == 'Published') {
# add a log when dataset is published
$this->createLog($this->Owner->id, 'Dataset publish');
}
if (preg_replace('/\\s+/', ' ', trim($oldAttrs['description'])) != preg_replace('/\\s+/', ' ', trim($newAttrs['description']))) {
$this->createLog($this->Owner->id, 'Description updated from : ' . $oldAttrs['description']);
}
if ($oldAttrs['title'] != $newAttrs['title']) {
$this->createLog($this->Owner->id, 'Title updated from : ' . $oldAttrs['title']);
}
if ($oldAttrs['dataset_size'] != $newAttrs['dataset_size']) {
$this->createLog($this->Owner->id, 'Dataset size updated from : ' . $oldAttrs['dataset_size'] . ' bytes');
}
if ($oldAttrs['modification_date'] != $newAttrs['modification_date']) {
$this->createLog($this->Owner->id, 'Modification date added : ' . $this->Owner->modification_date);
}
if ($oldAttrs['fairnuse'] != $newAttrs['fairnuse']) {
$this->createLog($this->Owner->id, 'Fair Use date added : ' . $this->Owner->fairnuse);
}
}
} else {
$this->createLog($this->Owner->id, 'Dataset Created');
}
}
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:55,代码来源:DatasetBehavior.php
示例17: __construct
function __construct($query, $request_type = 'issn', $sr_api_key = '')
{
$query_string = 'versions=all&' . $request_type . '=' . urlencode($query);
if ($sr_api_key) {
$query_string .= '&ak=' . $sr_api_key;
}
$client = new Zend_HTTP_Client();
$client->setUri('http://www.sherpa.ac.uk/romeo/api29.php?' . $query_string);
$response = $client->request();
if ($response->getStatus() == 200) {
$sr = $response->getBody();
$sr_xml = new DOMDocument();
$sr_xml->loadXML($sr);
$this->num_hits = $sr_xml->getElementsByTagName('numhits')->item(0)->nodeValue;
$this->issn = $sr_xml->getElementsByTagName('issn')->item(0)->nodeValue;
$this->jtitle = $sr_xml->getElementsByTagName('jtitle')->item(0)->nodeValue;
$pubs = $sr_xml->getElementsByTagName('publisher');
for ($i = 0; $i < $pubs->length; $i++) {
$id = $pubs->item($i)->getAttribute('id');
$name = $pubs->item($i)->getElementsByTagName('name')->item(0)->nodeValue;
$p = new Publisher($id, $name);
$p->setPrearchiving($pubs->item($i)->getElementsByTagName('prearchiving')->item(0)->nodeValue);
$p->setPostarchiving($pubs->item($i)->getElementsByTagName('postarchiving')->item(0)->nodeValue);
$p->setPdfarchiving($pubs->item($i)->getElementsByTagName('pdfarchiving')->item(0)->nodeValue);
$prerestrictions_xml = $pubs->item($i)->getElementsByTagName('prerestriction');
$prerestrictions = array();
for ($j = 0; $j < $prerestrictions_xml->length; $j++) {
$prerestrictions[] = strip_tags(trim($prerestrictions_xml->item($j)->nodeValue));
}
$p->setPrerestrictions($prerestrictions);
$postrestrictions_xml = $pubs->item($i)->getElementsByTagName('postrestriction');
$postrestrictions = array();
for ($j = 0; $j < $postrestrictions_xml->length; $j++) {
$postrestrictions[] = strip_tags(trim($postrestrictions_xml->item($j)->textContent));
}
$p->setPostrestrictions($postrestrictions);
$pdfrestrictions_xml = $pubs->item($i)->getElementsByTagName('pdfrestriction');
$pdfrestrictions = array();
for ($j = 0; $j < $pdfrestrictions_xml->length; $j++) {
$pdfrestrictions[] = strip_tags(trim($pdfrestrictions_xml->item($j)->nodeValue));
}
$p->setPdfrestrictions($pdfrestrictions);
$conditions_xml = $pubs->item($i)->getElementsByTagName('condition');
$conditions = array();
for ($j = 0; $j < $conditions_xml->length; $j++) {
$conditions[] = $conditions_xml->item($j)->nodeValue;
}
$p->setConditions($conditions);
$this->publishers[$id] = $p;
}
}
}
开发者ID:rshanrath,项目名称:zotero-sherparomeo,代码行数:52,代码来源:SherpaRomeo.php
示例18: actionEdit
/**
* Edit a publisher.
*/
public function actionEdit($id = 0)
{
if ($id > 0) {
$model = Publisher::model()->findByPk($id);
} else {
$model = new Publisher();
}
if (isset($_POST['Publisher'])) {
$model->attributes = $_POST['Publisher'];
if ($model->validate() && $model->save()) {
Yii::app()->user->setFlash('successmsg', 'The changes have been saved.');
$this->redirect('/publisher/index');
} else {
Yii::app()->user->setFlash('errormsg', 'Error saving the publisher page.');
$this->render('edit', array('model' => $model, 'id' => $id));
}
} else {
$this->render('edit', array('model' => $model, 'id' => $id));
}
}
开发者ID:sundgaarden,项目名称:dashboard,代码行数:23,代码来源:PublisherController.php
示例19: testUtf8
public function testUtf8()
{
$db = Propel::getDB(BookPeer::DATABASE_NAME);
$title = "Смерть на брудершафт. Младенец и черт";
// 1234567890123456789012345678901234567
// 1 2 3
$a = new Author();
$a->setFirstName("Б.");
$a->setLastName("АКУНИН");
$p = new Publisher();
$p->setName("Детектив российский, остросюжетная проза");
$b = new Book();
$b->setTitle($title);
$b->setISBN("B-59246");
$b->setAuthor($a);
$b->setPublisher($p);
$b->save();
$b->reload();
$this->assertEquals(37, iconv_strlen($b->getTitle(), 'utf-8'), "Expected 37 characters (not bytes) in title.");
$this->assertTrue(strlen($b->getTitle()) > iconv_strlen($b->getTitle(), 'utf-8'), "Expected more bytes than characters in title.");
}
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:21,代码来源:CharacterEncodingTest.php
示例20: Index
public function Index($params)
{
$this->view->Show('books.tpl', array('books' => Book::Find($this->conn, $params['pubId'], $params['catId'], $params['authId']), 'pubs' => array(-1 => '- Все -') + Publisher::GetAll($this->conn), 'pubId' => $params['pubId'], 'cats' => array(-1 => '- Все -') + Category::GetAll($this->conn), 'catId' => $params['catId'], 'auth' => array(-1 => '- Все -') + Author::GetAll($this->conn), 'authId' => $params['authId']));
// $this->smarty->assign('books', Book::Find($this->conn, $params['pubId'], $params['catId']));
//
// $this->smarty->assign('pubs', array(-1 => '- Все -') + Publisher::GetAll($this->conn));
// $this->smarty->assign('pubId', $params['pubId']);
//
// $this->smarty->assign('cats', array(-1 => '- Все -') + Category::GetAll($this->conn));
// $this->smarty->assign('catId', $params['catId']);
//
// $this->smarty->display('books.tpl');
}
开发者ID:usfuprog,项目名称:Library_ap,代码行数:13,代码来源:controller_book.php
注:本文中的Publisher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论