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


PHP cms_utils::set_app_data方法代码示例

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


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

示例1: debug_buffer

 /**
  * Loads a set of content objects into the cached tree.
  *
  * @param boolean $loadprops If true, load the properties of those content objects
  * @param boolean $onlyexpanded Not implemented
  * @param boolean $loadcontent If false, only create the nodes in the tree, 
  *                             don't load the content objects
  * @return mixed The cached tree of content
  */
 function &GetAllContentAsHierarchy($loadcontent = false)
 {
     debug_buffer('', 'starting tree');
     $gCms = cmsms();
     $db = $gCms->GetDb();
     $tree = null;
     $cachefilename = TMP_CACHE_LOCATION . '/contentcache.php';
     $loadedcache = false;
     if (file_exists($cachefilename)) {
         $last_modified = cms_utils::get_app_data('last_content_modification');
         if ($last_modified <= 0) {
         }
         $query = 'SELECT modified_date FROM ' . cms_db_prefix() . 'content ORDER BY modified_date DESC';
         $val = $db->GetOne($query);
         $last_modified = $db->UnixTimeStamp($val);
         cms_utils::set_app_data('last_content_modification', $last_modified);
         if ($last_modified > 0 && $last_modified < filemtime($cachefilename)) {
             debug_buffer('Content tree file needs loading');
             $handle = fopen($cachefilename, "r");
             $data = fread($handle, filesize($cachefilename));
             fclose($handle);
             $tree = unserialize(substr($data, 16));
             if (strtolower(get_class($tree)) == 'cms_content_tree') {
                 $loadedcache = true;
             } else {
                 $loadedcache = false;
             }
         }
     }
     if (!$loadedcache) {
         debug_buffer('', 'Start Loading Children into Tree');
         $query = 'SELECT content_id,parent_id,content_alias FROM ' . cms_db_prefix() . 'content ORDER BY parent_id,item_order';
         $nodes = $db->GetArray($query);
         $tree = cms_tree_operations::load_from_list($nodes);
         debug_buffer('', 'End Loading Children into Tree');
     }
     if (!$loadedcache) {
         debug_buffer("Serializing...");
         @file_put_contents($cachefilename, '<?php return; ?>' . serialize($tree));
     }
     if ($loadcontent) {
         $this->LoadChildren(-1, true, true);
     }
     debug_buffer('', 'ending tree');
     return $tree;
 }
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:55,代码来源:class.contentoperations.inc.php

示例2: lang

     $error .= "<li>" . lang('nofieldgiven', array(lang('name'))) . "</li>";
     $validinfo = false;
 } else {
     if ($templateops->CheckExistingTemplateName($template, $template_id)) {
         $error .= "<li>" . lang('templateexists') . "</li>";
         $validinfo = false;
     }
 }
 if ($content == "") {
     $error .= "<li>" . lang('nofieldgiven', array(lang('content'))) . "</li>";
     $validinfo = false;
 }
 if ($validinfo) {
     try {
         $parser = cmsms()->get_template_parser();
         cms_utils::set_app_data('tmp_template', $content);
         try {
             $parser->fetch('template:appdata;tmp_template');
             // do the magic.
         } catch (SmartyCompilerException $e) {
             debug_display($e);
             die;
             $error .= "<li>" . $e->getMessage() . '</li>';
             $validinfo = false;
         }
         $contentBlocks = CMS_Content_Block::get_content_blocks();
         if (!is_array($contentBlocks) || count($contentBlocks) == 0) {
             throw new CmsEditContentException('No content blocks defined in template');
         }
         if (!isset($contentBlocks['content_en'])) {
             throw new CmsEditContentException('No default content block {content} or {content block=\'content_en\'} defined in template');
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:31,代码来源:edittemplate.php

示例3: foreach

    $typesdropdown = '<select name="content_type" onchange="document.Edit_Content.submit()" class="standard">';
    $cur_content_type = '';
    $content_types = $contentops->ListContentTypes(false, true);
    foreach ($content_types as $onetype => $onetypename) {
        if ($onetype == 'errorpage' && !check_permission($userid, 'Manage All Content')) {
            continue;
        }
        $typesdropdown .= '<option value="' . $onetype . '"';
        if ($onetype == $content_type) {
            $typesdropdown .= ' selected="selected" ';
            $cur_content_type = $onetype;
        }
        $typesdropdown .= ">" . $onetypename . "</option>";
    }
    $typesdropdown .= "</select>";
    cms_utils::set_app_data('editing_content', $contentobj);
    if (empty($error) && $contentobj->GetError()) {
        $error = $contentobj->GetError();
    }
    if (FALSE == empty($error)) {
        echo $themeObject->ShowErrors($error);
    }
    ?>

<!--
<div class="pagecontainer">
	<p class="pageheader"><?php 
    echo lang('preview');
    ?>
</p>
	<iframe name="previewframe" class="preview" src="<?php 
开发者ID:Alexkuva,项目名称:Beaupotager,代码行数:31,代码来源:addcontent.php

示例4: cge_module_hint

 public static function cge_module_hint($params, $smarty)
 {
     if (!isset($params['module'])) {
         return;
     }
     $module = trim($params['module']);
     $modobj = cms_utils::get_module($module);
     if (!is_object($modobj)) {
         return;
     }
     $data = cms_utils::get_app_data('__MODULE_HINT__' . $module);
     if (!$data) {
         $data = array();
     }
     // warning, no check here if the module understands the parameter.
     foreach ($params as $key => $value) {
         if ($key == 'module') {
             continue;
         }
         $data[$key] = $value;
     }
     cms_utils::set_app_data('__MODULE_HINT__' . $module, $data);
 }
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:23,代码来源:class.cge_smarty_plugins.php

示例5: SetError

 protected function SetError($str)
 {
     // we don't need this being serialized.
     cms_utils::set_app_data('content_error', $str);
 }
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:5,代码来源:class.ContentBase.php

示例6: cms_module_plugin

/**
 * A function to call a module as a smarty plugin
 * This method is used by the {cms_module} plugin, and internally when {ModuleName} is called
 *
 * @internal
 * @access private
 * @param array A hash of parameters 
 * @param object The smarty object
 * @return string The module output
 */
function cms_module_plugin($params, &$template)
{
    $smarty = $template->smarty;
    $mid_cache = cms_utils::get_app_data('mid_cache');
    if (empty($mid_cache)) {
        $mid_cache = array();
    }
    for ($i = 0; $i < 10; $i++) {
        $tmp = $i;
        foreach ($params as $key => $value) {
            $tmp .= $key . '=' . $value;
        }
        $id = 'm' . substr(md5($tmp), 0, 5);
        if (!isset($mid_cache[$id])) {
            $mid_cache[$id] = $id;
            break;
        }
    }
    cms_utils::set_app_data('mid_cache', $mid_cache);
    $returnid = '';
    $content_obj = cmsms()->get_variable('content_obj');
    if (isset($content_obj) && $content_obj->Id()) {
        $returnid = $content_obj->Id();
    }
    //$params = array_merge($params, GetModuleParameters($id));
    $modulename = '';
    $action = 'default';
    $inline = false;
    $checkid = '';
    if (isset($params['module'])) {
        $modulename = $params['module'];
    } else {
        return '<!-- ERROR: module name not specified -->';
    }
    if (isset($params['idprefix'])) {
        $id = trim($params['idprefix']);
    }
    if (isset($params['action']) && $params['action'] != '') {
        // action was set in the module tag
        $action = $params['action'];
    }
    if (isset($_REQUEST['id'])) {
        $checkid = $_REQUEST['id'];
    } else {
        if (isset($_REQUEST['mact'])) {
            // we're handling an action
            $ary = explode(',', cms_htmlentities($_REQUEST['mact']), 4);
            $mactmodulename = isset($ary[0]) ? $ary[0] : '';
            if (!strcasecmp($mactmodulename, $params['module'])) {
                $checkid = isset($ary[1]) ? $ary[1] : '';
                $mactaction = isset($ary[2]) ? $ary[2] : '';
            }
            $mactinline = isset($ary[3]) && $ary[3] == 1 ? true : false;
            if ($checkid == $id) {
                // the action is for this instance of the module
                $inline = $mactinline;
                if ($inline == true) {
                    // and we're inline (the results are supposed to replace
                    // the tag, not {content}
                    $action = $mactaction;
                    $params = array_merge($params, GetModuleParameters($id));
                }
            }
        }
    }
    if ($action == '') {
        $action = 'default';
    }
    // probably not needed, but safe
    class_exists($modulename);
    $module = cms_utils::get_module($modulename);
    if ($module && $module->isPluginModule()) {
        @ob_start();
        $result = $module->DoActionBase($action, $id, $params, $returnid);
        if ($result !== FALSE) {
            echo $result;
        }
        $modresult = @ob_get_contents();
        @ob_end_clean();
        if (isset($params['assign'])) {
            $smarty->assign(trim($params['assign']), $modresult);
            return;
        }
        return $modresult;
    } else {
        return "<!-- {$modulename} is not a plugin module -->\n";
    }
}
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:98,代码来源:module.functions.php

示例7: GetFieldInput

 function GetFieldInput($id, &$params, $returnid)
 {
     $gCms = cmsms();
     $mod = $this->form_ptr->module_ptr;
     $cataloger = $mod->GetModuleInstance('Cataloger');
     if (!$cataloger) {
         return $mod->Lang('error_cataloger_module_not_available');
     }
     $tmp_attrs = $this->_get_cataloger_attribute_fields();
     $lines = (int) $this->GetOption('lines', '5');
     $nameregex = trim($this->GetOption('nameregex', ''));
     $tmp_attrs = array();
     foreach ($tmp_attrs as $one) {
         $safeattr = strtolower(preg_replace('/\\W/', '', $one->attr));
         $val = trim($this->GetOption('attr_' . $safeattr, ''));
         if (empty($val)) {
             continue;
         }
         $one->input = $val;
         $attrs[] = $one;
     }
     // put the hidden fields into smarty.
     $smarty_vars_set = cms_utils::get_app_data('fb_smarty_vars_set');
     if (!empty($smarty_vars_set)) {
         $smarty = cmsms()->GetSmarty();
         if (!$smarty) {
             return;
         }
         $theFields = $this->form_ptr->GetFields();
         for ($i = 0; $i < count($theFields); $i++) {
             if ($theFields[$i]->GetFieldType() != 'HiddenField') {
                 continue;
             }
             $smarty->assign('fld_' . $theFields[$i]->GetId(), $theFields[$i]->Value);
             if ($theFields[$i]->GetAlias() != '') {
                 $smarty->assign($theFields[$i]->GetAlias(), $theFields[$i]->Value);
             }
         }
         cms_utils::set_app_data('fb_smarty_vars_set', 1);
     }
     // for each hierarchy item (from the root down)
     $hm = $gCms->GetHierarchyManager();
     $allcontent = $hm->getFlatList();
     $results = array();
     foreach ($allcontent as $onepage) {
         $content = $onepage->GetContent();
         // if it's not a cataloger item continue
         if ($content->Type() != 'catalogitem') {
             continue;
         }
         // if it's not active or shown in menu continue
         if (!$content->Active() || !$content->ShowInMenu()) {
             continue;
         }
         // if the nameregex string is not empty, and the name does not match the
         //    regex, continue
         if (!empty($nameregex) && !preg_match('/' . $nameregex . '/', $content->Name())) {
             continue;
         }
         // for each attribute
         $passed = true;
         $attrs = array();
         foreach ($attrs as $oneattr) {
             // parse the field value through smarty?
             $expr = $mod->ProcessTemplateFromData($oneattr->input);
             if (empty($expr)) {
                 continue;
             }
             // no expression for this field. pass
             // get the value for this attribute for this content
             $currentval = $content->GetPropertyValue($oneattr->attr);
             if (empty($currentval)) {
                 // no value for this field, but we have an expression
                 // this catalog item fails.
                 $passed = false;
                 break;
             }
             list($type, $expr) = explode(':', $expr, 2);
             $type = trim($type);
             $expr = trim($expr);
             $res = false;
             switch (strtolower($type)) {
                 case 'range':
                     // for ranges:
                     // grab min and max values
                     list($minval, $maxval) = explode('to', $expr);
                     $minval = trim($minval);
                     $maxval = trim($maxval);
                     // check for numeric
                     if (!is_numeric($minval) || !is_numeric($maxval)) {
                         // can't test ranges with non numeric values
                         // so fail
                         $passed = false;
                         break;
                     }
                     if ($minval > $maxval) {
                         $tmp = $minval;
                         $minval = $maxval;
                         $maxval = $tmp;
                     }
//.........这里部分代码省略.........
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:101,代码来源:CatalogerItemsField.class.php

示例8: debug_buffer

 /**
  * Loads a set of content objects into the cached tree.
  *
  * @param boolean $loadprops If true, load the properties of those content objects
  * @param boolean $onlyexpanded Not implemented
  * @param boolean $loadcontent If false, only create the nodes in the tree, 
  *                             don't load the content objects
  * @return mixed The cached tree of content
  */
 function &GetAllContentAsHierarchy($loadcontent = false)
 {
     debug_buffer('', 'starting tree');
     $gCms = cmsms();
     $db = $gCms->GetDb();
     $tree = null;
     $cachefilename = TMP_CACHE_LOCATION . '/contentcache.php';
     $loadedcache = false;
     if (file_exists($cachefilename)) {
         $last_modified = cms_utils::get_app_data('last_content_modification');
         if (!$last_modified) {
         }
         $query = 'SELECT modified_date FROM ' . cms_db_prefix() . 'content ORDER BY modified_date DESC';
         $val = $db->GetOne($query);
         $last_modified = $db->UnixTimeStamp($val);
         cms_utils::set_app_data('last_content_modification', $last_modified);
         if ($last_modified > 0 && $last_modified < filemtime($cachefilename)) {
             debug_buffer('file needs loading');
             $handle = fopen($cachefilename, "r");
             $data = fread($handle, filesize($cachefilename));
             fclose($handle);
             $tree = unserialize(substr($data, 16));
             if (strtolower(get_class($tree)) == 'cms_content_tree') {
                 $loadedcache = true;
             } else {
                 die('problem loading cache');
                 $loadedcache = false;
             }
         }
     }
     if (!$loadedcache) {
         $query = "SELECT id_hierarchy,content_alias FROM " . cms_db_prefix() . "content ORDER BY hierarchy";
         $dbresult = $db->Execute($query);
         $nodes = array();
         if ($dbresult && $dbresult->RecordCount() > 0) {
             while ($row = $dbresult->FetchRow()) {
                 $nodes[] = $row['id_hierarchy'] . ',' . $row['content_alias'];
             }
             $dbresult->Close();
         }
         debug_buffer('', 'Start Loading Children into Tree');
         $tree = cms_tree_operations::load_from_list($nodes);
         debug_buffer('', 'End Loading Children into Tree');
     }
     if (!$loadedcache) {
         debug_buffer("Serializing...");
         @file_put_contents($cachefilename, '<?php return; ?>' . serialize($tree));
     }
     if ($loadcontent) {
         $this->LoadChildren(-1, true, true);
     }
     debug_buffer('', 'ending tree');
     return $tree;
 }
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:63,代码来源:class.contentoperations.inc.php

示例9: module_db_timestamp

 /** 
  *  A method to return the timestamp of a module database template
  *
  *  @access private
  *  @param  string The name of the module template
  *  @param  int    (returned) The file timestamp
  *  @param  object The smarty object
  *  @return boolean
  */
 function module_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
 {
     $db = cmsms()->GetDb();
     $module_template_cache = cms_utils::get_app_data('module_template_cache');
     if (isset($module_template_cache) && isset($module_template_cache[$tpl_name])) {
         $tpl_timestamp = $module_template_cache[$tpl_name];
         return true;
     }
     $query = "SELECT module_name,template_name,modified_date \n                            FROM " . cms_db_prefix() . "module_templates";
     $results = $db->GetArray($query);
     if (!count($results)) {
         return false;
     }
     if (empty($module_template_cache)) {
         $module_template_cache = array();
     }
     foreach ($results as $row) {
         $key = $row['module_name'] . ';' . $row['template_name'];
         $val = $db->UnixTimeStamp($row['modified_date']);
         $module_template_cache[$key] = $val;
     }
     $tpl_timestamp = $module_template_cache[$tpl_name];
     cms_utils::set_app_data('module_template_cache', $module_template_cache);
     return true;
 }
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:34,代码来源:class.Smarty_CMS.php

示例10: allow_admin_lang

/**
 * Temporarily allow accessing admin realm from within a frontend action.
 */
function allow_admin_lang($flag = TRUE)
{
    cms_utils::set_app_data('__allow_admin_realm__', $flag);
    if (!$flag) {
        global $lang;
        if (isset($lang['admin'])) {
            unset($lang['admin']);
        }
    }
}
开发者ID:aldrymaulana,项目名称:cmsdepdagri,代码行数:13,代码来源:translation.functions.php


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