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


PHP Option::updateOption方法代码示例

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


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

示例1: inactivePlugin

 /**
  * 禁用插件
  */
 function inactivePlugin($plugin)
 {
     $active_plugins = Option::get('active_plugins');
     if (in_array($plugin, $active_plugins)) {
         $key = array_search($plugin, $active_plugins);
         unset($active_plugins[$key]);
     } else {
         return;
     }
     $active_plugins = serialize($active_plugins);
     Option::updateOption('active_plugins', $active_plugins);
     //run remove callback functions
     $r = explode('/', $plugin, 2);
     $plugin = $r[0];
     $callback_file = "../content/plugins/{$plugin}/{$plugin}_callback.php";
     if (file_exists($callback_file)) {
         require_once $callback_file;
         if (function_exists('callback_rm')) {
             callback_rm();
         }
     }
 }
开发者ID:MikeCoder,项目名称:mblog,代码行数:25,代码来源:plugin_model.php

示例2: unset

                        Option::updateOption("widgets{$i}", $widgets_str);
                    }
                }
                unset($custom_widget[$rmwg]);
                $custom_widget_str = addslashes(serialize($custom_widget));
                Option::updateOption('custom_widget', $custom_widget_str);
            }
            break;
    }
    $CACHE->updateCache('options');
    emDirect("./widgets.php?activated=1");
}
//保存组件排序
if ($action == 'compages') {
    $wgNum = isset($_POST['wgnum']) ? intval($_POST['wgnum']) : 1;
    //侧边栏编号 1、2、3 ……
    $widgets = isset($_POST['widgets']) ? serialize($_POST['widgets']) : '';
    Option::updateOption("widgets{$wgNum}", $widgets);
    $CACHE->updateCache('options');
    emDirect("./widgets.php?activated=true&wg={$wgNum}");
}
//恢复组件设置到初始安装状态
if ($action == 'reset') {
    $widget_title = serialize(Option::getWidgetTitle());
    $default_widget = serialize(Option::getDefWidget());
    Option::updateOption("widget_title", $widget_title);
    Option::updateOption("custom_widget", 'a:0:{}');
    Option::updateOption("widgets1", $default_widget);
    $CACHE->updateCache('options');
    emDirect("./widgets.php?activated=1");
}
开发者ID:szshenjian,项目名称:JIEWU,代码行数:31,代码来源:widgets.php

示例3: gmdate

    $topimg_path = Option::UPLOADFILE_PATH . gmdate('Ym') . '/top-' . $time . '.jpg';
    $ret = imageCropAndResize($top_img, $topimg_path, 0, 0, $x1, $y1, $width, $height, $width, $height);
    if (false === $ret) {
        emDirect("./template.php?action=custom-top&error_a=1");
    }
    //create mini topimg
    $topimg_mini_path = Option::UPLOADFILE_PATH . gmdate('Ym') . '/top-' . $time . '_mini.jpg';
    $ret = imageCropAndResize($topimg_path, $topimg_mini_path, 0, 0, 0, 0, 230, 48, $width, $height);
    if (false === $ret) {
        emDirect("./template.php?action=custom-top&error_a=1");
    }
    @unlink($top_img);
    $custom_topimgs = Option::get('custom_topimgs');
    array_push($custom_topimgs, substr($topimg_path, 3));
    Option::updateOption('topimg', substr($topimg_path, 3));
    Option::updateOption('custom_topimgs', serialize($custom_topimgs));
    $CACHE->updateCache('options');
    emDirect("./template.php?action=custom-top&activated=1");
}
//安装模板
if ($action == 'install') {
    include View::getView('header');
    require_once View::getView('template_install');
    include View::getView('footer');
    View::output();
}
//上传zip模板
if ($action == 'upload_zip') {
    LoginAuth::checkToken();
    $zipfile = isset($_FILES['tplzip']) ? $_FILES['tplzip'] : '';
    if ($zipfile['error'] == 4) {
开发者ID:MikeCoder,项目名称:mblog,代码行数:31,代码来源:template.php

示例4: implode

        if (file_exists($style_path . $file . '/style.css')) {
            $styleData = implode('', @file($style_path . $file . '/style.css'));
            preg_match("/Style Name:([^\r\n]+)/i", $styleData, $name);
            preg_match("/Author:(.*)/i", $styleData, $author);
            preg_match("/Url:(.*)/i", $styleData, $url);
            $styleInfo['style_name'] = !empty($name[1]) ? trim($name[1]) : $file;
            $styleInfo['style_file'] = $file;
            if (!empty($author[1]) && !empty($url[1])) {
                $styleInfo['style_author'] = '(作者:<a href="' . $url[1] . '" target="_blank">' . $author[1] . '</a>)';
            } elseif (!empty($author[1])) {
                $styleInfo['style_author'] = '(作者:' . $author[1] . ')';
            } else {
                $styleInfo['style_author'] = '';
            }
            $styles[] = $styleInfo;
        }
    }
    closedir($handle);
    $stylenums = count($styles);
    include View::getView('header');
    require_once View::getView('style');
    include View::getView('footer');
    View::output();
}
//update
if ($action == 'usestyle') {
    $styleName = isset($_GET['style']) ? addslashes($_GET['style']) : '';
    Option::updateOption('admin_style', $styleName);
    $CACHE->updateCache('options');
    emDirect("./style.php?activated=1");
}
开发者ID:szshenjian,项目名称:JIEWU,代码行数:31,代码来源:style.php

示例5: isset

    include View::getView('footer');
    View::output();
}
if ($action == 'update') {
    LoginAuth::checkToken();
    $permalink = isset($_POST['permalink']) ? addslashes($_POST['permalink']) : '0';
    $isalias = isset($_POST['isalias']) ? addslashes($_POST['isalias']) : 'n';
    $isalias_html = isset($_POST['isalias_html']) ? addslashes($_POST['isalias_html']) : 'n';
    $getData = array('site_title' => isset($_POST['site_title']) ? addslashes($_POST['site_title']) : '', 'site_description' => isset($_POST['site_description']) ? addslashes($_POST['site_description']) : '', 'site_key' => isset($_POST['site_key']) ? addslashes($_POST['site_key']) : '', 'isurlrewrite' => isset($_POST['permalink']) ? addslashes($_POST['permalink']) : '0', 'isalias' => isset($_POST['isalias']) ? addslashes($_POST['isalias']) : 'n', 'isalias_html' => isset($_POST['isalias_html']) ? addslashes($_POST['isalias_html']) : 'n', 'log_title_style' => isset($_POST['log_title_style']) ? addslashes($_POST['log_title_style']) : '0');
    if ($permalink != '0' || $isalias == 'y') {
        $fp = @fopen(EMLOG_ROOT . '/.htaccess', 'w');
        $t = parse_url(BLOG_URL);
        $rw_rule = '<IfModule mod_rewrite.c>
					   RewriteEngine on
					   RewriteCond %{REQUEST_FILENAME} !-f
					   RewriteCond %{REQUEST_FILENAME} !-d
					   RewriteBase ' . $t['path'] . '
					   RewriteRule . ' . $t['path'] . 'index.php [L]
					</IfModule>';
        if (!@fwrite($fp, $rw_rule)) {
            header('Location: ./seo.php?error=1');
            exit;
        }
        fclose($fp);
    }
    foreach ($getData as $key => $val) {
        Option::updateOption($key, $val);
    }
    $CACHE->updateCache(array('options', 'navi'));
    header('Location: ./seo.php?activated=1');
}
开发者ID:MikeCoder,项目名称:mblog,代码行数:31,代码来源:seo.php

示例6: isset

//操作页面
if ($action == 'operate_page') {
    $operate = isset($_POST['operate']) ? $_POST['operate'] : '';
    $pages = isset($_POST['page']) ? array_map('intval', $_POST['page']) : array();
    LoginAuth::checkToken();
    $emPage = new Log_Model();
    switch ($operate) {
        case 'del':
            foreach ($pages as $value) {
                $emPage->deleteLog($value);
                unset($navibar[$value]);
            }
            $navibar = addslashes(serialize($navibar));
            Option::updateOption('navibar', $navibar);
            $CACHE->updateCache(array('options', 'sta', 'comment', 'logalias'));
            emDirect("./page.php?active_del=1");
            break;
        case 'hide':
        case 'pub':
            $ishide = $operate == 'hide' ? 'y' : 'n';
            foreach ($pages as $value) {
                $emPage->hideSwitch($value, $ishide);
                $navibar[$value]['hide'] = $ishide;
            }
            $navibar = addslashes(serialize($navibar));
            Option::updateOption('navibar', $navibar);
            $CACHE->updateCache(array('options', 'sta', 'comment'));
            emDirect("./page.php?active_hide_" . $ishide . "=1");
            break;
    }
}
开发者ID:myxzy,项目名称:markdown-for-emlog,代码行数:31,代码来源:page.php

示例7: closedir

        }
    }
    closedir($handle);
    $tplnums = count($tpls);
    include View::getView('header');
    require_once View::getView('template');
    include View::getView('footer');
    View::output();
}
//使用模板
if ($action == 'usetpl') {
    LoginAuth::checkToken();
    $tplName = isset($_GET['tpl']) ? addslashes($_GET['tpl']) : '';
    $tplSideNum = isset($_GET['side']) ? intval($_GET['side']) : '';
    Option::updateOption('nonce_templet', $tplName);
    Option::updateOption('tpl_sidenum', $tplSideNum);
    $CACHE->updateCache('options');
    emDirect("./template.php?activated=1");
}
//删除模板
if ($action == 'del') {
    LoginAuth::checkToken();
    $tplName = isset($_GET['tpl']) ? addslashes($_GET['tpl']) : '';
    $nonce_templet = Option::get('nonce_templet');
    if ($tplName === $nonce_templet) {
        emMsg('您不能删除正在使用的模板');
    }
    if (true === emDeleteFile(TPLS_PATH . $tplName)) {
        emDirect("./template.php?activate_del=1#tpllib");
    } else {
        emDirect("./template.php?error_a=1#tpllib");
开发者ID:flyysr,项目名称:emlog,代码行数:31,代码来源:template.php

示例8: trim

     break;
 case 'set_compression_size':
     $kl_album_compression_length = trim($_GET['kl_album_compression_length']) != '' ? intval(trim($_GET['kl_album_compression_length'])) : 1024;
     $kl_album_compression_width = trim($_GET['kl_album_compression_width']) != '' ? intval(trim($_GET['kl_album_compression_width'])) : 768;
     $kl_album_config['compression_length'] = $kl_album_compression_length;
     $kl_album_config['compression_width'] = $kl_album_compression_width;
     Option::updateOption('kl_album_config', serialize($kl_album_config));
     $CACHE->updateCache('options');
     echo json_encode(array('Y', $kl_album_compression_length, $kl_album_compression_width));
     break;
 case 'set_log_photo_size':
     $kl_album_log_photo_length = trim($_GET['kl_album_log_photo_length']) != '' ? intval(trim($_GET['kl_album_log_photo_length'])) : 480;
     $kl_album_log_photo_width = trim($_GET['kl_album_log_photo_width']) != '' ? intval(trim($_GET['kl_album_log_photo_width'])) : 360;
     $kl_album_config['log_photo_length'] = $kl_album_log_photo_length;
     $kl_album_config['log_photo_width'] = $kl_album_log_photo_width;
     Option::updateOption('kl_album_config', serialize($kl_album_config));
     $CACHE->updateCache('options');
     echo json_encode(array('Y', $kl_album_log_photo_length, $kl_album_log_photo_width));
     break;
 case 'remove':
     $remove = $_GET['remove'];
     if ($remove == 'Y') {
         $DB->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "kl_album`");
         $DB->query("DELETE FROM " . DB_PREFIX . "options WHERE option_name like 'kl_album_%'");
         $CACHE->updateCache('options');
         $Navi_Model = new Navi_Model();
         $navis = $Navi_Model->getNavis();
         foreach ($navis as $navi) {
             if ($navi['url'] == '?plugin=kl_album' && $navi['isdefault'] == 'y') {
                 $Navi_Model->deleteNavi($navi['id']);
                 $CACHE->updateCache('navi');
开发者ID:MikeCoder,项目名称:mblog,代码行数:31,代码来源:kl_album_ajax_do.php

示例9: isset

    include View::getView('header');
    require_once View::getView('permalink');
    include View::getView('footer');
    View::output();
}
if ($action == 'update') {
    $permalink = isset($_POST['permalink']) ? addslashes($_POST['permalink']) : '0';
    $isalias = isset($_POST['isalias']) ? addslashes($_POST['isalias']) : 'n';
    $isalias_html = isset($_POST['isalias_html']) ? addslashes($_POST['isalias_html']) : 'n';
    if ($permalink != '0' || $isalias == 'y') {
        $fp = @fopen(EMLOG_ROOT . '/.htaccess', 'w');
        $t = parse_url(BLOG_URL);
        $rw_rule = '<IfModule mod_rewrite.c>
					   RewriteEngine on
					   RewriteCond %{REQUEST_FILENAME} !-f
					   RewriteCond %{REQUEST_FILENAME} !-d
					   RewriteBase ' . $t['path'] . '
					   RewriteRule . ' . $t['path'] . 'index.php [L]
					</IfModule>';
        if (!@fwrite($fp, $rw_rule)) {
            header('Location: ./permalink.php?error=true');
            exit;
        }
        fclose($fp);
    }
    Option::updateOption('isurlrewrite', $permalink);
    Option::updateOption('isalias', $isalias);
    Option::updateOption('isalias_html', $isalias_html);
    $CACHE->updateCache('options');
    header('Location: ./permalink.php?activated=true');
}
开发者ID:MikeCoder,项目名称:mblog,代码行数:31,代码来源:permalink.php


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