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


PHP dcPage::addErrorNotice方法代码示例

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


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

示例1: foreach

            if (!empty($_POST['buttons'])) {
                foreach ($_POST['buttons'] as $plugin_name => $button_name) {
                    $plugins[$plugin_name]['button'] = $button_name;
                }
            }
            $core->blog->settings->dcCKEditorAddons->put('plugins', json_encode($plugins), 'string');
            if ($_POST['action'] == 'activate') {
                $verb = 'activated';
            } else {
                $verb = 'deactivated';
            }
            dcPage::addSuccessNotice(sprintf(__('Selected addon has been ' . $verb . '.', 'Selected (%d) addons have been ' . $verb . '.', count($_POST['plugins'])), count($_POST['plugins'])));
            http::redirect($p_url);
        } elseif ($_POST['action'] == 'delete') {
            try {
                foreach ($_POST['plugins'] as $plugin_name) {
                    if (!files::deltree($dcckeditor_addons_repository_path . '/' . $dcckeditor_addons_plugins[$plugin_name]['path'])) {
                        throw new Exception(sprintf(__('Cannot remove addon "%s" files'), $plugin_name));
                    }
                    unset($plugins[$plugin_name]);
                }
                dcPage::addSuccessNotice(sprintf(__('Selected addon has been deleted.', 'Selected (%d) addons have been deleted.', count($_POST['plugins'])), count($_POST['plugins'])));
                $core->blog->settings->dcCKEditorAddons->put('plugins', json_encode($plugins), 'string');
            } catch (Exception $e) {
                dcPage::addErrorNotice($e->getMessage());
            }
            http::redirect($p_url);
        }
    }
}
include __DIR__ . '/tpl/index.tpl';
开发者ID:nikrou,项目名称:dcCKEditorAddons,代码行数:31,代码来源:index.php

示例2: Copyright

# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::check('categories');
# Remove a categories
if (!empty($_POST['delete'])) {
    $keys = array_keys($_POST['delete']);
    $cat_id = (int) $keys[0];
    # Check if category to delete exists
    $c = $core->blog->getCategory((int) $cat_id);
    if ($c->isEmpty()) {
        dcPage::addErrorNotice(__('This category does not exist.'));
        $core->adminurl->redirect("admin.categories");
    }
    $name = $c->cat_title;
    unset($c);
    try {
        # Delete category
        $core->blog->delCategory($cat_id);
        dcPage::addSuccessNotice(sprintf(__('The category "%s" has been successfully deleted.'), html::escapeHTML($name)));
        $core->adminurl->redirect("admin.categories");
    } catch (Exception $e) {
        $core->error->add($e->getMessage());
    }
}
# move post into a category
if (!empty($_POST['mov']) && !empty($_POST['mov_cat'])) {
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:categories.php

示例3: array

         case 4:
             // Fourth step, menu item to be added
             try {
                 if ($item_label != '' && $item_url != '') {
                     // Add new item menu in menu array
                     $menu[] = array('label' => $item_label, 'descr' => $item_descr, 'url' => $item_url);
                     // Save menu in blog settings
                     $core->blog->settings->system->put('simpleMenu', serialize($menu));
                     $core->blog->triggerBlog();
                     // All done successfully, return to menu items list
                     dcPage::addSuccessNotice(__('Menu item has been successfully added.'));
                     http::redirect($p_url);
                 } else {
                     $step = 3;
                     $item_select_label = $item_label;
                     dcPage::addErrorNotice(__('Label and URL of menu item are mandatory.'));
                 }
             } catch (Exception $e) {
                 $core->error->add($e->getMessage());
             }
             break;
     }
 } else {
     # Remove selected menu items
     if (!empty($_POST['removeaction'])) {
         try {
             if (!empty($_POST['items_selected'])) {
                 foreach ($_POST['items_selected'] as $k => $v) {
                     $menu[$v]['label'] = '';
                 }
                 $newmenu = array();
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:index.php


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