当前位置: 首页>>代码示例>>PHP>>正文


PHP Link::set方法代码示例

本文整理汇总了PHP中Link::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::set方法的具体用法?PHP Link::set怎么用?PHP Link::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


在下文中一共展示了Link::set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Link

 /**
  * Add new link to owner Comment
  *
  * @param integer file ID
  * @param integer link position ( 'teaser', 'aftermore' )
  * @param int order of the link
  */
 function add_link($file_ID, $position, $order)
 {
     $edited_Link = new Link();
     $edited_Link->set('cmt_ID', $this->Comment->ID);
     $edited_Link->set('file_ID', $file_ID);
     $edited_Link->set('position', $position);
     $edited_Link->set('order', $order);
     $edited_Link->dbinsert();
     // Update last touched date of the Item
     $this->item_update_last_touched_date();
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:18,代码来源:_linkcomment.class.php

示例2: Link

 /**
  * Add new link to owner Comment
  *
  * @param integer file ID
  * @param integer link position ( 'teaser', 'aftermore' )
  * @param int order of the link
  * @param boolean true to update owner last touched timestamp after link was created, false otherwise
  * @return integer|boolean Link ID on success, false otherwise
  */
 function add_link($file_ID, $position = NULL, $order = 1, $update_owner = true)
 {
     if (is_null($position)) {
         // Use default link position
         $position = $this->get_default_position($file_ID);
     }
     $edited_Link = new Link();
     $edited_Link->set('cmt_ID', $this->Comment->ID);
     $edited_Link->set('file_ID', $file_ID);
     $edited_Link->set('position', $position);
     $edited_Link->set('order', $order);
     if ($edited_Link->dbinsert()) {
         $FileCache =& get_FileCache();
         $File = $FileCache->get_by_ID($file_ID, false, false);
         $file_name = empty($File) ? '' : $File->get_name();
         syslog_insert(sprintf('File %s was linked to %s with ID=%s', '<b>' . $file_name . '</b>', $this->type, $this->link_Object->ID), 'info', 'file', $file_ID);
         if ($update_owner) {
             // Update last touched date of the Comment & Item
             $this->update_last_touched_date();
         }
         return $edited_Link->ID;
     }
     return false;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:33,代码来源:_linkcomment.class.php

示例3: Link

 /**
  * Add new link to owner User
  *
  * @param integer file ID
  * @param integer link position ( 'teaser', 'aftermore' )
  * @param int order of the link
  */
 function add_link($file_ID, $position, $order = 1)
 {
     global $current_User;
     $edited_Link = new Link();
     $edited_Link->set('usr_ID', $this->User->ID);
     $edited_Link->set('file_ID', $file_ID);
     $edited_Link->set('position', $position);
     $edited_Link->set('order', $order);
     if (empty($current_User)) {
         // Current User not is set because probably we are creating links from upgrade script. Set the owner as creator and last editor.
         $edited_Link->set('creator_user_ID', $this->User->ID);
         $edited_Link->set('lastedit_user_ID', $this->User->ID);
     }
     $edited_Link->dbinsert();
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:22,代码来源:_linkuser.class.php

示例4: Link

 /**
  * Add new link to owner User
  *
  * @param integer file ID
  * @param integer link position ( 'teaser', 'aftermore' )
  * @param int order of the link
  * @return integer|boolean Link ID on success, false otherwise
  */
 function add_link($file_ID, $position = NULL, $order = 1)
 {
     global $current_User;
     if (is_null($position)) {
         // Use default link position
         $position = $this->get_default_position($file_ID);
     }
     $edited_Link = new Link();
     $edited_Link->set('usr_ID', $this->User->ID);
     $edited_Link->set('file_ID', $file_ID);
     $edited_Link->set('position', $position);
     $edited_Link->set('order', $order);
     if (empty($current_User)) {
         // Current User not is set because probably we are creating links from upgrade script. Set the owner as creator and last editor.
         $edited_Link->set('creator_user_ID', $this->User->ID);
         $edited_Link->set('lastedit_user_ID', $this->User->ID);
     }
     if ($edited_Link->dbinsert()) {
         if (!is_null($this->Links)) {
             // If user Links were already loaded update its content
             $this->Links[$edited_Link->ID] =& $edited_Link;
         }
         $FileCache =& get_FileCache();
         $File = $FileCache->get_by_ID($file_ID, false, false);
         $file_name = empty($File) ? '' : $File->get_name();
         syslog_insert(sprintf('File %s was linked to %s with ID=%s', '<b>' . $file_name . '</b>', $this->type, $this->link_Object->ID), 'info', 'file', $file_ID);
         return $edited_Link->ID;
     }
     return false;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:38,代码来源:_linkuser.class.php

示例5: Link

     $edited_Item->set('title', $title);
     // replacing category if selected at preview screen
     if (isset($title_Array[$fileNum])) {
         $edited_Item->set('title', $title_Array[$fileNum]);
     }
     $DB->begin('SERIALIZABLE');
     // INSERT NEW POST INTO DB:
     if ($edited_Item->dbinsert()) {
         // echo '<br>file meta: '.$l_File->meta;
         if ($l_File->meta == 'notfound') {
             // That file has no meta data yet, create it now!
             $l_File->dbsave();
         }
         // Let's make the link!
         $edited_Link = new Link();
         $edited_Link->set('itm_ID', $edited_Item->ID);
         $edited_Link->set('file_ID', $l_File->ID);
         $edited_Link->set('position', 'teaser');
         $edited_Link->set('order', 1);
         $edited_Link->dbinsert();
         $DB->commit();
         $Messages->add(sprintf(T_('&laquo;%s&raquo; has been posted.'), $l_File->dget('name')), 'success');
         $fileNum++;
     } else {
         $DB->rollback();
         $Messages->add(sprintf(T_('&laquo;%s&raquo; couldn\'t be posted.'), $l_File->dget('name')), 'error');
     }
 }
 // Note: we redirect without restoring filter. This should allow to see the new files.
 // &filter=restore
 header_redirect($dispatcher . '?ctrl=items&blog=' . $blog);
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:items.ctrl.php

示例6: addLink

 /**
  * @brief Function addLink
  *      adiciona um novo link.
  * @param id_adm do usuario logado
  * @return mensagem indicador de erro ou sucesso
  */
 public function addLink($id_adm)
 {
     $moreLink = new Link();
     return $moreLink->set($id_adm);
 }
开发者ID:cassiod,项目名称:SisAdm,代码行数:11,代码来源:Links.class.php

示例7: explode

// RECORD comment:
$Comment->dbinsert();
// Create links
if (!empty($preview_attachments)) {
    global $DB;
    $order = 1;
    $FileCache =& get_FileCache();
    $attachments = explode(',', $preview_attachments);
    $final_attachments = explode(',', $checked_attachments);
    $DB->begin();
    foreach ($attachments as $file_ID) {
        // create links between comment and attached files
        if (in_array($file_ID, $final_attachments)) {
            // attachment checkbox was checked, create the link
            $edited_Link = new Link();
            $edited_Link->set('cmt_ID', $Comment->ID);
            $edited_Link->set('file_ID', $file_ID);
            $edited_Link->set('position', 'aftermore');
            $edited_Link->set('order', $order);
            $edited_Link->dbinsert();
            $order++;
        } else {
            // attachment checkbox was not checked, remove unused uploaded file
            $unused_File = $FileCache->get_by_ID($file_ID, false);
            if ($unused_File) {
                $unused_File->unlink();
            }
        }
    }
    $DB->commit();
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:comment_post.php

示例8: pbm_process_messages

/**
 * Read messages from server and create posts
 *
 * @param resource $mbox created by pbm_connect() (by reference)
 * @param integer the number of messages to process
 * @return boolean true on success
 */
function pbm_process_messages(&$mbox, $limit)
{
    global $Settings;
    global $pbm_item_files, $pbm_messages, $pbm_items, $post_cntr, $del_cntr, $is_cron_mode;
    // No execution time limit
    set_max_execution_time(0);
    // Are we in test mode?
    $test_mode_on = $Settings->get('eblog_test_mode');
    $post_cntr = 0;
    $del_cntr = 0;
    for ($index = 1; $index <= $limit; $index++) {
        pbm_msg('<hr /><h3>Processing message #' . $index . ':</h3>');
        $strbody = '';
        $hasAttachment = false;
        $hasRelated = false;
        $pbm_item_files = array();
        // reset the value for each new Item
        // Save email to hard drive, otherwise attachments may take a lot of RAM
        if (!($tmpMIME = tempnam(sys_get_temp_dir(), 'b2evoMail'))) {
            pbm_msg(T_('Could not create temporary file.'), true);
            continue;
        }
        imap_savebody($mbox, $tmpMIME, $index);
        // Create random temp directory for message parts
        $tmpDirMIME = pbm_tempdir(sys_get_temp_dir(), 'b2evo_');
        $mimeParser = new mime_parser_class();
        $mimeParser->mbox = 0;
        // Set to 0 for parsing a single message file
        $mimeParser->decode_headers = 1;
        $mimeParser->ignore_syntax_errors = 1;
        $mimeParser->extract_addresses = 0;
        $MIMEparameters = array('File' => $tmpMIME, 'SaveBody' => $tmpDirMIME, 'SkipBody' => 1);
        if (!$mimeParser->Decode($MIMEparameters, $decodedMIME)) {
            pbm_msg(sprintf('MIME message decoding error: %s at position %d.', $mimeParser->error, $mimeParser->error_position), true);
            rmdir_r($tmpDirMIME);
            unlink($tmpMIME);
            continue;
        } else {
            pbm_msg('MIME message decoding successful');
            if (!$mimeParser->Analyze($decodedMIME[0], $parsedMIME)) {
                pbm_msg(sprintf('MIME message analyse error: %s', $mimeParser->error), true);
                rmdir_r($tmpDirMIME);
                unlink($tmpMIME);
                continue;
            }
            // Get message $subject and $post_date from headers (by reference)
            if (!pbm_process_header($parsedMIME, $subject, $post_date)) {
                // Couldn't process message headers
                rmdir_r($tmpDirMIME);
                unlink($tmpMIME);
                continue;
            }
            // TODO: handle type == "message" recursively
            // sam2kb> For some reason imap_qprint() demages HTML text... needs more testing
            if ($parsedMIME['Type'] == 'html') {
                // Mail is HTML
                if ($Settings->get('eblog_html_enabled')) {
                    // HTML posting enabled
                    pbm_msg('HTML message part saved as ' . $parsedMIME['DataFile']);
                    $html_body = file_get_contents($parsedMIME['DataFile']);
                }
                foreach ($parsedMIME['Alternative'] as $alternative) {
                    // First try to get HTML alternative (when possible)
                    if ($alternative['Type'] == 'html' && $Settings->get('eblog_html_enabled')) {
                        // HTML text
                        pbm_msg('HTML alternative message part saved as ' . $alternative['DataFile']);
                        // sam2kb> TODO: we may need to use $html_body here instead
                        $strbody = file_get_contents($alternative['DataFile']);
                        break;
                        // stop after first alternative
                    } elseif ($alternative['Type'] == 'text') {
                        // Plain text
                        pbm_msg('Text alternative message part saved as ' . $alternative['DataFile']);
                        $strbody = imap_qprint(file_get_contents($alternative['DataFile']));
                        break;
                        // stop after first alternative
                    }
                }
            } elseif ($parsedMIME['Type'] == 'text') {
                // Mail is plain text
                pbm_msg('Plain-text message part saved as ' . $parsedMIME['DataFile']);
                $strbody = imap_qprint(file_get_contents($parsedMIME['DataFile']));
            }
            // Check for attachments
            if (!empty($parsedMIME['Attachments'])) {
                $hasAttachment = true;
                foreach ($parsedMIME['Attachments'] as $file) {
                    pbm_msg('Attachment: ' . $file['FileName'] . ' stored as ' . $file['DataFile']);
                }
            }
            // Check for inline images
            if (!empty($parsedMIME['Related'])) {
                $hasRelated = true;
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_post_by_mail.funcs.php

示例9: writePageLinks

 /**
  * Write the links to the various pages, including the 'prev' and 'next'
  * links.
  */
 protected function writePageLinks()
 {
     $linksCount = Config::getInstance()->getInt("tablePaging/maxLinksCount", 10);
     $pageNumParamName = PagingInfoPrefs::getPageNumberParamName($this->getName());
     $recordsPerPageParamName = PagingInfoPrefs::getRecordsPerPageParamName($this->getName());
     $pageLink = new Link(Href::current());
     $pageLink->set("class", "pageNumber");
     $arrowLink = new Link(Href::current());
     $arrowLink->set("class", "arrows");
     $totalPages = $this->pagingInfo->getTotalPages();
     $lastLinkablePage = min($totalPages, $this->pagingInfo->getPageNumber() + $linksCount);
     $lastLinkIsShown = $lastLinkablePage == $totalPages;
     $i = max($this->pagingInfo->getPageNumber() - $linksCount, 0);
     $firstLinkIsShown = $i == 0;
     if (!$firstLinkIsShown) {
         echo $arrowLink->setTitle("First")->setParam($pageNumParamName, 0);
         echo "&nbsp;|&nbsp;";
     }
     if ($this->pagingInfo->getPageNumber() > 0) {
         echo $arrowLink->setTitle("Previous")->setParam($pageNumParamName, $this->pagingInfo->getPageNumber() - 1);
         echo " ";
     }
     if (!$firstLinkIsShown) {
         echo "...&nbsp;";
     }
     // If there's only one page available, don't write anything
     if ($i == $lastLinkablePage - 1) {
         echo "&nbsp;";
         return;
     }
     while ($i < $lastLinkablePage) {
         if ($i == $this->pagingInfo->getPageNumber()) {
             // Write current page number (not a link)
             $currentPageSpan = new HTMLElement("span");
             $currentPageSpan->set("class", "currentPage");
             $currentPageSpan->setBody($i + 1);
             echo $currentPageSpan;
         } else {
             // Write a link to this page
             $pageLink->setParam($pageNumParamName, $i);
             $pageLink->setTitle($i + 1);
             echo $pageLink;
         }
         echo "&nbsp;";
         $i++;
     }
     if (!$lastLinkIsShown) {
         echo "...";
     }
     //echo ($this->pagingInfo->getFirstRecord()+1) . " - " . ($this->pagingInfo->getFirstRecord() + $this->rowCount) . " of " . $this->pagingInfo->getTotalRows();
     if (!$this->pagingInfo->isLastPage()) {
         echo " ";
         echo $arrowLink->setTitle("Next")->setParam($pageNumParamName, $this->pagingInfo->getPageNumber() + 1);
     }
     if (!$lastLinkIsShown) {
         echo "&nbsp;|&nbsp;";
         echo $arrowLink->setTitle("Last")->setParam($pageNumParamName, $totalPages - 1);
     }
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:63,代码来源:Table.php

示例10: Link

 /**
  * Add new link to owner Item
  *
  * @param integer file ID
  * @param integer link position ( 'teaser', 'teaserperm', 'teaserlink', 'aftermore', 'inline', 'fallback' )
  * @param int order of the link
  * @param boolean true to update owner last touched timestamp after link was created, false otherwise
  * @return integer|boolean Link ID on success, false otherwise
  */
 function add_link($file_ID, $position = NULL, $order = 1, $update_owner = true)
 {
     if (is_null($position)) {
         // Use default link position
         $position = $this->get_default_position($file_ID);
     }
     $edited_Link = new Link();
     $edited_Link->set('itm_ID', $this->Item->ID);
     $edited_Link->set('file_ID', $file_ID);
     $edited_Link->set('position', $position);
     $edited_Link->set('order', $order);
     if ($edited_Link->dbinsert()) {
         // New link was added to the item, invalidate blog's media BlockCache
         BlockCache::invalidate_key('media_coll_ID', $this->Item->get_blog_ID());
         $FileCache =& get_FileCache();
         $File = $FileCache->get_by_ID($file_ID, false, false);
         $file_name = empty($File) ? '' : $File->get_name();
         syslog_insert(sprintf('File %s was linked to %s with ID=%s', '<b>' . $file_name . '</b>', $this->type, $this->link_Object->ID), 'info', 'file', $file_ID);
         if ($update_owner) {
             // Update last touched date of the Item
             $this->update_last_touched_date();
         }
         // Reset the Links
         $this->Links = NULL;
         $this->load_Links();
         return $edited_Link->ID;
     }
     return false;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:38,代码来源:_linkitem.class.php


注:本文中的Link::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。