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


PHP JError::RaiseWarning方法代码示例

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


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

示例1: shLoadPluginLanguage

function shLoadPluginLanguage($pluginName, $language, $defaultString, $path = '')
{
    // V 1.2.4.m
    global $sh_LANG;
    // load the Language File
    $path = JString::rtrim($path, DS) . DS;
    $path = $path == DS ? sh404SEF_ADMIN_ABS_PATH . 'language' . DS . 'plugins' . DS : $path;
    if (shFileExists($path . $pluginName . '.php')) {
        include_once $path . $pluginName . '.php';
    } else {
        JError::RaiseWarning(500, 'sh404SEF - missing language file for plugin ' . $pluginName . '.');
    }
    if (!isset($sh_LANG[$language][$defaultString])) {
        return 'en';
    } else {
        return $language;
    }
}
开发者ID:sangkasi,项目名称:joomla,代码行数:18,代码来源:sh404sef.class.php

示例2: VALUES

    $sql = "INSERT INTO `#__extensions` ( `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state` ) VALUES ('System - jsecure', 'plugin','jsecure', 'system', 0,1,1,0,'', '','', '', 0, '0000-00-00 00:00:00',0,0);";
    $database->setQuery($sql);
    $database->query();
    $session =& JFactory::getSession();
    $session->set('jSecureAuthentication', 1);
} else {
    if ($r1 === true) {
        JFile::delete(JPATH_ROOT . '/' . 'plugins' . '/' . 'system' . '/' . 'jsecure.php');
    }
    if ($r2 === true) {
        JFile::delete(JPATH_ROOT . '/' . 'plugins' . '/' . 'system' . '/' . 'jsecure.xml');
    }
    JFile::delete(JPATH_ROOT . '/' . 'plugins' . '/' . 'system' . '/' . '404.html');
    JFile::delete(JPATH_ADMINISTRATOR . '/' . 'language' . '/' . 'en-GB' . '/' . 'en-GB.plg_system_jsecure.ini');
    deleteDir(JPATH_ROOT . '/' . 'plugins' . '/' . 'system' . '/' . 'jsecure/');
    JError::RaiseWarning(500, JText::_('Could not install jsecure system plugin'));
}
if (file_exists(JPATH_ROOT . '/' . 'plugins' . '/' . 'system' . '/' . 'jsecure' . '/' . 'jsecure.php') && file_exists(JPATH_ROOT . '/' . 'plugins' . '/' . 'system' . '/' . 'jsecure' . '/' . 'jsecure' . '/' . 'jsecure.class.php')) {
    deleteDir(JPATH_ADMINISTRATOR . '/' . 'components' . '/' . 'com_jsecure' . '/' . 'sysplugin/');
} else {
    echo '<strong><font color="red">Sorry, something went wrong while installing jsecure on your web site. Please try uninstalling first, then check permissions on your file system, and make sure Joomla can write to the /plugin directory. Or contact your site administrator for assistance. <br>You can also report this on our website at <a target="_blank" href="#" >our support forum.</a></font>';
}
function deleteDir($dir)
{
    if ($handle = opendir($dir)) {
        $array = array();
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                if (is_dir($dir . $file)) {
                    if (!@rmdir($dir . $file)) {
                        deleteDir($dir . $file . '/');
开发者ID:01J,项目名称:topm,代码行数:31,代码来源:install.jsecure.php

示例3: shInsertPlugin

/**
 * Insert in the db the previously retrieved parameters for a plugin
 * including publication information. Also move files as required
 *
 * @param string $basePath , the base path to get original files from
 * @param array $shConfig an array holding the database parameters of the plugin
 * @param array $files, an array holding list of files from the plugin
 */
function shInsertPlugin($basePath, $shConfig, $files, $folders, $foldersToCopy)
{
    // check data
    if (empty($files)) {
        return;
    }
    // move the files to target location
    $result = array();
    $resultFolders = array();
    $success = true;
    // create folders as needed
    if (!empty($folders)) {
        foreach ($folders as $folder) {
            $success = $success && JFolder::create(JPATH_ROOT . DS . 'plugins' . DS . $folder);
        }
    }
    // copy raw folders as needed
    if (!empty($foldersToCopy)) {
        foreach ($foldersToCopy as $folder) {
            $success = $success && JFolder::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sh404sef' . DS . 'plugins' . DS . $shConfig['folder'] . DS . $folder, JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $folder, $path = '', $forced = true);
            $result[$folder] = $success;
        }
    }
    // now move files across
    if ($success) {
        foreach ($files as $pluginFile) {
            $target = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $pluginFile);
            $source = JPath::clean($basePath . DS . $pluginFile);
            $success = $success && true === JFile::copy($source, $target);
            $resultFolders[$pluginFile] = $success;
        }
        // check and add an index.html file if it does not exists
        $target = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . 'index.html');
        if (!JFile::exists($target)) {
            $source = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . 'index.html');
            $success = $success && true === JFile::copy($source, $target);
        }
    }
    // if files moved to destination, setup plugin in Joomla database
    if ($success) {
        $shouldRestore = shShouldRestore();
        if ($shouldRestore) {
            // read stored params from disk
            shGetExtensionSavedParams($shConfig['folder'] . '.' . $shConfig['element'], $shConfig);
        }
        // insert elements in db, but only if it does not exist
        // we can't use insert ignore, as the record may have been modified by user (unpublished, order change)
        $db =& JFactory::getDBO();
        $sql = 'select count(id) from `#__plugins` where ' . ' `element` = ' . $db->Quote($shConfig['element']) . ' and `folder` = ' . $db->Quote($shConfig['folder']);
        $db->setQuery($sql);
        $alreadyInstalled = $db->loadResult();
        if (empty($alreadyInstalled)) {
            $sql = "INSERT INTO `#__plugins` ( `name`, `element`, `folder`, `access`, `ordering`, `published`," . " `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`)" . " VALUES ('{$shConfig['name']}', '{$shConfig['element']}', '{$shConfig['folder']}', '{$shConfig['access']}', '{$shConfig['ordering']}'," . " '{$shConfig['published']}', '{$shConfig['iscore']}', '{$shConfig['client_id']}', '{$shConfig['checked_out']}'," . " '{$shConfig['checked_out_time']}', '{$shConfig['params']}');";
            $db->setQuery($sql);
            $db->query();
            if (!empty($db->getErrorNum)) {
                echo $db->getErrorMsg() . '<br />';
            }
        }
    } else {
        // failure while copying files
        // don't leave anything behind
        foreach ($files as $pluginFile) {
            if (!empty($result[$pluginFile])) {
                // if file was copied, try to delete it
                JFile::delete(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $pluginFile);
            }
        }
        // also delete folders
        if (!empty($resultFolders)) {
            foreach ($resultFolders as $folder) {
                if ($resultFolders[$folder]) {
                    // if file was copied, try to delete it
                    JFolder::delete(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $folder);
                }
            }
        }
        JError::RaiseWarning(500, JText::_('Could not install plugin'));
    }
    return $success;
}
开发者ID:sangkasi,项目名称:joomla,代码行数:89,代码来源:install.sh404sef.php

示例4: shInsertPlugin

/**
 * Insert in the db the previously retrieved parameters for a plugin
 * including publication information. Also move files as required
 *
 * @param string $basePath , the base path to get original files from
 * @param array $shConfig an array holding the database parameters of the plugin
 * @param array $files, an array holding list of files from the plugin
 */
function shInsertPlugin($basePath, $shConfig, $files, $folders, $foldersToCopy)
{
    // check data
    if (empty($files)) {
        return;
    }
    // move the files to target location
    $result = array();
    $resultFolders = array();
    $success = true;
    // create folders as needed
    if (!empty($folders)) {
        foreach ($folders as $folder) {
            $success = $success && JFolder::create(JPATH_ROOT . DS . 'plugins' . DS . $folder);
        }
    }
    // copy raw folders as needed
    if (!empty($foldersToCopy)) {
        foreach ($foldersToCopy as $folder) {
            $success = $success && JFolder::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sh404sef' . DS . 'plugins' . DS . $shConfig['folder'] . DS . $folder, JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $folder);
            $result[$folder] = $success;
        }
    }
    // now move files across
    if ($success) {
        foreach ($files as $pluginFile) {
            $target = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $pluginFile);
            $source = JPath::clean($basePath . DS . $pluginFile);
            $success = $success && true === JFile::copy($source, $target);
            $resultFolders[$pluginFile] = $success;
        }
    }
    // if files moved to destination, setup plugin in Joomla database
    if ($success) {
        // read stored params from disk
        shGetExtensionSavedParams($shConfig['folder'] . '.' . $shConfig['element'], $shConfig);
        // insert elements in db
        $db =& JFactory::getDBO();
        $sql = "INSERT INTO `#__plugins` ( `name`, `element`, `folder`, `access`, `ordering`, `published`," . " `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`)" . " VALUES ('{$shConfig['name']}', '{$shConfig['element']}', '{$shConfig['folder']}', '{$shConfig['access']}', '{$shConfig['ordering']}'," . " '{$shConfig['published']}', '{$shConfig['iscore']}', '{$shConfig['client_id']}', '{$shConfig['checked_out']}'," . " '{$shConfig['checked_out_time']}', '{$shConfig['params']}');";
        $db->setQuery($sql);
        $db->query();
    } else {
        // don't leave anything behind
        foreach ($files as $pluginFile) {
            if ($result[$pluginFile]) {
                // if file was copied, try to delete it
                JFile::delete(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $pluginFile);
            }
        }
        // also delete folders
        if (!empty($resultFolders)) {
            foreach ($resultFolders as $folder) {
                if ($resultFolders[$folder]) {
                    // if file was copied, try to delete it
                    JFolder::delete(JPATH_ROOT . DS . 'plugins' . DS . $shConfig['folder'] . DS . $folder);
                }
            }
        }
        JError::RaiseWarning(500, JText::_('Could not install plugin'));
    }
    return $success;
}
开发者ID:justinlyon,项目名称:scc,代码行数:70,代码来源:install.sh404sef.php


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