當前位置: 首頁>>代碼示例>>PHP>>正文


PHP URL::reset方法代碼示例

本文整理匯總了PHP中URL::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP URL::reset方法的具體用法?PHP URL::reset怎麽用?PHP URL::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在URL的用法示例。


在下文中一共展示了URL::reset方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: spwrans_redirect

 private function spwrans_redirect($spid)
 {
     global $PAGE;
     # We have a Scottish Parliament ID, need to find the date
     $SPWRANSLIST = new \SPWRANSLIST();
     $gid = $SPWRANSLIST->get_gid_from_spid($spid);
     if ($gid) {
         if (preg_match('/uk\\.org\\.publicwhip\\/spwa\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
             $URL = new \URL('spwrans');
             $URL->reset();
             $URL->insert(array('id' => $m[1]));
             $fragment_identifier = '#g' . $m[2];
             header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
             exit;
         } elseif (preg_match('/uk\\.org\\.publicwhip\\/spor\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
             $URL = new \URL('spdebates');
             $URL->reset();
             $URL->insert(array('id' => $m[1]));
             $fragment_identifier = '#g' . $m[2];
             header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
             exit;
         } else {
             $PAGE->error_message("Strange GID ({$gid}) for that Scottish Parliament ID.");
         }
     }
     $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID.");
 }
開發者ID:udp12,項目名稱:theyworkforyou,代碼行數:27,代碼來源:SpwransView.php

示例2: output

 /**
  * Output Page
  *
  * Assembles a completed page from template and sends it to output.
  *
  * @param string $template The name of the template file to load.
  * @param array  $data     An associative array of data to be made available to the template.
  */
 public static function output($template, $data = array())
 {
     global $page_errors;
     ////////////////////////////////////////////////////////////
     // Find the user's country. Used by header, so a safe bit to do regardless.
     if (preg_match('#^[A-Z]{2}$#i', get_http_var('country'))) {
         $data['country'] = strtoupper(get_http_var('country'));
     } else {
         $data['country'] = Utility\Gaze::getCountryByIp($_SERVER["REMOTE_ADDR"]);
     }
     ////////////////////////////////////////////////////////////
     // Get the page data
     global $DATA, $this_page, $THEUSER;
     $header = new Renderer\Header();
     $data = array_merge($header->data, $data);
     $user = new Renderer\User();
     $data = array_merge($user->data, $data);
     if (isset($page_errors)) {
         $data['page_errors'] = $page_errors;
     }
     ////////////////////////////////////////////////////////////
     // Search URL
     $SEARCH = new \URL('search');
     $SEARCH->reset();
     $data['search_url'] = $SEARCH->generate();
     ////////////////////////////////////////////////////////////
     // Search URL
     // Footer Links
     $footer = new Renderer\Footer();
     $data['footer_links'] = $footer->data;
     # banner text
     $b = new Model\Banner();
     $data['banner_text'] = $b->get_text();
     $data = self::addCommonURLs($data);
     # mini survey
     // we never want to display this on the front page or any
     // other survey page we might have
     if (!in_array($this_page, array('survey', 'overview'))) {
         $mini = new MiniSurvey();
         $data['mini_survey'] = $mini->get_values();
     }
     ////////////////////////////////////////////////////////////
     // Unpack the data we've been passed so it's available for use in the templates.
     extract($data);
     ////////////////////////////////////////////////////////////
     // Require the templates and output
     header('Content-Type: text/html; charset=iso-8859-1');
     require_once INCLUDESPATH . 'easyparliament/templates/html/header.php';
     require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
     require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php';
 }
開發者ID:vijo,項目名稱:theyworkforyou,代碼行數:59,代碼來源:Renderer.php

示例3: array

 function _get_nextprev_dates($date)
 {
     global $hansardmajors;
     // Pass it a yyyy-mm-dd date and it'll return an array
     // containing the next/prev dates that contain items from
     // $this->major of hansard object.
     twfy_debug(get_class($this), "getting next/prev dates");
     // What we return.
     $nextprevdata = array();
     $URL = new URL($this->listpage);
     $looper = array("next", "prev");
     foreach ($looper as $n => $nextorprev) {
         $URL->reset();
         if ($nextorprev == 'next') {
             $q = $this->db->query("SELECT MIN(hdate) AS hdate\n\t\t\t\t\t\t\tFROM \thansard\n\t\t\t\t\t\t\tWHERE \tmajor = '" . $this->major . "'\n\t\t\t\t\t\t\tAND\t\thdate > '" . mysql_escape_string($date) . "'\n\t\t\t\t\t\t\t");
         } else {
             $q = $this->db->query("SELECT MAX(hdate) AS hdate\n\t\t\t\t\t\t\tFROM \thansard\n\t\t\t\t\t\t\tWHERE \tmajor = '" . $this->major . "'\n\t\t\t\t\t\t\tAND\t\thdate < '" . mysql_escape_string($date) . "'\n\t\t\t\t\t\t\t");
         }
         // The '!= NULL' bit is needed otherwise I was getting errors
         // when displaying the first day of debates.
         if ($q->rows() > 0 && $q->field(0, 'hdate') != NULL) {
             $URL->insert(array('d' => $q->field(0, 'hdate')));
             if ($nextorprev == 'next') {
                 $body = 'Next day';
             } else {
                 $body = 'Previous day';
             }
             $title = format_date($q->field(0, 'hdate'), SHORTDATEFORMAT);
             $nextprevdata[$nextorprev] = array('hdate' => $q->field(0, 'hdate'), 'url' => $URL->generate(), 'body' => $body, 'title' => $title);
         }
     }
     $year = substr($date, 0, 4);
     $URL = new URL($hansardmajors[$this->major]['page_year']);
     $thing = $hansardmajors[$this->major]['plural'];
     $URL->insert(array('y' => $year));
     $nextprevdata['up'] = array('body' => "All of {$year}'s {$thing}", 'title' => '', 'url' => $URL->generate());
     return $nextprevdata;
 }
開發者ID:rhaleblian,項目名稱:twfy,代碼行數:38,代碼來源:hansardlist.php

示例4: display

    public function display()
    {
        // Print all our pending items out in a nice list or something
        // Add links later for "approve, decline, refer"
        // Just get the fucker working for now
        $URL = new URL('admin_glossary_pending');
        $URL->reset();
        $form_link = $URL->generate('url');
        ?>
<form action="<?php 
        echo $form_link;
        ?>
" method="post"><?php 
        foreach ($this->pending as $editqueue_id => $pender) {
            $URL = new URL('admin_glossary_pending');
            $URL->insert(array('approve' => $editqueue_id));
            $approve_link = $URL->generate('url');
            $URL = new URL('admin_glossary_pending');
            $URL->insert(array('modify' => $editqueue_id));
            $modify_link = $URL->generate('url');
            $URL = new URL('admin_glossary_pending');
            $URL->insert(array('decline' => $editqueue_id));
            $decline_link = $URL->generate('url');
            ?>
<div class="pending-item"><label for="<?php 
            echo $editqueue_id;
            ?>
"><input type="checkbox" name="approve[]" value="<?php 
            echo $editqueue_id;
            ?>
" id="<?php 
            echo $editqueue_id;
            ?>
"><strong><?php 
            echo $pender['title'];
            ?>
</strong></label>
            <p><?php 
            echo $pender['body'];
            ?>
<br>
            <small>
                <a href="<?php 
            echo $approve_link;
            ?>
">approve</a>
                &nbsp;|&nbsp;
                <a href="<?php 
            echo $modify_link;
            ?>
">modify</a>
                &nbsp;|&nbsp;
                <a href="<?php 
            echo $decline_link;
            ?>
">decline</a>
                <br>Submitted by: <em><?php 
            echo $pender['firstname'];
            ?>
&nbsp;<?php 
            echo $pender['lastname'];
            ?>
</em>
            </small></p></div>
        <?php 
        }
        ?>
<input type="submit" value="Approve checked items">
        </form><?php 
    }
開發者ID:vijo,項目名稱:theyworkforyou,代碼行數:70,代碼來源:editqueue.php

示例5: display_form

function display_form($details = array(), $errors = array())
{
    global $this_page, $ALERT, $PAGE, $THEUSER;
    $ACTIONURL = new URL($this_page);
    $ACTIONURL->reset();
    ?>

<p>This page allows you to request an email alert from OpenAustralia.org.</p>

<?php 
    if (!get_http_var('only')) {
        ?>
<ul>
<li>To receive an alert <strong>every time a particular person appears</strong>,
select their name from the drop-down list and
leave the word/phrase box blank.</li>

<li>To receive an alert <strong>every time a particular keyword or phrase appears</strong>,
select "Any Representative or Senator" from the drop-down list, and enter your search term in
the box underneath.  The results are selected using the same rules as for a
normal search (see the box to the right for help on setting your criteria).</li>

<li>You can also <strong>combine</strong> both types of criteria to be alerted
<strong>only</strong> when a particular person uses the keywords you have defined.
To do this, select the person from the drop-down list <em>and</em> enter the keyword(s) as
above.</li>
</ul>

<p>Please note that you should only enter one topic per alert - if you wish to receive alerts on more than one topic, or for more than one person, simply fill in this form as many times as you need.</p>
<?php 
    }
    ?>

	<form method="post" action="<?php 
    echo $ACTIONURL->generate();
    ?>
">
	
	<?php 
    if (!$THEUSER->loggedin()) {
        if (isset($errors["email"]) && (get_http_var('submitted') || get_http_var('only'))) {
            $PAGE->error_message($errors["email"]);
        }
        ?>
				<div class="row">
				<span class="label"><label for="email">Your email address:</label></span>
				<span class="formw"><input type="text" name="email" id="email" value="<?php 
        if (isset($details["email"])) {
            echo htmlentities($details["email"]);
        }
        ?>
" maxlength="255" size="30" class="form"></span>
				</div>
	<?php 
    }
    if (!get_http_var('only') || !$details['keyword']) {
        if (isset($errors['pid'])) {
            $PAGE->error_message($errors['pid']);
        }
        ?>
				<div class="row">
				<span class="label"><label for="pid">Person you wish to receive alerts for:</label></span>
				<span class="formw"><?php 
        if (get_http_var('only') && $details['pid']) {
            $MEMBER = new MEMBER(array('person_id' => $details['pid']));
            print $MEMBER->full_name();
            print '<input type="hidden" name="pid" value="' . htmlspecialchars($details['pid']) . '">';
        } else {
            ?>
<select name="pid">
				<option value="Any">Any Representative or Senator</option>
				<?php 
            // Get a list of MPs/Lords for displaying in the form using the PEOPLE class
            $LIST = new PEOPLE();
            $args['order'] = 'last_name';
            if ($details['pid']) {
                $args['pid'] = $details['pid'];
            }
            $LIST->listoptions($args);
            ?>
				</select>
			<?php 
        }
        ?>
				</span>
				</div>
	<?php 
    }
    if (!get_http_var('only') || !$details['pid']) {
        if (isset($errors["keyword"])) {
            $PAGE->error_message($errors["keyword"]);
        }
        ?>
				<div class="row"> 
				<span class="label"><label for="keyword">Word or phrase you wish to receive alerts for:</label></span>
				<span class="formw"><input type="text" name="keyword" id="keyword" value="<?php 
        if ($details['keyword']) {
            echo htmlentities($details['keyword']);
        }
        ?>
//.........這裏部分代碼省略.........
開發者ID:leowmjw,項目名稱:twfy,代碼行數:101,代碼來源:index.php

示例6: output


//.........這裏部分代碼省略.........
         }
         // The 'Log out' link.
         $menudata = $DATA->page_metadata('userlogout', 'menu');
         $logouttext = $menudata['text'];
         $logouttitle = $menudata['title'];
         $LOGOUTURL = new \URL('userlogout');
         if ($this_page != 'userlogout') {
             $LOGOUTURL->insert(array("ret" => $returl));
             $logoutclass = '';
         } else {
             $logoutclass = 'on';
         }
         $username = $THEUSER->firstname() . ' ' . $THEUSER->lastname();
         $data['user_nav_links'][] = array('href' => $LOGOUTURL->generate(), 'title' => $logouttitle, 'classes' => $logoutclass, 'text' => $logouttext);
         $data['user_nav_links'][] = array('href' => $EDITURL->generate(), 'title' => $edittitle, 'classes' => $editclass, 'text' => $edittext);
         $data['user_nav_links'][] = array('href' => $EDITURL->generate(), 'title' => $edittitle, 'classes' => $editclass, 'text' => _htmlentities($username));
     } else {
         // User not logged in
         // The 'Join' link.
         $menudata = $DATA->page_metadata('userjoin', 'menu');
         $jointext = $menudata['text'];
         $jointitle = $menudata['title'];
         $JOINURL = new \URL('userjoin');
         if ($this_page != 'userjoin') {
             if ($this_page != 'userlogout' && $this_page != 'userlogin') {
                 // We don't do this on the logout page, because then the user
                 // will return straight to the logout page and be logged out
                 // immediately!
                 $JOINURL->insert(array("ret" => $returl));
             }
             $joinclass = '';
         } else {
             $joinclass = 'on';
         }
         // The 'Log in' link.
         $menudata = $DATA->page_metadata('userlogin', 'menu');
         $logintext = $menudata['text'];
         $logintitle = $menudata['title'];
         $LOGINURL = new \URL('userlogin');
         if ($this_page != 'userlogin') {
             if ($this_page != "userlogout" && $this_page != "userpassword" && $this_page != 'userjoin') {
                 // We don't do this on the logout page, because then the user
                 // will return straight to the logout page and be logged out
                 // immediately!
                 // And it's also silly if we're sent back to Change Password.
                 // And the join page.
                 $LOGINURL->insert(array("ret" => $returl));
             }
             $loginclass = '';
         } else {
             $loginclass = 'on';
         }
         $data['user_nav_links'][] = array('href' => $LOGINURL->generate(), 'title' => $logintitle, 'classes' => $loginclass, 'text' => $logintext);
         $data['user_nav_links'][] = array('href' => $JOINURL->generate(), 'title' => $jointitle, 'classes' => $joinclass, 'text' => $jointext);
     }
     // If the user's postcode is set, then we add a link to Your MP etc.
     if ($THEUSER->postcode_is_set()) {
         $items = array('yourmp');
         if (postcode_is_scottish($THEUSER->postcode())) {
             $items[] = 'yourmsp';
         } elseif (postcode_is_ni($THEUSER->postcode())) {
             $items[] = 'yourmla';
         }
         foreach ($items as $item) {
             $menudata = $DATA->page_metadata($item, 'menu');
             $logintext = $menudata['text'];
             $URL = new \URL($item);
             $data['user_nav_links'][] = array('href' => $URL->generate(), 'title' => '', 'classes' => '', 'text' => $logintext);
         }
     }
     ////////////////////////////////////////////////////////////
     // Search URL
     $SEARCH = new \URL('search');
     $SEARCH->reset();
     $data['search_url'] = $SEARCH->generate();
     ////////////////////////////////////////////////////////////
     // Search URL
     // Footer Links
     $footer = new Renderer\Footer();
     $data['footer_links'] = $footer->data;
     # banner text
     $b = new Model\Banner();
     $data['banner_text'] = $b->get_text();
     # mini survey
     // we never want to display this on the front page or any
     // other survey page we might have
     if (!in_array($this_page, array('survey', 'overview'))) {
         $mini = new MiniSurvey();
         $data['mini_survey'] = $mini->get_values();
     }
     ////////////////////////////////////////////////////////////
     // Unpack the data we've been passed so it's available for use in the templates.
     extract($data);
     ////////////////////////////////////////////////////////////
     // Require the templates and output
     header('Content-Type: text/html; charset=iso-8859-1');
     require_once INCLUDESPATH . 'easyparliament/templates/html/header.php';
     require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
     require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php';
 }
開發者ID:udp12,項目名稱:theyworkforyou,代碼行數:101,代碼來源:Renderer.php

示例7: display_form

function display_form($details = array(), $errors = array())
{
    global $this_page, $THEUSER, $who, $PAGE;
    $PAGE->stripe_start();
    if (isset($errors["db"])) {
        $PAGE->error_message($errors["db"]);
    } else {
        $URL = new URL("userlogin");
        if (!$THEUSER->isloggedin()) {
            ?>
				<p>Already joined? <a href="<?php 
            echo $URL->generate();
            ?>
">Then log in!</a></p>
<?php 
        }
    }
    $ACTIONURL = new URL($this_page);
    $ACTIONURL->reset();
    ?>

				<form method="post" action="<?php 
    echo $ACTIONURL->generate();
    ?>
">
<?php 
    if ($this_page == "otheruseredit") {
        ?>
				<div class="row">
				<span class="label">User ID:</span>
				<span class="formw"><?php 
        echo htmlentities($details["user_id"]);
        ?>
</span>
				</div>

<?php 
    }
    if ($this_page == 'useredit' && isset($details['status'])) {
        ?>
				<div class="row">
				<span class="label">Status:</span>
				<span class="formw"><?php 
        echo htmlentities($details['status']);
        ?>
</span>
				</div>
<?php 
    }
    if (isset($errors["firstname"])) {
        $PAGE->error_message($errors["firstname"]);
    }
    ?>
				<div class="row">
				<span class="label"><label for="firstname">Your first name:</label></span>
				<span class="formw"><input type="text" name="firstname" id="firstname" value="<?php 
    if (isset($details["firstname"])) {
        echo htmlentities($details["firstname"]);
    }
    ?>
" maxlength="255" size="30" class="form"></span>
				</div>

<?php 
    if (isset($errors["lastname"])) {
        $PAGE->error_message($errors["lastname"]);
    }
    ?>
				<div class="row">
				<span class="label"><label for="lastname">Your last name:</label></span>
				<span class="formw"><input type="text" name="lastname" id="lastname" value="<?php 
    if (isset($details["lastname"])) {
        echo htmlentities($details["lastname"]);
    }
    ?>
" maxlength="255" size="30" class="form"></span>
				</div>

<?php 
    if (isset($errors["email"])) {
        $PAGE->error_message($errors["email"]);
    }
    ?>
				<div class="row">
				<span class="label"><label for="em">Email address:</label></span>
				<span class="formw"><input type="text" name="em" id="em" value="<?php 
    if (isset($details["email"])) {
        echo htmlentities($details["email"]);
    }
    ?>
" maxlength="255" size="30" class="form"></span>
				</div>

<?php 
    if ($this_page == "useredit" || $this_page == "otheruseredit") {
        // If not, the user's joining.
        ?>
				<div class="row">
				&nbsp;<br><small>To change <?php 
        echo $who;
//.........這裏部分代碼省略.........
開發者ID:bruno,項目名稱:openaustralia-app,代碼行數:101,代碼來源:index.php

示例8: array

    function login_form($errors = array())
    {
        // Used for /user/login/ and /user/prompt/
        // $errors is a hash of potential errors from a previous log in attempt.
        ?>
				<form method="post" action="<?php 
        $URL = new URL('userlogin');
        $URL->reset();
        echo $URL->generate();
        ?>
">


<?php 
        if (isset($errors["email"])) {
            $this->error_message($errors['email']);
        }
        if (isset($errors["invalidemail"])) {
            $this->error_message($errors['invalidemail']);
        }
        ?>
				<div class="row">
				<span class="label"><label for="email">Email address:</label></span>
				<span class="formw"><input type="text" name="email" id="email" value="<?php 
        echo htmlentities(get_http_var("email"));
        ?>
" maxlength="100" size="30" class="form"></span>
				</div>

<?php 
        if (isset($errors["password"])) {
            $this->error_message($errors['password']);
        }
        if (isset($errors["invalidpassword"])) {
            $this->error_message($errors['invalidpassword']);
        }
        ?>
				<div class="row">
				<span class="label"><label for="password">Password:</label></span>
				<span class="formw"><input type="password" name="password" id="password" maxlength="30" size="20" class="form"></span>
				</div>

				<div class="row">
				<span class="label">&nbsp;</span>
				<span class="formw"><input type="checkbox" name="remember" id="remember" value="true"<?php 
        $remember = get_http_var("remember");
        if (get_http_var("submitted") != "true" || $remember == "true") {
            print " checked";
        }
        ?>
> <label for="remember">Remember login details.*</label></span>
				</div>

				<div class="row">
				<span class="label">&nbsp;</span>
				<span class="formw"><input type="submit" value="Login" class="submit"> <small><a href="<?php 
        $URL = new URL("userpassword");
        $URL->insert(array("email" => get_http_var("email")));
        echo $URL->generate();
        ?>
">Forgotten your password?</a></small></span>
				</div>

				<div class="row">
				<small></small>
				</div>

				<input type="hidden" name="submitted" value="true">
<?php 
        // I had to havk about with this a bit to cover glossary login.
        // Glossary returl can't be properly formatted until the "add" form
        // has been submitted, so we have to do this rubbish:
        global $glossary_returl;
        if (get_http_var("ret") != "" || $glossary_returl != "") {
            // The return url for after the user has logged in.
            if (get_http_var("ret") != "") {
                $returl = get_http_var("ret");
            } else {
                $returl = $glossary_returl;
            }
            ?>
				<input type="hidden" name="ret" value="<?php 
            echo htmlentities($returl);
            ?>
">
<?php 
        }
        ?>
				</form>
<?php 
    }
開發者ID:archoo,項目名稱:twfy,代碼行數:91,代碼來源:page.php

示例9: strtoupper

<?php

$rep = preg_replace('#S$#', 's', strtoupper($this_page));

$URL = new URL($this_page);
$URL->insert(array('f'=>'csv'));
$csvurl = $URL->generate();

$URL->reset();
$URL->insert(array('all'=>1));
$allurl = $URL->generate();

$this->block_start(array('title'=>'Relevant links'));
echo "<ul><li><a href='$csvurl'>Download a CSV file that you can load into Excel</a></li>";
if ($this_page == 'mps') {
?>
<li><a href="?date=2010-05-06">MPs at 2010 general election</a></li>
<li><a href="?date=2005-05-05">MPs at 2005 general election</a></li>
<li><a href="?date=2001-06-07">MPs at 2001 general election</a></li>
<li><a href="?date=1997-05-01">MPs at 1997 general election</a></li>
<li><a href="?date=1992-04-09">MPs at 1992 general election</a></li>
<li><a href="?date=1987-06-11">MPs at 1987 general election</a></li>
<li><a href="?date=1983-06-09">MPs at 1983 general election</a></li>
<li><a href="?date=1979-05-03">MPs at 1979 general election</a></li>
<li><a href="?date=1974-10-10">MPs at Oct 1974 general election</a></li>
<li><a href="?date=1974-02-28">MPs at Feb 1974 general election</a></li>
<li><a href="?date=1970-06-18">MPs at 1970 general election</a></li>
<li><a href="?date=1966-03-31">MPs at 1966 general election</a></li>
<li><a href="?date=1964-10-15">MPs at 1964 general election</a></li>
<li><a href="?date=1959-10-08">MPs at 1959 general election</a></li>
<li><a href="?date=1955-05-26">MPs at 1955 general election</a></li>
開發者ID:nallachaitu,項目名稱:theyworkforyou,代碼行數:31,代碼來源:people.php

示例10: output


//.........這裏部分代碼省略.........
         // The 'Log out' link.
         $menudata = $DATA->page_metadata('userlogout', 'menu');
         $logouttext = $menudata['text'];
         $logouttitle = $menudata['title'];
         $LOGOUTURL = new \URL('userlogout');
         if ($this_page != 'userlogout') {
             $LOGOUTURL->insert(array("ret" => $returl));
             $logoutclass = '';
         } else {
             $logoutclass = 'on';
         }
         $username = $THEUSER->firstname() . ' ' . $THEUSER->lastname();
         $data['user_nav_links'][] = array('href' => $LOGOUTURL->generate(), 'title' => $logouttitle, 'classes' => $logoutclass, 'text' => $logouttext);
         $data['user_nav_links'][] = array('href' => $EDITURL->generate(), 'title' => $edittitle, 'classes' => $editclass, 'text' => $edittext);
         $data['user_nav_links'][] = array('href' => $EDITURL->generate(), 'title' => $edittitle, 'classes' => $editclass, 'text' => _htmlentities($username));
     } else {
         // User not logged in
         // The 'Join' link.
         $menudata = $DATA->page_metadata('userjoin', 'menu');
         $jointext = $menudata['text'];
         $jointitle = $menudata['title'];
         $JOINURL = new \URL('userjoin');
         if ($this_page != 'userjoin') {
             if ($this_page != 'userlogout' && $this_page != 'userlogin') {
                 // We don't do this on the logout page, because then the user
                 // will return straight to the logout page and be logged out
                 // immediately!
                 $JOINURL->insert(array("ret" => $returl));
             }
             $joinclass = '';
         } else {
             $joinclass = 'on';
         }
         // The 'Log in' link.
         $menudata = $DATA->page_metadata('userlogin', 'menu');
         $logintext = $menudata['text'];
         $logintitle = $menudata['title'];
         $LOGINURL = new \URL('userlogin');
         if ($this_page != 'userlogin') {
             if ($this_page != "userlogout" && $this_page != "userpassword" && $this_page != 'userjoin') {
                 // We don't do this on the logout page, because then the user
                 // will return straight to the logout page and be logged out
                 // immediately!
                 // And it's also silly if we're sent back to Change Password.
                 // And the join page.
                 $LOGINURL->insert(array("ret" => $returl));
             }
             $loginclass = '';
         } else {
             $loginclass = 'on';
         }
         $data['user_nav_links'][] = array('href' => $LOGINURL->generate(), 'title' => $logintitle, 'classes' => $loginclass, 'text' => $logintext);
         $data['user_nav_links'][] = array('href' => $JOINURL->generate(), 'title' => $jointitle, 'classes' => $joinclass, 'text' => $jointext);
     }
     // If the user's postcode is set, then we add a link to Your MP etc.
     if ($THEUSER->postcode_is_set()) {
         $items = array('yourmp');
         if (postcode_is_scottish($THEUSER->postcode())) {
             $items[] = 'yourmsp';
         } elseif (postcode_is_ni($THEUSER->postcode())) {
             $items[] = 'yourmla';
         }
         foreach ($items as $item) {
             $menudata = $DATA->page_metadata($item, 'menu');
             $logintext = $menudata['text'];
             $URL = new \URL($item);
             $data['user_nav_links'][] = array('href' => $URL->generate(), 'title' => '', 'classes' => '', 'text' => $logintext);
         }
     }
     ////////////////////////////////////////////////////////////
     // Search URL
     $SEARCH = new \URL('search');
     $SEARCH->reset();
     $data['search_url'] = $SEARCH->generate();
     ////////////////////////////////////////////////////////////
     // Search URL
     // Footer Links
     $data['footer_links']['about'] = self::get_menu_links(array('help', 'about', 'linktous', 'houserules', 'blog', 'news', 'contact', 'privacy'));
     $data['footer_links']['assemblies'] = self::get_menu_links(array('hansard', 'sp_home', 'ni_home', 'wales_home', 'boundaries'));
     $data['footer_links']['international'] = self::get_menu_links(array('newzealand', 'australia', 'ireland', 'mzalendo'));
     $data['footer_links']['tech'] = self::get_menu_links(array('code', 'api', 'data', 'pombola', 'devmailinglist', 'irc'));
     # banner text
     $b = new Model\Banner();
     $data['banner_text'] = $b->get_text();
     # Robots header
     if (DEVSITE) {
         $data['robots'] = 'noindex,nofollow';
     } elseif ($robots = $DATA->page_metadata($this_page, 'robots')) {
         $data['robots'] = $robots;
     }
     ////////////////////////////////////////////////////////////
     // Unpack the data we've been passed so it's available for use in the templates.
     extract($data);
     ////////////////////////////////////////////////////////////
     // Require the templates and output
     header('Content-Type: text/html; charset=iso-8859-1');
     require_once INCLUDESPATH . 'easyparliament/templates/html/header.php';
     require_once INCLUDESPATH . 'easyparliament/templates/html/' . $template . '.php';
     require_once INCLUDESPATH . 'easyparliament/templates/html/footer.php';
 }
開發者ID:sarahs-synapse,項目名稱:theyworkforyou,代碼行數:101,代碼來源:Renderer.php

示例11: display_search_form

function display_search_form($alert, $details = array(), $errors = array())
{
    global $this_page, $PAGE;
    $ACTIONURL = new URL($this_page);
    $ACTIONURL->reset();
    $form_start = '<form action="' . $ACTIONURL->generate() . '" method="post">
<input type="hidden" name="t" value="' . _htmlspecialchars(get_http_var('t')) . '">
<input type="hidden" name="email" value="' . _htmlspecialchars(get_http_var('email')) . '">';
    if (isset($details['members']) && $details['members']->rows() > 0) {
        echo '<ul class="hilites">';
        $q = $details['members'];
        for ($n = 0; $n < $q->rows(); $n++) {
            echo '<li>';
            echo $form_start . '<input type="hidden" name="pid" value="' . $q->field($n, 'person_id') . '">';
            echo 'Things by ';
            $name = member_full_name($q->field($n, 'house'), $q->field($n, 'title'), $q->field($n, 'given_name'), $q->field($n, 'family_name'), $q->field($n, 'lordofname'));
            if ($q->field($n, 'constituency')) {
                echo $name . ' (' . $q->field($n, 'constituency') . ') ';
            } else {
                echo $name;
            }
            echo ' <input type="submit" value="Subscribe"></form>';
            echo "</li>\n";
        }
        echo '</ul>';
    }
    if (isset($details['constituencies'])) {
        echo '<ul class="hilites">';
        foreach ($details['constituencies'] as $constituency) {
            $MEMBER = new MEMBER(array('constituency' => $constituency, 'house' => 1));
            echo "<li>";
            echo $form_start . '<input type="hidden" name="pid" value="' . $MEMBER->person_id() . '">';
            if ($details['valid_postcode']) {
                echo '<input type="hidden" name="pc" value="' . _htmlspecialchars($details['alertsearch']) . '">';
            }
            echo $MEMBER->full_name();
            echo ' (' . _htmlspecialchars($constituency) . ')';
            echo ' <input type="submit" value="Subscribe"></form>';
            echo "</li>";
        }
        echo '</ul>';
    }
    if ($details['alertsearch']) {
        echo '<ul class="hilites"><li>';
        echo $form_start . '<input type="hidden" name="keyword" value="' . _htmlspecialchars($details['alertsearch']) . '">';
        echo 'Mentions of [';
        $alertsearch = $details['alertsearch'];
        if (preg_match('#speaker:(\\d+)#', $alertsearch, $m)) {
            $MEMBER = new MEMBER(array('person_id' => $m[1]));
            $alertsearch = str_replace("speaker:{$m['1']}", "speaker:" . $MEMBER->full_name(), $alertsearch);
        }
        echo _htmlspecialchars($alertsearch) . '] ';
        echo ' <input type="submit" value="Subscribe"></form>';
        # Use original alertsearch variable here, because name replacement might introduce a comma
        if (strstr($details['alertsearch'], ',') > -1) {
            echo '<em class="error">You have used a comma in your search term &ndash; are you sure this is what you want?
You cannot sign up to multiple search terms using a comma &ndash; either use OR, or fill in this form multiple times.</em>';
        }
        if (preg_match('#([A-Z]{1,2}\\d+[A-Z]? ?\\d[A-Z]{2})#i', $alertsearch, $m) && strlen($alertsearch) > strlen($m[1]) && validate_postcode($m[1])) {
            $scottish_text = '';
            $mp_display_text = '';
            if (postcode_is_scottish($m[1])) {
                $mp_display_text = 'your MP, ';
                $scottish_text = ' or MSP';
            }
            echo '<em class="error">You have used a postcode and something else in your search term &ndash; are you sure this is what you want?
                  You will only get an alert if all of these are mentioned in the same debate. Did you mean to get alerts for when your MP' . $scottish_text . ' mentions something instead? If so click subscribe below.</em></li>';
            try {
                $MEMBER = new MEMBER(array('postcode' => $m[1]));
                // move the postcode to the front just to be tidy
                $tidy_alertsearch = $m[1] . " " . trim(str_replace("{$m['1']}", "", $alertsearch));
                $alertsearch_display = str_replace("{$m['1']} ", "", $tidy_alertsearch);
                $alertsearch = str_replace("{$m['1']}", "speaker:" . $MEMBER->person_id, $tidy_alertsearch);
                echo "<li>";
                echo $form_start . '<input type="hidden" name="keyword" value="' . _htmlspecialchars($alertsearch) . '">';
                echo 'Mentions of [';
                echo _htmlspecialchars($alertsearch_display) . '] by ' . $mp_display_text . $MEMBER->full_name();
                echo ' <input type="submit" value="Subscribe"></form>';
                if ($scottish_text) {
                    $constituencies = postcode_to_constituencies($m[1]);
                    if (isset($constituencies['SPC'])) {
                        $MEMBER = new MEMBER(array('constituency' => $constituencies['SPC'], 'house' => 4));
                        // move the postcode to the front just to be tidy
                        $alertsearch = str_replace("{$m['1']}", "speaker:" . $MEMBER->person_id, $tidy_alertsearch);
                        echo "</li><li>";
                        echo $form_start . '<input type="hidden" name="keyword" value="' . _htmlspecialchars($alertsearch) . '">';
                        echo 'Mentions of [';
                        echo _htmlspecialchars($alertsearch_display) . '] by your MSP, ' . $MEMBER->full_name();
                        echo ' <input type="submit" value="Subscribe"></form>';
                    }
                }
            } catch (MySociety\TheyWorkForYou\MemberException $e) {
                echo '<p>We had a problem looking up your representative.</p>';
            }
        }
        echo "</li></ul>";
    }
    if ($details['pid']) {
        $MEMBER = new MEMBER(array('person_id' => $details['pid']));
        echo '<ul class="hilites"><li>';
//.........這裏部分代碼省略.........
開發者ID:sarahs-synapse,項目名稱:theyworkforyou,代碼行數:101,代碼來源:index.php

示例12: getBasicData

 private function getBasicData()
 {
     global $this_page;
     if ($this->user->loggedin()) {
         $this->data['email'] = $this->user->email();
         $this->data['email_verified'] = true;
     } elseif ($this->data['alert']) {
         $this->data['email'] = $this->data['alert']['email'];
         $this->data['email_verified'] = true;
     } else {
         $this->data["email"] = trim(get_http_var("email"));
         $this->data['email_verified'] = false;
     }
     $this->data['keyword'] = trim(get_http_var("keyword"));
     $this->data['pid'] = trim(get_http_var("pid"));
     $this->data['alertsearch'] = trim(get_http_var("alertsearch"));
     $this->data['pc'] = get_http_var('pc');
     $this->data['submitted'] = get_http_var('submitted') || $this->data['pid'] || $this->data['keyword'];
     $this->data['token'] = get_http_var('t');
     $this->data['sign'] = get_http_var('sign');
     $this->data['site'] = get_http_var('site');
     $this->data['message'] = '';
     $ACTIONURL = new \URL($this_page);
     $ACTIONURL->reset();
     $this->data['actionurl'] = $ACTIONURL->generate();
 }
開發者ID:vijo,項目名稱:theyworkforyou,代碼行數:26,代碼來源:Standard.php

示例13: elseif

    // If we're getting matches and no glossary entry, we can trigger them to add a definition
    // Obviously, only if it's a proper noun
    if ($info['total_results'] > 0 && $GLOSSARY['num_search_matches'] == 0) {
        // I'll be leaving this empty for now, pending search engine improvements...
    }
    $last_result = $info['first_result'] + $info['results_per_page'] - 1;
    if ($last_result > $info['total_results']) {
        $last_result = $info['total_results'];
    }
    print "\t\t\t\t<h3 style='font-weight:normal'>Results <strong>" . number_format($info['first_result']) . '-' . number_format($last_result) . '</strong> of ' . number_format($info['total_results']) . " for <strong>" . _htmlentities($searchdescription) . "</strong></h3>\n";
} elseif ($info['total_results'] == 0) {
    echo '<h3 style="font-weight:normal">Your search for <strong>', _htmlentities($searchdescription), '</strong> did not match anything.</h3>';
}
if ($info['spelling_correction']) {
    $u = new URL('search');
    $u->reset();
    $u->insert(array('s' => $info['spelling_correction']));
    echo '<p><big>Did you mean: <a href="' . $u->generate(), '">', $info['spelling_correction'] . '</a>?</big></p>';
}
if ($match = get_http_var('match')) {
    echo '<p><big>Hansard only refers to previous answers/statements by column number, so we don&rsquo;t know exactly what
was being referred to. Help us out by picking the right result and clicking &ldquo;This is the correct match&rdquo; next to it.
You&rsquo;ll be taken back to the page you came from, but hopefully then the link will go directly to the section you want.</big></p>';
}
if (isset($data['rows']) && count($data['rows']) > 0) {
    echo '<dl id="searchresults">';
    for ($i = 0; $i < count($data['rows']); $i++) {
        $row = $data['rows'][$i];
        echo '<dt><a href="', $row['listurl'], '">';
        if (isset($row['parent']) && count($row['parent']) > 0) {
            echo '<strong>' . $row['parent']['body'] . '</strong>';
開發者ID:udp12,項目名稱:theyworkforyou,代碼行數:31,代碼來源:hansard_search.php

示例14: display_search_form

function display_search_form ( $alert, $details = array(), $errors = array() ) {
    global $this_page, $PAGE;

    $ACTIONURL = new URL($this_page);
    $ACTIONURL->reset();
    $form_start = '<form action="' . $ACTIONURL->generate() . '" method="post">
<input type="hidden" name="t" value="' . htmlspecialchars(get_http_var('t')) . '">
<input type="hidden" name="only" value="1">
<input type="hidden" name="email" value="' . htmlspecialchars(get_http_var('email')) . '">';

    if (isset($details['members']) && $details['members']->rows() > 0) {
        echo '<ul class="hilites">';
        $q = $details['members'];
        $last_pid = null;
        for ($n=0; $n<$q->rows(); $n++) {
            if ($q->field($n, 'person_id') != $last_pid) {
                $last_pid = $q->field($n, 'person_id');
                echo '<li>';
                echo $form_start . '<input type="hidden" name="pid" value="' . $last_pid . '">';
                echo 'Things by ';
                $name = member_full_name($q->field($n, 'house'), $q->field($n, 'title'), $q->field($n, 'first_name'), $q->field($n, 'last_name'), $q->field($n, 'constituency') );
                if ($q->field($n, 'house') != 2) {
                    echo $name . ' (' . $q->field($n, 'constituency') . ') ';
                } else {
                    echo $name;
                }
                echo ' <input type="submit" value="Subscribe"></form>';
                echo "</li>\n";
            }
        }
        echo '</ul>';
    }

    if (isset($details['constituencies'])) {
        echo '<ul class="hilites">';
        foreach ($details['constituencies'] as $constituency) {
            $MEMBER = new MEMBER(array('constituency'=>$constituency, 'house' => 1));
            echo "<li>";
            echo $form_start . '<input type="hidden" name="pid" value="' . $MEMBER->person_id() . '">';
            if ($details['valid_postcode'])
                echo '<input type="hidden" name="pc" value="' . htmlspecialchars($details['alertsearch']) . '">';
            echo $MEMBER->full_name();
            echo ' (' . htmlspecialchars($constituency) . ')';
            echo ' <input type="submit" value="Subscribe"></form>';
            echo "</li>";
        }
        echo '</ul>';
    }

    if ($details['alertsearch']) {
        echo '<ul class="hilites"><li>';
        echo $form_start . '<input type="hidden" name="keyword" value="' . htmlspecialchars($details['alertsearch']) . '">';
        echo 'Mentions of [';
		$alertsearch = $details['alertsearch'];
        if (preg_match('#speaker:(\d+)#', $alertsearch, $m)) {
			$MEMBER = new MEMBER(array('person_id'=>$m[1]));
		    $alertsearch = str_replace("speaker:$m[1]", "speaker:" . $MEMBER->full_name(), $alertsearch);
        }
        echo htmlspecialchars($alertsearch) . '] ';
        echo ' <input type="submit" value="Subscribe"></form>';
        echo "</li></ul>";
    }

    if ($details['pid']) {
        $MEMBER = new MEMBER(array('person_id'=>$details['pid']));
        echo '<ul class="hilites"><li>';
        echo "Signing up for things by " . $MEMBER->full_name();
        echo ' (' . htmlspecialchars($MEMBER->constituency()) . ')';
        echo "</li></ul>";
    }

    if ($details['keyword']) {
        echo '<ul class="hilites"><li>';
        echo 'Signing up for results from a search for [';
		$alertsearch = $details['keyword'];
        if (preg_match('#speaker:(\d+)#', $alertsearch, $m)) {
			$MEMBER = new MEMBER(array('person_id'=>$m[1]));
		    $alertsearch = str_replace("speaker:$m[1]", "speaker:" . $MEMBER->full_name(), $alertsearch);
        }
        echo htmlspecialchars($alertsearch) . ']';
        echo "</li></ul>";
    }

    if (!$details['add']) {
?>

<p><label for="alertsearch">To sign up to an email alert, enter either your
<strong>postcode</strong>, the <strong>name</strong> of who you're interested
in, or the <strong>search word</strong> or <strong>words</strong> you wish to receive alerts
for.</label> To be alerted on an exact <strong>phrase</strong>, be sure to put it in quotes.
Also use quotes around a word to avoid stemming (where &lsquo;horse&rsquo; will
also match &lsquo;horses&rsquo;),

<?
    }

    echo '<form action="' . $ACTIONURL->generate() . '" method="post">
<input type="hidden" name="t" value="' . htmlspecialchars(get_http_var('t')) . '">
<input type="hidden" name="submitted" value="1">';

//.........這裏部分代碼省略.........
開發者ID:nallachaitu,項目名稱:theyworkforyou,代碼行數:101,代碼來源:index.php


注:本文中的URL::reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。