/** * findNodeByUrl * * Recherche une URL identique ou similaire dans la base, * et retourne le noeud correspondant. * @author Frédéric Mossmann <*****@*****.**> */ public function findNodeByUrl($url) { // Simplification de l'URL à tester. $url_site = Welcome::simplifyUrl($url); // Initialisation des tests de similitude. $last_similar_text = 0; $last_levenshtein = 9999; $best_node = null; $best_similar_text_node = null; $best_levenshtein_node = null; // Recherche de toutes les URLs. //$url_dao = _dao("welcome|url"); $url_dao = _dao("kernel|kernel_limits_urls"); $url_list = $url_dao->findAll(); // Pour chaque URL... foreach ($url_list as $url_val) { //var_dump($url_val); // Simplifier l'URL $url_test = Welcome::simplifyUrl($url_val->url); // Tester l'exactitude. if ($url_site == $url_test) { return $url_val; } // Mesurer les similitudes. $test_similar_text = similar_text($url_site, $url_test); $test_levenshtein = levenshtein($url_site, $url_test); // Mémorisation si la similitude par "similar_text" est la meilleure. if ($test_similar_text >= $last_similar_text) { $last_similar_text = $test_similar_text; $best_similar_text_node = $url_val; } // Mémorisation si la similitude par "levenshtein" est la meilleure. if ($test_levenshtein <= $last_levenshtein) { $last_levenshtein = $test_levenshtein; $best_levenshtein_node = $url_val; } } // Si aucune URL n'est identique, et si il y a une URL // similaire par les deux algorithmes, on peut la retourner. if (isset($best_similar_text_node->url) && isset($best_levenshtein_node->url) && $best_similar_text_node->url == $best_levenshtein_node->url) { return $best_similar_text_node; } // Si vraiment rien ne colle, on ne retourne rien. return null; }
public static function work($ModuleName, $ControllerName, $ActionName) { // 模块名 $ModuleName = ucfirst($ModuleName); // 控制器名 $ControllerFileName = ucfirst(strtolower($ControllerName)) . "Controller"; // 操作方法名 $ActionName = $ActionName; // 模块目录 $modulePath = PRO_PATH . "/" . $ModuleName; if (is_dir($modulePath)) { // 检查是否默认控制与动作 if ($ControllerName == C("DEFAULT_CONTROLLER") and $ActionName == C("DEFAULT_METHOD")) { if (!is_file($defaultControllerFile = $modulePath . "/Controller/" . $ControllerFileName . EXTS)) { // 加载欢迎界面 Welcome::outputWelcomePage($ModuleName, $ControllerName, $ActionName); exit; } } // 实例化控制器 $ControllerHandle = new $ControllerFileName(); // 获取控制器所有操作方法 $allMethod = get_class_methods($ControllerHandle); // 检测是否开启路由大小写 $actionCaseSenstive = C("URL_CASE_INSENSITIVE"); if ($actionCaseSenstive) { if (false === array_search($ActionName, $allMethod, true)) { // 不存在操作方法,放回错误 trigger_error("不存在动作{$ActionName}", E_USER_ERROR); } } // 否则运行操作方法 call_user_func(array($ControllerHandle, $ActionName)); } else { trigger_error("不存在模块{$ModuleName}", E_USER_ERROR); } }
/** * Les limites de l'utilisateur, basees sur l'URL, sur un champ particulier ou toutes les infos * * @author Christophe Beyer <*****@*****.**> * @since 2009/09/24 * @param $pField string (option) Si on veut un champ particulier. Si null, on renvoit tous les champs * @return mixed Si pField=null, tout le recordset, sinon la valeur du champ (ou null si vide) */ public function getKernelLimits($pField = null) { _classInclude('welcome|welcome'); $null = _dao("kernel|kernel_limits_urls"); $cache_type = 'kernel_limits_urls'; $cache_id = CopixUrl::get(); if (0 && CopixCache::exists($cache_id, $cache_type)) { $node = CopixCache::read($cache_id, $cache_type); } else { $node = Welcome::findNodeByUrl($cache_id); if ($node != null) { if ($node->ville) { $node->ville_as_array = explode(',', $node->ville); } else { $node->ville_as_array = array(); } } //var_dump($node); CopixCache::write($cache_id, $node, $cache_type); } //var_dump($node); if ($pField && $node != null && $node->{$pField}) { $return = $node->{$pField}; } elseif ($pField) { $return = null; } else { $return = $node; } return $return; }
require_once "app/controllers/application_controller.php"; require_once "app/controllers/ringside_controller.php"; require_once "app/controllers/apps.php"; require_once "app/controllers/communities.php"; require_once "app/controllers/welcome.php"; // Automatically find controllers // spl_autoload_register('admin_autoload'); // function admin_autoload($class_name) // { // $_path = "app/controllers/" . strtolower($class_name) . '.php'; // if(file_exists($_path)) // require_once $_path; // } //require_once "app/controllers/welcome.php"; if (isset($_GET['apps'])) { $action = new Apps(); } elseif (isset($_GET['communities'])) { $action = new Communities(); } else { $action = new Welcome(); } Application_Controller::$controllers = array("Apps", "Communities", "Welcome"); //$action->setLocalClient( true ); //$user = $action->client->require_login(); $action->render(); ?> <br><br> <?php //print_r(Application_Controller::$controllers);
* This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ require_once __DIR__ . '/../../config/config.inc.php'; require_once __DIR__ . '/../../init.php'; require_once __DIR__ . '/welcome.php'; if (!isset($_POST['action'])) { throw new Exception('The action to call is not defined.'); } if (!isset($_POST['value'])) { throw new Exception('The value to set is not defined.'); } $onBoarding = new Welcome(); $onBoarding->apiCall($_POST['action'], $_POST['value']); echo '0';
<?php require 'view/dashboard/welcome.class.php'; $Welcome = new Welcome(); $var->module_output = $Welcome->dashboard($lang);
<tr> <th>QR Code</th> <th>Item</th> <th>Category</th> <th>Location</th> <th>Owner</th> </tr> </thead> <tbody> <?php foreach ($arrAllMissingItem As $missingItem) { $strUrl = '/items/view/' . $missingItem['itemid']; ?> <tr> <td><a href="<?php echo base_url($strUrl); ?>"><?php echo $missingItem['barcode']; ?></a></td> <td><?php echo Welcome::getItemManu($missingItem['item_manu'], $this->session->userdata('objSystemUser')->accountid); ?></td> <td><?php echo $missingItem['categoryname']; ?></td> <td><?php echo $missingItem['locationname']; ?></td> <td><?php echo $missingItem['firstname'] . " " . $missingItem['lastname']; ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> <!-- Missing Assets -->