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


PHP CampTemplate::trigger_error方法代码示例

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


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

示例1: __toString

 public function __toString()
 {
 	$className = get_class($this);
 	if (strncasecmp($className, 'Meta', 4) == 0) {
 		$className = strtolower(substr($className, 4));
 	}
 	CampTemplate::trigger_error("Invalid use of object of type '$className'. Use \$campsite->${className}->[property_name] to display a property of this object.");
 	return null;
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:9,代码来源:MetaDbObject.php

示例2: smarty_block_blogcomment_form

/**
 * Campsite blogcomment_form block plugin
 *
 * Type:     block
 * Name:     blogcomment_form
 * Purpose:  Provides a form for an blog comment
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_blogcomment_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    if (!isset($p_content)) {
        return '';
    }

    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');

    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');
    
    if (!is_object($campsite->blogentry) || !$campsite->blogentry->identifier) {
        return '';   
    }

    $url = $campsite->url;
    $url->uri_parameter = "";
    $template = null;
    if (isset($p_params['template'])) {
        $template = new MetaTemplate($p_params['template']);
        if (!$template->defined) {
            CampTemplate::trigger_error('invalid template "' . $p_params['template']
            . '" specified in the blog comment form');
            return false;
        }
    } elseif (is_numeric($url->get_parameter('tpl'))) {
        $template = $campsite->default_template;
    }
    if (!isset($p_params['submit_button'])) {
        $p_params['submit_button'] = 'Submit';
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }
    if (!isset($p_params['button_html_code']) || empty($p_params['button_html_code'])) {
        $p_params['button_html_code'] = '';
    }
    
    if (isset($template)) {
        $url->uri_parameter = "template " . str_replace(' ', "\\ ", $template->name);
    }
    $html = "<form name=\"blogcomment\" action=\"" . $url->uri_path . "\" method=\"post\" "
    .$p_params['html_code'].">\n";
    $html .= "<input type=\"hidden\" name=\"f_blogentry_id\" value=\"{$campsite->blogentry->identifier}\" />\n";
    
    if (isset($template)) {
        $html .= "<input type=\"hidden\" name=\"tpl\" value=\"" . $template->identifier . "\" />\n";
    }
    foreach ($campsite->url->form_parameters as $param) {
        if ($param['name'] == 'tpl') {
            continue;
        }
        $html .= '<input type="hidden" name="'.$param['name']
        .'" value="'.htmlentities($param['value'])."\" />\n";
    }
    $html .= $p_content;
    
    $html .= "<input type=\"submit\" name=\"f_submit_blogcomment\" "
    ."id=\"blogcomment_submit\" value=\""
    .smarty_function_escape_special_chars($p_params['submit_button'])
    ."\" " . $p_params['button_html_code'] . " />\n";
    if (isset($p_params['preview_button']) && !empty($p_params['preview_button'])) {
        $html .= "<input type=\"submit\" name=\"f_preview_blogcomment\" "
        ."id=\"blogcomment_preview\" value=\""
        .smarty_function_escape_special_chars($p_params['preview_button'])
        ."\" " . $p_params['button_html_code'] . " />\n";
    }
    $html .= "</form>\n";

    return $html;
} // fn smarty_block_blogcomment_form
开发者ID:nistormihai,项目名称:Newscoop,代码行数:88,代码来源:block.blogcomment_form.php

示例3: render

    /**
     * Renders the document.
     *
     * Displays the document after parsing it.
     *
     * @param array $p_params
     *
     * @return void
     */
    public function render($p_params)
    {
        $siteinfo = array();
        $context = $p_params['context'];
        $template = $p_params['template'];

        $siteinfo['info_message'] = isset($p_params['info_message']) ? $p_params['info_message'] : null;
        $siteinfo['error_message'] = isset($p_params['error_message']) ? $p_params['error_message'] : null;
        $siteinfo['templates_path'] = isset($p_params['templates_dir'])
                            ? $p_params['templates_dir'] : CS_TEMPLATES_DIR;
        $siteinfo['title'] = $this->getTitle();
        $siteinfo['content_type'] = $this->getMetaTag('Content-Type', true);
        $siteinfo['generator'] = $this->getGenerator();
        $siteinfo['keywords'] = $this->getMetaTag('keywords');
        $siteinfo['description'] = $this->getMetaTag('description');

        if (!file_exists(CS_PATH_SITE.DIR_SEP.$siteinfo['templates_path'].DIR_SEP.$template)
                || $template === false) {
            if (empty($template)) {
                $siteinfo['error_message'] = "No template set for display.";
            } else {
                $siteinfo['error_message'] = "The template '$template' does not exist in the templates directory.";
            }
            $template = CS_SYS_TEMPLATES_DIR.DIR_SEP.'_campsite_error.tpl';
            $siteinfo['templates_path'] = CS_TEMPLATES_DIR;
        }

        $tpl = CampTemplate::singleton();
        $tpl->template_dir = $siteinfo['templates_path'];
        $subdir = $this->m_config->getSetting('SUBDIR');
        if (!empty($subdir)) {
            $siteinfo['templates_path'] = substr($subdir, 1) . '/' . $siteinfo['templates_path'];
        }
        $tpl->assign('gimme', $context);
        $tpl->assign('siteinfo', $siteinfo);

        // on template caching add additional info
        if (SystemPref::Get('TemplateCacheHandler')) {
            $uri = CampSite::GetURIInstance();
            $tpl->campsiteVector = $uri->getCampsiteVector();
            $templateObj = new Template($template);
            $tpl->cache_lifetime = (int)$templateObj->getCacheLifetime();
        }

        try {
            $tpl->display($template);
        }
        catch (Exception $ex) {
            CampTemplate::trigger_error($ex->getMessage(), $tpl);
        }
    } // fn render
开发者ID:nistormihai,项目名称:Newscoop,代码行数:60,代码来源:CampHTMLDocument.php

示例4: processOldImageOptions

 /**
  * Process the image options given in the old format (for compatibility):
  * [<image_number> [<image_ratio>]]
  * or:
  * [<image_number> [width <image_width> | height <image_height>]
  * @param integer $p_imageNo
  * @param array $p_params
  */
 private function processOldImageOptions(&$p_imageNo, array $p_params)
 {
     $p_imageNo = isset($p_params[0]) ? array_shift($p_params) : null;
     if(isset($p_params[0]) && is_numeric($p_params[0])) {
         $this->m_buildQueryArray['ImageRatio'] = $p_params[0];
     } else {
         while (isset($p_params[0])) {
             $option = strtolower(array_shift($p_params));
             if ($option != 'width' && $option != 'height') {
                 CampTemplate::trigger_error("Invalid image attribute '$option' in URL statement.");
                 break;
             }
             if (isset($p_params[0]) && is_numeric($p_params[0])) {
                 $option_value = array_shift($p_params);
             } else {
                 CampTemplate::trigger_error("Value not set for '$option' image attribute in URL statement.");
                 break;
             }
             $param = 'Image' . ucfirst($option);
             $this->m_buildQueryArray[$param] = $option_value;
         }
     }
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:CampURI.php


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