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


PHP save_diy_data函数代码示例

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


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

示例1: import_diy

function import_diy($importfile, $primaltplname, $targettplname)
{
    global $_G;
    $css = $html = '';
    $arr = array();
    $content = file_get_contents(realpath($importfile));
    if (empty($content)) {
        return $arr;
    }
    require_once DISCUZ_ROOT . './source/class/class_xml.php';
    $diycontent = xml2array($content);
    if ($diycontent) {
        foreach ($diycontent['layoutdata'] as $key => $value) {
            if (!empty($value)) {
                getframeblock($value);
            }
        }
        $newframe = array();
        foreach ($_G['curtplframe'] as $value) {
            $newframe[] = $value['type'] . random(6);
        }
        $mapping = array();
        if (!empty($diycontent['blockdata'])) {
            $mapping = block_import($diycontent['blockdata']);
            unset($diycontent['bockdata']);
        }
        $oldbids = $newbids = array();
        if (!empty($mapping)) {
            foreach ($mapping as $obid => $nbid) {
                $oldbids[] = 'portal_block_' . $obid;
                $newbids[] = 'portal_block_' . $nbid;
            }
        }
        require_once DISCUZ_ROOT . './source/class/class_xml.php';
        $xml = array2xml($diycontent['layoutdata'], true);
        $xml = str_replace($oldbids, $newbids, $xml);
        $xml = str_replace((array) array_keys($_G['curtplframe']), $newframe, $xml);
        $diycontent['layoutdata'] = xml2array($xml);
        $css = str_replace($oldbids, $newbids, $diycontent['spacecss']);
        $css = str_replace((array) array_keys($_G['curtplframe']), $newframe, $css);
        $arr['spacecss'] = $css;
        $arr['layoutdata'] = $diycontent['layoutdata'];
        $arr['style'] = $diycontent['style'];
        save_diy_data($primaltplname, $targettplname, $arr, true);
    }
    return $arr;
}
开发者ID:v998,项目名称:discuzx-en,代码行数:47,代码来源:update.php

示例2: updatediytemplate

function updatediytemplate($targettplname = '', $tpldirectory = '')
{
    $r = false;
    $alldata = !empty($targettplname) ? array(C::t('common_diy_data')->fetch($targettplname, $tpldirectory)) : C::t('common_diy_data')->range();
    require_once libfile('function/portalcp');
    foreach ($alldata as $value) {
        $r = save_diy_data($value['tpldirectory'], $value['primaltplname'], $value['targettplname'], dunserialize($value['diycontent']));
    }
    return $r;
}
开发者ID:dalinhuang,项目名称:healthshop,代码行数:10,代码来源:function_core.php

示例3: empty

 $style = empty($_POST['style']) ? '' : preg_replace("/[^0-9a-z]/i", '', $_POST['style']);
 if ($style) {
     $cssfile = DISCUZ_ROOT . './static/topic/' . $style . '/style.css';
     if (!file_exists($cssfile)) {
         showmessage('theme_does_not_exist');
     } else {
         $templatedata['style'] = "static/topic/{$style}/style.css";
     }
 }
 $layoutdata = getstr($_POST['layoutdata'], 0, 0, 0, 0, 1);
 require_once libfile('class/xml');
 $templatedata['layoutdata'] = xml2array($layoutdata);
 if (empty($templatedata['layoutdata'])) {
     showmessage('diy_data_format_invalid');
 }
 $r = save_diy_data($tpldirectory, $template, $targettplname, $templatedata, true, $optype);
 include_once libfile('function/cache');
 updatecache('diytemplatename');
 if ($r && $optype != 'savecache') {
     if (!$iscategory && !$istopic && empty($savemod) && !empty($clonefile)) {
         $delfile = DISCUZ_ROOT . './data/diy/' . $tpldirectory . '/' . $template . '_' . $clonefile . '.htm';
         if (file_exists($delfile)) {
             unlink($delfile);
             @unlink($delfile . '.bak');
             C::t('common_template_block')->delete_by_targettplname("{$template}_{$clonefile}", $tpldirectory);
             C::t('common_diy_data')->delete("{$template}_{$clonefile}", $tpldirectory);
             include_once libfile('function/cache');
             updatecache('diytemplatename');
         }
     }
 }
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:portalcp_diy.php

示例4: updatediytemplate

function updatediytemplate($targettplname = '')
{
    global $_G;
    $r = false;
    $where = empty($targettplname) ? '' : " WHERE targettplname='{$targettplname}'";
    $query = DB::query("SELECT * FROM " . DB::table('common_diy_data') . "{$where}");
    require_once libfile('function/portalcp');
    while ($value = DB::fetch($query)) {
        $r = save_diy_data($value['primaltplname'], $value['targettplname'], unserialize($value['diycontent']));
    }
    return $r;
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:12,代码来源:function_core.php


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