本文整理汇总了PHP中html::mark_clean方法的典型用法代码示例。如果您正苦于以下问题:PHP html::mark_clean方法的具体用法?PHP html::mark_clean怎么用?PHP html::mark_clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::mark_clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
static function upgrade($version)
{
log::info("aws_s3", "Commencing module upgrade (" . $version . ")");
switch ($version) {
case 0:
log::info("aws_s3", "Installing version 1");
@mkdir(VARPATH . "modules/aws_s3");
@mkdir(VARPATH . "modules/aws_s3/log");
// installation's unique identifier - allows multiple g3's pointing to the same s3 bucket.
if (!module::get_var("aws_s3", "g3id")) {
module::set_var("aws_s3", "g3id", md5(time()));
}
module::set_var("aws_s3", "synced", false);
module::set_var("aws_s3", "enabled", false);
module::set_var("aws_s3", "access_key", "");
module::set_var("aws_s3", "secret_key", "");
module::set_var("aws_s3", "bucket_name", "");
module::set_version("aws_s3", 1);
case 1:
log::info("aws_s3", "Upgrading to version 2");
$db = Database::instance();
$db->query("CREATE TABLE {aws_s3_meta} (\n `item_id` int(9) NOT NULL,\n `item_hash` varchar(32) NOT NULL DEFAULT '',\n `thumb_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `resize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `fullsize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `local_deleted` smallint(1) NOT NULL DEFAULT 0,\n PRIMARY KEY (`item_id`)\n ) DEFAULT CHARSET=utf8;");
module::set_var("aws_s3", "upload_thumbs", true);
module::set_var("aws_s3", "upload_resizes", true);
module::set_var("aws_s3", "upload_fullsizes", true);
module::set_var("aws_s3", "s3_storage_only", false);
if (module::get_var("aws_s3", "synced")) {
// v1 has already synced this installation to s3. mark all the items with the relevant meta data
$items = ORM::factory("item")->find_all();
foreach ($items as $item) {
aws_s3::log("Updating S3 meta for item ID: " . $item->id);
$item->s3_thumb_uploaded = true;
if (!$item->is_album()) {
$item->s3_resize_uploaded = true;
$item->s3_fullsize_uploaded = true;
}
$item->s3_local_deleted = false;
$item->s3_item_hash = md5($item->relative_path());
$item->save_s3_meta();
}
} else {
// check various states after upgrade from v1..
if (module::get_var("aws_s3", "access_key") != "" && module::get_var("aws_s3", "secret_key") != "" && module::get_var("aws_s3", "bucket_name") != "" && aws_s3::validate_access_details(module::get_var("aws_s3", "access_key"), module::get_var("aws_s3", "secret_key"), module::get_var("aws_s3", "bucket_name"))) {
// details are correct but hasn't been synced.
if (aws_s3::can_schedule()) {
// i can schedule this task
aws_s3::schedule_full_sync2();
site_status::warning("Your site has been scheduled for full Amazon S3 re-synchronisation. This message will clear when this has been completed.", "aws_s3_not_synced");
} else {
// i CAN'T schedule it..
site_status::warning(t('Your site has not been synchronised to Amazon S3. Until it has, your server will continue to serve image content to your visitors.<br />Click <a href="%url" class="g-dialog-link">here</a> to start the synchronisation task.', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::manual_sync?csrf=__CSRF__")))), "aws_s3_not_synced");
}
} else {
site_status::warning(t('Amazon S3 module needs configuration. Click <a href="%url">here</a> to go to the configuration page.', array("url" => html::mark_clean(url::site("admin/aws_s3")))), "aws_s3_not_configured");
}
}
module::set_version("aws_s3", 2);
}
log::info("aws_s3", "Module upgrade complete");
}
示例2: check_index
/**
* @return string An error message suitable for inclusion in the task log
*/
static function check_index()
{
list($remaining) = search::stats();
if ($remaining) {
site_status::warning(t('Your search index needs to be updated. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), "search_index_out_of_date");
}
}
示例3: mark_clean_test
public function mark_clean_test()
{
$safe_string = html::mark_clean("hello <p >world</p>");
$this->assert_true($safe_string instanceof SafeString);
$safe_string_2 = html::clean($safe_string);
$this->assert_equal("hello <p >world</p>", $safe_string_2);
}
示例4: confirm
public function confirm($hash)
{
$pending_user = ORM::factory("pending_user")->where("hash", "=", $hash)->where("state", "=", 0)->find();
if ($pending_user->loaded()) {
// @todo add a request date to the pending user table and check that it hasn't expired
$policy = module::get_var("registration", "policy");
$pending_user->state = 1;
$pending_user->save();
if ($policy == "vistor") {
$user = register::create_new_user($pending_user->id);
message::success(t("Your registration request has been approved"));
auth::login($user);
Session::instance()->set("registration_first_usage", true);
$pending_user->delete();
} else {
site_status::warning(t("There are pending user registration. <a href=\"%url\">Review now!</a>", array("url" => html::mark_clean(url::site("admin/register")), "locale" => module::get_var("gallery", "default_locale"))), "pending_user_registrations");
message::success(t("Your registration request is awaiting administrator approval"));
// added by Shad Laws, v2
if (module::get_var("registration", "admin_notify") == 1) {
register::send_admin_notify($pending_user);
}
}
} else {
message::error(t("Your registration request is no longer valid, Please re-register."));
}
url::redirect(item::root()->abs_url());
}
示例5: index
public function index()
{
// require_once(MODPATH . "aws_s3/lib/s3.php");
$form = $this->_get_s3_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("aws_s3", "enabled", isset($_POST['enabled']) ? true : false);
module::set_var("aws_s3", "access_key", $_POST['access_key']);
module::set_var("aws_s3", "secret_key", $_POST['secret_key']);
module::set_var("aws_s3", "bucket_name", $_POST['bucket_name']);
module::set_var("aws_s3", "g3id", $_POST['g3id']);
module::set_var("aws_s3", "url_str", $_POST['url_str']);
module::set_var("aws_s3", "sig_exp", $_POST['sig_exp']);
module::set_var("aws_s3", "use_ssl", isset($_POST['use_ssl']) ? true : false);
if (module::get_var("aws_s3", "enabled") && !module::get_var("aws_s3", "synced", false)) {
site_status::warning(t('Your site has not yet been syncronised with your Amazon S3 bucket. Content will not appear correctly until you perform syncronisation. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::sync?csrf=__CSRF__")))), "aws_s3_not_synced");
}
message::success(t("Settings have been saved"));
url::redirect("admin/aws_s3");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
$v = new Admin_View("admin.html");
$v->page_title = t("Amazon S3 Configuration");
$v->content = new View("admin_aws_s3.html");
$v->content->form = $form;
$v->content->end = "";
echo $v;
}
示例6: module_change
static function module_change($changes)
{
if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) {
site_status::warning(t("The Slideshow module requires the RSS module. <a href=\"%url\">Activate the RSS module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "slideshow_needs_rss");
} else {
site_status::clear("slideshow_needs_rss");
}
}
示例7: module_change
static function module_change($changes)
{
// If EXIF is deactivated, display a warning that it is required for this module to function properly.
if (!module::is_active("exif") || in_array("exif", $changes->deactivate)) {
site_status::warning(t("The EXIF_GPS module requires the EXIF module. " . "<a href=\"%url\">Activate the EXIF module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "exif_gps_needs_exif");
} else {
site_status::clear("exif_gps_needs_exif");
}
}
示例8: check_config
static function check_config()
{
$public_key = module::get_var("recaptcha", "public_key");
$private_key = module::get_var("recaptcha", "private_key");
if (empty($public_key) || empty($private_key)) {
site_status::warning(t("reCAPTCHA is not quite ready! Please configure the <a href=\"%url\">reCAPTCHA Keys</a>", array("url" => html::mark_clean(url::site("admin/recaptcha")))), "recaptcha_config");
} else {
site_status::clear("recaptcha_config");
}
}
示例9: check_config
static function check_config($paths = null)
{
if ($paths === null) {
$paths = unserialize(module::get_var("videos", "authorized_paths"));
}
if (empty($paths)) {
site_status::warning(t("Videos needs configuration. <a href=\"%url\">Configure it now!</a>", array("url" => html::mark_clean(url::site("admin/videos")))), "videos_configuration");
} else {
site_status::clear("videos_configuration");
}
}
示例10: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = Database::instance()->query("UPDATE {tasks} SET `state` = 'stalled' " . "WHERE done = 0 " . "AND state <> 'stalled' " . "AND unix_timestamp(now()) - updated > 15");
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", 0)->orderby("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", 1)->orderby("updated", "DESC")->find_all();
print $view;
}
示例11: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = db::build()->update("tasks")->set("state", "stalled")->where("done", "=", 0)->where("state", "<>", "stalled")->where(new Database_Expression("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))->execute();
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
print $view;
}
示例12: check_config
/**
* Check whether the module's configured correctly
* @return boolean
*/
static function check_config()
{
$login = module::get_var("bitly", "login");
$api_key = module::get_var("bitly", "api_key");
if (empty($login) || empty($api_key)) {
site_status::warning(t("bit.ly is not quite ready! Please provide a <a href=\"%url\">login and API Key</a>", array("url" => html::mark_clean(url::site("admin/bitly")))), "bitly_config");
} else {
if (!self::validate_config($login, $api_key)) {
site_status::warning(t("bit.ly is not properly configured! URLs will not be shortened until its <a href=\"%url\">configuration</a> is updated.", array("url" => html::mark_clean(url::site("admin/bitly")))), "bitly_config");
} else {
site_status::clear("bitly_config");
return true;
}
}
return false;
}
示例13: index
/**
* Show a list of all available, running and finished tasks.
*/
public function index()
{
$query = db::build()->update("tasks")->set("state", "stalled")->where("done", "=", 0)->where("state", "<>", "stalled")->where(db::expr("UNIX_TIMESTAMP(NOW()) - `updated` > 15"))->execute();
$stalled_count = $query->count();
if ($stalled_count) {
log::warning("tasks", t2("One task is stalled", "%count tasks are stalled", $stalled_count), t('<a href="%url">view</a>', array("url" => html::mark_clean(url::site("admin/maintenance")))));
}
$view = new Admin_View("admin.html");
$view->page_title = t("Maintenance tasks");
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
print $view;
// Do some maintenance while we're in here
db::build()->delete("caches")->where("expiration", "<>", 0)->where("expiration", "<=", time())->execute();
module::deactivate_missing_modules();
}
示例14: show_user_profile
/**
* Add Twitter account info to user profiles
* @param object $data
*/
static function show_user_profile($data)
{
$twitter_account = ORM::factory("twitter_user")->where("user_id", "=", $data->user->id)->find();
if ($twitter_account->loaded()) {
$v = new View("user_profile_info.html");
$v->user_profile_data = array();
$fields = array("screen_name" => t("Screen name"));
foreach ($fields as $field => $label) {
if (!empty($twitter_account->{$field})) {
$value = $twitter_account->{$field};
if ($field == "screen_name") {
$value = html::mark_clean(html::anchor(twitter::$url . $twitter_account->screen_name, "@{$twitter_account->screen_name}"));
}
$v->user_profile_data[(string) $label] = $value;
}
}
if (identity::active_user()->id == $data->user->id) {
$button = html::mark_clean(html::anchor(url::site("twitter/reset/" . $data->user->id), t("Switch to another Twitter screen name")));
$v->user_profile_data[""] = $button;
}
$data->content[] = (object) array("title" => t("Twitter account"), "view" => $v);
}
}
示例15: t
echo url::site("form/add/comments/{$item->id})");
?>
" id="gAddCommentButton"
class="gButtonLink ui-corner-all ui-icon-left ui-state-default right">
<span class="ui-icon ui-icon-comment"></span>
<?php
echo t("Add a comment");
?>
</a>
<div id="gCommentDetail">
<?php
if (!$comments->count()) {
?>
<p id="gNoCommentsYet">
<?php
echo t("No comments yet. Be the first to <a %attrs>comment</a>!", array("attrs" => html::mark_clean("href=\"#add_comment_form\" class=\"showCommentForm\"")));
?>
</p>
<?php
}
?>
<ul>
<?php
foreach ($comments as $comment) {
?>
<li id="gComment-<?php
echo $comment->id;
?>
">
<p class="gAuthor">
<a href="#">