Example #1
0
 /**
  * Redirects to another method, and terminates the current request.
  *
  * Putting the word "Controller" at the end of each controller name is optional.
  *
  * self::redirect('about');
  * self::redirect(array('BlogController','post'),array('post_id'=>5));
  * self::redirect(array('Blog','post'),array('post_id'=>5));
  * self::redirect('http://google.com/');
  * @param mixed $controller_and_method String method name if redirecting to a method in the current controller or array('ControllerName','methodName') if redirecting to a method in another controller.
  * @param mixed $arguments Array arguments to resolve the route,or boolean false.
  */
 public static final function redirect($controller_and_method, $arguments = false, $include_base_url = true)
 {
     header('Location: ' . (is_string($controller_and_method) && (strpos($controller_and_method, 'http://') === 0 || strpos($controller_and_method, 'https://' === 0)) ? $controller_and_method : PicoraDispatcher::getUrl($controller_and_method, $arguments, $include_base_url)));
     exit;
 }
Example #2
0
 /**
  * Default view helper. Takes the same parameters as PicoraDispatcher::getUrl(), with text prepended.
  * 	#php
  * 	print self::link('Link Text',array('Blog','index'));
  */
 public static function link($text, $controller_and_method, $arguments = false, $include_base_url = true)
 {
     return self::tag('a', array('href' => PicoraDispatcher::getUrl($controller_and_method, $arguments, $include_base_url)), $text);
 }
Example #3
0
 /**
  * If you need more granular control over this process, use the afterCall callback function of the PicoraController.
  * @param callback $callback The callback function that will be called when a GET or POST request renders a response.
  * @return void
  */
 public static function setLayoutHandler($callback)
 {
     self::$layout_handler = $callback;
 }
Example #4
0
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 * @author Ryan Johnson <*****@*****.**>
 * @copyright 2007 LivePipe LLC
 * @license MIT
 */
$path = dirname(__FILE__);
require_once $path . '/classes/PicoraSupport.php';
require_once $path . '/classes/PicoraEvent.php';
require_once $path . '/classes/PicoraAutoLoader.php';
require_once $path . '/classes/PicoraDispatcher.php';
require_once $path . '/classes/PicoraController.php';
require_once $path . '/classes/PicoraView.php';
require_once $path . '/config.php';
require_once $path . '/functions.php';
PicoraAutoLoader::addFolder($path . '/classes/');
PicoraAutoLoader::addFolder($path . '/controllers/');
PicoraAutoLoader::addFolder($path . '/models/');
if (defined('CONNECTION_STRING')) {
    PicoraActiveRecord::connect(CONNECTION_STRING);
}
print PicoraDispatcher::dispatch($path, BASE_URL, isset($_GET['__route__']) ? '/' . $_GET['__route__'] : '/');
Example #5
0
 public static function viewHelper()
 {
     return '<link rel="pingback" href="' . PicoraDispatcher::getUrl(array('PicoraXMLRPC', 'respondToXMLRPC')) . '" />';
 }