public function init($config) { if (!empty($config['ip'])) { $this->id = $config['ip']; } elseif (!empty($config['interface'])) { exec("ip addr sh " . escapeshellarg($config['interface']) . "|grep inet", $ips); if (!empty($ips[0]) && preg_match("/inet ([0-9a-f\\:\\.]+)/", $ips[0], $m)) { $this->id = $m[1]; } } if (empty($this->id)) { exec("ip addr sh|grep inet", $ips); if (!empty($ips[0]) && preg_match("/inet ([0-9a-f\\:\\.]+)/", $ips[0], $m)) { $this->id = $m[1]; } } if (!empty($config['keepalive']) && intval($config['keepalive']) > 3) { $this->_keepalive = intval($config['keepalive']); } if (!empty($config['deploy']) && is_array($config['deploy'])) { $this->_deploy = $config['deploy']; } if (!empty($config['skeleton']) && is_dir($config['skeleton'])) { $this->_skeleton = $config['skeleton']; } if (!empty($config['skeleton']) && is_dir($config['skeleton'])) { $this->_rsync = true; } $master = DS::field("id", self::$_table, "type='master' AND modifyd>CURRENT_TIMESTAMP-120"); $this->_master = strtolower(trim($this->id)) == strtolower(trim($master)); View::jslib("cluster.js", "pe.cluster.init();"); }
/** * Register Cookie Alert * * @param cfg configuration */ function init($cfg) { //load assets View::jslib("cookiealert.js", "pe.cookiealert.init(" . json_encode($cfg) . ");"); View::css("cookiealert.css"); return true; }
/** * Register MultiServer * * @param cfg not used */ public function init($cfg) { //! check whether we are enabled //if(empty($cfg['type'])) // return false; View::jslib("multiserver.js"); View::css("multiserver.css"); }
<?php /** * PHP Portal Engine v3.0.0 * https://github.com/bztsrc/phppe3/ * * Copyright LGPL 2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/spectrum/init.php * @author bzt * @date 23 May 2016 * @brief */ namespace PHPPE; View::css("spectrum.css"); View::jslib("spectrum.js");
/** * Controller event, called before view generated * * @param context */ function ctrl($ctx) { //! if we are on an editable page if (get_class(View::getval("app")) == "PHPPE\\Content") { //! clear the list of parameters $_SESSION['cms_param'] = []; //! save page url for cms/param action handler $_SESSION['cms_url'] = str_replace("/action", "", Core::$core->url); //! load javascript library View::jslib("cms.js", "pe.cms.init(" . intval(@$_SESSION['cms_scroll'][0]) . "," . intval(@$_SESSION['cms_scroll'][1]) . ");", 9); $_SESSION['cms_scroll'] = []; } else { View::jslib("cms.js", "", 9); } }
/** * PHP Portal Engine v3.0.0 * https://github.com/bztsrc/phppe3/ * * Copyright LGPL 2016 bzt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/bootstrap/init.php * @author bzt * @date 1 Jan 2016 * @brief Bootstrap integration in PHPPE */ namespace PHPPE; //load style sheests View::css("bootstrap.min.css"); View::css("bootstrap-theme.min.css"); //load JavaScript View::jslib("bootstrap.min.js", "", 1);
/** * PHP Portal Engine v3.0.0 * https://github.com/bztsrc/phppe3/ * * Copyright LGPL 2016 bzt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/Core/init.php * @author bzt * @date 1 Jan 2016 * @brief PHPPE Core */ namespace PHPPE; //! add JavaScript library to output with highest priority View::jslib("jquery.min.js", "", 0); foreach (["toc", "boolean", "resptable"] as $m) { View::jslib($m . ".js", "pe." . $m . ".init();"); }
* * Copyright LGPL 2016 bzt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * <http://www.gnu.org/licenses/> * * @file vendor/phppe/bootstrapcdn/init.php * @author bzt * @date 1 Jan 2016 * @brief Bootstrap CDN integration in PHPPE */ namespace PHPPE; if (!Core::isInst("bootstrap")) { //load style sheests View::css("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"); View::css("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"); //load JavaScript View::jslib("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js", "", 1); //register ourself as bootstrap too Core::lib("bootstrap", "PHPPE\\Extension"); }