本文整理汇总了PHP中Article::getArticleNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getArticleNumber方法的具体用法?PHP Article::getArticleNumber怎么用?PHP Article::getArticleNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::getArticleNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ArticleMessage
/**
* Log article related event.
*
* @param Article $p_article
* @param string $p_text
* @param int $p_userId
* @param int $p_eventId
* @param bool $p_short
*
* @return void
*/
public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
{
ob_start();
echo getGS('Article'), ': ', $p_article->getTitle();
if (!$p_short) {
// add publication, issue, section
echo ' (';
echo getGS('Publication'), ': ', $p_article->getPublicationId();
echo ', ';
echo getGS('Issue'), ': ', $p_article->getIssueNumber();
echo ', ';
echo getGS('Section'), ': ', $p_article->getSectionNumber();
echo ")\n";
}
// generate url
$url = ShortURL::GetURL($p_article->getPublicationId(), $p_article->getLanguageId(), $p_article->getIssueNumber(), $p_article->getSectionNumber(), $p_article->getArticleNumber());
if (strpos($url, 'http') !== FALSE) {
// no url for deleted
echo getGS('Article URL'), ': ', $url, "\n";
}
echo getGS('Article Number'), ': ', $p_article->getArticleNumber(), "\n";
echo getGS('Language'), ': ', $p_article->getLanguageName(), "\n";
echo "\n";
echo getGS('Action') . ': ', $p_text;
$message = ob_get_clean();
self::Message($message, $p_userId, $p_eventId);
}
示例2: ArticleMessage
/**
* Log article related event.
*
* @param Article $p_article
* @param string $p_text
* @param int $p_userId
* @param int $p_eventId
* @param bool $p_short
*
* @return void
*/
public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
{
ob_start();
$translator = \Zend_Registry::get('container')->getService('translator');
echo $translator->trans('Article'), ': ', $p_article->getTitle();
if (!$p_short) {
// add publication, issue, section
echo ' (';
echo $translator->trans('Publication'), ': ', $p_article->getPublicationId();
echo ', ';
echo $translator->trans('Issue'), ': ', $p_article->getIssueNumber();
echo ', ';
echo $translator->trans('Section'), ': ', $p_article->getSectionNumber();
echo ")\n";
}
// generate url
$url = ShortURL::GetURL($p_article->getPublicationId(), $p_article->getLanguageId(), $p_article->getIssueNumber(), $p_article->getSectionNumber(), $p_article->getArticleNumber());
if (strpos($url, 'http') !== FALSE) {
// no url for deleted
echo $translator->trans('Article URL', array(), 'api'), ': ', $url, "\n";
}
echo $translator->trans('Article Number', array(), 'api'), ': ', $p_article->getArticleNumber(), "\n";
echo $translator->trans('Language'), ': ', $p_article->getLanguageName(), "\n";
echo "\n";
echo $translator->trans('Action') . ': ', $p_text;
$message = ob_get_clean();
self::Message(substr($message, 0, 254), $p_userId, $p_eventId);
}
示例3: getArticleLink
private function getArticleLink(Article $article)
{
$params = array('f_publication_id' => $article->getPublicationId(), 'f_issue_number' => $article->getIssueNumber(), 'f_section_number' => $article->getSectionNumber(), 'f_article_number' => $article->getArticleNumber(), 'f_language_id' => $article->getLanguageId(), 'f_language_selected' => $article->getLanguageId());
$queryString = implode('&', array_map(function ($property) use($params) {
return $property . '=' . $params[$property];
}, array_keys($params)));
return $this->view->baseUrl("/admin/articles/edit.php?{$queryString}");
}
示例4: getEditLink
/**
* Get article edit link
*
* @param Article $article
* @return string
*/
public function getEditLink($article)
{
$params = array('f_publication_id' => $article->getPublicationId(), 'f_issue_number' => $article->getIssueNumber(), 'f_section_number' => $article->getSectionNumber(), 'f_article_number' => $article->getArticleNumber(), 'f_language_id' => $article->getLanguageId(), 'f_language_selected' => $article->getLanguageId());
$paramsStrings = array();
foreach ($params as $key => $val) {
$paramsStrings[] = "{$key}={$val}";
}
return '/admin/articles/edit.php?' . implode('&', $paramsStrings);
}
示例5: clearpageCache
/**
* Send request to refresh article cache on Facebook
*
* @param int $number
* @param int $languageId
*
* @return mixed response from Facebook about url, or array with error message
*/
private function clearpageCache($number, $languageId)
{
$article = new \Article($languageId, $number);
if (!$article->isPublished()) {
return array('message' => $this->get('translator')->trans('fb.label.errornot'));
}
$url = \ShortURL::GetURL($article->getPublicationId(), $article->getLanguageId(), $article->getIssueNumber(), $article->getSectionNumber(), $article->getArticleNumber());
try {
$curlClient = new \Buzz\Client\Curl();
$curlClient->setTimeout(10000);
$browser = new \Buzz\Browser($curlClient);
$result = $browser->post('https://graph.facebook.com/?id=' . $url . '&scrape=true');
$urlInfo = json_decode($result->getContent(), true);
} catch (\Buzz\Exception\ClientException $e) {
return array('message' => $this->get('translator')->trans('fb.label.error'));
}
return $urlInfo;
}
示例6: camp_html_article_url
/**
* Create a link to an article.
*
* @param Article $p_articleObj
* The article we want to display.
*
* @param int $p_sectionLanguageId
* The language ID for the publication/issue/section.
*
* @param string $p_targetFileName
* Which file in the "articles" directory to call.
*
* @param string $p_backLink
* A URL to get back to the previous page the user was on.
*
* @param string $p_extraParams
*/
function camp_html_article_url($p_articleObj, $p_sectionLanguageId, $p_targetFileName = "", $p_backLink = "", $p_extraParams = null, $p_securityParameter = false)
{
global $ADMIN;
$str = "/{$ADMIN}/articles/" . $p_targetFileName . "?f_publication_id=" . $p_articleObj->getPublicationId() . "&f_issue_number=" . $p_articleObj->getIssueNumber() . "&f_section_number=" . $p_articleObj->getSectionNumber() . "&f_article_number=" . $p_articleObj->getArticleNumber() . "&f_language_id=" . $p_sectionLanguageId . "&f_language_selected=" . $p_articleObj->getLanguageId();
if ($p_securityParameter) {
$str .= '&' . SecurityToken::URLParameter();
}
if ($p_backLink != "") {
$str .= "&Back=" . urlencode($p_backLink);
}
if (!is_null($p_extraParams)) {
$str .= $p_extraParams;
}
return $str;
}
示例7: _getArticle
/**
* Get article
*
* @param int $articleNo
* @param MetaLanguage $language
* @return MetaArticle
*/
private function _getArticle($articleNo, MetaLanguage $language)
{
if (empty($articleNo)) {
return null;
}
$articleObj = new Article($language->number, $articleNo);
if (!$articleObj->exists() || !$this->m_preview && !$articleObj->isPublished()) {
throw new InvalidArgumentException("Invalid article identifier in URL.", self::INVALID_ARTICLE);
}
return new MetaArticle($language->number, $articleObj->getArticleNumber());
}
示例8: createTranslation
/**
* Create a copy of the article, but make it a translation
* of the current one.
*
* @param int $p_languageId
* @param int $p_userId
* @param string $p_name
* @return Article
*/
public function createTranslation($p_languageId, $p_userId, $p_name)
{
// Construct the duplicate article object.
$articleCopy = new Article();
$articleCopy->m_data['IdPublication'] = $this->m_data['IdPublication'];
$articleCopy->m_data['NrIssue'] = $this->m_data['NrIssue'];
$articleCopy->m_data['NrSection'] = $this->m_data['NrSection'];
$articleCopy->m_data['IdLanguage'] = $p_languageId;
$articleCopy->m_data['Number'] = $this->m_data['Number'];
$values = array();
// Copy some attributes
$values['ShortName'] = $this->m_data['ShortName'];
$values['Type'] = $this->m_data['Type'];
$values['OnFrontPage'] = $this->m_data['OnFrontPage'];
$values['OnSection'] = $this->m_data['OnFrontPage'];
$values['Public'] = $this->m_data['Public'];
$values['ArticleOrder'] = $this->m_data['ArticleOrder'];
$values['comments_enabled'] = $this->m_data['comments_enabled'];
$values['comments_locked'] = $this->m_data['comments_locked'];
// Change some attributes
$values['Name'] = $p_name;
$values['Published'] = 'N';
$values['IsIndexed'] = 'N';
$values['LockUser'] = 0;
$values['LockTime'] = 0;
$values['IdUser'] = $p_userId;
// Create the record
$success = $articleCopy->__create($values);
if (!$success) {
return false;
}
$articleCopy->setProperty('UploadDate', 'NOW()', true, true);
// Insert an entry into the article type table.
$articleCopyData = new ArticleData($articleCopy->m_data['Type'],
$articleCopy->m_data['Number'], $articleCopy->m_data['IdLanguage']);
$articleCopyData->create();
$origArticleData = $this->getArticleData();
$origArticleData->copyToExistingRecord($articleCopy->getArticleNumber(), $p_languageId);
if (function_exists("camp_load_translation_strings")) {
camp_load_translation_strings("api");
}
$logtext = getGS('Article translated to "$4" ($5)',
$articleCopy->getTitle(), $articleCopy->getLanguageName());
Log::ArticleMessage($this, $logtext, null, 31);
// geo-map processing
Geo_Map::OnCreateTranslation($this->m_data['Number'], $this->m_data['IdLanguage'], $p_languageId);
return $articleCopy;
} // fn createTranslation
示例9: putGS
<TD ALIGN="RIGHT" valign="top" style="padding-left: 1em;"><b><?php putGS("Type"); ?>:</b></TD>
<TD align="left" valign="top">
<?php print htmlspecialchars($dest->getDisplayName()); ?>
</TD>
<TD ALIGN="RIGHT" valign="top" style="padding-left: 1em;"><b><nobr><?php putGS("Creation date"); ?>:</nobr></b></TD>
<TD align="left" valign="top" nowrap>
<?php print $curPreview->getCreationDate(); ?>
</TD>
<TD ALIGN="RIGHT" valign="top" style="padding-left: 1em;"></TD>
<TD align="left" valign="top" style="padding-top: 0.25em;">
<?php putGS('Show article on section page'); ?>
</TD>
</TR>
<TR>
<td align="right" valign="top" nowrap><b><?php putGS("Number"); ?>:</b></td>
<td align="left" valign="top" style="padding-top: 2px; padding-left: 4px;"><?php p($curPreview->getArticleNumber()); ?> <?php if (isset($publicationObj) && $publicationObj->getUrlTypeId() == 2) { ?>
(<a href="/<?php echo $languageObj->getCode()."/".$issueObj->getUrlName()."/".$sectionObj->getUrlName()."/".$curPreview->getUrlName(); ?>"><?php putGS("Link to public page"); ?></a>)<?php } ?></td>
<TD ALIGN="RIGHT" valign="top" style="padding-left: 1em;"><b><?php putGS("Publish date"); ?>:</b></TD>
<TD align="left" valign="top">
<?php print htmlspecialchars($curPreview->getPublishDate()); ?>
</TD>
<TD ALIGN="RIGHT" valign="top" style="padding-left: 1em;"></TD>
<TD align="left" valign="top" style="padding-top: 0.25em;">
<?php putGS('Allow users without subscriptions to view the article'); ?>
</TD>
</TR>
</TABLE>
</TD>
</TR>
示例10: processItem
/**
* Process item
* @param Article $article
* @return array
*/
public function processItem(Article $article)
{
global $g_user, $Campsite;
return array($article->getArticleNumber(), $article->getLanguageId(), sprintf('
<div class="context-item" langid="%s">
<div class="context-drag-topics"><a href="#" title="drag to sort"></a></div>
<div class="context-item-header">
<div class="context-item-date">%s</div>
<a href="#" class="view-article" onClick="viewArticle($(this).parent(\'div\').parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'), $(this).parents(\'.context-item:eq(0)\').attr(\'langid\'));">%s</a>
</div>
<a href="javascript:void(0)" class="corner-button" style="display: none" onClick="removeFromContext($(this).parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'));removeFromContext($(this).parents(\'.item:eq(0)\').attr(\'id\'));toggleDragZonePlaceHolder();"><span class="ui-icon ui-icon-closethick"></span></a>
<div class="context-item-summary">%s</div>
</div>
', $article->getLanguageId(), $article->getCreationDate(), getGS('View article'), $article->getName()));
}
示例11: setArticleImagesLegacy
/**
* Set images for the article
*
* @param \Article $article
* @param \Newscoop\IngestPluginBundle\Entity\Entry $entry
*/
protected function setArticleImagesLegacy(\Article $article, \Newscoop\IngestPluginBundle\Entity\Feed\Entry $entry)
{
$images = $entry->getImages();
if (!is_array($images) || empty($images)) {
return;
}
$oldImages = \ArticleImage::GetImagesByArticleNumber($article->getArticleNumber());
if (is_array($oldImages)) {
foreach ($oldImages as $image) {
$image->delete();
}
}
$filesystem = new Filesystem();
foreach ($images as $image) {
if (!array_key_exists('location', $image) || !$image['location']) {
continue;
}
$imagePath = '';
if ($filesystem->exists($image['location'])) {
$basename = basename($image['location']);
$imagePath = $image['location'];
} else {
$tmpPath = tempnam(sys_get_temp_dir(), 'NWSIMG');
try {
$filesystem->copy($image['location'], $tmpPath, true);
} catch (IOExceptionInterface $e) {
continue;
}
$imagePath = $tmpPath;
$basename = basename($image['location']);
}
$imagesize = getimagesize($imagePath);
$info = array('name' => $basename, 'type' => $imagesize['mime'], 'tmp_name' => $imagePath, 'size' => filesize($imagePath), 'error' => 0);
$attributes = array('Photographer' => array_key_exists('photographer', $image) ? $image['photographer'] : '', 'Description' => array_key_exists('description', $image) ? $image['description'] : '', 'Source' => 'newsfeed', 'Status' => 'approved');
try {
$image = \Image::OnImageUpload($info, $attributes, null, null, true);
\ArticleImage::AddImageToArticle($image->getImageId(), $article->getArticleNumber(), null);
} catch (\Exception $e) {
var_dump($e);
exit;
}
}
}
示例12: getGS
}
if ($f_publish_hour == "" || $f_publish_minute == "") {
camp_html_add_msg(getGS('You must fill in the $1 field.', '<B>' . getGS('Time') . '</B>'));
}
if ($f_publish_action != "P" && $f_publish_action != "U" && $f_front_page_action != "S" && $f_front_page_action != "R" && $f_section_page_action != "S" && $f_section_page_action != "R") {
camp_html_add_msg(getGS('You must select an action.'));
}
if (count($articles) == 0 && count($errorArticles) > 0) {
camp_html_add_msg(getGS("The article is new; it is not possible to schedule it for automatic publishing."));
}
if (camp_html_has_msgs()) {
camp_html_goto_page($backLink);
}
$publishTime = $f_publish_date . " " . $f_publish_hour . ":" . $f_publish_minute . ":00";
foreach ($articles as $tmpArticle) {
$articleEvents = ArticlePublish::GetArticleEvents($tmpArticle->getArticleNumber(), $f_language_selected, TRUE);
foreach ($articleEvents as $event) {
if ($event->getActionTime() == $publishTime) {
if ($f_publish_action != $event->getPublishAction()) {
?>
<script type="text/javascript">
try {
parent.$.fancybox.reload = true;
parent.$.fancybox.message = '<?php
putGS('You can not schedule opposing events at the same time');
?>
';
parent.$.fancybox.close();
} catch (e) {
}
</script>
示例13: ArticlePublish
camp_html_add_msg(getGS('You must select an action.'));
}
if ( (count($articles) == 0) && (count($errorArticles) > 0) ) {
camp_html_add_msg(getGS("The article is new; it is not possible to schedule it for automatic publishing."));
}
if (camp_html_has_msgs()) {
camp_html_goto_page($backLink);
}
$publishTime = $f_publish_date . " " . $f_publish_hour . ":" . $f_publish_minute . ":00";
foreach ($articles as $tmpArticle) {
$articlePublishObj = new ArticlePublish();
$articlePublishObj->create();
$articlePublishObj->setArticleNumber($tmpArticle->getArticleNumber());
$articlePublishObj->setLanguageId($tmpArticle->getLanguageId());
$articlePublishObj->setActionTime($publishTime);
if ($f_publish_action == "P" || $f_publish_action == "U") {
$articlePublishObj->setPublishAction($f_publish_action);
}
if ($f_front_page_action == "S" || $f_front_page_action == "R") {
$articlePublishObj->setFrontPageAction($f_front_page_action);
}
if ($f_section_page_action == "S" || $f_section_page_action == "R") {
$articlePublishObj->setSectionPageAction($f_section_page_action);
}
Log::ArticleMessage($tmpArticle, getGS('Scheduled action added'), $g_user->getUserId(), 37);
}
if ($f_mode == "multi") {
$args = $_REQUEST;
示例14: time
exit;
}
// Only users with a lock on the article can change it.
if ($articleObj->isLocked() && $g_user->getUserId() != $articleObj->getLockedByUser()) {
$diffSeconds = time() - strtotime($articleObj->getLockTime());
$hours = floor($diffSeconds / 3600);
$diffSeconds -= $hours * 3600;
$minutes = floor($diffSeconds / 60);
$lockUser = new User($articleObj->getLockedByUser());
camp_html_add_msg($translator->trans('Could not save the article. It has been locked by $1 $2 hours and $3 minutes ago.', array('$1' => $lockUser->getRealName(), '$2' => $hours, '$3' => $minutes), 'articles'));
camp_html_goto_page($BackLink);
exit;
}
// Update the article author
if (!empty($f_article_author)) {
ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
$i = 0;
foreach ($f_article_author as $author) {
$authorObj = new Author($author);
if (!$authorObj->exists() && strlen(trim($author)) > 0) {
$authorData = Author::ReadName($author);
$authorObj->create($authorData);
}
// Sets the author type selected
$author_type = $f_article_author_type[$i];
$authorObj->setType($author_type);
// Links the author to the article
$articleAuthorObj = new ArticleAuthor($articleObj->getArticleNumber(), $articleObj->getLanguageId(), $authorObj->getId(), $author_type);
if (!$articleAuthorObj->exists()) {
$articleAuthorObj->create();
}
示例15: setURL
//.........这里部分代码省略.........
// gets the publication object based on site name (URI host)
$alias = preg_replace('/^'.$this->getScheme().':\/\//', '', $this->getBase());
$aliasObj = new Alias($alias);
if ($aliasObj->exists()) {
$this->m_publication = new MetaPublication($aliasObj->getPublicationId());
}
if (is_null($this->m_publication) || !$this->m_publication->defined()) {
return new PEAR_Error("Invalid site name '$alias' in URL.", self::INVALID_SITE_NAME);
}
// reads parameters values if any
$params = str_replace($this->m_config->getSetting('SUBDIR'), '', $this->getPath());
$cParams = explode('/', trim($params, '/'));
$cParamsSize = sizeof($cParams);
if ($cParamsSize >= 1) {
$cLangCode = $cParams[0];
}
if ($cParamsSize >= 2) {
$cIssueSName = $cParams[1];
}
if ($cParamsSize >= 3) {
$cSectionSName = $cParams[2];
}
if ($cParamsSize >= 4) {
$cArticleSName = $cParams[3];
}
// gets the language identifier and sets the language code
if (!empty($cLangCode)) {
$langArray = Language::GetLanguages(null, $cLangCode);
if (is_array($langArray) && sizeof($langArray) == 1) {
$this->m_language = new MetaLanguage($langArray[0]->getLanguageId());
}
} else {
$this->m_language = new MetaLanguage($this->m_publication->default_language->number);
}
if (is_null($this->m_language) || !$this->m_language->defined()) {
return new PEAR_Error("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
}
// gets the issue number and sets the issue short name
if (!empty($cIssueSName)) {
$publishedOnly = !$this->m_preview;
$issueArray = Issue::GetIssues($this->m_publication->identifier,
$this->m_language->number, null, $cIssueSName, null, $publishedOnly);
if (is_array($issueArray) && sizeof($issueArray) == 1) {
$this->m_issue = new MetaIssue($this->m_publication->identifier,
$this->m_language->number,
$issueArray[0]->getIssueNumber());
} else {
return new PEAR_Error("Invalid issue identifier in URL.", self::INVALID_ISSUE);
}
} else {
$issueObj = Issue::GetCurrentIssue($this->m_publication->identifier,
$this->m_language->number);
$this->m_issue = new MetaIssue($this->m_publication->identifier,
$this->m_language->number, $issueObj->getIssueNumber());
if (!$this->m_issue->defined()) {
return new PEAR_Error("No published issue was found.", self::INVALID_ISSUE);
}
}
// gets the section number and sets the section short name
if (!empty($cSectionSName)) {
$sectionArray = Section::GetSections($this->m_publication->identifier,
$this->m_issue->number,
$this->m_language->number,
$cSectionSName);
if (is_array($sectionArray) && sizeof($sectionArray) == 1) {
$this->m_section = new MetaSection($this->m_publication->identifier,
$this->m_issue->number,
$this->m_language->number,
$sectionArray[0]->getSectionNumber());
} else {
return new PEAR_Error("Invalid section identifier in URL.", self::INVALID_SECTION);
}
}
// gets the article number and sets the article short name
if (!empty($cArticleSName)) {
// we pass article short name as article identifier as they are
// the same for Campsite, we will have to change this in the future
$articleObj = new Article($this->m_language->number, $cArticleSName);
if (!$articleObj->exists() || (!$this->m_preview && !$articleObj->isPublished())) {
return new PEAR_Error("Invalid article identifier in URL.", self::INVALID_ARTICLE);
}
$this->m_article = new MetaArticle($this->m_language->number,
$articleObj->getArticleNumber());
}
$templateId = CampRequest::GetVar(CampRequest::TEMPLATE_ID);
$this->m_template = new MetaTemplate($this->getTemplate($templateId));
if (!$this->m_template->defined()) {
return new PEAR_Error("Invalid template in URL or no default template specified.",
self::INVALID_TEMPLATE);
}
$this->m_validURI = true;
$this->validateCache(false);
} // fn setURL