本文整理汇总了PHP中safe_require函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_require函数的具体用法?PHP safe_require怎么用?PHP safe_require使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_require函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance_config_form
public static function instance_config_form($instance, $istemplate)
{
global $USER;
safe_require('artefact', 'blog');
$configdata = $instance->get('configdata');
if (!empty($configdata['artefactid'])) {
$blog = $instance->get_artefact_instance($configdata['artefactid']);
}
$elements = array();
// If the blog in this block is owned by the owner of the View, then
// the block can be configured. Otherwise, the blog was copied in from
// another View. We won't confuse users by asking them to choose a blog
// to put in this block, when the one that is currently in it isn't
// choosable.
//
// Note: the owner check will have to change when we do group/site
// blogs
if (empty($configdata['artefactid']) || $blog->get('owner') == $USER->get('id')) {
$elements[] = self::artefactchooser_element(isset($configdata['artefactid']) ? $configdata['artefactid'] : null, $istemplate);
if ($istemplate) {
$elements[] = PluginArtefactBlog::block_advanced_options_element($configdata, 'blog');
}
} else {
$elements[] = array('type' => 'html', 'name' => 'notice', 'value' => '<div class="message">' . get_string('blogcopiedfromanotherview', 'artefact.blog', get_string('blog', 'artefact.blog')) . '</div>');
}
return $elements;
}
示例2: instance_config_form
public static function instance_config_form($instance, $istemplate)
{
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
return array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactid']) ? array($configdata['artefactid']) : null), 'showdescription' => array('type' => 'checkbox', 'title' => get_string('showdescription', 'blocktype.file/image'), 'defaultvalue' => $configdata['showdescription']), 'width' => array('type' => 'text', 'title' => get_string('width', 'blocktype.file/image'), 'size' => 3, 'description' => get_string('widthdescription', 'blocktype.file/image'), 'rules' => array('minvalue' => 16, 'maxvalue' => get_config('imagemaxwidth')), 'defaultvalue' => isset($configdata['width']) ? $configdata['width'] : ''));
}
示例3: instance_config_form
public static function instance_config_form($instance)
{
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
return array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactid']) ? array($configdata['artefactid']) : null));
}
示例4: site_settings_set
/**
* Sets the specified site settings.
* A table with | Setting label | value | is expected.
*
* @Given /^the following site settings are set:$/
* @param TableNode $table
* @throws SystemException
*/
public function site_settings_set(TableNode $table)
{
$settings = array();
foreach ($table->getHash() as $sitesetting) {
$settings[$sitesetting['field']] = $sitesetting['value'];
}
// Validate the settings
$allowsettings = array('sitename', 'lang', 'country', 'theme', 'dropdownmenu', 'homepageinfo', 'userscanchooseviewthemes', 'remoteavatars', 'userscanhiderealnames', 'searchusernames', 'searchuserspublic', 'anonymouscomments', 'loggedinprofileviewaccess', 'staffreports', 'staffstats', 'userscandisabledevicedetection', 'masqueradingreasonrequired', 'masqueradingnotified', 'showprogressbar', 'exporttoqueue', 'defaultmultipleblogs', 'searchplugin', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'institutionexpirynotification', 'institutionautosuspend', 'requireregistrationconfirm', 'allowpublicviews', 'allowpublicprofiles', 'allowanonymouspages', 'generatesitemap', 'showselfsearchsideblock', 'showtagssideblock', 'tagssideblockmaxtags', 'viewmicroheaders', 'showonlineuserssideblock', 'onlineuserssideblockmaxusers', 'licensemetadata', 'licenseallowcustom', 'allowmobileuploads', 'wysiwyg', 'sitefilesaccess', 'watchlistnotification_delay', 'skins');
// if public views are disabled, sitemap generation must also be disabled.
if (empty($settings['allowpublicviews'])) {
$settings['generatesitemap'] = false;
} else {
// Ensure allowpublicprofiles is set as well
$settings['allowpublicprofiles'] = 1;
}
// Update site settings
$oldsearchplugin = get_config('searchplugin');
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
foreach ($allowsettings as $setting) {
if (isset($settings[$setting]) && !set_config($setting, $settings[$setting])) {
throw new SystemException("Can not set the option \"{$setting}\" to \"{$settings[$setting]}\"");
}
}
if (isset($settings['lang']) && $oldlanguage != $settings['lang']) {
safe_require('artefact', 'file');
ArtefactTypeFolder::change_public_folder_name($oldlanguage, $settings['lang']);
}
}
示例5: pieform_element_wysiwyg_get_headdata
function pieform_element_wysiwyg_get_headdata()
{
global $_PIEFORM_WYSIWYGS;
if (is_html_editor_enabled() && !empty($_PIEFORM_WYSIWYGS)) {
$result = '<script type="application/javascript">' . "\nvar editor_to_focus;" . "\nPieformManager.connect('onsubmit', null, tinyMCE.triggerSave);" . "\nPieformManager.connect('onload', null, function() {\n";
foreach ($_PIEFORM_WYSIWYGS as $editor) {
$result .= " tinyMCE.execCommand('mceAddEditor', false, '{$editor}');\n";
$result .= " \$('{$editor}').focus = function() {\n";
$result .= " editor_to_focus = '{$editor}';\n";
$result .= " };\n";
}
$result .= "});\nPieformManager.connect('onreply', null, function() {\n";
foreach ($_PIEFORM_WYSIWYGS as $editor) {
$result .= " tinyMCE.execCommand('mceRemoveEditor', false, '{$editor}');\n";
}
$result .= "});</script>";
safe_require('artefact', 'file');
$strings = PluginArtefactFile::jsstrings('filebrowser');
$jsstrings = '';
foreach ($strings as $section => $sectionstrings) {
foreach ($sectionstrings as $s) {
$jsstrings .= "strings.{$s}=" . json_encode(get_raw_string($s, $section)) . ';';
}
}
$headdata = '<script type="application/javascript">' . $jsstrings . '</script>';
return array('tinymce', $result, $headdata);
}
return array();
}
示例6: siteoptions_submit
function siteoptions_submit(Pieform $form, $values)
{
$fields = array('sitename', 'lang', 'theme', 'pathtoclam', 'defaultaccountlifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn', 'allowpublicviews', 'allowpublicprofiles', 'createpublicgroups', 'searchplugin', 'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend');
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
foreach ($fields as $field) {
if (!set_config($field, $values[$field])) {
siteoptions_fail($form, $field);
}
}
if ($oldlanguage != $values['lang']) {
safe_require('artefact', 'file');
ArtefactTypeFolder::change_public_folder_name($oldlanguage, $values['lang']);
}
// submitted sessionlifetime is in minutes; db entry session_timeout is in seconds
if (!set_config('session_timeout', $values['sessionlifetime'] * 60)) {
siteoptions_fail($form, 'sessionlifetime');
}
// Submitted value is on/off; database entry should be 1/0
foreach (array('viruschecking', 'usersallowedmultipleinstitutions') as $checkbox) {
if (!set_config($checkbox, (int) ($values[$checkbox] == 'on'))) {
siteoptions_fail($form, $checkbox);
}
}
$message = get_string('siteoptionsset', 'admin');
if ($oldtheme != $values['theme']) {
$message .= ' ' . get_string('usersseenewthemeonlogin', 'admin');
}
$form->reply(PIEFORM_OK, array('message' => $message, 'goto' => '/admin/site/options.php'));
}
示例7: instance_config_form
public static function instance_config_form($instance)
{
safe_require('artefact', 'blog');
$configdata = $instance->get('configdata');
$elements = array(self::artefactchooser_element(isset($configdata['artefactids']) ? $configdata['artefactids'] : null), 'count' => array('type' => 'text', 'title' => get_string('itemstoshow', 'blocktype.blog/recentposts'), 'defaultvalue' => isset($configdata['count']) ? $configdata['count'] : 10, 'size' => 3));
return $elements;
}
示例8: instance_config_form
public static function instance_config_form(BlockInstance $instance)
{
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
return array('artefactfieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('Files', 'blocktype.file/filedownload'), 'class' => 'last with-formgroup', 'elements' => array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactids']) ? $configdata['artefactids'] : null))));
}
示例9: instance_config_form
public static function instance_config_form(BlockInstance $instance)
{
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
return array('artefactfieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('file', 'artefact.file'), 'class' => 'last select-file mtl', 'elements' => array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactid']) ? array($configdata['artefactid']) : null))));
}
示例10: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
global $exporter;
require_once get_config('docroot') . 'artefact/lib.php';
safe_require('artefact', 'plans');
$configdata = $instance->get('configdata');
$smarty = smarty_core();
$blockid = param_integer('block', '');
$this_instance_id = $instance->get('id');
if (!$blockid or $blockid and $blockid == $this_instance_id) {
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 3);
} else {
$offset = 0;
$limit = 3;
$blockid = $this_instance_id;
}
$tasks = ArtefactTypeTask::get_alltasks($blockid, $offset, $limit);
$template = 'artefact:plans:alltaskrows.tpl';
if ($exporter) {
$pagination = false;
} else {
$baseurl = $instance->get_view()->get_url();
$baseurl .= (false === strpos($baseurl, '?') ? '?' : '&') . 'block=' . $blockid;
$pagination = array('baseurl' => $baseurl, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'tasktable_' . $blockid, 'jsonscript' => 'artefact/plans/viewtasks.json.php');
}
ArtefactTypeTask::render_tasks($tasks, $template, $configdata, $pagination);
if ($exporter && $tasks['count'] > $tasks['limit']) {
$artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view');
$tasks['pagination'] = '<a href="' . $artefacturl . '">' . get_string('alltasks', 'artefact.plans') . '</a>';
}
$smarty->assign('tasks', $tasks);
$smarty->assign('blockid', $instance->get('id'));
return $smarty->fetch('blocktype:alltasks:content.tpl');
}
示例11: instance_config_form
public static function instance_config_form($instance)
{
safe_require('artefact', 'blog');
$configdata = $instance->get('configdata');
$elements = array(self::artefactchooser_element(isset($configdata['artefactids']) ? $configdata['artefactids'] : null), 'count' => array('type' => 'text', 'title' => get_string('itemstoshow', 'blocktype.blog/recentposts'), 'description' => get_string('betweenxandy', 'mahara', 1, 100), 'defaultvalue' => isset($configdata['count']) ? $configdata['count'] : 10, 'size' => 3, 'rules' => array('integer' => true, 'minvalue' => 1, 'maxvalue' => 100)));
return $elements;
}
示例12: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
$configdata = $instance->get('configdata');
$text = isset($configdata['text']) ? $configdata['text'] : '';
safe_require('artefact', 'file');
$text = ArtefactTypeFolder::append_view_url($text, $instance->get('view'));
return clean_html($text);
}
示例13: instance_config_form
public static function instance_config_form($instance)
{
global $USER;
safe_require('artefact', 'survey');
$configdata = $instance->get('configdata');
log_debug($configdata);
$options = getoptions_available_surveys();
return array('userid' => array('type' => 'hidden', 'value' => $USER->get('id')), 'survey' => array('type' => $options ? 'select' : 'html', 'labelhtml' => get_string('surveytitle', 'artefact.survey'), 'defaultvalue' => isset($configdata['survey']) ? $configdata['survey'] : null, 'value' => $options ? null : '<div id="artefactchooser-body"><p class="noartefacts">' . get_string('noartefactstochoosefrom', 'view') . '</p></div>', 'options' => $options), 'steps' => array('type' => 'select', 'labelhtml' => get_string('surveyhistorysteps', 'blocktype.survey/surveyhistory'), 'defaultvalue' => isset($configdata['steps']) ? $configdata['steps'] : 5, 'options' => array(2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9)), 'showchart' => array('type' => 'checkbox', 'title' => get_string('showchart', 'blocktype.survey/surveyhistory'), 'defaultvalue' => isset($configdata['showchart']) ? $configdata['showchart'] : true), 'chartoptions' => array('type' => 'fieldset', 'legend' => get_string('chartoptions', 'artefact.survey'), 'collapsible' => true, 'collapsed' => true, 'elements' => ArtefactTypeSurvey::get_chart_options_elements($configdata)));
}
示例14: class_from_format
public static function class_from_format($format)
{
$format = trim($format);
if ($format == 'files') {
$format = 'file';
}
safe_require('import', $format);
return generate_class_name('import', $format);
}
示例15: Dwoo_Plugin_survey_title
/**
* Dwoo {survey_name} function plugin
*
* Type: function<br>
* Name: survey_title<br>
* Date: June 22, 2006<br>
* Purpose: Get the survey title from XML
* @author Gregor Anzelj
* @version 1.0
* @return Survey title instead of survey filename
*/
function Dwoo_Plugin_survey_title(Dwoo $dwoo, $survey, $lang = null)
{
safe_require('artefact', 'survey');
$return = ArtefactTypeSurvey::get_survey_title_from_xml($survey);
if ($lang != null) {
$return .= ' (' . substr($lang, 0, 2) . ')';
}
return $return;
}