本文整理汇总了PHP中Skin::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::get方法的具体用法?PHP Skin::get怎么用?PHP Skin::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deletefontform_submit
function deletefontform_submit(Pieform $form, $values)
{
global $SESSION;
$fontname = $values['font'];
$result = delete_records('skin_fonts', 'name', $fontname);
if ($result == false) {
$SESSION->add_error_msg(get_string('cantdeletefont', 'skin'));
} else {
// Check to see if the font is being used in a skin. If it is remove it from
// the skin's viewskin data
$skins = get_records_array('skin');
if (is_array($skins)) {
foreach ($skins as $skin) {
$options = unserialize($skin->viewskin);
foreach ($options as $key => $option) {
if (preg_match('/font_family/', $key) && $option == $fontname) {
require_once get_config('docroot') . 'lib/skin.php';
$skinobj = new Skin($skin->id);
$viewskin = $skinobj->get('viewskin');
$viewskin[$key] = 'Arial';
// the default font
$skinobj->set('viewskin', $viewskin);
$skinobj->commit();
}
}
}
}
// Also delete all the files in the appropriate folder and the folder itself...
$fontpath = get_config('dataroot') . 'skins/fonts/' . $fontname;
recurse_remove_dir($fontpath);
$SESSION->add_ok_msg(get_string('fontdeleted', 'skin'));
}
redirect('/admin/site/fonts.php');
}
示例2: deleteskin_submit
function deleteskin_submit(Pieform $form, $values)
{
global $SESSION, $USER, $skinid, $redirect;
$skin = new Skin($skinid, null);
if ($skin->get('owner') == $USER->get('id') || $USER->get('admin')) {
$skin->delete();
unlink(get_config('dataroot') . 'skins/' . $skinid . '.png');
$SESSION->add_ok_msg(get_string('skindeleted', 'skin'));
} else {
$SESSION->add_error_msg(get_string('cantdeleteskin', 'skin'));
}
redirect($redirect);
}
示例3: AccessDeniedException
}
if (!empty($viewskin['view_background_image'])) {
if (!record_exists('artefact', 'id', $viewskin['view_background_image'])) {
$viewskin['view_background_image'] = false;
}
}
} else {
throw new AccessDeniedException("You can't access and/or edit Skin with id {$id}");
}
define('TITLE', get_string('editskin', 'skin'));
} else {
define('TITLE', get_string('createskin', 'skin'));
$skinobj = new Skin();
}
// Set the Skin access options (for creating or editing form)...
$designsiteskin = $designsiteskin || isset($skinobj) && $skinobj->get('type') == 'site';
if ($designsiteskin) {
$accessoptions = array('site' => get_string('siteskinaccess', 'skin'));
} else {
$accessoptions = array('private' => get_string('privateskinaccess', 'skin'), 'public' => get_string('publicskinaccess', 'skin'));
}
// because the page has two artefact choosers in the form
// we need to handle how the browse works differently from normal
$folder = param_integer('folder', null);
$highlight = null;
if ($file = param_integer('file', 0)) {
$highlight = array($file);
}
$skintitle = $skinobj->get('title');
$skindesc = $skinobj->get('description');
$skintype = $skinobj->get('type');
示例4: xmldb_core_upgrade
function xmldb_core_upgrade($oldversion = 0)
{
global $SESSION;
raise_time_limit(120);
raise_memory_limit('256M');
$status = true;
if ($oldversion < 2009022700) {
// Get rid of all blocks with position 0 caused by 'about me' block on profile views
if (count_records('block_instance', 'order', 0) && !count_records_select('block_instance', '"order" < 0')) {
if (is_mysql()) {
$ids = get_column_sql('
SELECT i.id FROM {block_instance} i
INNER JOIN (SELECT view, "column" FROM {block_instance} WHERE "order" = 0) z
ON (z.view = i.view AND z.column = i.column)');
execute_sql('UPDATE {block_instance} SET "order" = -1 * "order" WHERE id IN (' . join(',', $ids) . ')');
} else {
execute_sql('UPDATE {block_instance} SET "order" = -1 * "order" WHERE id IN (
SELECT i.id FROM {block_instance} i
INNER JOIN (SELECT view, "column" FROM {block_instance} WHERE "order" = 0) z
ON (z.view = i.view AND z.column = i.column))');
}
execute_sql('UPDATE {block_instance} SET "order" = 1 WHERE "order" = 0');
execute_sql('UPDATE {block_instance} SET "order" = -1 * ("order" - 1) WHERE "order" < 0');
}
}
if ($oldversion < 2009031000) {
reload_html_filters();
}
if ($oldversion < 2009031300) {
$table = new XMLDBTable('institution');
$expiry = new XMLDBField('expiry');
$expiry->setAttributes(XMLDB_TYPE_DATETIME);
add_field($table, $expiry);
$expirymailsent = new XMLDBField('expirymailsent');
$expirymailsent->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $expirymailsent);
$suspended = new XMLDBField('suspended');
$suspended->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $suspended);
// Insert a cron job to check for soon expiring and expired institutions
if (!record_exists('cron', 'callfunction', 'auth_handle_institution_expiries')) {
$cron = new StdClass();
$cron->callfunction = 'auth_handle_institution_expiries';
$cron->minute = '5';
$cron->hour = '9';
$cron->day = '*';
$cron->month = '*';
$cron->dayofweek = '*';
insert_record('cron', $cron);
}
}
if ($oldversion < 2009031800) {
// Files can only attach blogpost artefacts, but we would like to be able to attach them
// to other stuff. Rename the existing attachment table artefact_blog_blogpost_file to
// artefact_file_attachment so we don't end up with many tables doing the same thing.
execute_sql("ALTER TABLE {artefact_blog_blogpost_file} RENAME TO {artefact_attachment}");
if (is_postgres()) {
// Ensure all of the indexes and constraints are renamed
execute_sql("\n ALTER TABLE {artefact_attachment} RENAME blogpost TO artefact;\n ALTER TABLE {artefact_attachment} RENAME file TO attachment;\n\n ALTER INDEX {arteblogblogfile_blofil_pk} RENAME TO {arteatta_artatt_pk};\n ALTER INDEX {arteblogblogfile_blo_ix} RENAME TO {arteatta_art_ix};\n ALTER INDEX {arteblogblogfile_fil_ix} RENAME TO {arteatta_att_ix};\n\n ALTER TABLE {artefact_attachment} DROP CONSTRAINT {arteblogblogfile_blo_fk};\n ALTER TABLE {artefact_attachment} ADD CONSTRAINT {arteatta_art_fk} FOREIGN KEY (artefact) REFERENCES {artefact}(id);\n\n ALTER TABLE {artefact_attachment} DROP CONSTRAINT {arteblogblogfile_fil_fk};\n ALTER TABLE {artefact_attachment} ADD CONSTRAINT {arteatta_att_fk} FOREIGN KEY (attachment) REFERENCES {artefact}(id);\n ");
} else {
if (is_mysql()) {
execute_sql("ALTER TABLE {artefact_attachment} DROP FOREIGN KEY {arteblogblogfile_blo_fk}");
execute_sql("ALTER TABLE {artefact_attachment} DROP INDEX {arteblogblogfile_blo_ix}");
execute_sql("ALTER TABLE {artefact_attachment} CHANGE blogpost artefact BIGINT(10) DEFAULT NULL");
execute_sql("ALTER TABLE {artefact_attachment} ADD CONSTRAINT {arteatta_art_fk} FOREIGN KEY {arteatta_art_ix} (artefact) REFERENCES {artefact}(id)");
execute_sql("ALTER TABLE {artefact_attachment} DROP FOREIGN KEY {arteblogblogfile_fil_fk}");
execute_sql("ALTER TABLE {artefact_attachment} DROP INDEX {arteblogblogfile_fil_ix}");
execute_sql("ALTER TABLE {artefact_attachment} CHANGE file attachment BIGINT(10) DEFAULT NULL");
execute_sql("ALTER TABLE {artefact_attachment} ADD CONSTRAINT {arteatta_att_fk} FOREIGN KEY {arteatta_att_ix} (attachment) REFERENCES {artefact}(id)");
}
}
// Drop the _pending table. From now on files uploaded as attachments will become artefacts
// straight away. Hopefully changes to the upload/file browser form will make it clear to
// the user that these attachments sit in his/her files area as soon as they are uploaded.
$table = new XMLDBTable('artefact_blog_blogpost_file_pending');
drop_table($table);
}
if ($oldversion < 2009040900) {
// The view access page has been putting the string 'null' in as a group role in IE.
set_field('view_access_group', 'role', null, 'role', 'null');
}
if ($oldversion < 2009040901) {
$table = new XMLDBTable('import_installed');
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, 255, XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('version', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('release', XMLDB_TYPE_TEXT, 'small', XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('active', XMLDB_TYPE_INTEGER, 1, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 1);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('name'));
create_table($table);
$table = new XMLDBTable('import_cron');
$table->addFieldInfo('plugin', XMLDB_TYPE_CHAR, 255, XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('callfunction', XMLDB_TYPE_CHAR, 255, XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('minute', XMLDB_TYPE_CHAR, 25, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '*');
$table->addFieldInfo('hour', XMLDB_TYPE_CHAR, 25, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '*');
$table->addFieldInfo('day', XMLDB_TYPE_CHAR, 25, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '*');
$table->addFieldInfo('dayofweek', XMLDB_TYPE_CHAR, 25, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '*');
$table->addFieldInfo('month', XMLDB_TYPE_CHAR, 25, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '*');
$table->addFieldInfo('nextrun', XMLDB_TYPE_DATETIME, null, null);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('plugin', 'callfunction'));
$table->addKeyInfo('pluginfk', XMLDB_KEY_FOREIGN, array('plugin'), 'import_installed', array('name'));
//.........这里部分代码省略.........
示例5: remove_background
/**
* Given a background image to delete, remove it from skin and update the skin thumbs
*
* @param int $aid Artefact id of the background image to remove from skins
*/
public static function remove_background($aid)
{
$skinstoupdate = get_records_select_array('skin', 'bodybgimg = ? OR viewbgimg = ?', array($aid, $aid), 'id');
if (!empty($skinstoupdate) && is_array($skinstoupdate)) {
foreach ($skinstoupdate as $skin) {
$skin = new Skin($skin->id);
$viewskin = $skin->get('viewskin');
if (isset($viewskin['body_background_image']) && $viewskin['body_background_image'] == $aid) {
$viewskin['body_background_image'] = 0;
}
if (isset($viewskin['view_background_image']) && $viewskin['view_background_image'] == $aid) {
// TODO remove this
$viewskin['view_background_image'] = 0;
}
$skin->set('viewskin', $viewskin);
$skin->commit();
}
}
}