本文整理汇总了PHP中Plugin::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::all方法的具体用法?PHP Plugin::all怎么用?PHP Plugin::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$args = func_get_args();
$page = implode('/', $args);
$this->section = '/p/' . $page;
$data = $this->init_view_data();
$title = '';
/* Find Plugin matching page */
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
try {
// First plugin wins
$data['script'] = $plugin->getScript($page);
if (!empty($data['script'])) {
PluginData::setPluginId($plugin->getPluginId());
OpenVBX::$currentPlugin = $plugin;
$plugin_info = $plugin->getInfo();
$page_title = $plugin->getPluginPageName($page);
$title = !empty($page_title) ? $page_title : $plugin_info['name'];
break;
}
} catch (PluginException $e) {
error_log($e->getMessage());
$ci =& get_instance();
$ci->session->set_flashdata('error', $e->getMessage());
}
}
$this->respond($title, 'page/index', $data);
}
示例2: index
/**
* Display a listing of the resource.
* GET /overview
*
* @return Response
*/
public function index()
{
//check applications for high or medium risk
$overview = DB::table('applications')->join('application_version', 'applications.id', '=', 'application_version.application_id')->join('versions', 'application_version.version_id', '=', 'versions.id')->select('applications.name', 'applications.id', 'applications.url', 'versions.risk')->where('versions.risk', '>', '1')->paginate('5');
//make view and return it to the user
return View::make('admin.overview')->with(['totalapps' => Application::all()->count(), 'totalplugins' => Plugin::all()->count(), 'overview' => $overview]);
}
示例3: _ratatoeskr
function _ratatoeskr()
{
global $backend_subactions, $ste, $url_handlers, $ratatoeskr_settings, $plugin_objs, $api_compat;
$ts_start = microtime(True);
session_start();
db_connect();
clean_database();
if (isset($ratatoeskr_settings["debugmode"]) and $ratatoeskr_settings["debugmode"]) {
define("__DEBUG__", True);
}
if (PLUGINS_ENABLED) {
$activeplugins = array_filter(Plugin::all(), function ($plugin) {
return $plugin->active;
});
foreach ($activeplugins as $plugin) {
if (!in_array($plugin->api, $api_compat)) {
$plugin->active = False;
$plugin->save();
continue;
}
eval($plugin->code);
$plugin_obj = new $plugin->classname($plugin->get_id());
if ($plugin->update) {
$plugin_obj->update();
$plugin->update = False;
$plugin->save();
}
$plugin_obj->init();
$plugin_objs[$plugin->get_id()] = $plugin_obj;
}
}
/* Register URL handlers */
build_backend_subactions();
register_url_handler("_default", "frontend_url_handler");
register_url_handler("_index", "frontend_url_handler");
register_url_handler("index", "frontend_url_handler");
register_url_handler("backend", $backend_subactions);
register_url_handler("_notfound", url_action_simple(function ($data) {
global $ste;
header("HTTP/1.1 404 Not Found");
$ste->vars["title"] = "404 Not Found";
$ste->vars["details"] = str_replace("[[URL]]", $_SERVER["REQUEST_URI"], isset($translation) ? $translation["e404_details"] : "The page [[URL]] could not be found. Sorry.");
echo $ste->exectemplate("/systemtemplates/error.html");
}));
$urlpath = explode("/", @$_GET["action"]);
$rel_path_to_root = implode("/", array_merge(array("."), array_repeat("..", count($urlpath) - 1)));
$GLOBALS["rel_path_to_root"] = $rel_path_to_root;
$data = array("rel_path_to_root" => $rel_path_to_root);
$ste->vars["rel_path_to_root"] = $rel_path_to_root;
url_process($urlpath, $url_handlers, $data);
if (PLUGINS_ENABLED) {
foreach ($plugin_objs as $plugin_obj) {
$plugin_obj->atexit();
}
}
$ratatoeskr_settings->save();
}
示例4: run
public function run()
{
$faker = Faker::create();
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
foreach (range(1, rand(2, 10)) as $index) {
Version::create(['name' => $faker->randomFloat(2, 0, 9), 'risk' => rand(0, 3), 'plugin_id' => $plugin->id]);
}
}
}
示例5: index
public function index()
{
$currentSchemaVersion = OpenVBX::schemaVersion();
$upgradingToSchemaVersion = OpenVBX::getLatestSchemaVersion();
if ($currentSchemaVersion == $upgradingToSchemaVersion) {
redirect('/');
}
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
$data['plugins'][] = $plugin->getInfo();
}
$this->load->view('upgrade/main', $data);
}
示例6: index
public function index()
{
$args = func_get_args();
$hook = implode('/', $args);
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
// First plugin wins
$data['script'] = $plugin->getHookScript($hook);
if (!empty($data['script'])) {
// include the script
define("HOOK", true);
require $data['script'];
return;
}
}
redirect('');
}
示例7: index
public function index()
{
$currentSchemaVersion = OpenVBX::schemaVersion();
$upgradingToSchemaVersion = OpenVBX::getLatestSchemaVersion();
if ($currentSchemaVersion == $upgradingToSchemaVersion) {
redirect('/');
}
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
$data['plugins'][] = $plugin->getInfo();
}
$data['php_version_min'] = MIN_PHP_VERSION;
$data['php_version'] = phpversion();
if (!version_compare($data['php_version'], $data['php_version_min'], '>=')) {
$data['error'] = '<p>Your server doesn\'t meet the minimum PHP requirements necessary to run this version of OpenVBX.</p>' . '<p>PHP version required: ' . $data['php_version_min'] . '<br />' . 'PHP version installed: ' . $data['php_version'] . '</p>' . '<p>Installation will not be allowed to continue</p>';
}
$this->load->view('upgrade/main', $data);
}
示例8: index
public function index()
{
$currentSchemaVersion = OpenVBX::schemaVersion();
$upgradingToSchemaVersion = OpenVBX::getLatestSchemaVersion();
if ($currentSchemaVersion == $upgradingToSchemaVersion) {
redirect('/');
}
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
$data['plugins'][] = $plugin->getInfo();
}
$data['php_version_min'] = MIN_PHP_VERSION;
$data['php_version'] = phpversion();
if (!version_compare($data['php_version'], $data['php_version_min'], '>=')) {
$data['error'] = $this->load->view('upgrade/min-php-req-notice', $data, true);
}
$this->load->view('upgrade/main', $data);
}
示例9: index
public function index($page)
{
$this->section = '/p/' . $page;
$data = $this->init_view_data();
/* Find Plugin matching page */
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
try {
// First plugin wins
$data['script'] = $plugin->getScript($page);
if (!empty($data['script'])) {
PluginData::setPluginId($plugin->getPluginId());
OpenVBX::$currentPlugin = $plugin;
break;
}
} catch (PluginException $e) {
error_log($e->getMessage());
$ci =& get_instance();
$ci->session->set_flashdata('error', $e->getMessage());
}
}
$this->respond('', 'page/index', $data);
}
示例10: get_site
private function get_site()
{
$this->template->add_js('assets/j/settings.js');
$data = $this->init_view_data();
$current_settings = $this->get_current_settings();
$data = array_merge($data, $current_settings);
$data['tenant_mode'] = self::MODE_SINGLE;
if ($this->tenant->name == 'default') {
$data['tenant_mode'] = self::MODE_MULTI;
$data['tenants'] = $this->settings->get_all_tenants();
} else {
// allow tenants to see the rewrite setting
$data['rewrite_enabled'] = array('value' => intval($this->settings->get('rewrite_enabled', VBX_PARENT_TENANT)));
}
$data['available_themes'] = $this->vbx_theme->get_all();
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
$data['plugins'][] = $plugin->getInfo();
}
$data['error'] = $this->session->flashdata('error');
$data['json']['settings'] = $current_settings;
$this->respond('Site Settings', 'settings/site', $data);
}
示例11: time
echo "DESC";
}
?>
">Plugin</a></td>
<td class="box head version">Vers.</div>
<td class="box head updated"><a href="?order=moddate&sort=<?php
if ($sort == "DESC") {
echo "ASC";
} else {
echo "DESC";
}
?>
">Updated</a></div>
</tr>
<?php
$plugins = Plugin::all(false, LEVEL_DEV, "{$order} {$sort}");
$now = time();
$i = 0;
foreach ($plugins as $plugin) {
$moddate_unix = strtotime($plugin->modDate);
$odd = $i % 2 == 1 ? 'odd' : '';
$image_url = $plugin->image_url();
if (!$image_url) {
$image_url = "images/plugins/default.png";
}
$plugin_url = "https://qs0.qsapp.com/plugins/download.php?id=" . $plugin->identifier . "&version=" . $plugin->version;
?>
<tr>
<td class="box name <?php
echo $odd;
?>
示例12: get_navigation
protected function get_navigation($logged_in, $is_admin)
{
$nav = array();
$nav['util_links'] = array();
try {
$plugins = Plugin::all();
} catch (PluginException $e) {
$plugins = array();
/* TODO: Properly notify user of malfunction of plugin */
}
$plugin_links = array();
foreach ($plugins as $plugin) {
try {
$plugin_links = array_merge_recursive($plugin_links, $plugin->getLinks());
} catch (PluginException $e) {
error_log($e->getMessage());
$ci =& get_instance();
$ci->session->set_flashdata('error', 'Failed to fetch link information: ' . $e->getMessage());
}
}
if (!empty($plugin_links['plugin_menus'])) {
$nav['plugin_menus'] = $plugin_links['plugin_menus'];
}
if ($logged_in) {
$nav['util_links'] = array('account' => 'My Account', 'auth/logout' => 'Log Out');
if (!empty($plugin_links['util_links'])) {
$nav['util_links'] = array_merge($nav['util_links'], $plugin_links['util_links']);
}
$nav['setup_links'] = array();
$nav['setup_links'] = array('devices' => 'Devices', 'voicemail' => 'Voicemail');
if (!empty($plugin_links['setup_links'])) {
$nav['setup_links'] = array_merge($nav['setup_links'], $plugin_links['setup_links']);
}
$nav['log_links'] = array();
$nav['admin_links'] = array();
$nav['site_admin_links'] = array();
if ($is_admin) {
$nav['log_links'] = array();
if (!empty($plugin_links['log_links'])) {
$nav['log_links'] = array_merge($nav['log_links'], $plugin_links['log_links']);
}
$nav['admin_links'] = array('flows' => 'Flows', 'numbers' => 'Numbers', 'accounts' => 'Users', 'settings/site' => 'Settings');
/* Support plugins that used site_admin */
if (!empty($plugin_links['site_admin_links'])) {
$nav['admin_links'] = array_merge($nav['admin_links'], $plugin_links['site_admin_links']);
}
/* Include plugins that refer to 'admin' menu */
if (!empty($plugin_links['admin_links'])) {
$nav['admin_links'] = array_merge($nav['admin_links'], $plugin_links['admin_links']);
}
}
}
return $nav;
}
示例13: get_site
private function get_site()
{
$this->template->add_js('assets/j/settings.js');
$data = $this->init_view_data();
$current_settings = $this->get_current_settings();
// insert the server's default time zone in the event none is saved
if (empty($current_settings['server_time_zone'])) {
$current_settings['server_time_zone'] = array('id' => null, 'value' => date_default_timezone_get());
}
$current_settings['cache_enabled'] = $this->cache->enabled();
$current_settings['api_cache_enabled'] = $this->api_cache->enabled();
$data = array_merge($data, $current_settings);
$data['tenant_mode'] = self::MODE_SINGLE;
$data['openvbx_version'] = OpenVBX::version();
// determine wether we can successfully use the GitHub api library
// to check our current tag against available tags. See ::can_check_upgrade()
// for a full explanation.
// @todo - find a more graceful way around this
// @todo - notify admin that checks can't be made?
$data['check_upgrade'] = $this->can_check_upgrade();
if ($this->tenant->name == 'default') {
$data['tenant_mode'] = self::MODE_MULTI;
$data['tenants'] = $this->settings->get_all_tenants();
if ($data['check_upgrade']) {
$data['latest_version'] = $this->get_latest_tag();
if (version_compare($data['openvbx_version'], $data['latest_version'], '<')) {
$data['upgrade_notice'] = true;
}
}
}
// allow tenants to see the rewrite setting
$data['rewrite_enabled'] = array('value' => intval($this->settings->get('rewrite_enabled', VBX_PARENT_TENANT)));
if ($this->db->dbdriver == 'mysqli') {
$mysql_version = $this->db->conn_id->server_info;
} else {
$mysql_version = mysql_get_server_info($this->db->conn_id);
}
$data['server_info'] = array('system_version' => php_uname(), 'php_version' => phpversion(), 'php_sapi' => php_sapi_name(), 'mysql_version' => $mysql_version, 'mysql_driver' => $this->db->dbdriver, 'apache_version' => $_SERVER['SERVER_SOFTWARE'], 'current_url' => site_url($this->uri->uri_string()) . ' (' . $_SERVER['SERVER_ADDR'] . ')');
$data['available_themes'] = $this->get_available_themes();
// get plugin data
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
$data['plugins'][] = $plugin->getInfo();
}
$data['error'] = $this->session->flashdata('error');
$data['json']['settings'] = $current_settings;
// build list of time zones
$tzs = timezone_identifiers_list();
$data['time_zones'] = array_combine($tzs, $tzs);
// makes keys & values match
// get list of available countries
$this->load->model('vbx_incoming_numbers');
$data['countries'] = array();
try {
if ($countrydata = $this->vbx_incoming_numbers->get_available_countries()) {
foreach ($countrydata as $country) {
$data['countries'][$country->country_code] = $country->country;
}
}
} catch (VBX_IncomingNumberException $e) {
$data['error'] = 'Unable to fetch available countries: ';
switch ($e->getCode()) {
case 0:
$data['error'] .= 'Authentication failed.';
break;
default:
$data['error'] .= $e->getMessage();
}
}
// load language codes for text-to-speech
$this->config->load('langcodes');
$data['lang_codes'] = $this->config->item('lang_codes');
// verify Client Application data
$data['client_application_error'] = false;
$account = OpenVBX::getAccount();
$application = $account->applications->get($data['application_sid']['value']);
if (!empty($data['application_sid']['value'])) {
try {
// only way to be sure on these is to pull them in to variables, ugh...
$application_sid = $application->sid;
$application_voice_url = $application->voice_url;
$application_voice_fallback_url = $application->voice_fallback_url;
if (strlen($application_sid) == 0) {
// application missing
$data['client_application_error'] = 2;
} elseif (strlen($application_voice_url) == 0 || strlen($application_voice_fallback_url) == 0) {
// urls are missing
$data['client_application_error'] = 3;
} elseif ($application_voice_url != site_url('/twiml/dial') || $application_voice_fallback_url != asset_url('fallback/voice.php')) {
// url mismatch
$data['client_application_error'] = 4;
}
} catch (Exception $e) {
$data['client_application_error'] = 5;
$data['error'] = 'Could not validate Client Application data: ' . $e->getMessage();
$data['client_application_error_message'] = $e->getMessage();
log_message($e->getMessage());
}
} else {
$data['client_application_error'] = 1;
//.........这里部分代码省略.........
示例14: get_site
private function get_site()
{
$this->template->add_js('assets/j/settings.js');
$data = $this->init_view_data();
$current_settings = $this->get_current_settings();
$data = array_merge($data, $current_settings);
$data['tenant_mode'] = self::MODE_SINGLE;
if ($this->tenant->name == 'default') {
$data['tenant_mode'] = self::MODE_MULTI;
$data['tenants'] = $this->settings->get_all_tenants();
} else {
// allow tenants to see the rewrite setting
$data['rewrite_enabled'] = array('value' => intval($this->settings->get('rewrite_enabled', VBX_PARENT_TENANT)));
}
if ($this->db->dbdriver == 'mysqli') {
$mysql_version = $this->db->conn_id->server_info;
} else {
$mysql_version = mysql_get_server_info($this->db->conn_id);
}
$data['server_info'] = array('system_version' => php_uname(), 'php_version' => phpversion(), 'php_sapi' => php_sapi_name(), 'mysql_version' => $mysql_version, 'mysql_driver' => $this->db->dbdriver, 'apache_version' => $_SERVER['SERVER_SOFTWARE'], 'current_url' => site_url($this->uri->uri_string()) . ' (' . $_SERVER['SERVER_ADDR'] . ')');
$data['available_themes'] = $this->get_available_themes();
$plugins = Plugin::all();
foreach ($plugins as $plugin) {
$data['plugins'][] = $plugin->getInfo();
}
$data['error'] = $this->session->flashdata('error');
$data['json']['settings'] = $current_settings;
$this->load->model('vbx_incoming_numbers');
$data['countries'] = array();
if ($countrydata = $this->vbx_incoming_numbers->get_available_countries()) {
foreach ($countrydata as $country) {
$data['countries'][$country->country_code] = $country->country;
}
}
// verify Client Application data
$data['client_application_error'] = false;
$account = OpenVBX::getAccount();
$application = $account->applications->get($data['application_sid']['value']);
if (!empty($data['application_sid']['value'])) {
try {
if (strlen($application->sid) == 0) {
// application missing
$data['client_application_error'] = 2;
} elseif (strlen($application->voice_url) == 0 || strlen($application->voice_fallback_url) == 0) {
// urls are missing
$data['client_application_error'] = 3;
} elseif ($application->voice_url != site_url('/twiml/dial') || $application->voice_fallback_url != asset_url('fallback/voice.php')) {
// url mismatch
$data['client_application_error'] = 4;
}
} catch (Exception $e) {
// @todo show relevant exception data as error
$data['error'] = 'Could not validate Client Application data: ' . $e->getMessage();
log_message($e->getMessage());
}
} else {
$data['client_application_error'] = 1;
}
$data['client_application'] = $application;
$this->respond('Site Settings', 'settings/site', $data);
}
示例15: build_backend_subactions
function build_backend_subactions()
{
global $backend_subactions, $pluginpages_handlers;
$backend_subactions = url_action_subactions(array("_index" => url_action_alias(array("login")), "index" => url_action_alias(array("login")), "_prelude" => function (&$data, $url_now, &$url_next) {
global $ratatoeskr_settings, $admin_grp, $ste, $languages;
if ($admin_grp === NULL) {
$admin_grp = Group::by_name("admins");
}
$ste->vars["all_languages"] = array();
$ste->vars["all_langcodes"] = array();
foreach ($languages as $code => $data) {
$ste->vars["all_languages"][$code] = $data["language"];
$ste->vars["all_langcodes"][] = $code;
}
ksort($ste->vars["all_languages"]);
sort($ste->vars["all_langcodes"]);
/* Check authentification */
if (isset($_SESSION["ratatoeskr_uid"])) {
try {
$user = User::by_id($_SESSION["ratatoeskr_uid"]);
if ($user->pwhash == $_SESSION["ratatoeskr_pwhash"] and $user->member_of($admin_grp)) {
if (empty($user->language)) {
$user->language = $ratatoeskr_settings["default_language"];
$user->save();
}
load_language($user->language);
if ($url_next[0] == "login") {
$url_next = array("content", "write");
}
$data["user"] = $user;
$ste->vars["user"] = array("id" => $user->get_id(), "name" => $user->username, "lang" => $user->language);
return;
/* Authentification successful, continue */
} else {
unset($_SESSION["ratatoeskr_uid"]);
}
} catch (DoesNotExistError $e) {
unset($_SESSION["ratatoeskr_uid"]);
}
}
load_language();
/* If we are here, user is not logged in... */
$url_next = array("login");
}, "login" => url_action_simple(function ($data) {
global $ste, $admin_grp;
if (!empty($_POST["user"])) {
try {
$user = User::by_name($_POST["user"]);
if (!PasswordHash::validate($_POST["password"], $user->pwhash)) {
throw new Exception();
}
if (!$user->member_of($admin_grp)) {
throw new Exception();
}
/* Login successful. */
$_SESSION["ratatoeskr_uid"] = $user->get_id();
$_SESSION["ratatoeskr_pwhash"] = $user->pwhash;
load_language($user->language);
$data["user"] = $user;
$ste->vars["user"] = array("id" => $user->get_id(), "name" => $user->username, "lang" => $user->language);
} catch (Exception $e) {
$ste->vars["login_failed"] = True;
}
if (isset($data["user"])) {
throw new Redirect(array("content", "write"));
}
}
echo $ste->exectemplate("/systemtemplates/backend_login.html");
}), "logout" => url_action_simple(function ($data) {
unset($_SESSION["ratatoeskr_uid"]);
unset($_SESSION["ratatoeskr_pwhash"]);
load_language();
throw new Redirect(array("login"));
}), "content" => url_action_subactions(array("write" => function (&$data, $url_now, &$url_next) {
global $ste, $translation, $textprocessors, $ratatoeskr_settings, $languages, $articleeditor_plugins;
list($article, $editlang) = array_slice($url_next, 0);
if (!isset($editlang)) {
$editlang = $data["user"]->language;
}
if (isset($article)) {
$ste->vars["article_editurl"] = urlencode($article) . "/" . urlencode($editlang);
} else {
$ste->vars["article_editurl"] = "";
}
$url_next = array();
$default_section = Section::by_id($ratatoeskr_settings["default_section"]);
$ste->vars["section"] = "content";
$ste->vars["submenu"] = isset($article) ? "articles" : "newarticle";
$ste->vars["textprocessors"] = array();
foreach ($textprocessors as $txtproc => $properties) {
if ($properties[1]) {
$ste->vars["textprocessors"][] = $txtproc;
}
}
$ste->vars["sections"] = array();
foreach (Section::all() as $section) {
$ste->vars["sections"][] = $section->name;
}
$ste->vars["article_section"] = $default_section->name;
/* Check Form */
//.........这里部分代码省略.........