• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ContentModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: home

 public static function home()
 {
     require_once 'Goals.model.php';
     require_once 'Content.model.php';
     $contentMdl = new ContentModel();
     $data = array('templates' => array('header.html', 'menu.html', 'searchForm.html', 'content.html', 'footer.html'), 'content' => $contentMdl->viewContent(), 'userID' => $_SESSION['userID'], 'user' => $_SESSION['username'], 'userLevel' => $_SESSION['userLevel'], 'viewRating' => $contentMdl->viewRating());
     return $data;
 }
开发者ID:KristianSkog,项目名称:Fantastic-Teaching,代码行数:8,代码来源:User.controller.php


示例2: search

 public static function search()
 {
     // sends info to search method in content.model on what to search for
     require_once 'Content.model.php';
     $contentMdl = new ContentModel();
     $data = array('templates' => array('header.html', 'menu.html', 'searchForm.html', 'content.html', 'footer.html'), 'content' => $contentMdl->searchContent($_POST['search'], $_POST['searchSubject'], $_POST['searchYear']), 'userLevel' => $_SESSION['userLevel'], 'user' => $_SESSION['username'], 'userID' => $_SESSION['userID']);
     return $data;
 }
开发者ID:KristianSkog,项目名称:Fantastic-Teaching,代码行数:8,代码来源:Content.controller.php


示例3: __construct

 /**
  * Initialize the object
  *
  * @param ContentModel|ModuleModel|FormModel $objElement
  * @param string                             $strColumn
  */
 public function __construct($objElement, $strColumn = 'main')
 {
     parent::__construct();
     // Store the parent element (see #4556)
     if ($objElement instanceof Model) {
         $this->objParent = $objElement;
     } elseif ($objElement instanceof Model\Collection) {
         $this->objParent = $objElement->current();
     }
     if ($this->strKey == '' || $this->strTable == '') {
         return;
     }
     /** @var Model $strModelClass */
     $strModelClass = \Model::getClassFromTable($this->strTable);
     // Load the model
     if (class_exists($strModelClass)) {
         $objHybrid = $strModelClass::findByPk($objElement->{$this->strKey});
         if ($objHybrid === null) {
             return;
         }
         $this->objModel = $objHybrid;
     } else {
         $objHybrid = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")->limit(1)->execute($objElement->{$this->strKey});
         if ($objHybrid->numRows < 1) {
             return;
         }
     }
     $cssID = array();
     $this->arrData = $objHybrid->row();
     // Get the CSS ID from the parent element (!)
     $this->cssID = deserialize($objElement->cssID, true);
     if (isset($objHybrid->attributes)) {
         $cssID = deserialize($objHybrid->attributes, true);
     }
     // Override the CSS ID (see #305)
     if (!empty($this->cssID[0])) {
         $cssID[0] = $this->cssID[0];
     }
     // Merge the CSS classes (see #6011)
     if (!empty($this->cssID[1])) {
         $cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
     }
     $this->cssID = $cssID;
     $this->typePrefix = $objElement->typePrefix;
     $arrHeadline = deserialize($objElement->headline);
     $this->headline = is_array($arrHeadline) ? $arrHeadline['value'] : $arrHeadline;
     $this->hl = is_array($arrHeadline) ? $arrHeadline['unit'] : 'h1';
     $this->strColumn = $strColumn;
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:55,代码来源:Hybrid.php


示例4: del

 public function del()
 {
     if (IS_POST) {
         $uid = Q('uid', 0, 'intval');
         //删除文章
         if (Q('post.delcontent')) {
             $ModelCache = cache('model');
             foreach ($ModelCache as $model) {
                 $contentModel = ContentModel::getInstance($model['mid']);
                 $contentModel->where(array('uid' => $uid))->del();
             }
         }
         //删除评论
         if (Q('post.delcomment')) {
             M('comment')->where(array('uid' => $uid))->del();
         }
         //删除附件
         if (Q('post.delupload')) {
             M('upload')->where(array('uid' => $uid))->del();
         }
         //删除用户
         M('user')->del($uid);
         $this->success('删除成功...');
     } else {
         $uid = Q("uid", 0, "intval");
         $field = M('user')->find($uid);
         $this->assign('field', $field);
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:30,代码来源:UserControl.class.php


示例5: createContentElements

 protected function createContentElements(&$objItem)
 {
     if ($objItem->tl_content) {
         // need to wrap <p> around text for contao
         $tidyConfig = array('enclose-text' => true, 'drop-font-tags' => true, 'drop-proprietary-attributes' => true, 'quote-ampersand' => true, 'clean' => false);
         $bodyText = '<!DOCTYPE html><head><title></title></head><body>' . $objItem->tl_content . '</body></html>';
         //			$bodyText = $this->convert_external_link_tags($bodyText);
         //			$bodyText = $this->convert_internal_link_tags($bodyText);
         $bodyText = $this->nl2p($bodyText);
         $tidy = new \tidy();
         $tidy->parseString($bodyText, $tidyConfig, $GLOBALS['TL_CONFIG']['dbCharset']);
         $body = $tidy->body();
         $objContent = new \ContentModel();
         $objContent->text = trim(str_replace(array('<body>', '</body>'), '', $body));
         $objContent->text = preg_replace("/<img[^>]+\\>/i", "", $objContent->text);
         // strip images
         // create links from text
         $objContent->text = preg_replace('!(\\s|^)((https?://|www\\.)+[a-z0-9_./?=&-]+)!i', ' <a href="http://$2" target="_blank">$2</a>', $objContent->text);
         // replace <b> by <strong>
         $objContent->text = preg_replace('!<b(.*?)>(.*?)</b>!i', '<strong>$2</strong>', $objContent->text);
         // replace emails with inserttags
         $objContent->text = preg_replace('/([A-Z0-9._%+-]+)@([A-Z0-9.-]+)\\.([A-Z]{2,4})(\\((.+?)\\))?/i', "{{email::\$1@\$2.\$3}}", $objContent->text);
         // strip not allowed tags
         $objContent->text = strip_tags($objContent->text, \Config::get('allowedTags'));
         $objContent->text = $this->stripAttributes($objContent->text, array('style', 'class', 'id'));
         $objContent->ptable = static::$strTable;
         $objContent->pid = $objItem->id;
         $objContent->sorting = 16;
         $objContent->tstamp = time();
         $objContent->type = 'text';
         $objContent->save();
     }
 }
开发者ID:heimrichhannot,项目名称:contao-newsport,代码行数:33,代码来源:NewsImporter.php


示例6: listNewsletterArticles

    /**
     * Add the type of input field
     * @param array
     * @return string
     */
    public function listNewsletterArticles($arrRow)
    {
        $strStats = '';
        $strContents = '';
        $objContents = \ContentModel::findPublishedByPidAndTable($arrRow['id'], 'tl_newsletter');
        if (!is_null($objContents)) {
            foreach ($objContents as $objContent) {
                $strContents .= $this->getContentElement($objContent->id) . '<hr>';
            }
        }
        $intTotal = $arrRow['recipients'] + $arrRow['rejected'];
        //		$intTracked = NewsletterContent\Models\NewsletterTrackingModel::countTrackedByPid($arrRow['id']);
        $objTracked = NewsletterContent\Models\NewsletterTrackingModel::findTrackedInteractionsByPid($arrRow['id']);
        $intTracked = !is_null($objTracked) ? $objTracked->count() : 0;
        $intPercent = @round($intTracked / $intTotal * 100);
        $strStats = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentTo'], $arrRow['recipients'], strval($intTotal), strval($intTracked), strval($intPercent));
        return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $arrRow['date'])) . '<br>' . $strStats : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!$GLOBALS['TL_CONFIG']['doNotCollapse'] ? ' h128' : '') . '">
' . (!$arrRow['sendText'] && strlen($strContents) ? '
' . $strContents : '') . '
' . nl2br_html5($arrRow['text']) . '
</div>' . "\n";
        return '<div class="tl_content_left">' . $arrRow['subject'] . ' <span style="color:#b3b3b3;padding-left:3px">[' . $arrRow['senderName'] . ' &lt;' . $arrRow['sender'] . '&gt;]</span></div>';
    }
开发者ID:davidenke,项目名称:newsletter_content,代码行数:30,代码来源:tl_newsletter.php


示例7: compile

 /**
  * compile wrapper element
  */
 protected function compile()
 {
     // get included elements
     if ($this->objWrapper->getType() == ContentWrapper\Model::TYPE_START) {
         $this->Template->count = ContentWrapper\Repository::countRelatedElements($this->objWrapper);
         $cssID = $this->cssID;
         if ($cssID[0] == '') {
             $cssID[0] = sprintf($this->strIdentifier, $this->id);
             $this->cssID = $cssID;
         }
     } else {
         $start = \ContentModel::findByPk($this->bootstrap_parentId);
         if ($start !== null) {
             $start = new Attributes($start);
             $start->registerNamespaceAttributes($this->arrBootstrapAttributes);
             $start->cssID = deserialize($start->cssID, true);
             $this->Template->start = $start;
             if ($start->cssID[0] == '') {
                 $cssID = $start->cssID;
                 $cssID[0] = sprintf($this->strIdentifier, $start->id);
                 $this->cssID = $cssID;
             } else {
                 $this->cssID = $start->cssID;
             }
         }
     }
     $this->Template->identifier = $this->cssID[0];
 }
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:31,代码来源:Carousel.php


示例8: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     $objElement = \ContentModel::findByPk($this->cteAlias);
     if ($objElement === null) {
         return '';
     }
     $strClass = static::findClass($objElement->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objElement->origId = $objElement->id;
     $objElement->id = $this->id;
     $objElement->typePrefix = 'ce_';
     /** @var ContentElement $objElement */
     $objElement = new $strClass($objElement);
     $cssID = deserialize($objElement->cssID, true);
     // Override the CSS ID (see #305)
     if (!empty($this->cssID[0])) {
         $cssID[0] = $this->cssID[0];
     }
     // Merge the CSS classes (see #6011)
     if (!empty($this->cssID[1])) {
         $cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
     }
     $objElement->cssID = $cssID;
     return $objElement->generate();
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:32,代码来源:ContentAlias.php


示例9: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     $objElement = \ContentModel::findByPk($this->cteAlias);
     if ($objElement === null) {
         return '';
     }
     $strClass = static::findClass($objElement->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objElement->origId = $objElement->id;
     $objElement->id = $this->id;
     $objElement->typePrefix = 'ce_';
     /** @var \ContentElement $objElement */
     $objElement = new $strClass($objElement);
     // create new cssID array
     $cssID = array();
     // set the ID
     $cssID[0] = $this->cssID[0] ?: $objElement->cssID[0];
     // merge the classes
     $arrElementClasses = explode(' ', $this->cssID[1]);
     $arrIncludeClasses = explode(' ', $objElement->cssID[1]);
     $cssID[1] = implode(' ', array_unique(array_merge($arrIncludeClasses, $arrElementClasses)));
     // Overwrite spacing and CSS ID
     $objElement->origSpace = $objElement->space;
     $objElement->space = $this->space;
     $objElement->origCssID = $objElement->cssID;
     $objElement->cssID = $cssID;
     return $objElement->generate();
 }
开发者ID:fritzmg,项目名称:contao-mergecssclasses,代码行数:35,代码来源:ContentAliasMerged_C35.php


示例10: compile

 /**
  * compile wrapper element
  */
 protected function compile()
 {
     if ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_START)) {
         $cssID = $this->cssID;
         if ($cssID[0] == '') {
             $cssID[0] = sprintf($this->identifier, $this->id);
             $this->cssID = $cssID;
         }
         $attributes = new Attributes();
         $attributes->addClass('carousel')->addClass('slide')->setAttribute('id', $cssID[0]);
         if ($this->bootstrap_autostart) {
             $attributes->setAttribute('data-ride', 'carousel');
         }
         if ($this->bootstrap_interval > 0) {
             $attributes->setAttribute('data-interval', $this->bootstrap_interval);
         }
         $this->Template->attributes = $attributes;
         $this->Template->count = $this->wrapper->countRelatedElements();
     } else {
         $start = \ContentModel::findByPk($this->bootstrap_parentId);
         if ($start !== null) {
             $start->cssID = deserialize($start->cssID, true);
             $this->Template->start = $start;
             if ($start->cssID[0] == '') {
                 $cssID = $start->cssID;
                 $cssID[0] = sprintf($this->identifier, $start->id);
                 $this->cssID = $cssID;
             } else {
                 $this->cssID = $start->cssID;
             }
         }
     }
     $this->Template->identifier = $this->cssID[0];
     $this->Template->wrapper = $this->wrapper;
 }
开发者ID:Olli,项目名称:components,代码行数:38,代码来源:Carousel.php


示例11: compile

 protected function compile()
 {
     global $objPage;
     $arrElements = array();
     $objCte = \ContentModel::findPublishedByPidAndTable($objPage->id, 'tl_page');
     if ($objCte !== null) {
         $intCount = 0;
         $intLast = $objCte->count() - 1;
         while ($objCte->next()) {
             $arrCss = array();
             /** @var \ContentModel $objRow */
             $objRow = $objCte->current();
             // Add the "first" and "last" classes (see #2583)
             if ($intCount == 0 || $intCount == $intLast) {
                 if ($intCount == 0) {
                     $arrCss[] = 'first';
                 }
                 if ($intCount == $intLast) {
                     $arrCss[] = 'last';
                 }
             }
             $objRow->classes = $arrCss;
             $arrElements[] = $this->getContentElement($objRow, $this->strColumn);
             ++$intCount;
         }
     }
     $this->Template->elements = $arrElements;
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['compileArticle']) && is_array($GLOBALS['TL_HOOKS']['compileArticle'])) {
         foreach ($GLOBALS['TL_HOOKS']['compileArticle'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($this->Template, $this->arrData, $this);
         }
     }
 }
开发者ID:alarstyle,项目名称:contao-no_more_articles,代码行数:35,代码来源:ModuleArticle.php


示例12: getPlaceholder

 public static function getPlaceholder($placeholder)
 {
     $object = new self();
     $strContent = "";
     $addStmt = "";
     $db = \Database::getInstance();
     $placeholderId = is_numeric($placeholder) ? $placeholder : 0;
     $placeholderAlias = is_string($placeholder) ? $placeholder : 0;
     if (!BE_USER_LOGGED_IN) {
         $time = time();
         $addStmt = " AND (start='' OR start<{$time}) AND (stop='' OR stop>{$time}) AND published=1";
     }
     // TODO: make a Placeholder Model!!
     $objPlaceholder = $db->prepare("SELECT * FROM tl_dps_placeholder WHERE (id=? OR alias=?)" . $addStmt)->limit(1)->execute($placeholderId, $placeholderAlias);
     if ($objPlaceholder->numRows > 0) {
         $objPlaceholder = $objPlaceholder->first();
         $id = $objPlaceholder->id;
         $objContent = \ContentModel::findPublishedByPidAndTable($id, "tl_dps_placeholder");
         if ($objContent && $objContent->count() > 0) {
             while ($objContent->next()) {
                 $strContent .= $object->replaceInsertTags($object->getContentElement($objContent->id));
             }
         }
     }
     return $strContent;
 }
开发者ID:pressi,项目名称:zdps_customize,代码行数:26,代码来源:Placeholder.php


示例13: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     // Get ID
     $strAlias = \Input::get('auto_item') ? \Input::get('auto_item') : \Input::get('store');
     // Find published store from ID
     if (($objStore = AnyStoresModel::findPublishedByIdOrAlias($strAlias)) !== null) {
         // load all details
         $objStore->loadDetails();
         // generate description
         $objDescription = \ContentModel::findPublishedByPidAndTable($objStore->id, $objStore->getTable());
         if ($objDescription !== null) {
             while ($objDescription->next()) {
                 $objStore->description .= \Controller::getContentElement($objDescription->current());
             }
         }
         // Get referer for back button
         $objStore->referer = $this->getReferer();
         // generate google map if template and geodata is set
         if ($this->anystores_mapTpl != '' && is_numeric($objStore->latitude) && is_numeric($objStore->longitude)) {
             $objMapTemplate = new \FrontendTemplate($this->anystores_mapTpl);
             $objMapTemplate->setData($objStore->row());
             $objStore->gMap = $objMapTemplate->parse();
         }
         // Template
         $objDetailTemplate = new \FrontendTemplate($this->anystores_detailTpl);
         $objDetailTemplate->setData($objStore->row());
         $this->Template->store = $objDetailTemplate->parse();
     } else {
         $this->_redirect404();
     }
 }
开发者ID:stefansl,项目名称:anyStores,代码行数:34,代码来源:ModuleAnyStoresDetails.php


示例14: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->Template->content = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     if (TL_MODE == 'FE' && BE_USER_LOGGED_IN) {
         $objNewsletter = \NewsletterModel::findByIdOrAlias(\Input::get('items'));
     } else {
         $objNewsletter = \NewsletterModel::findSentByParentAndIdOrAlias(\Input::get('items'), $this->nl_channels);
     }
     if ($objNewsletter === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->content = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
         return;
     }
     // Overwrite the page title (see #2853 and #4955)
     if ($objNewsletter->subject != '') {
         $objPage->pageTitle = strip_tags(strip_insert_tags($objNewsletter->subject));
     }
     // Add enclosure
     if ($objNewsletter->addFile) {
         $this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
     }
     if (!$objNewsletter->sendText) {
         $nl2br = $objPage->outputFormat == 'xhtml' ? 'nl2br_xhtml' : 'nl2br_html5';
         $strContent = '';
         $objContentElements = \ContentModel::findPublishedByPidAndTable($objNewsletter->id, 'tl_newsletter');
         if ($objContentElements !== null) {
             if (!defined('NEWSLETTER_CONTENT_PREVIEW')) {
                 define('NEWSLETTER_CONTENT_PREVIEW', true);
             }
             foreach ($objContentElements as $objContentElement) {
                 $strContent .= $this->getContentElement($objContentElement->id);
             }
         }
         // Parse simple tokens and insert tags
         $strContent = $this->replaceInsertTags($strContent);
         $strContent = \String::parseSimpleTokens($strContent, array());
         // Encode e-mail addresses
         $strContent = \String::encodeEmail($strContent);
         $this->Template->content = $strContent;
     } else {
         $strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
     }
     // Convert relative URLs
     $strContent = $this->convertRelativeUrls($strContent);
     // Parse simple tokens and insert tags
     $strContent = $this->replaceInsertTags($strContent);
     $strContent = \String::parseSimpleTokens($strContent, array());
     // Encode e-mail addresses
     $strContent = \String::encodeEmail($strContent);
     $this->Template->content = $strContent;
     $this->Template->subject = $objNewsletter->subject;
 }
开发者ID:hojanssen,项目名称:newsletter_content,代码行数:62,代码来源:ModuleNewsletterReader.php


示例15: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->Template->content = '';
     if (($objElement = \ContentModel::findPublishedByPidAndTable($this->User->id, 'tl_member')) !== null) {
         while ($objElement->next()) {
             $this->Template->content .= $this->getContentElement($objElement->id);
         }
     }
 }
开发者ID:codefog,项目名称:contao-member_content,代码行数:12,代码来源:ModuleMemberContent.php


示例16: getSearchablePages

 /**
  * Add product items to the indexer
  * @param array
  * @param integer
  * @param boolean
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $time = time();
     $arrProcessed = array();
     // Get all catalog categories
     $objCatalog = \ProductCatalogModel::findByProtected('');
     // Walk through each archive
     if ($objCatalog !== null) {
         while ($objCatalog->next()) {
             // Skip catalog categories without target page
             if (!$objCatalog->jumpTo) {
                 continue;
             }
             // Skip catalog categories outside the root nodes
             if (!empty($arrRoot) && !in_array($objCatalog->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objCatalog->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objCatalog->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 // The target page has not been published (see #5520)
                 if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop < $time) {
                     continue;
                 }
                 // The target page is exempt from the sitemap (see #6418)
                 if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
                     continue;
                 }
                 // Set the domain (see #6421)
                 $domain = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/';
                 // Generate the URL
                 $arrProcessed[$objCatalog->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objCatalog->jumpTo];
             // Get the items
             $objProduct = \ProductModel::findPublishedByPid($objCatalog->id);
             if ($objProduct !== null) {
                 while ($objProduct->next()) {
                     $objElement = \ContentModel::findPublishedByPidAndTable($objProduct->id, 'tl_product');
                     if ($objElement !== null) {
                         $arrPages[] = $this->getLink($objProduct, $strUrl);
                     }
                 }
             }
         }
     }
     return $arrPages;
 }
开发者ID:respinar,项目名称:contao-product,代码行数:63,代码来源:Product.php


示例17: update

 public function update()
 {
     $content = new ContentModel();
     $id = $_POST['id'];
     if ($id != '') {
         $data['id'] = $id;
         $data['title'] = $_POST['title'];
         $data['content'] = $_POST['content'];
         if ($content->save($data)) {
             $this->assign("jumpUrl", "__URL__/index");
             $this->success("更新数据成功!");
         } else {
             $this->assign("jumpUrl", "__URL__/index");
             $this->success("更新数据失败!");
         }
     } else {
         echo "保存数据失败!";
     }
 }
开发者ID:highestgoodlikewater,项目名称:class-website,代码行数:19,代码来源:IndexAction.class.php


示例18: modifyPalette

 public function modifyPalette(DataContainer $dc)
 {
     $objElement = \ContentModel::findByPk($dc->id);
     if ($objElement === null || $objElement->type != 'linkteaser' || $objElement->source != 'modal') {
         return false;
     }
     $GLOBALS['TL_DCA']['tl_content']['fields']['jumpTo']['label'] =& $GLOBALS['TL_LANG']['tl_content']['modalJumpTo'];
     $GLOBALS['TL_DCA']['tl_content']['fields']['jumpTo']['eval']['mandatory'] = false;
     $GLOBALS['TL_DCA']['tl_content']['fields']['jumpTo']['eval']['tl_class'] = 'clr w50';
 }
开发者ID:heimrichhannot,项目名称:contao-modal,代码行数:10,代码来源:tl_content.php


示例19: index

 public function index()
 {
     //编号,也就是下载第几个链接,有的是多文件下载用的!
     $k = I('get.k', 0, 'intval');
     //字段名称
     $f = I('get.f', '');
     if (empty($this->id) || empty($this->catid) || empty($f)) {
         $this->error("参数有误!");
     }
     //模型ID
     $modelid = getCategory($this->catid, 'modelid');
     $Model_field = F("Model_field_" . $modelid);
     //判断字段类型
     if (!in_array($Model_field[$f]['formtype'], array('downfiles', 'downfile'))) {
         $this->error('下载地址错误!');
     }
     $this->db = ContentModel::getInstance($modelid);
     $data = $this->db->relation(true)->where(array("id" => $this->id, 'status' => 99))->find();
     if (empty($data)) {
         $this->error("该信息不存在!");
     }
     $this->db->dataMerger($data);
     if (!empty($data)) {
         //取得下载字段信息
         $downfiles = $data[$f];
         $dowUnserialize = unserialize($downfiles);
         if ($dowUnserialize) {
             $info = $dowUnserialize[$k];
             if (empty($info)) {
                 $this->error("该下载地址已经失效!");
             }
         } else {
             $info = array();
             $info['filename'] = basename($downfiles);
             $info['point'] = 0;
             $info['groupid'] = 0;
         }
         //当前客户端标识
         $aut = md5($this->userid . $this->groupid . substr($_SERVER['HTTP_USER_AGENT'], 0, 254));
         //加密
         //格式:aut|栏目ID|信息id|下载编号|字段
         $key = authcode(implode('|', array($aut, $this->catid, $this->id, $k, $f)), '', '', 3600);
         $this->assign("info", $data);
         $this->assign("fileurl", U("Download/d", array('key' => urlencode($key))));
         $this->assign("filename", $info['filename']);
         $this->assign("point", $info['point']);
         $this->assign("groupid", $info['groupid']);
         $this->assign("Member_group", F("Member_group"));
         $this->assign("SEO", seo($this->catid, urldecode($info['filename']), '', ''));
         $this->display("Public:download");
     } else {
         $this->error("该信息不存在!");
     }
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:54,代码来源:DownloadAction.class.php


示例20: createContentElements

 protected function createContentElements(&$objItem)
 {
     if ($objItem->tl_content) {
         // need to wrap <p> around text for contao
         $tidyConfig = array('enclose-text' => true, 'drop-font-tags' => true, 'drop-proprietary-attributes' => true, 'quote-ampersand' => true, 'clean' => false, 'wrap-attributes' => false, 'wrap' => 500);
         $bodyText = '<!DOCTYPE html><head><title></title></head><body>' . $objItem->tl_content . '</body></html>';
         //			$bodyText = $this->convert_external_link_tags($bodyText);
         //			$bodyText = $this->convert_internal_link_tags($bodyText);
         $bodyText = $this->nl2p($bodyText);
         $tidy = new \tidy();
         $tidy->parseString($bodyText, $tidyConfig, $GLOBALS['TL_CONFIG']['dbCharset']);
         $body = $tidy->body();
         $objContent = new \ContentModel();
         $objContent->text = urldecode($objContent->text);
         // decode, otherwise link and email regex wont work
         $objContent->text = trim(str_replace(array('<body>', '</body>'), '', $body));
         $objContent->text = preg_replace("/<img[^>]+\\>/i", "", $objContent->text);
         // strip images
         // remove inline styles
         $objContent->text = preg_replace('#(<[a-z ]*)(style=("|\')(.*?)("|\'))([a-z ]*>)#', '\\1\\6', $objContent->text);
         // remove white space from empty tags
         $objContent->text = preg_replace('#(<[a-z]*)(\\s+)>#', '$1>', $objContent->text);
         // create links from text
         $objContent->text = preg_replace('!(\\s|^)((https?://|www\\.)+[a-z0-9_./?=&-]+)!i', ' <a href="http://$2" target="_blank">$2</a>', $objContent->text);
         // replace <b> by <strong>
         $objContent->text = preg_replace('!<b(.*?)>(.*?)</b>!i', '<strong>$2</strong>', $objContent->text);
         // replace plain email text with inserttags
         $objContent->text = preg_replace('/([A-Z0-9._%+-]+)@([A-Z0-9.-]+)\\.([A-Z]{2,4})(\\((.+?)\\))?(?![^<]*>)(?![^>]*<)/i', "{{email::\$1@\$2.\$3}}", $objContent->text);
         // replace email links with inserttags
         $objContent->text = preg_replace('/<a.*href=[\'|"]mailto:([A-Z0-9._%+-]+)@([A-Z0-9.-]+)\\.([A-Z]{2,4})(\\((.+?)\\))?[\'|"].*>(.*)<\\/a>/i', "{{email::\$1@\$2.\$3}}", $objContent->text);
         // strip not allowed tags
         $objContent->text = strip_tags($objContent->text, \Config::get('allowedTags'));
         $objContent->text = $this->stripAttributes($objContent->text, array('style', 'class', 'id'));
         $objContent->ptable = $this->dbTargetTable;
         $objContent->pid = $objItem->id;
         $objContent->sorting = 16;
         $objContent->tstamp = time();
         $objContent->type = 'text';
         $objContent->save();
     }
 }
开发者ID:heimrichhannot,项目名称:contao-entity_import,代码行数:41,代码来源:NewsImporter.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ContentPeer类代码示例发布时间:2022-05-23
下一篇:
PHP ContentHelperRoute类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap