public function test_getBasePath()
 {
     $result = getBasePath();
     $result = '/srcspace/www/devlogiks/tests/helpers/test_helpers_pathfuncs.php';
     $expected = '/srcspace/www/devlogiks/tests/helpers/test_helpers_pathfuncs.php';
     $this->assertEquals($expected, $result);
 }
示例#2
0
/**
 * Helper-Method for CLI logging.
 *
 * @param string $sMessage
 * @param string $sType
 */
function cliLog($sMessage, $sType = 'INFO')
{
    $sLog = '[' . date('Y-m-d H:i:s') . '] [' . str_pad($sType, 11, ' ', STR_PAD_BOTH) . '] ' . $sMessage . "\n";
    echo $sLog;
    file_put_contents(getBasePath() . 'cli.log', $sLog, FILE_APPEND);
    if ($sType == 'CRITICAL') {
        die("Exiting.\n");
    }
}
示例#3
0
 /**
  * getAssetUrl
  *
  * @param string $asset_route
  * @return string
  */
 function getAssetUrl($asset_route)
 {
     $filename = getcwd() . '/' . $asset_route;
     if (!file_exists($filename)) {
         return $asset_route;
     }
     $changed_date = filemtime($filename);
     return getBasePath() . $asset_route . '?q=' . $changed_date;
 }
示例#4
0
 public static function places()
 {
     $user = getenv('BACKEND_USER');
     $pass = getenv('BACKEND_PASS');
     if (http_login($user, $pass)) {
         $places = Place::where('confirmed', 1)->orderBy('id', 'desc')->get();
         Flight::view()->set("places", $places->toArray());
         Flight::view()->set("total_places", $places->count());
         Flight::view()->set("base_path", getBasePath());
         Flight::render('backend/places', array(), 'yield');
         Flight::render('backend/layout', array());
     }
 }
示例#5
0
 /**
  * 系统初始化函数,主要初始化smarty模板引擎,定义一些主要的全局模板路径
  * @param $c 控制器名称
  */
 public function _sys_init_action($c)
 {
     $this->smt = new Smarty();
     $this->smt->left_delimiter = "{";
     $this->smt->right_delimiter = "}";
     //模板目录,模板命名为方法名驼峰转下划线,再小写
     $tmpDir = APP_PATH . "/tpl/" . strtolower(toUnderLineName($c));
     //模板编译缓存目录
     $cmpDir = TEMP_PATH . "/tpl_c";
     $this->smt->setTemplateDir($tmpDir)->setCompileDir($cmpDir);
     //定义程序相对路径
     $this->smt->assign("myf_path", getBasePath());
     //定义程序绝对URL路径
     $this->smt->assign("myf_full_url", getFullURL());
     //定义程序根目录绝对URL路径
     $this->smt->assign("myf_project_url", getProjectURL());
 }
示例#6
0
 public static function edit_place($id)
 {
     $user = getenv('BACKEND_USER');
     $pass = getenv('BACKEND_PASS');
     if (http_login($user, $pass)) {
         $place = Place::find($id);
         Flight::view()->set("place_name", $place->name);
         Flight::view()->set("place_address", $place->address);
         Flight::view()->set("place_start_hour", $place->start_hour);
         Flight::view()->set("place_end_hour", $place->end_hour);
         Flight::view()->set("place_days", $place->days);
         Flight::view()->set("place_comments", $place->comments);
         Flight::view()->set("basepath", getBasePath());
         Flight::render('backend/places-edit', array(), 'yield');
         Flight::render('backend/layout', array());
     }
 }
示例#7
0
 /**
  * Sets up all commands that are available.
  */
 protected function _setupCommands()
 {
     require_once getBasePath() . 'core/Command.php';
     $aCommands = glob(getBasePath() . 'commands/*_Command.php');
     // Adding dynamic commands
     foreach ($aCommands as $sCommandClass) {
         require_once $sCommandClass;
         $sClassName = basename($sCommandClass, '.php');
         $this->addCommand($sClassName);
     }
     // Adding static commands
     $this->__aStaticCommands = parse_ini_file(getBasePath() . 'configs/static_commands.ini');
     if (count($this->__aStaticCommands)) {
         foreach ($this->__aStaticCommands as $sCommand => $sMessage) {
             $this->__aReadableCommands[] = '!' . $sCommand;
         }
     }
     cliLog("Available commands: " . implode(', ', $this->__aReadableCommands), 'SETUP');
 }
示例#8
0
文件: Home.php 项目: j0an/AcaSeDona
 public static function index()
 {
     $flash = (string) flash();
     if (!empty($flash)) {
         Flight::view()->set("flash", 'success');
     }
     Flight::view()->set("base_path", getBasePath());
     Flight::view()->set("url_website", getWebsiteUrl(false) . '/');
     Flight::view()->set("recaptcha_public", getenv('RECAPTCHA_PUBLIC'));
     Flight::view()->set("ga_code", getenv('GOOGLE_ANALYTICS'));
     // layout assets
     Flight::view()->set("asset_favicon", getAssetUrl("assets/images/favicon.png"));
     Flight::view()->set("asset_css", getAssetUrl("assets/css/app.css"));
     Flight::view()->set("asset_js_vendors", getAssetUrl("assets/js/vendors.js"));
     Flight::view()->set("asset_js", getAssetUrl("assets/js/app.js"));
     Flight::view()->set("asset_share_fb", getAssetUrl("assets/images/acasedona-fb.png"));
     Flight::view()->set("asset_share_tw", getAssetUrl("assets/images/acasedona-tw.png"));
     Flight::view()->set("asset_share_gp", getAssetUrl("assets/images/acasedona-fb.png"));
     Flight::render('flowics', array(), 'flowics');
     Flight::render('analytics', array(), 'analytics');
     Flight::render('header', array(), 'header');
     Flight::render('home', array(), 'yield');
     Flight::render('layout', array());
 }
示例#9
0
 * @author Andy Prevost
 * @copyright 2004 - 2009 Andy Prevost. All Rights Reserved.
 */
/* CONFIGURATION SETTINGS (note: trailing slashes on all paths and URLs) */
if (!$_SESSION) {
    session_start();
}
/* GENERAL & PATH SETTINGS */
$phpml['FromAddy'] = '*****@*****.**';
// Your email address
$phpml['FromName'] = 'Your Name';
// Your Full Name
// NOTE: You should not have to edit anything below here. If you do, make sure you know what you are doing.
$phpml['iProtocol'] = "http://";
// option is "https://";
$phpml['path_base'] = getBasePath();
// PHPMailer-ML (Mailing List) root path
$phpml['path_root'] = $_SERVER['DOCUMENT_ROOT'] . '/' . $phpml['path_base'];
$phpml['path_admin'] = $phpml['path_root'] . "/" . $_SESSION['acp'];
$phpml['url_root'] = $phpml['iProtocol'] . $_SERVER["HTTP_HOST"] . '/' . $phpml['path_base'];
$phpml['url_admin'] = $phpml['url_root'] . "/" . $_SESSION['acp'];
$phpml['PHPMailer_path'] = $phpml['path_admin'] . "/phpmailer";
// Path to PHPMailer class
$phpml['LangPref'] = 'en';
$phpml['ListName'] = 'PHPMailer-ML';
$phpml['ReturnPage'] = "index.php";
// default return page if HTTP_REFERER not found
$phpml['useBcc'] = false;
$phpml['EmailSend'] = true;
$phpml['adminBcc'] = true;
$phpml['progressmin'] = 25;
 public function actionUpload()
 {
     $uploaddir = getBasePath() . '/upload/importCsv/';
     $uploadfile = $uploaddir . basename($_FILES['myfile']['name']);
     $name_array = explode(".", $_FILES['myfile']['name']);
     $type = end($name_array);
     if ($type == "csv") {
         if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) {
             $importError = 0;
         } else {
             $importError = 1;
         }
     } else {
         $importError = 2;
     }
     // checking file with earlier imports
     $paramsArray = $this->checkOldFile($uploadfile);
     $delimiterFromFile = $paramsArray['delimiter'];
     $textDelimiterFromFile = $paramsArray['textDelimiter'];
     $tableFromFile = $paramsArray['table'];
     // view rendering
     $this->layout = 'clear';
     $this->render('firstResult', array('error' => $importError, 'uploadfile' => $uploadfile, 'delimiterFromFile' => $delimiterFromFile, 'textDelimiterFromFile' => $textDelimiterFromFile, 'tableFromFile' => $tableFromFile));
 }
示例#11
0
 /**
  * Parses configs/config.ini file and saves it to an array
  */
 public function __construct()
 {
     $this->__aConfig = parse_ini_file(getBasePath() . 'configs/config.ini', false, INI_SCANNER_NORMAL);
     cliLog("Configuration loaded from configs/config.ini", 'SETUP');
 }
示例#12
0
文件: install.php 项目: tillk/vufind
                        $userInputNeeded['multisiteMode'] = true;
                    }
                }
            }
        }
    }
    // Now that we've validated as many parameters as possible, retrieve
    // user input where needed.
    if (isset($userInputNeeded['overrideDir'])) {
        $overrideDir = getOverrideDir($overrideDir);
    }
    if (isset($userInputNeeded['module'])) {
        $module = getModule();
    }
    if (isset($userInputNeeded['basePath'])) {
        $basePath = getBasePath($basePath);
    }
    if (isset($userInputNeeded['multisiteMode'])) {
        $multisiteMode = getMultisiteMode();
    }
    // Load supplemental multisite parameters:
    if ($multisiteMode == MULTISITE_HOST_BASED) {
        if ($opts->getOption('hostname')) {
            $host = $opts->getOption('hostname');
        } else {
            if ($interactive) {
                $host = getHost();
            }
        }
    }
}
示例#13
0
        return $url;
    } else {
        echo $url;
    }
}
$themePath = getThemePath(true);
function getBasePath($return = false)
{
    $url = site_url();
    if ($return === true) {
        return $url;
    } else {
        echo $url;
    }
}
$basePath = getBasePath(true);
function getImagePath($return = false)
{
    $url = get_template_directory_uri() . '/dist/images';
    if ($return === true) {
        return $url;
    } else {
        echo $url;
    }
}
$imagePath = getImagePath(true);
function dist_url()
{
    $url = get_template_directory_uri() . '/dist';
    if ($return === true) {
        return $url;
示例#14
0
function loadFileContent($relativePath)
{
    return file_get_contents(getBasePath() . $relativePath);
}
示例#15
0
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">

<!-- IE stuff -->
<!--[if (lt IE 9)|(IE 9)]>
<link rel="stylesheet" href="<?php 
echo getThemePath();
?>
/dist/css/ie.css">
<![endif]-->

<link rel="pingback" href="<?php 
bloginfo('pingback_url');
?>
">
<link rel="shortcut icon" href="<?php 
echo getBasePath();
?>
/favicon.ico" rel="shortcut icon">

<script>
  (function(d) {
    var config = {
      kitId: 'gxo1ywi',
      scriptTimeout: 3000
    },
    h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
  })(document);
</script>

<?php 
wp_head();
示例#16
0
文件: functions.php 项目: Honvid/HCMS
/**
 * 获取项目基础绝对URL
 * @return string
 */
function getFullURL()
{
    $pageURL = 'http://';
    $sitePath = getBasePath();
    $host = $_SERVER["HTTP_HOST"];
    $port = $_SERVER["SERVER_PORT"];
    if ($port != "80") {
        $pageURL .= $host . $sitePath;
    } else {
        $pageURL .= str_replace(":80", "", $host) . $sitePath;
    }
    return $pageURL;
}
示例#17
0
<?php

/**
 * @link        https://github.com/Crease29/simple-twitch-bot
 * @author      Kai Neuwerth <github.com/Crease29>
 */
require_once dirname(__FILE__) . '/core/Helper.php';
require_once getBasePath() . 'core/Config.php';
require_once getBasePath() . 'core/DB.php';
require_once getBasePath() . 'core/IRCBot.php';
echo "\n";
$oConfig = Config::getInstance();
$oIRCBot = new IRCBot($oConfig->get('irc.server'), $oConfig->get('irc.port'), $oConfig->get('irc.nick'), explode(',', $oConfig->get('irc.channels')), $oConfig->get('irc.oauth'));
echo "\n\n";
示例#18
0
function importPaths($path = '')
{
    return getBasePath() . '/data/import/' . $path;
}
示例#19
0
/**
 * Get uploads base path
 * @return string
 */
function getUploadsPath()
{
    $path = getBasePath();
    if (getParam('uploads_dir')) {
        $path .= '/' . getParam('uploads_dir');
    }
    return $path;
}
示例#20
0
function redirectToEdit($message = null)
{
	global $cid;
	
	$u =& JFactory::getURI();
	$url = $u->toString();
	header('Location: ' . getBasePath($url) . '/administrator/index.php?option=com_modules&client=0&task=edit&cid[]=' . urlencode($cid) . '&message=' . urlencode($message));
}
示例#21
0
 /**
  * Initializes the bot's functions.
  */
 protected function _init()
 {
     require_once getBasePath() . 'core/Commander.php';
     $this->setCommander(new Commander());
     cliLog("Opening socket...", 'SETUP');
     $this->__fpSocket = fsockopen($this->getServer(), $this->getPort()) or cliLog("Unable to connect to {$this->getServer()}:{$this->getPort()}.", 'CRITICAL');
     cliLog("Logging in to server", 'SETUP');
     $this->login();
     cliLog("Joining channels: " . implode(', ', $this->getChannels()), 'SETUP');
     $this->joinChannels($this->getChannels());
 }