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


PHP i18n::c方法代码示例

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


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

示例1: get_comment_notification

 public function get_comment_notification($item)
 {
     global $context;
     // build a tease notification for simple members
     // sanity check
     if (!isset($item['anchor']) || !($anchor = Anchors::get($item['anchor']))) {
         throw new Exception('no anchor for this comment');
     }
     // headline
     $headline = sprintf(i18n::c('%s has replied'), Surfer::get_link());
     $content = BR;
     // shape these
     $tease = Skin::build_mail_content($headline, $content);
     // a set of links
     $menu = array();
     // call for action
     $link = $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($item['id'], 'view');
     $menu[] = Skin::build_mail_button($link, i18n::c('View the reply'), TRUE);
     // link to the container
     $menu[] = Skin::build_mail_button($anchor->get_url(), $anchor->get_title(), FALSE);
     // finalize links
     $tease .= Skin::build_mail_menu($menu);
     // assemble all parts of the mail
     $mail = array();
     $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Reply in the discussion'), strip_tags($anchor->get_title()));
     $mail['notification'] = Comments::build_notification($item);
     // full notification
     $mail['tease'] = Mailer::build_notification($tease, 1);
     return $mail;
 }
开发者ID:rair,项目名称:yacs,代码行数:30,代码来源:thread.php

示例2: strip_tags

 $subject = '';
 if (isset($_REQUEST['subject'])) {
     $subject = strip_tags($_REQUEST['subject']);
 }
 // headline
 $headline = sprintf(i18n::c('%s is notifying you from %s'), Surfer::get_link(), '<a href="' . Categories::get_permalink($item) . '">' . $item['title'] . '</a>');
 // enable yacs codes in messages
 $message = Codes::beautify($_REQUEST['message']);
 // assemble main content of this message
 $message = Skin::build_mail_content($headline, $message);
 // a set of links
 $menu = array();
 // call for action
 $link = Categories::get_permalink($item);
 if (!is_object($overlay) || !($label = $overlay->get_label('permalink_command', 'categories', FALSE))) {
     $label = i18n::c('View the category');
 }
 $menu[] = Skin::build_mail_button($link, $label, TRUE);
 // link to the container
 if (is_object($anchor)) {
     $link = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
     $menu[] = Skin::build_mail_button($link, $anchor->get_title(), FALSE);
 }
 // finalize links
 $message .= Skin::build_mail_menu($menu);
 // threads messages
 $headers = Mailer::set_thread('category:' . $item['id']);
 // send the message
 if (Mailer::notify(Surfer::from(), $to, $subject, $message, $headers)) {
     // feed-back to the sender
     $context['text'] .= '<p>' . i18n::s('A message has been sent to:') . "</p>\n" . '<ul>' . "\n";
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:mail.php

示例3: submit_page

 /**
  * create a page out of a textual entity
  *
  * If a target is provided, it is extended with the text of this entity.
  * Else if the anchor is an article, a comment is created. Otherwise an article is created.
  *
  * @param array of entity attributes
  * @param string the textual entity to process
  * @param array poster attributes
  * @param string an optional anchor (e.g., 'article:123')
  * @param string reference of the object to be extended, if any
  * @return string reference to the created or updated object, or NULL
  */
 public static function submit_page($entity_headers, $text, $user, $anchor = NULL, $target = NULL)
 {
     global $context;
     // retrieve queue parameters
     list($server, $account, $password, $allowed, $match, $section, $options, $hooks, $prefix, $suffix) = $context['mail_queue'];
     // preserve breaks
     $text = preg_replace('/\\s*<(br|div|h|p)/is', "\n\n<\$1", $text);
     // suppress dangerous html tags
     $text = strip_tags($text, $context['users_allowed_tags']);
     // trim white spaces
     while (TRUE) {
         $text = trim($text, " \t\r\n");
         if (!strncmp($text, '<br>', 4)) {
             $text = substr($text, 4);
         } elseif (!strncmp($text, '<br/>', 5)) {
             $text = substr($text, 5);
         } elseif (!strncmp($text, '<br />', 6)) {
             $text = substr($text, 6);
         } else {
             break;
         }
     }
     // parse article content
     include_once $context['path_to_root'] . 'articles/article.php';
     $article = new Article();
     $entry_fields = array();
     $entry_fields = $article->parse($text, $entry_fields);
     // trim the header
     if ($prefix) {
         $tokens = explode($prefix, $entry_fields['description']);
         if (isset($tokens[1])) {
             $entry_fields['description'] = $tokens[1];
         } else {
             $entry_fields['description'] = $tokens[0];
         }
     }
     // trim the signature
     if ($suffix) {
         list($entry_fields['description'], $dropped) = explode($suffix, $entry_fields['description']);
     }
     // strip extra text
     $entry_fields['description'] = trim(preg_replace('/\\(See attached file: [^\\)]+?\\)/', '', $entry_fields['description']));
     // anchor this item to something
     $entry_fields['anchor'] = $anchor;
     // make a title
     if (!isset($entry_fields['title'])) {
         $entry_fields['title'] = $context['mail_subject'];
     }
     // message creation stamp
     $entry_fields['create_date'] = gmstrftime('%Y-%m-%d %H:%M:%S', strtotime($context['mail_date']));
     if (!isset($entry_fields['create_name'])) {
         $entry_fields['create_name'] = $user['nick_name'];
     }
     if (!isset($entry_fields['create_id'])) {
         $entry_fields['create_id'] = $user['id'];
     }
     if (!isset($entry_fields['create_address'])) {
         $entry_fields['create_address'] = $user['email'];
     }
     // message edition stamp
     $entry_fields['edit_date'] = gmstrftime('%Y-%m-%d %H:%M:%S', time());
     if (!isset($entry_fields['edit_name'])) {
         $entry_fields['edit_name'] = $user['nick_name'];
     }
     if (!isset($entry_fields['edit_id'])) {
         $entry_fields['edit_id'] = $user['id'];
     }
     if (!isset($entry_fields['edit_address'])) {
         $entry_fields['edit_address'] = $user['email'];
     }
     // we have to extend an existing article --this entity is mutable
     if ($target && !strncmp($target, 'article:', 8) && ($article = Articles::get(substr($target, 8), TRUE))) {
         // append the text to article description field
         $fields = array();
         $fields['id'] = $article['id'];
         $fields['description'] = $article['description'] . $entry_fields['description'];
         $fields['silent'] = TRUE;
         Articles::put_attributes($fields);
         return $target;
         // we have to extend an existing comment --this entity is mutable
     } elseif ($target && !strncmp($target, 'comment:', 8) && ($comment = Comments::get(substr($target, 8), TRUE))) {
         // append the text to comment description field
         $comment['description'] .= $entry_fields['description'];
         Comments::post($comment);
         return $target;
         // we have to comment an existing page
     } elseif (!strncmp($anchor, 'article:', 8)) {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:messages.php

示例4: elseif

    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // no deletion in demo mode
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes' && file_exists($context['path_to_root'] . 'parameters/demo.flag')) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation in demonstration mode.'));
    // deletion is confirmed
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') {
    // close the session on self-deletion
    if (Surfer::get_id() == $item['id']) {
        Surfer::reset();
    }
    // attempt to delete
    if (Users::delete($item['id'])) {
        // log item deletion
        $label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['nick_name']));
        $description = Users::get_permalink($item);
        Logger::remember('users/delete.php: ' . $label, $description);
        // this can appear anywhere
        Cache::clear();
        // back to the index page
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/');
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // the submit button
    if (Surfer::is($item['id'])) {
        $label = i18n::s('Yes, I want to suppress my own profile from this server and log out.');
    } else {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:delete.php

示例5: click

 /**
  * record a click
  *
  * @param string the external url that is targeted
  *
  */
 public static function click($url)
 {
     global $context;
     // we record only GET requests
     if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'GET') {
         return;
     }
     // do not count crawling
     if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(blo\\.gs|\\bblog|bot\\b|crawler\\b|frontier\\b|slurp\\b|spider\\b)/i', $_SERVER['HTTP_USER_AGENT'])) {
         return;
     }
     // record the activity
     Activities::post($url, 'click');
     // do not record clicks driving to search engines
     if (preg_match('/\\b(google|yahoo)\\b/i', $url)) {
         return;
     }
     // if this url is known
     $query = "SELECT * FROM " . SQL::table_name('links') . " AS links" . " WHERE links.link_url LIKE '" . SQL::escape($url) . "'";
     if ($item = SQL::query_first($query)) {
         // increment the number of clicks
         $query = "UPDATE " . SQL::table_name('links') . " SET hits=hits+1 WHERE id = " . SQL::escape($item['id']);
         SQL::query($query);
         // else create a new record with a count of one click
     } else {
         // get the section for clicks
         $anchor = Sections::lookup('clicks');
         // no section yet, create one
         if (!$anchor) {
             $fields['nick_name'] = 'clicks';
             $fields['title'] = i18n::c('Clicks');
             $fields['introduction'] = i18n::c('Clicked links are referenced here.');
             $fields['description'] = i18n::c('YACS ties automatically external links to this section on use. Therefore, you will have below a global picture of external sites that are referenced through your site.');
             $fields['active_set'] = 'N';
             // for associates only
             $fields['locked'] = 'Y';
             // no direct contributions
             $fields['index_map'] = 'N';
             // listd only to associates
             $fields['rank'] = 20000;
             // towards the end of the list
             // reference the new section
             if ($fields['id'] = Sections::post($fields)) {
                 $anchor = 'section:' . $fields['id'];
             }
         }
         // create a new link in the database
         $fields = array();
         $fields['anchor'] = $anchor;
         $fields['link_url'] = $url;
         $fields['hits'] = 1;
         Surfer::check_default_editor($fields);
         if ($fields['id'] = Links::post($fields)) {
             Links::clear($fields);
         }
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:63,代码来源:links.php

示例6: sprintf

            // message body
            $message = sprintf(i18n::s("<p>Your query will now be reviewed by one of the associates of this community. It is likely that this will be done within the next 24 hours at the latest.</p><p>You can check the status of your query at the following address:</p><p>%s</p><p>We would like to thank you for your interest in our web site.</p>"), '<a href="' . $link . '">' . $link . '</a>');
            // enable threading
            if (isset($item['id'])) {
                $headers = Mailer::set_thread('article:' . $item['id']);
            } else {
                $headers = '';
            }
            // actual post - don't stop on error
            Mailer::notify(NULL, $to, $subject, $message, $headers);
        }
        // get the article back
        $article = Anchors::get('article:' . $_REQUEST['id']);
        // log the query submission
        if (is_object($article)) {
            $label = sprintf(i18n::c('New query: %s'), strip_tags($article->get_title()));
            $link = $context['url_to_home'] . $context['url_to_root'] . $article->get_url();
            $description = '<a href="' . $link . '">' . $link . '</a>' . "\n\n" . $article->get_teaser('basic');
            Logger::notify('query.php: ' . $label, $description);
        }
    }
    // display the form on GET
} else {
    $with_form = TRUE;
}
// display the form
if ($with_form) {
    // splash message
    $context['text'] .= '<p>' . i18n::s('Please fill out the form and it will be sent automatically to the site managers. Be as precise as possible, and mention your e-mail address to let us a chance to contact you back.') . "</p>\n";
    // the form to send a query
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:query.php

示例7: sprintf

    $fields['submit_monitor'] = 'N';
    $fields['monitor_url'] = '';
    if ($error = Servers::post($fields)) {
        $text .= $error;
    } else {
        $text .= sprintf(i18n::s('A record has been created for server %s'), $fields['host_name']) . BR . "\n";
    }
}
// 'www.yacs.fr' server
$fields = array();
$fields['host_name'] = i18n::s('www.yacs.fr');
if (Servers::get($fields['host_name'])) {
    $text .= sprintf(i18n::s('An entry already exists for server %s'), $fields['host_name']) . BR . "\n";
} else {
    $fields['title'] = 'yacs';
    $fields['description'] = i18n::c('The origin server for the YACS system');
    $fields['main_url'] = 'http://www.yacs.fr/';
    $fields['submit_feed'] = 'Y';
    $fields['feed_url'] = 'http://www.yacs.fr/feeds/rss.php';
    $fields['submit_ping'] = 'Y';
    $fields['ping_url'] = 'http://www.yacs.fr/services/ping.php';
    $fields['submit_search'] = 'N';
    $fields['search_url'] = 'http://www.yacs.fr/services/search.php';
    $fields['submit_monitor'] = 'N';
    $fields['monitor_url'] = 'http://www.yacs.fr/services/ping.php';
    if ($error = Servers::post($fields)) {
        $text .= $error;
    } else {
        $text .= sprintf(i18n::s('A record has been created for server %s'), $fields['host_name']) . BR . "\n";
    }
}
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:populate.php

示例8: sprintf

 }
 $content .= '?>' . "\n";
 // save switch parameters, if any
 if (!Safe::file_put_contents('parameters/switch.include.php', $content)) {
     // not enough rights to write the file
     Logger::error(sprintf(i18n::s('Impossible to write to %s.'), 'parameters/switch.include.php.'));
     // allow for a manual update
     $context['text'] .= '<p style="text-decoration: blink;">' . sprintf(i18n::s('To actually change the configuration, please copy and paste following lines by yourself in file %s.'), 'parameters/switch.include.php') . "</p>\n";
     // display updated parameters
     $context['text'] .= Skin::build_box(i18n::s('Configuration'), Safe::highlight_string($content), 'folded');
 }
 // rename the switch file
 if (Safe::rename($context['path_to_root'] . 'parameters/switch.on', $context['path_to_root'] . 'parameters/switch.off')) {
     Logger::error(i18n::s('The server has been switched OFF. Switch it back on as soon as possible.'));
     // remember the change
     $label = i18n::c('The server has been switched off.');
     Logger::remember('control/switch.php: ' . $label);
     // if the server is currently switched off
 } elseif (file_exists($context['path_to_root'] . 'parameters/switch.off')) {
     Logger::error(i18n::s('The server is currently switched off. All users are redirected to the closed page.'));
 } else {
     Logger::error(i18n::s('Impossible to rename the file parameters/switch.on to parameters/switch.off. Do it yourself manually if you like.'));
 }
 // follow-up commands
 $menu = array();
 // do it again
 if (file_exists($context['path_to_root'] . 'parameters/switch.off')) {
     $menu = array_merge($menu, array('control/switch.php?action=on' => i18n::s('Switch on')));
 }
 // control panel
 $menu = array_merge($menu, array('control/' => i18n::s('Control Panel')));
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:switch.php

示例9: array

             $mail = array();
             $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Contribution'), strip_tags($anchor->get_title()));
             $mail['notification'] = Files::build_notification('multiple', $attributes);
             // one file has been added
         } elseif ($item =& Files::get_by_anchor_and_name($anchor->get_reference(), $uploaded)) {
             $context['text'] .= '<p>' . i18n::s('Following file has been added:') . '</p>' . Codes::render_object('file', $item['id']);
             // use this file record
             $_REQUEST['id'] = $item['id'];
             // log single upload
             $label = sprintf(i18n::c('New file in %s'), strip_tags($anchor->get_title()));
             $link = Files::get_permalink($item);
             $description = sprintf(i18n::c('%s at %s'), $item['file_name'], '<a href="' . $link . '">' . $link . '</a>');
             Logger::notify('files/edit.php: ' . $label, $description);
             // notification to send by e-mail
             $mail = array();
             $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Contribution'), strip_tags($anchor->get_title()));
             $mail['notification'] = Files::build_notification('upload', $item);
         }
         // send to anchor watchers
         if (isset($_REQUEST['notify_watchers']) && $_REQUEST['notify_watchers'] == 'Y') {
             $anchor->alert_watchers($mail, $action, isset($_REQUEST['active']) && $_REQUEST['active'] == 'N');
         }
         // send to followers of this user
         if (isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y' && Surfer::get_id() && $_REQUEST['active'] != 'N') {
             $mail['message'] = Mailer::build_notification($mail['notification'], 2);
             Users::alert_watchers('user:' . Surfer::get_id(), $mail);
         }
     }
     // update a record about an uploaded file
 } elseif (isset($_REQUEST['id'])) {
     // change has been documented
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php

示例10: array

    $context['page_tools'][] = Skin::build_link('sections/edit.php', i18n::s('Add a section'));
    $context['page_tools'][] = Skin::build_link('help/populate.php', i18n::s('Content Assistant'));
    $context['page_tools'][] = Skin::build_link('sections/check.php', i18n::s('Maintenance'));
}
// display extra information
$cache_id = 'sections/index.php#extra';
if (!($text = Cache::get($cache_id))) {
    // see also
    $lines = array();
    $lines[] = Skin::build_link('categories/', i18n::s('Categories'));
    $lines[] = Skin::build_link('search.php', i18n::s('Search'));
    $lines[] = Skin::build_link('help/', i18n::s('Help index'));
    $lines[] = Skin::build_link('query.php', i18n::s('Contact'));
    $text .= Skin::build_box(i18n::s('See also'), Skin::finalize_list($lines, 'compact'), 'boxes');
    // list monthly publications in an extra box
    $anchor = Categories::get(i18n::c('monthly'));
    if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
        $text .= Skin::build_box($anchor['title'], Skin::build_list($items, 'compact'), 'boxes') . "\n";
    }
    // side boxes for related categories, if any
    if ($categories = Categories::list_by_date_for_display('section:index', 0, 7, 'raw')) {
        foreach ($categories as $id => $attributes) {
            // link to the category page from the box title
            $label =& Skin::build_box_title(Skin::strip($attributes['title']), Categories::get_permalink($attributes), i18n::s('View the category'));
            // box content
            if ($items =& Members::list_articles_by_date_for_anchor('category:' . $id, 0, COMPACT_LIST_SIZE, 'compact')) {
                $text .= Skin::build_box($label, Skin::build_list($items, 'compact'), 'boxes') . "\n";
            }
        }
    }
    // save, whatever change, for 5 minutes
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:index.php

示例11: array

     // reference the new section
     if ($fields['id'] = Sections::post($fields, FALSE)) {
         $anchor = 'section:' . $fields['id'];
     }
 }
 // archive the letter
 $context['text'] .= i18n::s('Archiving the new letter') . BR . "\n";
 // save the letter as a published article, but don't use special categories
 $fields = array();
 $fields['anchor'] = $anchor;
 $fields['title'] = $_REQUEST['letter_title'];
 $label = $_REQUEST['letter_recipients'];
 if ($_REQUEST['letter_recipients'] == 'custom' && isset($_REQUEST['mail_to'])) {
     $label = $_REQUEST['mail_to'];
 }
 $fields['introduction'] = sprintf(i18n::c('Sent %s to&nbsp;"%s"'), Skin::build_date(time(), 'full', $context['preferred_language']), $label);
 $fields['description'] = $_REQUEST['letter_body'];
 $fields['publish_name'] = Surfer::get_name();
 $fields['publish_id'] = Surfer::get_id();
 $fields['publish_address'] = Surfer::get_email_address();
 $fields['publish_date'] = gmstrftime('%Y-%m-%d %H:%M:%S');
 $fields['id'] = Articles::post($fields);
 // from: from configuration files
 if (isset($context['letter_reply_to']) && $context['letter_reply_to']) {
     $from = $context['letter_reply_to'];
 } elseif (isset($context['mail_from']) && $context['mail_from']) {
     $from = $context['mail_from'];
 } else {
     $from = $context['site_name'];
 }
 // to: build the list of recipients
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:new.php

示例12: sprintf

        $count++;
        // avoid timeouts
        if (!($count % 50)) {
            Safe::set_time_limit(30);
            SQL::ping();
        }
    }
    if ($count) {
        $context['text'] .= sprintf(i18n::s('%d files have been updated.'), $count) . "\n";
    }
    $context['text'] .= "</p>\n";
    // display the execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    // forward to the index page
    $menu = array('control/' => i18n::s('Control Panel'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // remember the operation
    $label = sprintf(i18n::c('chmod %s has been applied to scripts'), $context['file_mask']);
    Logger::remember('control/chmod.php: ' . $label);
    // confirmation is required
} else {
    // the confirmation question
    $context['text'] .= '<b>' . sprintf(i18n::s('You are about to chmod(%d) all running scripts of this server. Are you sure?'), $context['file_mask']) . "</b>\n";
    // the menu for this page
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . Skin::build_submit_button(i18n::s('Yes, I do want to change permissions of running scripts')) . '<input type="hidden" name="action" value="confirm" />' . '</p></form>' . "\n";
    // this may take several minutes
    $context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . "</p>\n";
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:chmod.php

示例13: send_body

/**
 * dynamically generate the page
 *
 * @see skins/index.php
 */
function send_body()
{
    global $context, $local;
    // $local is required to localize included scripts
    // include every script that has to be run once
    global $scripts, $scripts_count;
    if (@count($scripts)) {
        // the alphabetical order may be used to control script execution order
        sort($scripts);
        reset($scripts);
        // process each script one by one
        foreach ($scripts as $item) {
            // do not execute on first installation
            if (file_exists('../parameters/switch.on') || file_exists('../parameters/switch.off')) {
                // ensure we have a valid database resource
                if (!$context['connection']) {
                    break;
                }
                // remember this as an event
                Logger::remember('scripts/run_once.php: ' . sprintf(i18n::c('script %s has been executed'), $item));
                // where scripts actually are
                $actual_item = str_replace('//', '/', $context['path_to_root'] . 'scripts/run_once/' . $item);
                // include the script to execute it
                $scripts_count++;
                echo Skin::build_block($item, 'subtitle');
                include $actual_item;
                echo "\n";
            }
            // ensure enough overall execution time
            Safe::set_time_limit(30);
            // stamp the file to remember execution time
            Safe::touch($actual_item);
            // rename the script to avoid further execution
            Safe::unlink($actual_item . '.done');
            Safe::rename($actual_item, $actual_item . '.done');
        }
        // refresh javascript libraries
        Cache::purge('js');
    }
    // report on actual execution
    if ($scripts_count) {
        echo '<p>&nbsp;</p><p>' . sprintf(i18n::ns('%d script has been executed', '%d scripts have been executed', $scripts_count), $scripts_count) . "</p>\n";
    } else {
        echo '<p>' . i18n::s('No script has been executed') . "</p>\n";
    }
    // display the total execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    if ($time > 30) {
        echo '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    }
    // if the server has been switched off, go back to the control panel
    if (file_exists('../parameters/switch.off')) {
        echo '<form method="get" action="' . $context['url_to_root'] . 'control/">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Control Panel')) . '</p>' . "\n" . '</form>' . "\n";
        // else back to the control panel as well, but without a button
    } else {
        $menu = array('control/' => i18n::s('Control Panel'));
        echo Skin::build_list($menu, 'menu_bar');
    }
    // purge the cache, since it is likely that we have modified some data
    Cache::clear();
}
开发者ID:rair,项目名称:yacs,代码行数:66,代码来源:run_once.php

示例14: array

    $context['text'] .= Skin::build_block(sprintf(i18n::s('This file has been reserved by %s %s, and it is likely that an updated version will be made available soon.'), Users::get_link($item['assign_name'], $item['assign_address'], $item['assign_id']), Skin::build_date($item['assign_date'])), 'caution');
    // follow-up commands
    $menu = array();
    $menu[] = Skin::build_link($anchor->get_url('files'), i18n::s('Done'), 'button');
    $menu[] = Skin::build_link(Files::get_url($item['id'], 'release'), i18n::s('Release reservation'), 'span');
    $context['text'] .= Skin::build_block(Skin::finalize_list($menu, 'menu_bar'), 'bottom');
    // deletion is confirmed
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') {
    // touch the related anchor before actual deletion, since the file has to be accessible at that time
    if (is_object($anchor)) {
        $anchor->touch('file:delete', $item['id']);
    }
    // if no error, back to the anchor or to the index page
    if (Files::delete($item['id'])) {
        // log item deletion
        $label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['title']));
        $description = Files::get_permalink($item);
        Logger::remember('files/delete.php: ' . $label, $description);
        Files::clear($item);
        if ($render_overlaid) {
            echo 'delete done';
            die;
        }
        if (is_object($anchor)) {
            Safe::redirect($anchor->get_url() . '#_attachments');
        } else {
            Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'files/');
        }
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:delete.php

示例15: elseif

 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'assign' && isset($_REQUEST['anchor']) && isset($_REQUEST['member'])) {
     // add a category member
     if (!strncmp($_REQUEST['member'], 'category:', 9)) {
         Members::assign($_REQUEST['anchor'], $_REQUEST['member']);
         Members::assign($_REQUEST['member'], $_REQUEST['anchor']);
         // add a follower to this person
     } elseif (!strncmp($_REQUEST['member'], 'user:', 5)) {
         Members::assign($_REQUEST['anchor'], $_REQUEST['member']);
         // notify a person that is followed
         if (($follower = Anchors::get($_REQUEST['member'])) && isset($user['email']) && $user['email'] && $user['without_alerts'] != 'Y') {
             // notify target user by e-mail
             $subject = sprintf(i18n::c('%s is following you'), strip_tags($follower->get_title()));
             // headline
             $headline = sprintf(i18n::c('%s is following you'), '<a href="' . $context['url_to_home'] . $context['url_to_root'] . $follower->get_url() . '">' . $follower->get_title() . '</a>');
             // information
             $message = '<p>' . sprintf(i18n::c('%s will receive notifications when you will update your followers at %s'), $follower->get_title(), $context['site_name']) . '</p>';
             // assemble main content of this message
             $message = Skin::build_mail_content($headline, $message);
             // a set of links
             $menu = array();
             // call for action
             $link = $context['url_to_home'] . $context['url_to_root'] . $follower->get_url();
             $menu[] = Skin::build_mail_button($link, $follower->get_title(), TRUE);
             // finalize links
             $message .= Skin::build_mail_menu($menu);
             // enable threading
             $headers = Mailer::set_thread($follower->get_reference());
             // allow for cross-referencing
             Mailer::notify(Surfer::from(), $user['email'], $subject, $message, $headers);
         }
         // regular container
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php


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