本文整理汇总了PHP中Plugin::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::where方法的具体用法?PHP Plugin::where怎么用?PHP Plugin::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_deactivate
public function plugin_deactivate($slug)
{
$plugin_data = Plugins::get_plugin($slug);
$plugin = Plugin::where('slug', '=', $slug)->first();
$plugin->active = 0;
$plugin->save();
return Redirect::to('admin?section=plugins')->with(array('note' => 'Successfully De-activated ' . $plugin_data['name'], 'note_type' => 'success'));
}
示例2: Plugin
function save_data()
{
if (class_exists('Plugin')) {
$p = new Plugin();
$p->where('path', $this->get_key())->get();
$p->data = serialize((array) $this->get_data());
$p->save();
} else {
return false;
}
}
示例3: index
function index()
{
if (!$this->auth) {
$this->error('401', 'Not authorized to perform this action.');
return;
}
list($params, $id) = $this->parse_params(func_get_args());
$plugins = $this->parse_plugins();
$db_config = Shutter::get_db_configuration();
switch ($this->method) {
case 'delete':
$p = new Plugin();
$p->where('id', $id)->get();
if ($p->exists()) {
$p->run_plugin_method('after_uninstall', $plugins);
$plugin = $p->init($plugins);
if ($plugin->database_fields) {
$this->load->dbforge();
foreach ($plugin->database_fields as $table => $fields) {
$table = $db_config['prefix'] . $table;
foreach ($fields as $column => $info) {
$this->dbforge->drop_column($table, $column);
}
}
$this->_clear_datamapper_cache();
}
$p->delete();
}
$this->_compile_plugins();
exit;
break;
case 'post':
$p = new Plugin();
$p->path = $_POST['path'];
$p->setup = $p->run_plugin_method('require_setup', $plugins) === false;
if ($p->save()) {
$plugin = $p->init($plugins);
if ($plugin->database_fields) {
$this->load->dbforge();
foreach ($plugin->database_fields as $table => $fields) {
$table = $db_config['prefix'] . $table;
foreach ($fields as $column => $info) {
$this->dbforge->add_column($table, array($column => $info));
}
}
$this->_clear_datamapper_cache();
}
$p->run_plugin_method('after_install', $plugins);
}
$this->_compile_plugins();
$this->redirect('/plugins');
break;
case 'put':
unset($_POST['_method']);
$data = serialize($_POST);
$p = new Plugin();
$p->where('id', $id)->get();
$p->save_data($plugins, $_POST);
$validate = $p->run_plugin_method('confirm_setup', $plugins, $data);
if ($validate === true) {
$p->setup = 1;
$p->save();
$this->_compile_plugins();
exit;
} else {
$this->error(400, $validate);
return;
}
break;
default:
$data = array('plugins' => $plugins);
function sortByName($a, $b)
{
return $a['name'] > $b['name'];
}
usort($data['plugins'], 'sortByName');
$data['plugins'] = Shutter::filter('api.plugins', array($data['plugins']));
$data['custom_sources'] = Shutter::$custom_sources;
$this->set_response_data($data);
break;
}
}
示例4:
<table class="table plugins">
<thead>
<tr>
<th>Plugin Name</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($plugins_available as $plugin)
<?php
$this_plugin = Plugin::where('slug', '=', $plugin['slug'])->first();
?>
<tr>
<td><h2 style="margin-bottom:0px; padding-bottom:0px;">{{ $plugin['name'] }} <span style="font-size:14px;">V.{{ $plugin['version'] }}</span></h2>
<small>{{ $plugin['description'] }}</small>
</td>
@if(!empty($this_plugin->active) && $this_plugin->active == 1)
<td><p>Active</p></td>
<td><a href="plugin/deactivate/{{ $plugin['slug'] }}" class="btn btn-danger" style="display:inline; float:left; margin-right:10px;">De-activate</a><a href="plugin/{{ $plugin['slug'] }}" class="btn btn-success ajax" data-header="<i class='ion ion-outlet'></i> Plugin Settings" data-section="plugins"><i class="fa fa-cog"></i></a></td>
@else
<td><p>Inactive</p></td>
<td><a href="plugin/activate/{{ $plugin['slug'] }}" class="btn btn-primary">Activate</a></td>
@endif</p></td>
</tr>
@endforeach
示例5: plugin
function plugin()
{
if ($this->method !== 'post') {
$this->error('403', 'Forbidden');
return;
}
$local = $this->input->post('local_path');
$guid = $this->input->post('guid');
$install_id = $this->input->post('uuid');
$purchase = $this->input->post('purchase');
$is_new = $this->input->post('new');
$plugin_id = $this->input->post('id');
$base = FCPATH . 'storage' . DIRECTORY_SEPARATOR;
$tmp_path = $base . 'tmp';
$remote = KOKEN_STORE_URL . '/plugins/download/' . $guid . '/for/' . $install_id . ($purchase ? '/' . $purchase : '');
$local_zip = $tmp_path . DIRECTORY_SEPARATOR . 'update.zip';
$updated_theme = $tmp_path . DIRECTORY_SEPARATOR . $guid;
$current_path = $base . $local;
if (is_dir("{$current_path}.off")) {
delete_files("{$current_path}.off", true, 1);
}
if (is_dir("{$current_path}/.git")) {
delete_files("{$current_path}/.git", true, 1);
}
make_child_dir($tmp_path);
$success = false;
$old_mask = umask(0);
if (ENVIRONMENT === 'development' && !$is_new) {
$success = true;
sleep(3);
} else {
if ($this->_download($remote, $local_zip)) {
$this->load->library('unzip');
$this->unzip->extract($local_zip);
if (file_exists($updated_theme . DIRECTORY_SEPARATOR . 'info.json') || file_exists($updated_theme . DIRECTORY_SEPARATOR . 'pulse.json') || file_exists($updated_theme . DIRECTORY_SEPARATOR . 'plugin.json')) {
if ($is_new || rename($current_path, "{$current_path}.off")) {
if (rename($updated_theme, $current_path)) {
// Hack for watermark update issue. Can removed this eventually (0.15.1 was when this was implemented)
if (file_exists("{$current_path}.off/image.png")) {
copy("{$current_path}.off/image.png", "{$current_path}/storage/image.png");
}
// /Hack
// Copy storage folder to ensure userland files survive update
if (is_dir("{$current_path}.off/storage")) {
delete_files("{$current_path}/storage", true, 1);
rename("{$current_path}.off/storage", "{$current_path}/storage");
}
delete_files("{$current_path}.off", true, 1);
$success = true;
if (file_exists($current_path . DIRECTORY_SEPARATOR . 'info.json')) {
$json = $current_path . DIRECTORY_SEPARATOR . 'info.json';
} else {
if (file_exists($current_path . DIRECTORY_SEPARATOR . 'pulse.json')) {
$json = $current_path . DIRECTORY_SEPARATOR . 'pulse.json';
} else {
$json = $current_path . DIRECTORY_SEPARATOR . 'plugin.json';
}
}
$json = json_decode(file_get_contents($json, true));
} else {
$json = 'Could not rename folder.';
}
} else {
$json = 'Could not rename old version before upgrading';
}
} else {
$json = 'Could not download plugin ZIP.';
}
unlink($local_zip);
delete_files($updated_theme, true, 1);
}
}
umask($old_mask);
if ($plugin_id) {
$p = new Plugin();
$p->where('id', $plugin_id)->get();
if ($p->exists()) {
$plugins = $this->parse_plugins();
$plugin = $p->init($plugins);
if ($plugin->database_fields) {
$db_config = Shutter::get_db_configuration();
$this->load->dbforge();
foreach ($plugin->database_fields as $table => $fields) {
$table = $db_config['prefix'] . $table;
foreach ($fields as $column => $info) {
if (in_array(strtolower($info['type']), array('text', 'varchar', 'longtext'))) {
$info['null'] = true;
}
$this->dbforge->add_column($table, array($column => $info));
}
}
$this->_clear_datamapper_cache();
}
$p->run_plugin_method('after_upgrade', $plugins);
}
}
$this->_compile_plugins();
die(json_encode(array('done' => $success, 'info' => isset($json) ? $json : array())));
}
示例6: foreach
return Redirect::to('/');
}
if (Cookie::get('theme')) {
Config::set('site.theme', Cookie::get('theme'));
} else {
if ($settings->theme) {
Config::set('site.theme', $settings->theme);
}
}
View::addNamespace('Theme', 'content/themes/' . Config::get('site.theme'));
$theme_functions = 'content/themes/' . Config::get('site.theme') . '/functions.php';
if (file_exists($theme_functions)) {
include $theme_functions;
}
if (Config::get('database.connections.mysql.host') != '') {
$plugins = Plugin::where('active', '=', 1)->get();
//print_r($plugins); die();
foreach ($plugins as $plugin) {
$plugin_name = $plugin->slug;
$include_file = 'content/plugins/' . $plugin_name . '/functions.php';
// Create Settings Route for Plugin
Route::group(array('before' => 'admin'), function () {
Route::get('admin/plugin/{plugin_name}', function ($plugin_name) {
$data = array('plugin_data' => PluginData::where('plugin_slug', '=', $plugin_name)->get());
return View::make('plugins.' . $plugin_name . '.index', $data);
});
Route::post('admin/plugin/{plugin_name}', function ($plugin_name) {
$input = Input::all();
foreach ($input as $key => $value) {
$pluginData = PluginData::where('plugin_slug', '=', $plugin_name)->where('key', '=', $key)->first();
if (!empty($pluginData->id)) {