public function __construct(Config $config = null, $url = null) { if (!$url) { $url = get_current_path(); } spl_autoload_register(array($this, 'load_class')); $this->config = $config ? $config : new Config(); if (empty($this->config->encoding)) { $this->config->encoding = 'UTF-8'; } $this->config->lib_url = guess_lib_url(); $this->config->lib_dir = dirname(__FILE__); $this->config->app_dir = dirname($_SERVER['SCRIPT_FILENAME']); $this->config->app_url = guess_app_url(); $this->config->data_dir = $this->config->app_dir . '/data'; $this->config->data_url = $this->config->app_url . '/data'; Services::set($this->config); $this->method = strtolower($_SERVER['REQUEST_METHOD']); if ($this->method == 'post' && array_key_exists('HTTP_X_HTTP_METHOD', $_SERVER)) { if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'DELETE' || $_SERVER['HTTP_X_HTTP_METHOD'] == 'PUT') { $this->method = strtolower($_SERVER['HTTP_X_HTTP_METHOD']); } } $request_body = json_decode(file_get_contents('php://input'), true); if ($request_body === null) { $request_body = []; } $request_data = array_merge($request_body, $_GET, $_POST); $this->request = new Request(explode('?', $url)[0], $this->method, $request_data); Services::set($this->request); Services::set(new TemplateEngine()); $this->router = Services::inject_set(Router::class); }
function get_web_path() { $root = get_current_path(); //$root = rtrim(dirname($root),"/\\"); $root = preg_replace('#(.*)/(\\w+\\.php)$#', '$1', $root); return $root; }
protected function showAuthToken() { $api = new Services_Soundcloud($this->userid, $this->secret, $this->getRedirectUri()); $authurl = $api->getAuthorizeUrl(array('scope' => 'non-expiring')); echo "<br />Go to <strong><a href='" . $authurl . "' target='_blank'>" . $authurl . "</a></strong> to generate the authorization code, then enter it bellow.<br />"; echo "<form action='" . get_current_path() . "' method='post' enctype='multipart/form-data'>"; if ($_REQUEST['action']) { echo "<input type='hidden' name='action' value='" . scrub_in($_REQUEST['action']) . "' />"; echo "<input type='hidden' name='catalogs[]' value='" . $this->id . "' />"; } echo "<input type='hidden' name='perform_ready' value='true' />"; echo "<input type='text' name='authcode' />"; echo "<input type='submit' value='Ok' />"; echo "</form>"; echo "<br />"; }
color: orange; } .Refunded { color: #6495ed; } </style> <!-- Foundation 6 CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/foundation/6.2.4/foundation.min.css"> <?php global $wpdb; $order_statuses = wc_get_order_statuses(); $current_path = get_current_path(); // source: functions.php $current_reader = $reader_paths[$current_path]; // Product ID - Cooresponds to reading service product. $product_id = $current_reader['product_id']; // Select all Orders for a Single Reading Product via order ID. $sql_query = "SELECT order_id " . "WHERE meta_key = '_product_id' AND meta_value = %d " . "GROUP BY order_id;"; $order_ids = $wpdb->get_col($wpdb->prepare($sql_query, $product_id)); //foreach( $order_ids as $order_id ) { // var_dump($order_id); //} if ($order_ids) { $args = array('post_type' => 'shop_order', 'post__in' => $order_ids, 'post_status' => 'publish', 'posts_per_page' => 2, 'order' => 'DESC', 'tax_query' => array(array('taxonomy' => 'shop_order_status', 'field' => 'slug', 'terms' => array($order_statuses)))); $orders = new WP_Query($args); } $reader_key = $current_reader['reader_key'];
<?php if (AmpConfig::get('geolocation')) { ?> <div class="stats_graph"> <?php $graph = new Graph(); $graph->display_map($user_id, $object_type, $object_id, $start_date, $end_date, $zoom); ?> </div> <?php } ?> <form action='<?php echo get_current_path(); ?> ' method='post' enctype='multipart/form-data'> <dl class="media_details"> <?php $rowparity = UI::flip_class(); ?> <dt class="<?php echo $rowparity; ?> "><?php echo T_('Start Date'); ?> </dt> <dd class="<?php echo $rowparity;
function guess_lib_url() { $relative = quotemeta(get_current_path()); $base_url = preg_replace("!" . $relative . "(.*)\$!", '', str_replace("\\", '/', $_SERVER['REQUEST_URI'])); return path_to_url($base_url); }
/** * Route all of the menus. */ function route() { global $theme; // Get the current active path. $current_path = get_current_path(); $permissions = new permissions(); $check_permissions = $permissions->check_perms(); // Setup some theme arguments. $error = false; $theme_args = array(); if ($check_permissions) { // Now use it to route visitors :). if (isset($current_path) && $current_path != 'index') { // We need to parse all of the url files. $urls = $this->parse_urls(); // Deal with wild cards in the URLs and return the active URL. $active_url = build_urls($urls); $current_path = $active_url['system']; // Now we parse the correct URL. // TODO: add some permission checks at some point. if (isset($urls[$current_path])) { // Now we need to get the callback. $callback = $urls[$current_path]['callback']; $callback_array = explode('.', $callback); // Check to see if we are calling a custom file. if (isset($urls[$current_path]['file'])) { include_once serum_get_path('module', $urls[$current_path]['module']) . '/' . $urls[$current_path]['file']; } // Now we call the module class and invoke the menu item. ${$callback_array[0]} = new $callback_array[0](); // Set the initial page title and description. tpl_set('page_title', $urls[$current_path]['title']); tpl_set('page_description', $urls[$current_path]['description']); // Make sure that method does exist. if (method_exists(${$callback_array[0]}, $callback_array[1])) { ${$callback_array[0]}->{$callback_array[1]}(); } else { // Otherwise just return a 404. four_oh_four(); $error = true; $tpl = 'erorr.tpl'; } } else { // Return a 404 error. $user->login(); $error = true; $tpl = 'error.tpl'; } } else { // If there is nothing in the menu we need to render the index page. $this->index(); } } else { // Return the login form. Silly me. $permissions->login_form(); $error = true; $tpl = 'login.tpl'; } if (!$error) { $theme_args = array('header' => true, 'footer' => true); } else { $theme_args = array('template' => $tpl); } // Render the theme. $theme->engine->render($theme_args); }
protected function showAuthToken() { $webAuth = $this->getWebAuth(); $authurl = $webAuth->start(); printf('<br />' . T_('Go to %s to generate the authorization code, then enter it bellow.') . '<br />', '<strong><a href="' . $authurl . '"target="_blank">' . $authurl . '</a></strong>'); echo "<form action='" . get_current_path() . "' method='post' enctype='multipart/form-data'>"; if ($_REQUEST['action']) { echo "<input type='hidden' name='action' value='" . scrub_in($_REQUEST['action']) . "' />"; echo "<input type='hidden' name='catalogs[]' value='" . $this->id . "' />"; } echo "<input type='hidden' name='perform_ready' value='true' />"; echo "<input type='text' name='authcode' /> "; echo "<input type='submit' value='Ok' />"; echo "</form>"; echo "<br />"; }