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


PHP _r函数代码示例

本文整理汇总了PHP中_r函数的典型用法代码示例。如果您正苦于以下问题:PHP _r函数的具体用法?PHP _r怎么用?PHP _r使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 public function getInput()
 {
     // Initialize variables.
     $html = array();
     // Initialize some field attributes.
     $class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"';
     // Start the radio field output.
     $html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
     // Get the field options.
     $options = $this->getOptions();
     // Build the radio field output.
     foreach ($options as $i => $option) {
         // Initialize some option attributes.
         $checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : '';
         $class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
         $disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
         // Initialize some JavaScript option attributes.
         $onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
         $html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';
         $html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . _r($option->text) . '</label>';
     }
     // End the radio field output.
     $html[] = '</fieldset>';
     return implode($html);
 }
开发者ID:rotoballer,项目名称:emily,代码行数:31,代码来源:radio.php

示例2: __construct

 public function __construct($project_id, $options = null)
 {
     parent::__construct($options);
     $this->setName('deploymentSetup');
     $servers_map = new GD_Model_ServersMapper();
     $servers = $servers_map->getServersByProject($project_id);
     if (!is_array($servers) || count($servers) == 0) {
         throw new GD_Exception("There are no servers configured for this project.");
     }
     $server_id = new Zend_Form_Element_Select('serverId');
     $server_id->setLabel(_r('Server'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     foreach ($servers as $server) {
         $server_id->addMultiOption($server->getId(), $server->getDisplayName());
     }
     $from_revision = new Zend_Form_Element_Text('fromRevision');
     $from_revision->setLabel(_r('Current revision'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('readonly', 'readonly')->setAttrib('disabled', 'disabled');
     $to_revision = new Zend_Form_Element_Text('toRevision');
     $to_revision->setLabel(_r('Deploy revision or tag'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDescription('<a href="javascript:;" onclick="getLatestRevision();">Click to get latest revision</a><span id="get_latest_revision_status"></span>');
     $comment = new Zend_Form_Element_Text('comment');
     $comment->setLabel(_r('Comment (optional)'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
     $submitRun = new Zend_Form_Element_Image('submitRun');
     $submitRun->setImage('/images/buttons/small/deploy.png');
     $submitRun->class = "processing_btn size_small";
     $submitPreview = new Zend_Form_Element_Image('submitPreview');
     $submitPreview->setImage('/images/buttons/small/inverted/preview.png');
     $submitPreview->class = "preview processing_btn size_small";
     $this->addElements(array($server_id, $from_revision, $to_revision, $comment, $submitRun, $submitPreview));
 }
开发者ID:rodrigorm,项目名称:godeploy,代码行数:28,代码来源:DeploymentSetup.php

示例3: dispatch

 /**
  * Dispatches the current URL and executes an assigned callback
  */
 public static function dispatch()
 {
     $method = 'default';
     if (isset($_REQUEST['method'])) {
         $method = preg_replace('/[^-_.0-9a-zA-Z]/', '', $_REQUEST['method']);
     }
     $method = apply_filters('controller-method', $method);
     define('LILINA_PAGE', $method);
     try {
         if (!$method || empty(Controller::$methods[$method])) {
             // Dynamically load method if possible
             if (file_exists(LILINA_INCPATH . '/core/method-' . $method . '.php')) {
                 require_once LILINA_INCPATH . '/core/method-' . $method . '.php';
             }
         }
         // Check again, in case we loaded it last time
         if (!$method || empty(Controller::$methods[$method])) {
             // No or invalid method
             throw new Exception(sprintf(_r('Unknown method: %s'), $method));
         }
         $callback = Controller::$methods[$method];
         call_user_func($callback);
     } catch (Exception $e) {
         lilina_nice_die('<p>' . sprintf(_r('An error occured dispatching a method: %s'), $e->getMessage()) . '</p>');
     }
 }
开发者ID:JocelynDelalande,项目名称:Lilina,代码行数:29,代码来源:class-controller.php

示例4: process_single

 /**
  * Process a single feed
  *
  * @param array $feed Feed information (required elements are 'name' for error reporting, 'feed' for the feed URL and 'id' for the feed's unique internal ID)
  * @return int Number of items added
  */
 public static function process_single($feed)
 {
     do_action('iu-feed-start', $feed);
     $sp =& self::load_feed($feed);
     if ($error = $sp->error()) {
         self::log(sprintf(_r('An error occurred with "%2$s": %1$s'), $error, $feed['name']), Errors::get_code('api.itemupdater.itemerror'));
         do_action('iu-feed-finish', $feed);
         return -1;
     }
     $count = 0;
     $items = $sp->get_items();
     foreach ($items as $item) {
         $new_item = self::normalise($item, $feed['id']);
         $new_item = apply_filters('item_data_precache', $new_item, $feed);
         if (Items::get_instance()->check_item($new_item)) {
             $count++;
             do_action('iu-item-add', $new_item, $feed);
         } else {
             do_action('iu-item-noadd', $new_item, $feed);
         }
     }
     $sp->__destruct();
     unset($sp);
     do_action('iu-feed-finish', $feed);
     return $count;
 }
开发者ID:JocelynDelalande,项目名称:Lilina,代码行数:32,代码来源:class-itemupdater.php

示例5: getInput

 public function getInput()
 {
     global $gantry;
     $buffer = '';
     $buffer .= "<div class='wrapper'>\n";
     foreach ($this->fields as $field) {
         if ($field->element['enabler'] && strtolower((string) $field->element['enabler']) == 'true') {
             $this->enabler = $field;
         }
     }
     foreach ($this->fields as $field) {
         $itemName = $this->fieldname . "-" . $field->fieldname;
         $field->detached = false;
         if ($field != $this->enabler && isset($this->enabler) && (int) $this->enabler->value == 0) {
             $field->detached = true;
         }
         if ($field->basetype == 'select') {
             $basetype = ' base-selectbox';
         } else {
             $basetype = ' base-' . $field->basetype;
         }
         $buffer .= '<div class="chain ' . $itemName . ' chain-' . strtolower($field->type) . $basetype . '">' . "\n";
         if (strlen($field->getLabel())) {
             $buffer .= '<span class="chain-label">' . _r($field->getLabel()) . '</span>' . "\n";
         }
         $buffer .= $field->getInput();
         $buffer .= "</div>" . "\n";
     }
     $buffer .= "</div>" . "\n";
     return $buffer;
 }
开发者ID:rotoballer,项目名称:emily,代码行数:31,代码来源:chain.php

示例6: errorAction

 public function errorAction()
 {
     $errors = $this->_getParam('error_handler');
     if (!$errors) {
         $this->view->message = 'You have reached the error page';
         return;
     }
     switch ($errors->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error -- controller or action not found
             $this->getResponse()->setHttpResponseCode(404);
             $this->view->message = _r("Could not find the page you were looking for...");
             break;
         default:
             // application error
             $this->getResponse()->setHttpResponseCode(500);
             $this->view->message = 'Application error';
             if ($errors->exception instanceof GD_Exception) {
                 $this->view->extended_information = $errors->exception->getMessage();
             }
             break;
     }
     // Log exception
     GD_Debug::Log("Exception: " . $this->view->message, GD_Debug::DEBUG_BASIC);
     // conditionally display exceptions
     if ($this->getInvokeArg('displayExceptions') == true) {
         $this->view->exception = $errors->exception;
     }
     $this->view->request = $errors->request;
 }
开发者ID:rodrigorm,项目名称:godeploy,代码行数:32,代码来源:ErrorController.php

示例7: feed_list_table

/**
 * feed_list_table() - {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 */
function feed_list_table()
{
    //Defined in admin panel
    $feeds = get_feeds();
    $j = 0;
    $table = '';
    if (is_array($feeds) && !empty($feeds)) {
        foreach ($feeds as $this_feed) {
            $table .= '
		<tr id="feed-' . $j . '" class="' . ($j % 2 ? 'alt' : '') . '">
			<td class="name-col">' . stripslashes($this_feed['name']) . '</td>
			<td class="url-col">' . $this_feed['feed'] . '</td>
			<td class="cat-col">' . $this_feed['cat'] . '</td>
			' . apply_filters('admin-feeds-infocol', '', $this_feed, $j) . '
			<td class="change-col"><a href="feeds.php?change=' . $j . '&amp;action=change" class="change_link">' . _r('Change') . '</a></td>
			<td class="remove-col"><a href="feeds.php?remove=' . $j . '&amp;action=remove">' . _r('Remove') . '</a></td>
			' . apply_filters('admin-feeds-actioncol', '', $this_feed, $j) . '
		</tr>';
            ++$j;
        }
    } else {
        $table = '<tr id="nofeeds"><td>' . _r('You don\'t currently have any feeds. Try <a href="#add_form">adding some</a>.') . '</td></tr>';
    }
    return $table;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:feeds.php

示例8: introduction

	public function introduction() {
		admin_header(_r('Google Reader Importer'));
?>
<h1><?php _e('Google Reader Importer') ?></h1>
<p><?php _e('There are several ways to import from Google Reader.'); ?></p>
<h2><?php _e('Method 1'); ?></h2>
<p><?php printf(
	_r('<a href="%1$s">Export</a> your feeds from Google reader and then use the <a href="%2$s">OPML importer</a>.'),
	'http://www.google.com/reader/subscriptions/export',
	'feed-import.php?service=opml'
	); ?></p>
<h2><?php _e('Method 2'); ?></h2>
<p><?php _e("We can grab your OPML file for you, but we'll need your username and password. This information won't be stored anywhere and is only used once. (It sucks, we know, but Google doesn't offer any other way.)"); ?>
<form action="feed-import.php" method="POST">
	<button id="continue"><?php _e('Start Method 2'); ?></button>
	<fieldset id="greader">
		<legend><?php _e('Import Feeds'); ?></legend>
		<div class="row">
			<label for="user"><?php _e('Username (Email address)'); ?>:</label>
			<input type="text" name="user" id="user" />
		</div>
		<div class="row">
			<label for="pass"><?php _e('Password'); ?>:</label>
			<input type="password" name="pass" id="pass" />
		</div>
		<input type="submit" value="<?php _e('Import'); ?>" class="submit" name="submit" />
		<input type="hidden" name="step" value="1" />
		<input type="hidden" name="service" value="opml" />
	</fieldset>
</form>
<?php
		admin_footer();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:33,代码来源:import-greader.php

示例9: process

 public static function process()
 {
     header('Content-Type: text/plain; charset=utf-8');
     require_once LILINA_INCPATH . '/contrib/simplepie.class.php';
     $updated = false;
     foreach (self::$feeds as $feed) {
         do_action('iu-feed-start', $feed);
         $sp = self::load_feed($feed);
         if ($error = $sp->error()) {
             self::log(sprintf(_r('An error occurred with "%2$s": %1$s'), $error, $feed['name']), Errors::get_code('api.itemupdater.itemerror'));
             continue;
         }
         $count = 0;
         $items = $sp->get_items();
         foreach ($items as $item) {
             $new_item = self::normalise($item, $feed['id']);
             $new_item = apply_filters('item_data_precache', $new_item);
             if (Items::get_instance()->check_item($new_item)) {
                 $count++;
                 $updated = true;
             }
         }
         do_action('iu-feed-finish', $feed);
     }
     Items::get_instance()->sort_all();
     if ($updated) {
         Items::get_instance()->save_cache();
     }
 }
开发者ID:rmccue,项目名称:Lilina,代码行数:29,代码来源:class-cronupdater.php

示例10: submit

    protected static function submit()
    {
        $id = $_GET['item'];
        $item = Items::get_instance()->get_item($id);
        if (false === $item) {
            throw new Exception(_r('Invalid item ID specified', 'instapaper'));
        }
        $user = get_option('instapaper_user');
        if (empty($user)) {
            throw new Exception(sprintf(_r('Please set your username and password in the <a href="%s">settings</a>.', 'instapaper'), get_option('baseurl') . 'admin/settings.php'));
        }
        if (!check_nonce('instapaper-submit', $_GET['_nonce'])) {
            throw new Exception(_r('Nonces did not match. Try again.', 'instapaper'));
        }
        $data = array('username' => get_option('instapaper_user', ''), 'password' => get_option('instapaper_pass', ''), 'url' => $item->permalink, 'title' => apply_filters('the_title', $item->title));
        $request = new HTTPRequest('', 2);
        $response = $request->post("https://www.instapaper.com/api/add", array(), $data);
        switch ($response->status_code) {
            case 400:
                throw new Exception(_r('Internal error. Please report this.', 'instapaper'));
            case 403:
                throw new Exception(sprintf(_r('Invalid username/password. Please check your details in the <a href="%s">settings</a>.', 'instapaper'), get_option('baseurl') . 'admin/settings.php'));
            case 500:
                throw new Exception(_r('An error occurred when contacting Instapaper. Please try again later.', 'instapaper'));
        }
        Instapaper::page_head();
        ?>
		<div id="message">
			<h1><?php 
        _e('Success!');
        ?>
</h1>
			<p class="sidenote"><?php 
        _e('Closing window in...', 'instapaper');
        ?>
</p>
			<p class="sidenote" id="counter">3</p>
		</div>
		<script>
			$(document).ready(function () {
				setInterval(countdown, 1000);
			});

			function countdown() {
				if(timer > 0) {
					$('#counter').text(timer);
					timer--;
				}
				else {
					self.close();
				}
			}

			var timer = 2;
		</script>
	<?php 
        Instapaper::page_foot();
        die;
    }
开发者ID:JocelynDelalande,项目名称:Lilina,代码行数:59,代码来源:instapaper.php

示例11: __construct

 public function __construct()
 {
     $this->db = _r('db');
     $this->params = array();
     $this->results = null;
     $this->where = array();
     $this->distinct = false;
 }
开发者ID:wamania,项目名称:mynd-framework,代码行数:8,代码来源:Select.php

示例12: __construct

 public function __construct()
 {
     $this->db = _r('db');
     if (!empty($this->sql)) {
         $content = file_get_contents('sql/' . $this->sql, 'r');
         $tabSql = explode(';', $content);
         foreach ($tabSql as $sql) {
             $sql = trim($sql);
             if (!empty($sql)) {
                 $this->db->query($sql);
             }
         }
     }
 }
开发者ID:wamania,项目名称:mynd-framework,代码行数:14,代码来源:MfTestModel.php

示例13: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('adminsetup_form');
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel(_r('Username'))->setValue("admin")->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty');
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(_r('Password'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty');
     $passwordConfirm = new Zend_Form_Element_Password('passwordconf');
     $passwordConfirm->setLabel(_r('Confirm Password'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->addValidator('Identical', false, array('token' => 'password'));
     $submit = new Zend_Form_Element_Image('btn_submit');
     $submit->setImage('/images/buttons/small/next.png')->setAttrib('style', 'float: right;');
     $this->addElements(array($username, $password, $passwordConfirm, $submit));
 }
开发者ID:robertbasic,项目名称:godeploy,代码行数:14,代码来源:SetupAdmin.php

示例14: authenticate

 protected function authenticate()
 {
     $data = array('service' => 'reader', 'continue' => 'http://www.google.com/', 'Email' => $this->id, 'Passwd' => $this->pass, 'source' => 'Lilina/' . LILINA_CORE_VERSION);
     $response = $this->request->post($this->urls['auth'], array(), $data);
     if ($response->success !== true) {
         if ($response->status_code == 403) {
             // Error text from Google
             throw new Exception(_r('The username or password you entered is incorrect.'), Errors::get_code('admin.importer.greader.invalid_auth'));
         }
     }
     preg_match('#SID=(.*)#i', $response->body, $results);
     // so we've found the SID
     // now we can build the cookie that gets us in the door
     $this->cookie = 'SID=' . $results[1];
 }
开发者ID:rmccue,项目名称:Lilina,代码行数:15,代码来源:googlereaderapi.php

示例15: import_opml

 /**
  * Parse feeds into an array, ready to pass to the Javascript importer
  *
  * @param string $opml OPML standard file.
  * @return array Associative array containing feed URL, title and category (if applicable)
  */
 protected function import_opml($opml)
 {
     if (empty($opml)) {
         throw new Exception(_r('No OPML specified'));
         return false;
     }
     $opml = new OPMLParser($opml);
     if (!empty($opml->error) || empty($opml->data)) {
         throw new Exception(sprintf(_r('The OPML file could not be read. The parser said: %s'), $opml->error));
         return false;
     }
     $feeds_num = 0;
     $feeds = $this->parse($opml->data);
     MessageHandler::add(sprintf(Locale::ngettext('Adding %d feed', 'Adding %d feeds', $feeds_num), $feeds_num));
     return $feeds;
 }
开发者ID:rmccue,项目名称:Lilina,代码行数:22,代码来源:import-other.php


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