public static function basepath($path = null) { if (!is_null($path)) { self::$basepath = self::sanitize($path); } return self::$basepath; }
/** * Setup path related constants * * @author Jonathan Davis * @since 1.3 * * @return void **/ public function paths() { // This should only run once if (defined('SHOPP_PATH')) { return; } $filepath = dirname(ShoppLoader::basepath()) . "/Shopp.php"; $path = sanitize_path(dirname($filepath)); $file = basename($filepath); $directory = basename($path); // Paths define('SHOPP_PATH', $path); define('SHOPP_DIR', $directory); define('SHOPP_PLUGINFILE', "{$directory}/{$file}"); define('SHOPP_PLUGINURI', set_url_scheme(plugins_url() . "/{$directory}")); define('SHOPP_ADMIN_DIR', '/core/ui'); define('SHOPP_ADMIN_PATH', SHOPP_PATH . SHOPP_ADMIN_DIR); define('SHOPP_ADMIN_URI', SHOPP_PLUGINURI . SHOPP_ADMIN_DIR); define('SHOPP_ICONS_URI', SHOPP_ADMIN_URI . '/icons'); define('SHOPP_FLOW_PATH', SHOPP_PATH . '/core/flow'); define('SHOPP_MODEL_PATH', SHOPP_PATH . '/core/model'); define('SHOPP_GATEWAYS', SHOPP_PATH . '/gateways'); define('SHOPP_SHIPPING', SHOPP_PATH . '/shipping'); define('SHOPP_STORAGE', SHOPP_PATH . '/storage'); define('SHOPP_THEME_APIS', SHOPP_PATH . '/api/theme'); // @deprecated define('SHOPP_DBSCHEMA', SHOPP_PATH . '/core/schema/schema.sql'); }
public function add($handle, $src, $deps = array(), $ver = false, $args = null) { $debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG; // Determine if we are debugging the scripts if (isset($_GET['debug']) && 1 == $_GET['debug']) { $debug = true; } $extension = '.js'; // Use .js extension for script files $suffix = '.min'; // Use .min for suffix $minsrc = str_replace($extension, $suffix . $extension, $src); // Add the suffix when not debugging and the suffix isn't already used (the file is not available unminified) if (!$debug && false === strpos($src, $suffix . $extension) && file_exists(ShoppLoader::basepath() . $minsrc)) { $src = $minsrc; } return parent::add($handle, $src, $deps, $ver, $args); }
if (!defined('WPINC')) { define('WPINC', 'wp-includes'); } date_default_timezone_set('UTC'); } $ShoppScripts = new ShoppScripts(); shopp_default_scripts($ShoppScripts); $compress = isset($_GET['c']) && $_GET['c']; $force_gzip = $compress && 'gzip' == $_GET['c']; $expires_offset = 31536000; $out = ''; foreach ($load as $handle) { if (!isset($ShoppScripts->registered[$handle])) { continue; } $path = ShoppLoader::basepath() . $ShoppScripts->registered[$handle]->src; $out .= get_file($path) . "\n"; } header('Content-Type: application/x-javascript; charset=UTF-8'); header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $expires_offset) . ' GMT'); header("Cache-Control: public, max-age={$expires_offset}"); if ($compress && !ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler')) { header('Vary: Accept-Encoding'); // Handle proxies if (false !== strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && !$force_gzip) { header('Content-Encoding: deflate'); $out = gzdeflate($out, 3); } elseif (false !== strpos(strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode')) { header('Content-Encoding: gzip'); $out = gzencode($out, 3); }
require "{$path}/core/library/Loader.php"; } // Barebones bootstrap (say that 5x fast) for WordPress if (!defined('ABSPATH') && ($loadfile = ShoppLoader::find_wpload())) { require $loadfile; global $table_prefix; } // Stub i18n for compatibility if (!function_exists('__')) { // Localization API is not available at this point function __($string, $domain = false) { return $string; } } ShoppDeveloperAPI::load(dirname(ShoppLoader::basepath()), array('core', 'settings')); // Start the server new ImageServer(); exit; /** * ImageServer class * * @author Jonathan Davis * @since 1.1 * @package image **/ class ImageServer { static $prettyurls = '{^/.+?/images/(\\d+)/.*$}'; private $caching = true; // Set to false to force off image caching