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


PHP Reg::set方法代碼示例

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


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

示例1: _runBounceBack

 /**
  * Run's the set bounceback.
  * 
  * @access private
  * @final
  * @return boolean true if the check returns true and boolean false if not
  */
 private final function _runBounceBack()
 {
     // call hook
     Hook::call('Controller.runBounceBack.before', array(&$this->bounceback));
     if (isset($this->bounceback['check']) && method_exists($this->bounceback['check'][0], $this->bounceback['check'][1]) && (isset($this->bounceback['bounce']) && method_exists($this->bounceback['bounce'][0], $this->bounceback['bounce'][1])) && !$this->_viewExists(array("name" => $this->viewToLoad, "checkmethod" => true))) {
         $keys = array_keys(Reg::get('URI.working'));
         $values = array_values(Reg::get('URI.working'));
         $controllerPos = array_search('controller', $keys);
         if ($controllerPos === false) {
             $controllerPos = 0;
         }
         $this->params = array_combine($keys, array_slice(array_merge(array_slice($values, 0, $controllerPos + 1), array($this->bounceback['bounce'][1]), array_slice($values, $controllerPos + 1)), 0, count($keys)));
         Reg::set('Param', $this->params);
         $this->viewToLoad = Config::uriToMethod($this->params['view']);
         if ($this->_viewExists(array("name" => $this->viewToLoad, "checkmethod" => true)) !== true) {
             $return = false;
         } else {
             if (is_callable($this->bounceback['check']) && call_user_func($this->bounceback['check']) === false) {
                 $return = false;
             } else {
                 $return = true;
             }
         }
     } else {
         $return = false;
     }
     // call hook
     Hook::call('Controller.runBounceBack.after', array(&$return));
     return $return;
 }
開發者ID:kidaa30,項目名稱:Evergreen-1,代碼行數:37,代碼來源:controller.class.php

示例2: array

<?php

/* System Setup */
Reg::set("System.mode", "development");
/* URI Setup */
Reg::set(array("URI.useModRewrite" => true, "URI.useDashes" => true, "URI.forceDashes" => true));
Reg::set(array("URI.map" => array("controller" => "main", "view" => "index", "action" => null, "id" => null)));
/* Errors Setup */
Reg::set("Error.generalErrorMessage", "An error occured. Please contact the administrator.");
/* Database Setup */
Reg::set("Database.host", "localhost");
Reg::set("Database.username", "");
Reg::set("Database.password", "");
Reg::set("Database.database", "");
Reg::set("Database.driver", "MySQL");
/* Cache */
Reg::set(array('Cache.enabled' => true, 'Cache.path' => Reg::get('Path.physical') . '/cache', 'Cache.expires' => 3600));
開發者ID:kidaa30,項目名稱:Evergreen-1,代碼行數:17,代碼來源:config.php

示例3: function

$app['conf'] = function () {
    return Art\Config::getInstance();
};
$app['user'] = function () {
    return new Art\User();
};
class Reg
{
    private static $reg = array();
    public static function set($key, $value)
    {
        self::$reg[$key] = $value;
    }
    public static function get($key)
    {
        return self::$reg[$key];
    }
}
Reg::set('app', $app);
Reg::set('seo', $app['conf']->getOptions('seo'));
require_once ROOT . '/vendor/AR/ActiveRecord.php';
ActiveRecord\Config::initialize(function ($cfg) use($app) {
    $cfg->set_model_directory(ROOT . '/model');
    $cfg->set_connections(array('production' => $app['conf']->getOption('db', 'dsn')));
    $cfg->set_default_connection('production');
});
require_once ROOT . '/vendor/Art/OpenPlayer.php';
$vkconf = $app['conf']->getOptions('vk');
$max = count($vkconf['email']) - 1;
$rkey = rand(0, $max);
$app['openplayer'] = new OpenPlayer\Core($vkconf['email'][$rkey], $vkconf['pass'][$rkey], $vkconf['appId'], $vkconf['uagent']);
開發者ID:nyaa11,項目名稱:oplayer,代碼行數:31,代碼來源:services.php

示例4: loadURL

 /**
  * Loads the url for the error. If the url points to a page inside the framework the function attempts to load it and handles any errors
  * or issues associated such as loading in a default error. If the url points to a page outside the framework then header location is set
  * and execution is stopped.
  * 
  * @access public
  * @static
  * @final
  * @param string|array $url The url that should be loaded can be the url or an array in the URI.map format
  */
 public function loadURL($url)
 {
     // call hook
     Hook::call('Exception.loadURL.before', array(&$url));
     if (!empty($url)) {
         if (!is_array($url) && preg_match("/^(http:|https:|ftp:|ftps:)/im", $url)) {
             // call hook
             Hook::call('Exception.loadURL.redirect', array(&$url));
             header('Location: ' . $url);
             header('Connection: close');
             exit;
         }
         if (is_array($url)) {
             $url = '/' . implode('/', array_merge(Reg::get("URI.map"), $url));
         }
         $url = str_replace(Reg::get('Path.root'), "", $url);
         $_SERVER['REQUEST_URI'] = $url;
         Reg::set("URI.working", $url);
         Reg::del("Branch.name");
         Config::processURI();
         $load['name'] = Config::uriToClass(Reg::get("URI.working.controller"));
         if (Reg::hasVal("Branch.name")) {
             $load['branch'] = Config::uriToClass(Reg::get("Branch.name"));
         }
         $load['type'] = 'Controller';
         $load = implode('_', $load);
         $controller = new $load();
         if (!is_object($controller)) {
             if (!file_exists(Reg::get("System.defaultError404"))) {
                 include Reg::get("System.defaultError404");
             } else {
                 echo Reg::get("System.defaultError404");
             }
         } else {
             try {
                 // call hook
                 Hook::call('Exception.loadURL.controller', array(&$controller));
                 $controller->_showView();
             } catch (EvergreenException $e) {
                 var_dump($e);
                 exit;
                 if (Reg::get("System.mode") == "development") {
                     if (isset(self::$params['code'])) {
                         $code = self::$params['code'];
                     }
                     // call hook
                     Hook::call('Exception.loadURL.default', array(&$url, &$code));
                     switch ($code) {
                         case 'GEN':
                             if (file_exists(Reg::get("System.defaultErrorGEN"))) {
                                 include Reg::get("System.defaultErrorGEN");
                             } else {
                                 echo Reg::get("System.defaultErrorGEN");
                             }
                             break;
                         case 'DB':
                             if (file_exists(Reg::get("System.defaultErrorDB"))) {
                                 include Reg::get("System.defaultErrorDB");
                             } else {
                                 echo Reg::get("System.defaultErrorDB");
                             }
                             break;
                         default:
                             if (file_exists(Reg::get("System.defaultErrorGEN"))) {
                                 include Reg::get("System.defaultErrorGEN");
                             } else {
                                 echo Reg::get("System.defaultErrorGEN");
                             }
                             break;
                     }
                 }
             }
         }
     } else {
         if (file_exists(Reg::get("System.defaultErrorGEN"))) {
             include Reg::get("System.defaultErrorGEN");
         } else {
             echo Reg::get("System.defaultErrorGEN");
         }
     }
 }
開發者ID:kidaa30,項目名稱:Evergreen-1,代碼行數:91,代碼來源:evergreen.exception.class.php

示例5: checkBackupTasks

function checkBackupTasks()
{
    $maxTime = time() - 60 * 60;
    //60 mins before.
    $data = DB::getArray("?:history", "siteID,historyID,microtimeInitiated", "microtimeInitiated >= " . $maxTime . " AND recheck = 0 AND \r\n\t(\r\n\t\t(type = 'backup' AND action = 'now') OR \r\n\t\t(type = 'scheduleBackup' AND action = 'runTask') OR \r\n\t\t(type = 'installClone' AND action = 'installCloneBackupNow')\r\n\t)\r\n\tAND \r\n\t(\r\n\t\t(status = 'netError' AND error IN('28', '52', '500', '502', '504', 'timeoutClear')) OR\r\n\t\t(status = 'error' AND error IN('main_plugin_connection_error'))\r\n\t)\r\n\t");
    // time and task == 'neterror', verifying check == 0 //28 => curl error: operation timeout, 52 => curl error: empty reply form server
    $checkTill = 35 * 60;
    //35 mins each 5 min interval
    if (!empty($data)) {
        foreach ($data as $key => $value) {
            $siteIDs = array();
            $siteIDs[] = $value['siteID'];
            $balanceTime = $value['microtimeInitiated'] + $checkTill - time();
            $addTime = 0;
            do {
                $actionID = uniqid('', true);
                Reg::set('currentRequest.actionID', $actionID);
                $params['timeScheduled'] = time() + $addTime;
                $params['status'] = 'scheduled';
                //$siteIDs = array($siteID);
                $extras = array('sendAfterAllLoad' => false, 'doNotShowUser' => true);
                manageClientsFetch::getStatsProcessor($siteIDs, $params, $extras);
                $balanceTime -= 5 * 60;
                $addTime += 5 * 60;
            } while ($balanceTime > 0);
            DB::update("?:history", array('recheck' => '1'), "historyID =" . $value['historyID']);
        }
    }
    return;
}
開發者ID:Trideon,項目名稱:gigolo,代碼行數:30,代碼來源:appFunctions.php

示例6: backupResponseProcessor

 public static function backupResponseProcessor($historyID, $responseData)
 {
     responseDirectErrorHandler($historyID, $responseData);
     if (empty($responseData['success'])) {
         return false;
     }
     $historyData = DB::getRow("?:history", "*", "historyID='" . $historyID . "'");
     $siteID = $historyData['siteID'];
     if (!empty($responseData['success']['error']) && is_string($responseData['success']['error'])) {
         DB::update("?:history_additional_data", array('status' => 'error', 'errorMsg' => $responseData['success']['error'], 'error' => $responseData['success']['error_code']), "historyID=" . $historyID);
         return false;
     } else {
         if ($historyData['type'] == 'backup' && $historyData['action'] == 'multiCallNow') {
             $historyResponseStatus[$historyID] = "multiCallWaiting";
             Reg::set("historyResponseStatus", $historyResponseStatus);
             updateHistory(array('status' => "multiCallWaiting"), $historyID);
             self::triggerRecheck($responseData, $siteID);
         } else {
             DB::update("?:history_additional_data", array('status' => 'success'), "historyID='" . $historyID . "'");
             //---------------------------post process------------------------>
             $siteID = DB::getField("?:history", "siteID", "historyID='" . $historyID . "'");
             $allParams = array('action' => 'getStats', 'args' => array('siteIDs' => array($siteID), 'extras' => array('sendAfterAllLoad' => false, 'doNotShowUser' => true)));
             panelRequestManager::handler($allParams);
         }
     }
 }
開發者ID:Trideon,項目名稱:gigolo,代碼行數:26,代碼來源:manageClientsBackup.php

示例7: runOffBrowserLoad

 public static function runOffBrowserLoad($params)
 {
     if (Reg::get('settings.executeUsingBrowser') != 1) {
         //using fsock
         callURLAsync(APP_URL . EXECUTE_FILE, array('runOffBrowserLoad' => 'true'));
     } elseif (Reg::get('settings.executeUsingBrowser') == 1) {
         Reg::set('currentRequest.runOffBrowserLoad', 'true');
     }
 }
開發者ID:Trideon,項目名稱:gigolo,代碼行數:9,代碼來源:panelRequestManager.php

示例8: checkRoutes

 /**
  * Check's the current uri for a route match and reprocesses the uri if there is a match.
  * 
  * @access private
  * @static
  * @param string $request_uri The current uri with the base uri excluded
  * @return boolean true if a route was found and boolean false if not
  */
 private static function checkRoutes($request_uri)
 {
     if (is_array(self::$routes)) {
         foreach (self::$routes as $route) {
             $generatedRegex = self::createRouteRegex($route['definition']);
             $destination = $route['destination'];
             if (preg_match($generatedRegex['regex'], $request_uri, $matches)) {
                 array_shift($matches);
                 $combinedMatches = array_combine(array_pad((array) $generatedRegex['definedPositions'], count($matches), 'wildcard'), array_pad((array) $matches, count($generatedRegex['definedPositions']), null));
                 foreach ($combinedMatches as $key => $match) {
                     if (in_array($match, $generatedRegex['definedPositions'])) {
                         unset($combinedMatches[$key]);
                     }
                 }
                 // Validate named positions
                 if (!empty($route['validation'])) {
                     foreach ($route['validation'] as $name => $regex) {
                         //$regex = preg_quote($regex, '/');
                         if ($combinedMatches[$name] == NULL && isset($destination[$name])) {
                             continue;
                         }
                         if (array_key_exists($name, $combinedMatches) && !preg_match('/^' . $regex . '$/i', $combinedMatches[$name])) {
                             return false;
                         }
                     }
                 }
                 // Check if the route is trying to load from main
                 if (isset($destination['branch']) && $destination['branch'] == Reg::get('System.rootIdentifier')) {
                     unset($destination['branch']);
                 }
                 // Check if routing to a branch, unset it from the destination, and load in the branch config
                 if (!empty($destination['branch'])) {
                     $branch = $destination['branch'];
                     unset($destination['branch']);
                     if (self::isBranch($branch)) {
                         self::loadBranchConfig($branch);
                     }
                 }
                 // Check if there is a wildcard match in the regex
                 $wildcard_matches = null;
                 if (!empty($combinedMatches['wildcard'])) {
                     $wildcard_matches = explode("/", $combinedMatches['wildcard']);
                     unset($combinedMatches['wildcard']);
                 }
                 // Clean up Null's from matches so that defaults aren't overridden
                 foreach ($combinedMatches as $key => $value) {
                     if ($value == NULL) {
                         unset($combinedMatches[$key]);
                     }
                 }
                 // Build the new URI array that has been defined by the route
                 $newURI = array_merge((array) array('branch' => $branch), (array) Reg::get("URI.map"), (array) $destination, (array) $combinedMatches);
                 // Loop through the URI and handle empty positions
                 foreach ($newURI as $key => &$value) {
                     if (is_array($value) && count($value) > 1) {
                         $value = reset($value);
                     }
                     if (empty($value) && count($wildcard_matches)) {
                         $newURI[$key] = array_shift($wildcard_matches);
                     }
                 }
                 // Check if there are remaining wildcard matches that havent filled empty positions and append them to the URI
                 if (isset($wildcard_matches) && count($wildcard_matches)) {
                     $newURI[] = implode("/", $wildcard_matches);
                 }
                 // Build the final URI that will be used
                 $newURI = rtrim("/" . implode("/", (array) $newURI), '/');
                 // Setup the needed configuration settings and re-process the URI
                 Reg::set("Route.current", array_merge($route, array("newWorkingURI" => $newURI)));
                 Reg::set("URI.working", $newURI);
                 self::processURI();
                 return true;
             }
         }
     }
     return false;
 }
開發者ID:kidaa30,項目名稱:Evergreen-1,代碼行數:85,代碼來源:config.class.php

示例9: parse_url

    }
} else {
    @date_default_timezone_set($getTimeZone);
}
//session
$cookiePath = parse_url(APP_URL, PHP_URL_PATH);
//@session_set_cookie_params(0, $cookiePath);
//@session_start();
//To prevent SQL Injection
$_REQUEST_ORIGINAL = $_REQUEST;
$_GET_ORIGINAL = $_GET;
$_POST_ORIGINAL = $_POST;
$_REQUEST = filterParameters($_REQUEST);
$_GET = filterParameters($_GET);
$_POST = filterParameters($_POST);
include_once APP_ROOT . "/controllers/processManager.php";
Reg::set('dateFormatLong', 'M d, Y @ h:ia');
Reg::set('dateFormatYearLess', 'M d @ h:ia');
clearUncompletedTask();
checkTriggerStatus();
checkBackupTasks();
checkUserLoggedInAndRedirect();
defineAppFullURL();
if (!defined('FORCED_AJAX_CALL_MIN_INTERVAL')) {
    define('FORCED_AJAX_CALL_MIN_INTERVAL', 1);
}
//need user id for checkUserLoggedInAndRedirect() so this code move top to here
if (!defined('UPDATE_PAGE')) {
    //addons //reason why it is not used in update page(update process page) is if those addons are loaded, in update process it include the latest file to run particular addon's update process by including its class, which results in fatal error of class already exists.
    loadActiveAddons();
}
開發者ID:Trideon,項目名稱:gigolo,代碼行數:31,代碼來源:app.php

示例10: array

    }, array('proximity' => 5, 'next_message' => 'Вперед', 'previous_message' => 'Назад'));
    $similar = array();
    if (!strpos($q, " ")) {
        $lastfmdata = Art\LastFM::request($app['conf'], "artist.getSimilar", array("limit" => 10, "artist" => $q));
        if (isset($lastfmdata->similarartists)) {
            $similar = $lastfmdata->similarartists->artist;
        }
    }
    Reg::set('q', $q);
    return $app['view']->render('layout.phtml', 'search/list.phtml', array('res' => $pagerfanta, 'pagination' => $pagination, 'q' => $q, 'similar' => $similar));
});
$app->get('/track/{vkid}', function (Request $request, $vkid) use($app) {
    $vtrack = $app['openplayer']->audioGetById($vkid)->audio;
    $seo = Reg::get('seo');
    $seo['title'] = "Слушать {$vtrack->artist} - {$vtrack->title} онлайн.";
    Reg::set('seo', $seo);
    $track = (array) $vtrack;
    $track['vkid'] = "{$vtrack->owner_id}_{$vtrack->aid}";
    return $app['view']->render('layout.phtml', 'part/track.phtml', array('track' => $track));
});
$app->get('/getlyrics', function (Request $request) use($app) {
    $text = nl2br($app['openplayer']->audioGetLyrics($request->get('lyricsId')));
    return new Response($text);
});
$app->get('/getsong/{vkid}', function (Request $request, $vkid) use($app) {
    session_write_close();
    $vkTrack = $app['openplayer']->getTrack($vkid);
    header("Content-Length: {$vkTrack['size']}");
    if ($request->get('dl')) {
        header('Last-Modified:');
        header('ETag:');
開發者ID:nyaa11,項目名稱:oplayer,代碼行數:31,代碼來源:search.php

示例11:

<?php

Reg::set("Branch.active", true);
Reg::set("Branch.requiredSystemMode", "development");
Reg::set("Branch.minimumSystemVersion", "1.0");
開發者ID:kidaa30,項目名稱:Evergreen-1,代碼行數:5,代碼來源:config.php


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