repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/checkboxbutton.blade.php | resources/views/form/checkboxbutton.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($column) ?: 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}" id="{{$id}}">
@include('admin::form.error')
<div class="btn-group checkbox-group-toggle">
@foreach($options as $option => $label)
<label class="btn btn-default {{ false !== array_search($option, array_filter(old($column, $value ?? []))) || ($value === null && in_array($option, $checked)) ?'active':'' }}">
<input type="checkbox" name="{{$name}}[]" value="{{$option}}" class="hide {{$class}}" {{ false !== array_search($option, array_filter(old($column, $value ?? []))) || ($value === null && in_array($option, $checked)) ?'checked':'' }} {!! $attributes !!} /> {{$label}}
</label>
@endforeach
</div>
<input type="hidden" name="{{$name}}[]">
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/map.blade.php | resources/views/form/map.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id['lat']}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div id="map_{{$id['lat'].$id['lng']}}" style="width: 100%;height: 300px"></div>
<input type="hidden" id="{{$id['lat']}}" name="{{$name['lat']}}" value="{{ old($column['lat'], $value['lat']) }}" {!! $attributes !!} />
<input type="hidden" id="{{$id['lng']}}" name="{{$name['lng']}}" value="{{ old($column['lng'], $value['lng']) }}" {!! $attributes !!} />
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/radiobutton.blade.php | resources/views/form/radiobutton.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div class="btn-group radio-group-toggle">
@foreach($options as $option => $label)
<label class="btn btn-default {{ ($option == old($column, $value)) || ($value === null && in_array($label, $checked)) ?'active':'' }}">
<input type="radio" name="{{$name}}" value="{{$option}}" class="hide minimal {{$class}}" {{ ($option == old($column, $value)) || ($value === null && in_array($label, $checked)) ?'checked':'' }} {!! $attributes !!} /> {{$label}}
</label>
@endforeach
</div>
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/radiocard.blade.php | resources/views/form/radiocard.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div class="card-group radio-group-toggle">
@foreach($options as $option => $label)
<label class="panel panel-default {{ ($option == old($column, $value)) || ($value === null && in_array($label, $checked)) ?'active':'' }}">
<div class="panel-body">
<input type="radio" name="{{$name}}" value="{{$option}}" class="hide minimal {{$class}}" {{ ($option == old($column, $value)) || ($value === null && in_array($label, $checked)) ?'checked':'' }} {!! $attributes !!} /> {{$label}}
</div>
</label>
@endforeach
</div>
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/hasmany.blade.php | resources/views/form/hasmany.blade.php |
<div class="row">
<div class="{{$viewClass['label']}}"><h4 class="pull-right">{{ $label }}</h4></div>
<div class="{{$viewClass['field']}}"></div>
</div>
<hr style="margin-top: 0px;">
<div id="has-many-{{$column}}" class="has-many-{{$column}}">
<div class="has-many-{{$column}}-forms">
@foreach($forms as $pk => $form)
<div class="has-many-{{$column}}-form fields-group">
@foreach($form->fields() as $field)
{!! $field->render() !!}
@endforeach
@if($options['allowDelete'])
<div class="form-group">
<label class="{{$viewClass['label']}} control-label"></label>
<div class="{{$viewClass['field']}}">
<div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash"> </i>{{ trans('admin.remove') }}</div>
</div>
</div>
@endif
<hr>
</div>
@endforeach
</div>
<template class="{{$column}}-tpl">
<div class="has-many-{{$column}}-form fields-group">
{!! $template !!}
<div class="form-group">
<label class="{{$viewClass['label']}} control-label"></label>
<div class="{{$viewClass['field']}}">
<div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash"></i> {{ trans('admin.remove') }}</div>
</div>
</div>
<hr>
</div>
</template>
@if($options['allowCreate'])
<div class="form-group">
<label class="{{$viewClass['label']}} control-label"></label>
<div class="{{$viewClass['field']}}">
<div class="add btn btn-success btn-sm"><i class="fa fa-save"></i> {{ trans('admin.new') }}</div>
</div>
</div>
@endif
</div> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/slider.blade.php | resources/views/form/slider.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<input type="text" class="{{$class}}" name="{{$name}}" data-from="{{ old($column, $value) }}" {!! $attributes !!} />
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/keyvalue.blade.php | resources/views/form/keyvalue.blade.php | <div class="{{$viewClass['form-group']}}">
<label class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
<table class="table table-hover">
<thead>
<tr>
<th>{{ __('Key') }}</th>
<th>{{ __('Value') }}</th>
<th style="width: 75px;"></th>
</tr>
</thead>
<tbody class="kv-{{$column}}-table">
@foreach(old("{$column}.keys", ($value ?: [])) as $k => $v)
@php($keysErrorKey = "{$column}.keys.{$loop->index}")
@php($valsErrorKey = "{$column}.values.{$loop->index}")
<tr>
<td>
<div class="form-group {{ $errors->has($keysErrorKey) ? 'has-error' : '' }}">
<div class="col-sm-12">
<input name="{{ $name }}[keys][]" value="{{ old("{$column}.keys.{$k}", $k) }}" class="form-control" required/>
@if($errors->has($keysErrorKey))
@foreach($errors->get($keysErrorKey) as $message)
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
@endforeach
@endif
</div>
</div>
</td>
<td>
<div class="form-group {{ $errors->has($valsErrorKey) ? 'has-error' : '' }}">
<div class="col-sm-12">
<input name="{{ $name }}[values][]" value="{{ old("{$column}.values.{$k}", $v) }}" class="form-control" />
@if($errors->has($valsErrorKey))
@foreach($errors->get($valsErrorKey) as $message)
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
@endforeach
@endif
</div>
</div>
</td>
<td class="form-group">
<div>
<div class="{{$column}}-remove btn btn-warning btn-sm pull-right">
<i class="fa fa-trash"> </i>{{ __('admin.remove') }}
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td>
<div class="{{ $column }}-add btn btn-success btn-sm pull-right">
<i class="fa fa-save"></i> {{ __('admin.new') }}
</div>
</td>
</tr>
</tfoot>
</table>
</div>
<template class="{{$column}}-tpl">
<tr>
<td>
<div class="form-group ">
<div class="col-sm-12">
<input name="{{ $name }}[keys][]" class="form-control" required/>
</div>
</div>
</td>
<td>
<div class="form-group ">
<div class="col-sm-12">
<input name="{{ $name }}[values][]" class="form-control" />
</div>
</div>
</td>
<td class="form-group">
<div>
<div class="{{$column}}-remove btn btn-warning btn-sm pull-right">
<i class="fa fa-trash"> </i>{{ __('admin.remove') }}
</div>
</div>
</td>
</tr>
</template>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/editor.blade.php | resources/views/form/editor.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<textarea class="form-control {{$class}}" id="{{$id}}" name="{{$name}}" placeholder="{{ $placeholder }}" {!! $attributes !!} >{{ old($column, $value) }}</textarea>
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/hasmanytab.blade.php | resources/views/form/hasmanytab.blade.php | <style>
.nav-tabs > li:hover > i{
display: inline;
}
.close-tab {
position: absolute;
font-size: 10px;
top: 2px;
right: 5px;
color: #94A6B0;
cursor: pointer;
display: none;
}
</style>
<div id="has-many-{{$column}}" class="nav-tabs-custom has-many-{{$column}}">
<div class="row header">
<div class="col-md-2 {{$viewClass['label']}}"><h4 class="pull-right">{{ $label }}</h4></div>
<div class="col-md-8 {{$viewClass['field']}}">
<button type="button" class="btn btn-default btn-sm add"><i class="fa fa-plus-circle" style="font-size: large;"></i></button>
</div>
</div>
<hr style="margin-top: 0px;">
<ul class="nav nav-tabs">
@foreach($forms as $pk => $form)
<li class="@if ($form == reset($forms)) active @endif ">
<a href="#{{ $relationName . '_' . $pk }}" data-toggle="tab">
{{ $pk }} <i class="fa fa-exclamation-circle text-red hide"></i>
</a>
<i class="close-tab fa fa-times" ></i>
</li>
@endforeach
</ul>
<div class="tab-content has-many-{{$column}}-forms">
@foreach($forms as $pk => $form)
<div class="tab-pane fields-group has-many-{{$column}}-form @if ($form == reset($forms)) active @endif" id="{{ $relationName . '_' . $pk }}">
@foreach($form->fields() as $field)
{!! $field->render() !!}
@endforeach
</div>
@endforeach
</div>
<template class="nav-tab-tpl">
<li class="new">
<a href="#{{ $relationName . '_new_' . \Encore\Admin\Form\NestedForm::DEFAULT_KEY_NAME }}" data-toggle="tab">
New {{ \Encore\Admin\Form\NestedForm::DEFAULT_KEY_NAME }} <i class="fa fa-exclamation-circle text-red hide"></i>
</a>
<i class="close-tab fa fa-times" ></i>
</li>
</template>
<template class="pane-tpl">
<div class="tab-pane fields-group new" id="{{ $relationName . '_new_' . \Encore\Admin\Form\NestedForm::DEFAULT_KEY_NAME }}">
{!! $template !!}
</div>
</template>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/hidden.blade.php | resources/views/form/hidden.blade.php | <input type="hidden" name="{{$name}}" value="{{$value}}" class="{{$class}}" {!! $attributes !!} />
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/footer.blade.php | resources/views/form/footer.blade.php | <div class="box-footer">
{{ csrf_field() }}
<div class="col-md-{{$width['label']}}">
</div>
<div class="col-md-{{$width['field']}}">
@if(in_array('submit', $buttons))
<div class="btn-group pull-right">
<button type="submit" class="btn btn-primary">{{ trans('admin.submit') }}</button>
</div>
@foreach($submit_redirects as $value => $redirect)
@if(in_array($redirect, $checkboxes))
<label class="pull-right" style="margin: 5px 10px 0 0;">
<input type="checkbox" class="after-submit" name="after-save" value="{{ $value }}" {{ ($default_check == $redirect) ? 'checked' : '' }}> {{ trans("admin.{$redirect}") }}
</label>
@endif
@endforeach
@endif
@if(in_array('reset', $buttons))
<div class="btn-group pull-left">
<button type="reset" class="btn btn-warning">{{ trans('admin.reset') }}</button>
</div>
@endif
</div>
</div> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/datetimerange.blade.php | resources/views/form/datetimerange.blade.php | <div class="{{$viewClass['form-group']}} {!! ($errors->has($errorKey['start']) || $errors->has($errorKey['end'])) ? 'has-error' : '' !!}">
<label for="{{$id['start']}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
<div class="row">
<div class="col-lg-12">
@if($errors->has($errorKey['start']))
@foreach($errors->get($errorKey['start']) as $message)
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
@endforeach
@endif
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text"
name="{{$name['start']}}"
value="{{ old($column['start'], $value['start'] ?? null) }}"
class="form-control {{$class['start']}}"
style="width: 160px"
autocomplete="off"
{!! $attributes !!}
/>
</div>
</div>
</div>
<div class="row" style="margin-top: 5px">
<div class="col-lg-12">
@if($errors->has($errorKey['end']))
@foreach($errors->get($errorKey['end']) as $message)
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
@endforeach
@endif
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text"
name="{{$name['end']}}"
value="{{ old($column['end'], $value['end'] ?? null) }}"
class="form-control {{$class['end']}}"
style="width: 160px"
autocomplete="off"
{!! $attributes !!}
/>
</div>
</div>
</div>
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/embeds.blade.php | resources/views/form/embeds.blade.php |
<div class="row">
<div class="{{$viewClass['label']}}"><h4 class="pull-right">{{ $label }}</h4></div>
<div class="{{$viewClass['field']}}"></div>
</div>
<hr style="margin-top: 0px;">
<div id="embed-{{$column}}" class="embed-{{$column}}">
<div class="embed-{{$column}}-forms">
<div class="embed-{{$column}}-form fields-group">
@foreach($form->fields() as $field)
{!! $field->render() !!}
@endforeach
</div>
</div>
</div>
<hr style="margin-top: 0px;"> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/input.blade.php | resources/views/form/input.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div class="input-group">
@if ($prepend)
<span class="input-group-addon">{!! $prepend !!}</span>
@endif
<input {!! $attributes !!} />
@if ($append)
<span class="input-group-addon clearfix">{!! $append !!}</span>
@endif
@isset($btn)
<span class="input-group-btn">
{!! $btn !!}
</span>
@endisset
</div>
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/switchfield.blade.php | resources/views/form/switchfield.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<input type="checkbox" class="{{$class}} la_checkbox" {{ old($column, $value) == 'on' ? 'checked' : '' }} {!! $attributes !!} />
<input type="hidden" class="{{$class}}" name="{{$name}}" value="{{ old($column, $value) }}" />
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/filepicker.blade.php | resources/views/form/filepicker.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}} picker-{{ $column }}">
@include('admin::form.error')
<div class="picker-file-preview {{ empty($preview) ? 'hide' : '' }}">
@foreach($preview as $item)
<div class="file-preview-frame" data-val="{!! $item['value'] !!}">
<div class="file-content">
@if($item['is_file'])
<i class="fa fa-file-text-o"></i>
@else
<img src="{{ $item['url'] }}"/>
@endif
</div>
<div class="file-caption-info">{{ basename($item['url']) }}</div>
<div class="file-actions">
<a class="btn btn-default btn-sm remove">
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-default btn-sm" target="_blank" download="{{ basename($item['url']) }}" href="{{ $item['url'] }}">
<i class="fa fa-download"></i>
</a>
</div>
</div>
@endforeach
</div>
<div class="input-group">
<input {!! $attributes !!} />
<span class="input-group-btn">
{!! $btn !!}
</span>
</div>
@include('admin::form.help-block')
</div>
</div>
<template>
<template id="file-preview">
<div class="file-preview-frame" data-val="_val_">
<div class="file-content">
<i class="fa fa-file-text-o"></i>
</div>
<div class="file-caption-info">_name_</div>
<div class="file-actions">
<a class="btn btn-default btn-sm remove">
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-default btn-sm" target="_blank" download="_name_" href="_url_">
<i class="fa fa-download"></i>
</a>
</div>
</div>
</template>
<template id="image-preview">
<div class="file-preview-frame" data-val="_val_">
<div class="file-content">
<img src="_url_">
</div>
<div class="file-caption-info">_name_</div>
<div class="file-actions">
<a class="btn btn-default btn-sm remove">
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-default btn-sm" target="_blank" download="_name_" href="_url_">
<i class="fa fa-download"></i>
</a>
</div>
</div>
</template>
</template>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/hasmanytable.blade.php | resources/views/form/hasmanytable.blade.php | <style>
td .form-group {
margin-bottom: 0 !important;
}
</style>
<div class="row">
<div class="{{$viewClass['label']}}"><h4 class="pull-right">{{ $label }}</h4></div>
<div class="{{$viewClass['field']}}">
<div id="has-many-{{$column}}" style="margin-top: 15px;">
<table class="table table-has-many has-many-{{$column}}">
<thead>
<tr>
@foreach($headers as $header)
<th>{{ $header }}</th>
@endforeach
<th class="hidden"></th>
@if($options['allowDelete'])
<th></th>
@endif
</tr>
</thead>
<tbody class="has-many-{{$column}}-forms">
@foreach($forms as $pk => $form)
<tr class="has-many-{{$column}}-form fields-group">
<?php $hidden = ''; ?>
@foreach($form->fields() as $field)
@if (is_a($field, \Encore\Admin\Form\Field\Hidden::class))
<?php $hidden .= $field->render(); ?>
@continue
@endif
<td>{!! $field->setLabelClass(['hidden'])->setWidth(12, 0)->render() !!}</td>
@endforeach
<td class="hidden">{!! $hidden !!}</td>
@if($options['allowDelete'])
<td class="form-group">
<div>
<div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash"> </i>{{ trans('admin.remove') }}</div>
</div>
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
<template class="{{$column}}-tpl">
<tr class="has-many-{{$column}}-form fields-group">
{!! $template !!}
<td class="form-group">
<div>
<div class="remove btn btn-warning btn-sm pull-right"><i class="fa fa-trash"> </i>{{ trans('admin.remove') }}</div>
</div>
</td>
</tr>
</template>
@if($options['allowCreate'])
<div class="form-group">
<div class="{{$viewClass['field']}}">
<div class="add btn btn-success btn-sm"><i class="fa fa-save"></i> {{ trans('admin.new') }}</div>
</div>
</div>
@endif
</div>
</div>
</div>
<hr style="margin-top: 0px;">
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/row.blade.php | resources/views/form/row.blade.php | <div class="row">
@foreach($fields as $field)
<div class="col-md-{{ $field['width'] }}">
{!! $field['element']->render() !!}
</div>
@endforeach
</div> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/rate.blade.php | resources/views/form/rate.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div class="input-group" style="width: 150px">
<input type="text" id="{{$id}}" name="{{$name}}" value="{{ old($column, $value) }}" class="form-control {{$class}}" placeholder="0" style="text-align:right;" {!! $attributes !!} />
<span class="input-group-addon">%</span>
</div>
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/captcha.blade.php | resources/views/form/captcha.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div class="input-group" style="width: 250px;">
<input {!! $attributes !!} />
<span class="input-group-addon clearfix" style="padding: 1px;"><img id="{{$column}}-captcha" src="{{ captcha_src() }}" style="height:30px;cursor: pointer;" title="Click to refresh"/></span>
</div>
@include('admin::form.help-block')
</div>
</div> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/error.blade.php | resources/views/form/error.blade.php | @if(is_array($errorKey))
@foreach($errorKey as $key => $col)
@if($errors->has($col.$key))
@foreach($errors->get($col.$key) as $message)
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
@endforeach
@endif
@endforeach
@else
@if($errors->has($errorKey))
@foreach($errors->get($errorKey) as $message)
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
@endforeach
@endif
@endif | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/checkboxcard.blade.php | resources/views/form/checkboxcard.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($column) ?: 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}" id="{{$id}}">
@include('admin::form.error')
<div class="card-group checkbox-group-toggle">
@foreach($options as $option => $label)
<label class="panel panel-default {{ false !== array_search($option, array_filter(old($column, $value ?? []))) || ($value === null && in_array($option, $checked)) ?'active':'' }}">
<div class="panel-body">
<input type="checkbox" name="{{$name}}[]" value="{{$option}}" class="hide {{$class}}" {{ false !== array_search($option, array_filter(old($column, $value ?? []))) || ($value === null && in_array($option, $checked)) ?'checked':'' }} {!! $attributes !!} /> {{$label}}
</div>
</label>
@endforeach
</div>
<input type="hidden" name="{{$name}}[]">
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/form/textarea.blade.php | resources/views/form/textarea.blade.php | <div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<textarea name="{{$name}}" class="form-control {{$class}}" rows="{{ $rows }}" placeholder="{{ $placeholder }}" {!! $attributes !!} >{{ old($column, $value) }}</textarea>
{!! $append !!}
@include('admin::form.help-block')
</div>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/tree/branch.blade.php | resources/views/tree/branch.blade.php | <li class="dd-item" data-id="{{ $branch[$keyName] }}">
<div class="dd-handle">
{!! $branchCallback($branch) !!}
<span class="pull-right dd-nodrag">
<a href="{{ url("$path/$branch[$keyName]/edit") }}"><i class="fa fa-edit"></i></a>
<a href="javascript:void(0);" data-id="{{ $branch[$keyName] }}" class="tree_branch_delete"><i class="fa fa-trash"></i></a>
</span>
</div>
@if(isset($branch['children']))
<ol class="dd-list">
@foreach($branch['children'] as $branch)
@include($branchView, $branch)
@endforeach
</ol>
@endif
</li> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/table.blade.php | resources/views/grid/table.blade.php | <div class="box grid-box">
@if(isset($title))
<div class="box-header with-border">
<h3 class="box-title"> {{ $title }}</h3>
</div>
@endif
@if ( $grid->showTools() || $grid->showExportBtn() || $grid->showCreateBtn() )
<div class="box-header with-border">
<div class="pull-right">
{!! $grid->renderColumnSelector() !!}
{!! $grid->renderExportButton() !!}
{!! $grid->renderCreateButton() !!}
</div>
@if ( $grid->showTools() )
<div class="pull-left">
{!! $grid->renderHeaderTools() !!}
</div>
@endif
</div>
@endif
{!! $grid->renderFilter() !!}
{!! $grid->renderHeader() !!}
<!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<table class="table table-hover grid-table" id="{{ $grid->tableID }}">
<thead>
<tr>
@foreach($grid->visibleColumns() as $column)
<th {!! $column->formatHtmlAttributes() !!}>{!! $column->getLabel() !!}{!! $column->renderHeader() !!}</th>
@endforeach
</tr>
</thead>
@if ($grid->hasQuickCreate())
{!! $grid->renderQuickCreate() !!}
@endif
<tbody>
@if($grid->rows()->isEmpty() && $grid->showDefineEmptyPage())
@include('admin::grid.empty-grid')
@endif
@foreach($grid->rows() as $row)
<tr {!! $row->getRowAttributes() !!}>
@foreach($grid->visibleColumnNames() as $name)
<td {!! $row->getColumnAttributes($name) !!}>
{!! $row->column($name) !!}
</td>
@endforeach
</tr>
@endforeach
</tbody>
{!! $grid->renderTotalRow() !!}
</table>
</div>
{!! $grid->renderFooter() !!}
<div class="box-footer clearfix">
{!! $grid->paginator() !!}
</div>
<!-- /.box-body -->
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/selector.blade.php | resources/views/grid/selector.blade.php | <style>
.grid-selector .wrap {
position: relative;
line-height: 34px;
border-bottom: 1px dashed #eee;
padding: 0 30px;
font-size: 13px;
overflow:auto;
}
.grid-selector .wrap:last-child {
border-bottom: none;
}
.grid-selector .select-label {
float: left;
width: 100px;
padding-left: 10px;
color: #999;
}
.grid-selector .select-options {
margin-left: 100px;
}
.grid-selector ul {
height: 25px;
list-style: none;
}
.grid-selector ul > li {
margin-right: 30px;
float: left;
}
.grid-selector ul > li a {
color: #666;
text-decoration: none;
}
.grid-selector .select-options a.active {
color: #dd4b39;
font-weight: 600;
}
.grid-selector li .add {
visibility: hidden;
}
.grid-selector li:hover .add {
visibility: visible;
}
.grid-selector ul .clear {
visibility: hidden;
}
.grid-selector ul:hover .clear {
color: #3c8dbc;
visibility: visible;
}
</style>
<div class="grid-selector">
@foreach($selectors as $column => $selector)
<div class="wrap">
<div class="select-label">{{ $selector['label'] }}</div>
<div class="select-options">
<ul>
@foreach($selector['options'] as $value => $option)
@php
$active = in_array($value, \Illuminate\Support\Arr::get($selected, $column, []));
@endphp
<li>
<a href="{{ \Encore\Admin\Grid\Tools\Selector::url($column, $value, true) }}"
class="{{$active ? 'active' : ''}}">{{ $option }}</a>
@if(!$active && $selector['type'] == 'many')
<a href="{{ \Encore\Admin\Grid\Tools\Selector::url($column, $value) }}" class="add"><i
class="fa fa-plus-square-o"></i></a>
@else
<a style="visibility: hidden;"><i class="fa fa-plus-square-o"></i></a>
@endif
</li>
@endforeach
<li>
<a href="{{ \Encore\Admin\Grid\Tools\Selector::url($column) }}" class="clear"><i
class="fa fa-trash"></i></a>
</li>
</ul>
</div>
</div>
@endforeach
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/fixed-table.blade.php | resources/views/grid/fixed-table.blade.php | <div class="box">
@if(isset($title))
<div class="box-header with-border">
<h3 class="box-title"> {{ $title }}</h3>
</div>
@endif
@if ( $grid->showTools() || $grid->showExportBtn() || $grid->showCreateBtn() )
<div class="box-header with-border">
<div class="pull-right">
{!! $grid->renderColumnSelector() !!}
{!! $grid->renderExportButton() !!}
{!! $grid->renderCreateButton() !!}
</div>
@if ( $grid->showTools() )
<div class="pull-left">
{!! $grid->renderHeaderTools() !!}
</div>
@endif
</div>
@endif
{!! $grid->renderFilter() !!}
{!! $grid->renderHeader() !!}
<!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<div class="tables-container">
<div class="table-wrap table-main">
<table class="table grid-table" id="{{ $grid->tableID }}">
<thead>
<tr>
@foreach($grid->visibleColumns() as $column)
<th {!! $column->formatHtmlAttributes() !!}>{{$column->getLabel()}}{!! $column->renderHeader() !!}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($grid->rows() as $row)
<tr {!! $row->getRowAttributes() !!}>
@foreach($grid->visibleColumnNames() as $name)
<td {!! $row->getColumnAttributes($name) !!} class="column-{!! $name !!}">
{!! $row->column($name) !!}
</td>
@endforeach
</tr>
@endforeach
</tbody>
{!! $grid->renderTotalRow() !!}
</table>
</div>
@if($grid->leftVisibleColumns()->isNotEmpty())
<div class="table-wrap table-fixed table-fixed-left">
<table class="table grid-table">
<thead>
<tr>
@foreach($grid->leftVisibleColumns() as $column)
<th {!! $column->formatHtmlAttributes() !!}>{{$column->getLabel()}}{!! $column->renderHeader() !!}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($grid->rows() as $row)
<tr {!! $row->getRowAttributes() !!}>
@foreach($grid->leftVisibleColumns() as $column)
@php
$name = $column->getName()
@endphp
<td {!! $row->getColumnAttributes($name) !!} class="column-{!! $name !!}">
{!! $row->column($name) !!}
</td>
@endforeach
</tr>
@endforeach
</tbody>
{!! $grid->renderTotalRow($grid->leftVisibleColumns()) !!}
</table>
</div>
@endif
@if($grid->rightVisibleColumns()->isNotEmpty())
<div class="table-wrap table-fixed table-fixed-right">
<table class="table grid-table">
<thead>
<tr>
@foreach($grid->rightVisibleColumns() as $column)
<th {!! $column->formatHtmlAttributes() !!}>{{$column->getLabel()}}{!! $column->renderHeader() !!}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($grid->rows() as $row)
<tr {!! $row->getRowAttributes() !!}>
@foreach($grid->rightVisibleColumns() as $column)
@php
$name = $column->getName()
@endphp
<td {!! $row->getColumnAttributes($name) !!} class="column-{!! $name !!}">
{!! $row->column($name) !!}
</td>
@endforeach
</tr>
@endforeach
</tbody>
{!! $grid->renderTotalRow($grid->rightVisibleColumns()) !!}
</table>
</div>
@endif
</div>
</div>
{!! $grid->renderFooter() !!}
<div class="box-footer clearfix">
{!! $grid->paginator() !!}
</div>
<!-- /.box-body -->
</div>
<style>
.tables-container {
position:relative;
}
.tables-container table {
margin-bottom: 0px !important;
}
.tables-container table th, .tables-container table td {
white-space:nowrap;
}
.table-wrap table tr .active {
background: #f5f5f5;
}
.table-main {
overflow-x: auto;
width: 100%;
}
.table-fixed {
position:absolute;
top: 0px;
background:#ffffff;
z-index:10;
}
.table-fixed-left {
left:0;
box-shadow: 7px 0 5px -5px rgba(0,0,0,.12);
}
.table-fixed-right {
right:0;
box-shadow: -5px 0 5px -5px rgba(0,0,0,.12);
}
</style>
<script>
var theadHeight = $('.table-main thead tr')[0].getBoundingClientRect().height;
$('.table-fixed thead tr').outerHeight(theadHeight);
var tfootHeight = $('.table-main tfoot tr').outerHeight();
$('.table-fixed tfoot tr').outerHeight(tfootHeight);
$('.table-main tbody tr').each(function(i, obj) {
var height = obj.getBoundingClientRect().height;
$('.table-fixed-left tbody tr').eq(i).outerHeight(height);
$('.table-fixed-right tbody tr').eq(i).outerHeight(height);
});
if ($('.table-main').width() >= $('.table-main').prop('scrollWidth')) {
$('.table-fixed').hide();
}
$('.table-wrap tbody tr').on('mouseover', function () {
var index = $(this).index();
$('.table-main tbody tr').eq(index).addClass('active');
$('.table-fixed-left tbody tr').eq(index).addClass('active');
$('.table-fixed-right tbody tr').eq(index).addClass('active');
});
$('.table-wrap tbody tr').on('mouseout', function () {
var index = $(this).index();
$('.table-main tbody tr').eq(index).removeClass('active');
$('.table-fixed-left tbody tr').eq(index).removeClass('active');
$('.table-fixed-right tbody tr').eq(index).removeClass('active');
});
$('.{{ $rowName }}-checkbox').iCheck({checkboxClass:'icheckbox_minimal-blue'}).on('ifChanged', function () {
var id = $(this).data('id');
var index = $(this).closest('tr').index();
if (this.checked) {
$.admin.grid.select(id);
$('.table-main tbody tr').eq(index).css('background-color', '#ffffd5');
$('.table-fixed-left tbody tr').eq(index).css('background-color', '#ffffd5');
$('.table-fixed-right tbody tr').eq(index).css('background-color', '#ffffd5');
} else {
$.admin.grid.unselect(id);
$('.table-main tbody tr').eq(index).css('background-color', '');
$('.table-fixed-left tbody tr').eq(index).css('background-color', '');
$('.table-fixed-right tbody tr').eq(index).css('background-color', '');
}
}).on('ifClicked', function () {
var id = $(this).data('id');
if (this.checked) {
$.admin.grid.unselect(id);
} else {
$.admin.grid.select(id);
}
var selected = $.admin.grid.selected().length;
if (selected > 0) {
$('.{{ $allName }}-btn').show();
} else {
$('.{{ $allName }}-btn').hide();
}
$('.{{ $allName }}-btn .selected').html("{{ trans('admin.grid_items_selected') }}".replace('{n}', selected));
});
</script>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/quick-search.blade.php | resources/views/grid/quick-search.blade.php | <form action="{!! $action !!}" pjax-container style="display: inline-block;">
<div class="input-group input-group-sm" style="display: inline-block;">
<input type="text" name="{{ $key }}" class="form-control grid-quick-search" style="width: 200px;" value="{{ $value }}" placeholder="{{ $placeholder }}">
<div class="input-group-btn" style="display: inline-block;">
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
</div>
</div>
</form> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/batch-actions.blade.php | resources/views/grid/batch-actions.blade.php | @if(!$holdAll)
<div class="btn-group {{ $all }}-btn" style="display:none;margin-right: 5px;">
<a class="btn btn-sm btn-default hidden-xs"><span class="selected"></span></a>
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
@if(!$actions->isEmpty())
<ul class="dropdown-menu" role="menu">
@foreach($actions as $action)
@if($action instanceof \Encore\Admin\Actions\BatchAction)
<li>{!! $action->render() !!}</li>
@else
<li><a href="#" class="{{ $action->getElementClass(false) }}">{!! $action->render() !!} </a></li>
@endif
@endforeach
</ul>
@endif
</div>
@endif
<script>
$('.{{ $all }}').iCheck({checkboxClass:'icheckbox_minimal-blue'});
$('.{{ $all }}').on('ifChanged', function(event) {
if (this.checked) {
$('.{{ $row }}-checkbox').iCheck('check');
} else {
$('.{{ $row }}-checkbox').iCheck('uncheck');
}
}).on('ifClicked', function () {
if (this.checked) {
$.admin.grid.selects = {};
} else {
$('.{{ $row }}-checkbox').each(function () {
var id = $(this).data('id');
$.admin.grid.select(id);
});
}
var selected = $.admin.grid.selected().length;
if (selected > 0) {
$('.{{ $all }}-btn').show();
} else {
$('.{{ $all }}-btn').hide();
}
$('.{{ $all }}-btn .selected')
.html("{{ trans('admin.grid_items_selected') }}".replace('{n}', selected));
});
</script>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/empty-grid.blade.php | resources/views/grid/empty-grid.blade.php | <tr>
<td colspan="{{ $grid->visibleColumns()->count() }}" class="empty-grid" style="padding: 100px;text-align: center;color: #999999">
<svg t="1562312016538" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="2076" width="128" height="128" style="fill: #e9e9e9;">
<path d="M512.8 198.5c12.2 0 22-9.8 22-22v-90c0-12.2-9.8-22-22-22s-22 9.8-22 22v90c0 12.2 9.9 22 22 22zM307 247.8c8.6 8.6 22.5 8.6 31.1 0 8.6-8.6 8.6-22.5 0-31.1L274.5 153c-8.6-8.6-22.5-8.6-31.1 0-8.6 8.6-8.6 22.5 0 31.1l63.6 63.7zM683.9 247.8c8.6 8.6 22.5 8.6 31.1 0l63.6-63.6c8.6-8.6 8.6-22.5 0-31.1-8.6-8.6-22.5-8.6-31.1 0l-63.6 63.6c-8.6 8.6-8.6 22.5 0 31.1zM927 679.9l-53.9-234.2c-2.8-9.9-4.9-20-6.9-30.1-3.7-18.2-19.9-31.9-39.2-31.9H197c-19.9 0-36.4 14.5-39.5 33.5-1 6.3-2.2 12.5-3.9 18.7L97 679.9v239.6c0 22.1 17.9 40 40 40h750c22.1 0 40-17.9 40-40V679.9z m-315-40c0 55.2-44.8 100-100 100s-100-44.8-100-100H149.6l42.5-193.3c2.4-8.5 3.8-16.7 4.8-22.9h630c2.2 11 4.5 21.8 7.6 32.7l39.8 183.5H612z"
p-id="2077"></path>
</svg>
</td>
</tr>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/image.blade.php | resources/views/grid/image.blade.php | <div class="box">
<div class="box-header"></div>
{!! $grid->renderFilter() !!}
<div class="box-body table-responsive no-padding">
<ul class="image clearfix">
@foreach($grid->rows() as $row)
<li>
<label>
{!! $row->column($key) !!}
{!! $row->column('__modal_selector__') !!}
</label>
</li>
@endforeach
</ul>
</div>
<div class="box-footer clearfix">
{!! $grid->paginator() !!}
</div>
<!-- /.box-body -->
</div>
<style>
ul.image {
padding: 0px;
}
.image li {
float: left;
margin: 10px;
list-style-type:none;
position: relative;
}
.image label {
cursor: pointer;
}
.image .img-thumbnail {
padding-right: 15px;
}
.image .iradio_minimal-blue,.image .icheckbox_minimal-blue {
position: absolute;
bottom: 5px;
right: 1px;
background-color: #ffffff;
}
</style>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/total-row.blade.php | resources/views/grid/total-row.blade.php | <tfoot>
<tr>
@foreach($columns as $column)
<td class="{{ $column['class'] }}">{!! $column['value'] !!}</td>
@endforeach
</tr>
</tfoot>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/quick-create/multipleselect.blade.php | resources/views/grid/quick-create/multipleselect.blade.php | <style>
.quick-create .select2-selection--multiple {
padding: 0 !important;
height: 30px !important;
width: 200px !important;
min-height: 30px !important;
}
</style>
<div class="input-group input-group-sm">
<select class="form-control {{$class}}" style="width: 100%;" name="{{$name}}" {!! $attributes !!} multiple data-placeholder="{{ $label }}">
<option value=""></option>
@foreach($options as $select => $option)
<option value="{{$select}}" {{ $select == old($column, $value) ?'selected':'' }}>{{$option}}</option>
@endforeach
</select>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/quick-create/select.blade.php | resources/views/grid/quick-create/select.blade.php | <style>
.quick-create .select2-selection--single {
padding: 3px 12px !important;
height: 30px !important;
width: 150px !important;
}
</style>
<div class="input-group input-group-sm">
<select class="form-control {{$class}}" style="width: 100%;" name="{{$name}}" {!! $attributes !!} >
<option value=""></option>
@foreach($options as $select => $option)
<option value="{{$select}}" {{ $select == old($column, $value) ?'selected':'' }}>{{$option}}</option>
@endforeach
</select>
</div>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/quick-create/text.blade.php | resources/views/grid/quick-create/text.blade.php | <div class="input-group input-group-sm">
<input {!! $attributes !!} placeholder="{{ $label }}"/>
</div> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/quick-create/date.blade.php | resources/views/grid/quick-create/date.blade.php | <div class="input-group input-group-sm">
<input style="width: 125px;" {!! $attributes !!} placeholder="{{ $label }}" />
</div> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/quick-create/form.blade.php | resources/views/grid/quick-create/form.blade.php | <thead>
<tr class="quick-create">
<td colspan="{{ $columnCount }}" style="height: 47px;padding-left: 57px;background-color: #f9f9f9; vertical-align: middle;">
<span class="create" style="color: #bdbdbd;cursor: pointer;display: block;">
<i class="fa fa-plus"></i> {{ __('admin.quick_create') }}
</span>
<form class="form-inline create-form" style="display: none;" method="post">
@foreach($fields as $field)
{!! $field->render() !!}
@endforeach
<button class="btn btn-primary btn-sm">{{ __('admin.submit') }}</button>
<a href="javascript:void(0);" class="cancel">{{ __('admin.cancel') }}</a>
{{ csrf_field() }}
</form>
</td>
</tr>
</thead> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/datetime.blade.php | resources/views/grid/inline-edit/datetime.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
<input class="form-control ie-input"/>
@endsection
@section('assert')
<style>
.ie-content-{{ $name }} .ie-container {
height: 290px;
}
.ie-content-{{ $name }} .ie-input {
display: none;
}
</style>
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('input').attr('value', $trigger.data('value'));
@endslot
@slot('shown')
var $input = $popover.find('.ie-input');
$popover.find('.ie-container').datetimepicker({
inline: true,
format: '{{ $format }}',
date: $input.val(),
locale: '{{ $locale }}'
}).on('dp.change', function (event) {
var date = event.date.format('{{ $format }}');
$input.val(date);
});
@endslot
@endcomponent
</script>
{{--after submit--}}
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
$popover.data('display').html(val);
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/switch-group.blade.php | resources/views/grid/inline-edit/switch-group.blade.php |
<tr style="height: 28px;">
<td><strong><small>{{ $label }}:</small></strong> </td>
<td><input type="checkbox" class="{{ $class }}" {{ $checked }} data-key="{{ $key }}" /></td>
</tr>
<script>
$('.{{ $class }}').bootstrapSwitch({
size:'mini',
onText: '{{ $states['on']['text'] }}',
offText: '{{ $states['off']['text'] }}',
onColor: '{{ $states['on']['color'] }}',
offColor: '{{ $states['off']['color'] }}',
onSwitchChange: function(event, state){
$(this).val(state ? {{ $states['on']['value'] }} : {{ $states['off']['value'] }});
var key = $(this).data('key');
var value = $(this).val();
var _status = true;
$.ajax({
url: "{{ $resource }}/" + key,
type: "POST",
data: {
"{{ $name }}": value,
_token: LA.token,
_method: 'PUT'
},
success: function (data) {
if (data.status)
toastr.success(data.message);
else
toastr.warning(data.message);
},
complete:function(xhr,status) {
if (status == 'success')
_status = xhr.responseJSON.status;
}
});
return _status;
}
});
</script>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/multiple-select.blade.php | resources/views/grid/inline-edit/multiple-select.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
<select name='multiple-select-{{ $name }}' class="form-control ie-input" multiple>
@foreach($options as $option => $label)
<option name='multiple-select-{{ $name }}' value="{{ $option }}" data-label="{{ $label }}"> {{$label}} </option>
@endforeach
</select>
@endsection
@section('assert')
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('select>option').each(function (index, option) {
if($.inArray($(option).attr('value'), $trigger.data('value')) >= 0) {
$(option).attr('selected', true);
}
});
@endslot
@endcomponent
</script>
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
@slot('val')
var val = [];
var label = [];
$popover.find('.ie-input>option:selected').each(function(){
val.push($(this).val());
label.push($(this).data('label'));
});
@endslot
$popover.data('display').html(label.join(';'));
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/belongsto.blade.php | resources/views/grid/inline-edit/belongsto.blade.php | <span class="grid-selector" data-toggle="modal" data-target="#{{ $modal }}" key="{{ $key }}" data-val="{{ $original }}">
<a href="javascript:void(0)" class="text-muted">
<i class="fa fa-check-square-o"></i>
<span class="text">{{ $value }}</span>
</a>
</span>
<style>
.belongsto.modal tr {
cursor: pointer;
}
.belongsto.modal .box {
border-top: none;
margin-bottom: 0;
box-shadow: none;
}
.belongsto.modal .loading {
margin: 50px;
}
</style>
<template>
<div class="modal fade belongsto" id="{{ $modal }}" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content" style="border-radius: 5px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">{{ admin_trans('admin.choose') }}</h4>
</div>
<div class="modal-body">
<div class="loading text-center">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ admin_trans('admin.cancel') }}</button>
<button type="button" class="btn btn-primary submit">{{ admin_trans('admin.submit') }}</button>
</div>
</div>
</div>
</div>
</template>
<script>
var $modal = $('#{{ $modal }}');
var $related = null;
var update = function (callback) {
$.ajax({
url: "{{ $resource }}/" + $related.attr('key'),
type: "POST",
data: {
'{{ $name }}': selected.length ? selected : [''],
_token: LA.token,
_method: 'PUT'
},
success: function (data) {
callback(data);
}
});
};
@if($relation == \Encore\Admin\Grid\Displayers\BelongsTo::class)
var selected = null;
var load = function (url) {
$.get(url, function (data) {
$modal.find('.modal-body').html(data);
$modal.find('.select').iCheck({
radioClass:'iradio_minimal-blue',
checkboxClass:'icheckbox_minimal-blue'
});
$modal.find('.box-header:first').hide();
$modal.find('input.select').each(function (index, el) {
if ($(el).val() == selected) {
$(el).iCheck('toggle');
}
});
});
};
$modal.on('show.bs.modal', function (e) {
$related = $(e.relatedTarget);
selected = $related.data('val');
load("{!! $url !!}");
}).on('ifChecked', 'input.select', function (e) {
selected = $(this).val();
}).find('.modal-footer .submit').click(function () {
update(function (data) {
$related.data('val', selected);
$related.find('.text').html(data.display["{{ $name }}"]);
$related.find('a').toggleClass('text-green text-muted');
setTimeout(function () {
$related.find('a').toggleClass('text-green text-muted');
}, 2000);
$modal.modal('toggle');
toastr.success(data.message);
});
});
@else
var selected = [];
var load = function (url) {
$.get(url, function (data) {
$modal.find('.modal-body').html(data);
$modal.find('.select').iCheck({
radioClass:'iradio_minimal-blue',
checkboxClass:'icheckbox_minimal-blue'
});
$modal.find('.box-header:first').hide();
$modal.find('input.select').each(function (index, el) {
if ($.inArray($(el).val().toString(), selected) >=0 ) {
$(el).iCheck('toggle');
}
});
});
};
$modal.on('show.bs.modal', function (e) {
$related = $(e.relatedTarget);
selected = $related.data('val').map(function (value) {
return value.toString();
});
load("{!! $url !!}");
}).on('ifChecked', 'input.select', function (e) {
var val = $(this).val().toString();
if (selected.indexOf(val) < 0) {
selected.push(val);
}
}).on('ifUnchecked', 'input.select', function (e) {
var val = $(this).val().toString();
var index = selected.indexOf(val);
if (index !== -1) {
selected.splice(index, 1);
}
}).find('.modal-footer .submit').click(function () {
update(function (data) {
$related.data('val', selected);
$related.find('.text').html(data.display["{{ $name }}"]);
$related.find('a').toggleClass('text-green text-muted');
setTimeout(function () {
$related.find('a').toggleClass('text-green text-muted');
}, 2000);
$modal.modal('toggle');
toastr.success(data.message);
});
});
@endif
$modal.on('click', '.page-item a, .filter-box a', function (e) {
load($(this).attr('href'));
e.preventDefault();
}).on('click', 'tr', function (e) {
$(this).find('input.select').iCheck('toggle');
e.preventDefault();
}).on('submit', '.box-header form', function (e) {
load($(this).attr('action')+'&'+$(this).serialize());
e.preventDefault();
return false;
})
</script>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/radio.blade.php | resources/views/grid/inline-edit/radio.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
@foreach($options as $option => $label)
<div class="radio icheck">
<label>
<input type="radio" name='radio-{{ $name }}' class="minimal ie-input" value="{{ $option }}" data-label="{{ $label }}"/> {{$label}}
</label>
</div>
@endforeach
@endsection
@section('assert')
<style>
.icheck.radio {
margin: 5px 0 5px 20px;
}
.ie-content-{{ $name }} .ie-container {
width: 150px;
position: relative;
}
</style>
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('input[type=radio]').each(function (index, radio) {
if ($(radio).attr('value') == $trigger.data('value')) {
$(radio).attr('checked', true);
}
});
@endslot
@endcomponent
</script>
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
@slot('val')
var val = $popover.find('.ie-input:checked').val();
var label = $popover.find('.ie-input:checked').data('label');
@endslot
$popover.data('display').html(label);
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/select.blade.php | resources/views/grid/inline-edit/select.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
<select name='select-{{ $name }}' class="form-control ie-input">
@foreach($options as $option => $label)
<option name='select-{{ $name }}' value="{{ $option }}" data-label="{{ $label }}"> {{$label}} </option>
@endforeach
</select>
@endsection
@section('assert')
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('select>option').each(function (index, option) {
if ($(option).attr('value') == $trigger.data('value')) {
$(option).attr('selected', true);
}
});
@endslot
@endcomponent
</script>
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
@slot('val')
var val = $popover.find('.ie-input').val();
var label = $popover.find('.ie-input>option:selected').data('label');
@endslot
$popover.data('display').html(label);
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/checkbox.blade.php | resources/views/grid/inline-edit/checkbox.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
@foreach($options as $option => $label)
<div class="checkbox icheck">
<label>
<input type="checkbox" name='radio-{{ $name }}[]' class="minimal ie-input" value="{{ $option }}" data-label="{{ $label }}"/> {{$label}}
</label>
</div>
@endforeach
@endsection
@section('assert')
<style>
.icheck.checkbox {
margin: 5px 0 5px 20px;
}
.ie-content-{{ $name }} .ie-container {
width: 150px;
position: relative;
}
</style>
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('input[type=checkbox]').each(function (index, checkbox) {
if($.inArray($(checkbox).attr('value'), $trigger.data('value')) >= 0) {
$(checkbox).attr('checked', true);
}
});
@endslot
@endcomponent
</script>
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
@slot('val')
var val = [];
var label = [];
$popover.find('.ie-input:checked').each(function(){
val.push($(this).val());
label.push($(this).data('label'));
});
@endslot
$popover.data('display').html(label.join(';'));
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/switch.blade.php | resources/views/grid/inline-edit/switch.blade.php | <input type="checkbox" class="{{ $class }}" {{ $checked }} data-key="{{ $key }}" />
<script>
$('.{{ $class }}').bootstrapSwitch({
size:'mini',
onText: '{{ $states['on']['text'] }}',
offText: '{{ $states['off']['text'] }}',
onColor: '{{ $states['on']['color'] }}',
offColor: '{{ $states['off']['color'] }}',
onSwitchChange: function(event, state){
$(this).val(state ? {{ $states['on']['value'] }} : {{ $states['off']['value'] }});
var key = $(this).data('key');
var value = $(this).val();
var _status = true;
$.ajax({
url: "{{ $resource }}/" + key,
type: "POST",
async:false,
data: {
"{{ $name }}": value,
_token: LA.token,
_method: 'PUT',
_edit_inline: true
},
success: function (data) {
if (data.status)
toastr.success(data.message);
else
toastr.warning(data.message);
},
error: function (xhr, textStatus, errorThrown) {
_status = false;
var data = xhr.responseJSON
if (data['errors'] || data['message']) {
var message = data['message'] || Object.values(data['errors']).join("\n");
toastr.error(message);
} else {
toastr.error('Error: ' + errorThrown);
}
},
complete:function(xhr,status) {
if (status == 'success')
_status = xhr.responseJSON.status;
}
});
return _status;
}
});
</script>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/input.blade.php | resources/views/grid/inline-edit/input.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
<input class="form-control ie-input"/>
@endsection
@section('assert')
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('input').attr('value', $trigger.data('value'));
@endslot
@slot('shown')
$popover.find('.ie-input').focus();
@if($mask)
$popover.find('.ie-input').inputmask(@json($mask));
@endif
@endslot
@endcomponent
</script>
{{--after submit--}}
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
$popover.data('display').html(val);
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/comm.blade.php | resources/views/grid/inline-edit/comm.blade.php | {{--inline edit popover--}}
<span class="ie-wrap">
<a
href="javascript:void(0);"
class="{{ $trigger }}"
data-toggle="popover"
data-target="{{ $target }}"
data-value="{{ $value }}"
data-original="{{ $value }}"
data-key="{{ $key }}"
data-name="{{ $name }}"
>
<span class="ie-display">{{ $display }}</span>
<i class="fa fa-edit" style="visibility: hidden;"></i>
</a>
</span>
<template>
<template id="{{ $target }}">
<div class="ie-content ie-content-{{ $name }}">
<div class="ie-container">
@yield('field')
<div class="error"></div>
</div>
<div class="ie-action">
<button class="btn btn-primary btn-sm ie-submit">{{ __('admin.submit') }}</button>
<button class="btn btn-default btn-sm ie-cancel">{{ __('admin.cancel') }}</button>
</div>
</div>
</template>
</template>
<style>
.ie-wrap>a {
padding: 3px;
border-radius: 3px;
color:#777;
}
.ie-wrap>a:hover {
text-decoration: none;
background-color: #ddd;
color:#777;
}
.ie-wrap>a:hover i {
visibility: visible !important;
}
.ie-action button {
margin: 10px 0 10px 10px;
float: right;
}
.ie-container {
width: 250px;
position: relative;
}
.ie-container .error {
color: #dd4b39;
font-weight: 700;
}
</style>
<script>
$(document).on('click', '.ie-action .ie-cancel', function () {
$('[data-toggle="popover"]').popover('hide');
});
$('body').on('click', function (e) {
if ($(e.target).data('toggle') !== 'popover'
&& $(e.target).parents('[data-toggle="popover"]').length === 0
&& $(e.target).parents('.popover.in').length === 0) {
$('[data-toggle="popover"]').popover('hide');
}
});
</script>
@yield('assert')
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/upload.blade.php | resources/views/grid/inline-edit/upload.blade.php | <a href='javascript:void(0);' class='text-muted inline-upload-trigger' data-target="{{ $target }}">
<i class="fa fa-upload"></i> {!! $value !!}
</a>
<div class="hide">
<input type="file" class="inline-upload" id="{{ $target }}" data-key="{{ $key }}" {{ $multiple ? 'multiple' : '' }}/>
</div>
<script>
$('.inline-upload-trigger').click(function () {
$('#'+$(this).data('target')).trigger('click');
});
$('input.inline-upload').on('change', function () {
var formData = new FormData();
@if ($multiple)
event.target.files.forEach(function (file) {
formData.append("{{ $name }}[]", file);
});
@else
formData.append("{{ $name }}", event.target.files[0]);
@endif
formData.append('_token', LA.token);
formData.append('_method', 'PUT');
$.ajax({
url: "{{ $resource }}/" + $(this).data('key'),
type: "POST",
processData: false,
contentType: false,
enctype: 'multipart/form-data',
data: formData,
success: function (data) {
toastr.success(data.message);
$.admin.reload();
}
});
});
</script>
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/textarea.blade.php | resources/views/grid/inline-edit/textarea.blade.php | @extends('admin::grid.inline-edit.comm')
@section('field')
<textarea class="form-control ie-input" rows="{{ $rows }}"></textarea>
@endsection
@section('assert')
<script>
@component('admin::grid.inline-edit.partials.popover', compact('trigger'))
@slot('content')
$template.find('textarea').text($trigger.data('value'));
@endslot
@slot('shown')
$popover.find('.ie-input').focus();
@endslot
@endcomponent
</script>
{{--after submit--}}
<script>
@component('admin::grid.inline-edit.partials.submit', compact('resource', 'name'))
$popover.data('display').html(val);
@endcomponent
</script>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/partials/submit.blade.php | resources/views/grid/inline-edit/partials/submit.blade.php | $(document).off('click', '.ie-content .ie-submit').on('click', '.ie-content .ie-submit', function () {
var $popover = $(this).closest('.ie-content');
var $trigger = $popover.data('trigger');
@isset($val)
{{ $val }}
@else
var val = $popover.find('.ie-input').val();
@endisset
var original = $trigger.data('original');
if (val == original) {
$('[data-toggle="popover"]').popover('hide');
return;
}
var data = {
_token: LA.token,
_method: 'PUT',
_edit_inline: true,
};
data[$trigger.data('name')] = val;
$.ajax({
url: "{{ $resource }}/" + $trigger.data('key'),
type: "POST",
data: data,
success: function (data) {
toastr.success(data.message);
{{ $slot }}
$trigger.data('value', val)
.data('original', val);
$('[data-toggle="popover"]').popover('hide');
},
statusCode: {
422: function(xhr) {
$popover.find('.error').empty();
var errors = xhr.responseJSON.errors;
for (var key in errors) {
$popover.find('.error').append('<div><i class="fa fa-times-circle-o"></i> '+errors[key]+'</div>')
}
}
}
});
});
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/inline-edit/partials/popover.blade.php | resources/views/grid/inline-edit/partials/popover.blade.php | $('.{{ $trigger }}').popover({
html: true,
container: 'body',
trigger: 'manual',
placement: function (context, source) {
var position = $(source).position();
if (position.left < 100) return "right";
if (position.top < 110) return "bottom";
if ($(window).height() - $(source).offset().top < 370) {
return 'top';
}
return "bottom";
},
content: function () {
var $trigger = $(this);
var $template = $($('template#'+$(this).data('target')).html());
{{ $content }}
return $template.prop("outerHTML");
}
}).on('shown.bs.popover', function (e) {
var $popover = $($(this).data('bs.popover').$tip[0]).find('.ie-content');
var $display = $(this).parents('.ie-wrap').find('.ie-display');
var $trigger = $(this);
$popover.data('display', $display);
$popover.data('trigger', $trigger);
{{ $shown ?? '' }}
}).click(function () {
$('[data-toggle="popover"]').popover('hide');
$(this).popover('toggle');
});
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/displayer/table.blade.php | resources/views/grid/displayer/table.blade.php | <table class="table table-hover" style="margin-bottom: 0;">
<thead>
<tr>
@foreach($titles as $column => $title)
<th>{{ $title }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($data as $datum)
<tr>
@foreach($datum as $key => $value)
<td>{{ $value }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table> | php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/actions/dropdown.blade.php | resources/views/grid/actions/dropdown.blade.php | <div class="grid-dropdown-actions dropdown">
<a href="#" style="padding: 0 10px;" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-ellipsis-v"></i>
</a>
<ul class="dropdown-menu" style="min-width: 70px !important;box-shadow: 0 2px 3px 0 rgba(0,0,0,.2);border-radius:0;left: -65px;top: 5px;">
@foreach($default as $action)
<li>{!! $action->render() !!}</li>
@endforeach
@if(!empty($custom))
@if(!empty($default))
<li class="divider"></li>
@endif
@foreach($custom as $action)
<li>{!! $action->render() !!}</li>
@endforeach
@endif
</ul>
</div>
<script>
$('.table-responsive').on('shown.bs.dropdown', function(e) {
var t = $(this),
m = $(e.target).find('.dropdown-menu'),
tb = t.offset().top + t.height(),
mb = m.offset().top + m.outerHeight(true),
d = 20;
if (t[0].scrollWidth > t.innerWidth()) {
if (mb + d > tb) {
t.css('padding-bottom', ((mb + d) - tb));
}
} else {
t.css('overflow', 'visible');
}
}).on('hidden.bs.dropdown', function() {
$(this).css({
'padding-bottom': '',
'overflow': ''
});
});
</script>
@yield('child')
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
z-song/laravel-admin | https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/resources/views/grid/actions/contextmenu.blade.php | resources/views/grid/actions/contextmenu.blade.php | @extends('admin::grid.actions.dropdown')
@section('child')
<script>
$("body").on("contextmenu", "table.grid-table>tbody>tr", function (e) {
$('#grid-context-menu .dropdown-menu').hide();
var menu = $(this).find('td.column-__actions__ .dropdown-menu');
var index = $(this).index();
if (menu.length) {
menu.attr('index', index).detach().appendTo('#grid-context-menu');
} else {
menu = $('#grid-context-menu .dropdown-menu[index=' + index + ']');
}
var height = 0;
if (menu.height() > (document.body.clientHeight - e.pageY)) {
menu.css({left: e.pageX + 10, top: e.pageY - menu.height()}).show();
} else {
menu.css({left: e.pageX + 10, top: e.pageY - 10}).show();
}
return false;
});
$(document).on('click', function () {
$('#grid-context-menu .dropdown-menu').hide();
});
$('#grid-context-menu').click('a', function () {
$('#grid-context-menu .dropdown-menu').hide();
});
</script>
<style>
.grid-table .column-__actions__ {
display: none !important;
}
</style>
<template>
<div id="grid-context-menu"></div>
</template>
@endsection
| php | MIT | 67c441eb78ecc5437e59775d89770cd9c2cb1e05 | 2026-01-04T15:05:15.717211Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/src/Doctrine/Instantiator/InstantiatorInterface.php | src/Doctrine/Instantiator/InstantiatorInterface.php | <?php
declare(strict_types=1);
namespace Doctrine\Instantiator;
use Doctrine\Instantiator\Exception\ExceptionInterface;
/**
* Instantiator provides utility methods to build objects without invoking their constructors
*/
interface InstantiatorInterface
{
/**
* @phpstan-param class-string<T> $className
*
* @phpstan-return T
*
* @throws ExceptionInterface
*
* @template T of object
*/
public function instantiate(string $className): object;
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/src/Doctrine/Instantiator/Instantiator.php | src/Doctrine/Instantiator/Instantiator.php | <?php
declare(strict_types=1);
namespace Doctrine\Instantiator;
use ArrayIterator;
use Doctrine\Instantiator\Exception\ExceptionInterface;
use Doctrine\Instantiator\Exception\InvalidArgumentException;
use Doctrine\Instantiator\Exception\UnexpectedValueException;
use Exception;
use ReflectionClass;
use ReflectionException;
use Serializable;
use function class_exists;
use function enum_exists;
use function is_subclass_of;
use function restore_error_handler;
use function set_error_handler;
use function sprintf;
use function strlen;
use function unserialize;
final class Instantiator implements InstantiatorInterface
{
/**
* Markers used internally by PHP to define whether {@see \unserialize} should invoke
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
* the {@see \Serializable} interface.
*/
private const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
private const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
/**
* Used to instantiate specific classes, indexed by class name.
*
* @var array<class-string, callable(): object>
*/
private static array $cachedInstantiators = [];
/**
* Array of objects that can directly be cloned, indexed by class name.
*
* @var object[]
*/
private static array $cachedCloneables = [];
/**
* @phpstan-param class-string<T> $className
*
* @phpstan-return T
*
* @throws ExceptionInterface
*
* @template T of object
*/
public function instantiate(string $className): object
{
if (isset(self::$cachedCloneables[$className])) {
/** @phpstan-var T */
$cachedCloneable = self::$cachedCloneables[$className];
return clone $cachedCloneable;
}
if (isset(self::$cachedInstantiators[$className])) {
$factory = self::$cachedInstantiators[$className];
return $factory();
}
return $this->buildAndCacheFromFactory($className);
}
/**
* Builds the requested object and caches it in static properties for performance
*
* @phpstan-param class-string<T> $className
*
* @phpstan-return T
*
* @template T of object
*/
private function buildAndCacheFromFactory(string $className): object
{
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
$instance = $factory();
if ($this->isSafeToClone(new ReflectionClass($instance))) {
self::$cachedCloneables[$className] = clone $instance;
}
return $instance;
}
/**
* Builds a callable capable of instantiating the given $className without
* invoking its constructor.
*
* @phpstan-param class-string<T> $className
*
* @phpstan-return callable(): T
*
* @throws InvalidArgumentException
* @throws UnexpectedValueException
* @throws ReflectionException
*
* @template T of object
*/
private function buildFactory(string $className): callable
{
$reflectionClass = $this->getReflectionClass($className);
if ($this->isInstantiableViaReflection($reflectionClass)) {
return [$reflectionClass, 'newInstanceWithoutConstructor'];
}
$serializedString = sprintf(
'%s:%d:"%s":0:{}',
is_subclass_of($className, Serializable::class) ? self::SERIALIZATION_FORMAT_USE_UNSERIALIZER : self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER,
strlen($className),
$className,
);
$this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString);
return static fn () => unserialize($serializedString);
}
/**
* @phpstan-param class-string<T> $className
*
* @phpstan-return ReflectionClass<T>
*
* @throws InvalidArgumentException
* @throws ReflectionException
*
* @template T of object
*/
private function getReflectionClass(string $className): ReflectionClass
{
if (! class_exists($className)) {
throw InvalidArgumentException::fromNonExistingClass($className);
}
if (enum_exists($className, false)) {
throw InvalidArgumentException::fromEnum($className);
}
$reflection = new ReflectionClass($className);
if ($reflection->isAbstract()) {
throw InvalidArgumentException::fromAbstractClass($reflection);
}
return $reflection;
}
/**
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @throws UnexpectedValueException
*
* @template T of object
*/
private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString): void
{
set_error_handler(static function (int $code, string $message, string $file, int $line) use ($reflectionClass, &$error): bool {
$error = UnexpectedValueException::fromUncleanUnSerialization(
$reflectionClass,
$message,
$code,
$file,
$line,
);
return true;
});
try {
$this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString);
} finally {
restore_error_handler();
}
if ($error) {
throw $error;
}
}
/**
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @throws UnexpectedValueException
*
* @template T of object
*/
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString): void
{
try {
unserialize($serializedString);
} catch (Exception $exception) {
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
}
}
/**
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @template T of object
*/
private function isInstantiableViaReflection(ReflectionClass $reflectionClass): bool
{
return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal());
}
/**
* Verifies whether the given class is to be considered internal
*
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @template T of object
*/
private function hasInternalAncestors(ReflectionClass $reflectionClass): bool
{
do {
if ($reflectionClass->isInternal()) {
return true;
}
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass);
return false;
}
/**
* Checks if a class is cloneable
*
* Classes implementing `__clone` cannot be safely cloned, as that may cause side-effects.
*
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @template T of object
*/
private function isSafeToClone(ReflectionClass $reflectionClass): bool
{
return $reflectionClass->isCloneable()
&& ! $reflectionClass->hasMethod('__clone')
&& ! $reflectionClass->isSubclassOf(ArrayIterator::class);
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/src/Doctrine/Instantiator/Exception/ExceptionInterface.php | src/Doctrine/Instantiator/Exception/ExceptionInterface.php | <?php
declare(strict_types=1);
namespace Doctrine\Instantiator\Exception;
use Throwable;
/**
* Base exception marker interface for the instantiator component
*/
interface ExceptionInterface extends Throwable
{
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php | src/Doctrine/Instantiator/Exception/UnexpectedValueException.php | <?php
declare(strict_types=1);
namespace Doctrine\Instantiator\Exception;
use Exception;
use ReflectionClass;
use UnexpectedValueException as BaseUnexpectedValueException;
use function sprintf;
/**
* Exception for given parameters causing invalid/unexpected state on instantiation
*/
class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface
{
/**
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @template T of object
*/
public static function fromSerializationTriggeredException(
ReflectionClass $reflectionClass,
Exception $exception,
): self {
return new self(
sprintf(
'An exception was raised while trying to instantiate an instance of "%s" via un-serialization',
$reflectionClass->getName(),
),
0,
$exception,
);
}
/**
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @template T of object
*/
public static function fromUncleanUnSerialization(
ReflectionClass $reflectionClass,
string $errorString,
int $errorCode,
string $errorFile,
int $errorLine,
): self {
return new self(
sprintf(
'Could not produce an instance of "%s" via un-serialization, since an error was triggered '
. 'in file "%s" at line "%d"',
$reflectionClass->getName(),
$errorFile,
$errorLine,
),
0,
new Exception($errorString, $errorCode),
);
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php | src/Doctrine/Instantiator/Exception/InvalidArgumentException.php | <?php
declare(strict_types=1);
namespace Doctrine\Instantiator\Exception;
use InvalidArgumentException as BaseInvalidArgumentException;
use ReflectionClass;
use function interface_exists;
use function sprintf;
use function trait_exists;
/**
* Exception for invalid arguments provided to the instantiator
*/
class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface
{
public static function fromNonExistingClass(string $className): self
{
if (interface_exists($className)) {
return new self(sprintf('The provided type "%s" is an interface, and cannot be instantiated', $className));
}
if (trait_exists($className)) {
return new self(sprintf('The provided type "%s" is a trait, and cannot be instantiated', $className));
}
return new self(sprintf('The provided class "%s" does not exist', $className));
}
/**
* @phpstan-param ReflectionClass<T> $reflectionClass
*
* @template T of object
*/
public static function fromAbstractClass(ReflectionClass $reflectionClass): self
{
return new self(sprintf(
'The provided class "%s" is abstract, and cannot be instantiated',
$reflectionClass->getName(),
));
}
public static function fromEnum(string $className): self
{
return new self(sprintf(
'The provided class "%s" is an enum, and cannot be instantiated',
$className,
));
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php | tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTest;
use ArrayObject;
use Doctrine\Instantiator\Exception\InvalidArgumentException;
use Doctrine\Instantiator\Exception\UnexpectedValueException;
use Doctrine\Instantiator\Instantiator;
use Doctrine\Instantiator\InstantiatorInterface;
use DoctrineTest\InstantiatorTestAsset\AbstractClassAsset;
use DoctrineTest\InstantiatorTestAsset\ArrayObjectAsset;
use DoctrineTest\InstantiatorTestAsset\ExceptionAsset;
use DoctrineTest\InstantiatorTestAsset\FinalExceptionAsset;
use DoctrineTest\InstantiatorTestAsset\PharExceptionAsset;
use DoctrineTest\InstantiatorTestAsset\SerializableArrayObjectAsset;
use DoctrineTest\InstantiatorTestAsset\SerializableFinalInternalChildAsset;
use DoctrineTest\InstantiatorTestAsset\SimpleEnumAsset;
use DoctrineTest\InstantiatorTestAsset\SimpleSerializableAsset;
use DoctrineTest\InstantiatorTestAsset\SimpleTraitAsset;
use DoctrineTest\InstantiatorTestAsset\UnCloneableAsset;
use DoctrineTest\InstantiatorTestAsset\UnserializeExceptionArrayObjectAsset;
use DoctrineTest\InstantiatorTestAsset\WakeUpNoticesAsset;
use DoctrineTest\InstantiatorTestAsset\XMLReaderAsset;
use Exception;
use Generator;
use PDORow;
use PharException;
use PHPUnit\Framework\TestCase;
use stdClass;
use function str_replace;
use function uniqid;
/**
* Tests for {@see \Doctrine\Instantiator\Instantiator}
*
* @covers \Doctrine\Instantiator\Instantiator
*/
class InstantiatorTest extends TestCase
{
private Instantiator $instantiator;
protected function setUp(): void
{
parent::setUp();
$this->instantiator = new Instantiator();
}
/**
* @phpstan-param class-string $className
*
* @dataProvider getInstantiableClasses
*/
public function testCanInstantiate(string $className): void
{
self::assertInstanceOf($className, $this->instantiator->instantiate($className));
}
/**
* @phpstan-param class-string $className
*
* @dataProvider getInstantiableClasses
*/
public function testInstantiatesSeparateInstances(string $className): void
{
$instance1 = $this->instantiator->instantiate($className);
$instance2 = $this->instantiator->instantiate($className);
self::assertEquals($instance1, $instance2);
self::assertNotSame($instance1, $instance2);
}
public function testExceptionOnUnSerializationException(): void
{
$this->expectException(UnexpectedValueException::class);
$this->instantiator->instantiate(PDORow::class);
}
/**
* @phpstan-param class-string $invalidClassName
*
* @dataProvider getInvalidClassNames
*/
public function testInstantiationFromNonExistingClass(string $invalidClassName): void
{
$this->expectException(InvalidArgumentException::class);
$this->instantiator->instantiate($invalidClassName);
}
public function testInstancesAreNotCloned(): void
{
$namespace = __NAMESPACE__;
$className = 'TemporaryClass' . str_replace('.', '', uniqid('', true));
eval(<<< PHP
namespace $namespace;
#[\AllowDynamicProperties]
class $className {}
PHP
);
/** @phpstan-var class-string */
$classNameWithNamespace = $namespace . '\\' . $className;
$instance = $this->instantiator->instantiate($classNameWithNamespace);
$instance->foo = 'bar';
$instance2 = $this->instantiator->instantiate($classNameWithNamespace);
self::assertObjectNotHasProperty('foo', $instance2);
}
/**
* Provides a list of instantiable classes (existing)
*
* @return string[][]
* @phpstan-return list<array{class-string}>
*/
public static function getInstantiableClasses(): array
{
return [
[stdClass::class],
[self::class],
[Instantiator::class],
[Exception::class],
[PharException::class],
[SimpleSerializableAsset::class],
[ExceptionAsset::class],
[FinalExceptionAsset::class],
[PharExceptionAsset::class],
[UnCloneableAsset::class],
[XMLReaderAsset::class],
[PharException::class],
[ArrayObject::class],
[ArrayObjectAsset::class],
[SerializableArrayObjectAsset::class],
[WakeUpNoticesAsset::class],
[UnserializeExceptionArrayObjectAsset::class],
[SerializableFinalInternalChildAsset::class],
];
}
/**
* Provides a list of instantiable classes (existing)
*
* @return Generator<string, array{string}>
*/
public static function getInvalidClassNames(): Generator
{
yield 'invalid string' => [self::class . str_replace('.', '', uniqid('', true))];
yield 'interface' => [InstantiatorInterface::class];
yield 'abstract class' => [AbstractClassAsset::class];
yield 'trait' => [SimpleTraitAsset::class];
yield 'enum' => [SimpleEnumAsset::class];
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTest/Exception/InvalidArgumentExceptionTest.php | tests/DoctrineTest/InstantiatorTest/Exception/InvalidArgumentExceptionTest.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTest\Exception;
use Doctrine\Instantiator\Exception\InvalidArgumentException;
use Doctrine\Instantiator\InstantiatorInterface;
use DoctrineTest\InstantiatorTestAsset\AbstractClassAsset;
use DoctrineTest\InstantiatorTestAsset\SimpleTraitAsset;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use function sprintf;
use function str_replace;
use function uniqid;
/**
* Tests for {@see \Doctrine\Instantiator\Exception\InvalidArgumentException}
*
* @covers \Doctrine\Instantiator\Exception\InvalidArgumentException
*/
class InvalidArgumentExceptionTest extends TestCase
{
public function testFromNonExistingTypeWithNonExistingClass(): void
{
$className = self::class . str_replace('.', '', uniqid('', true));
$exception = InvalidArgumentException::fromNonExistingClass($className);
self::assertSame('The provided class "' . $className . '" does not exist', $exception->getMessage());
}
public function testFromNonExistingTypeWithTrait(): void
{
$exception = InvalidArgumentException::fromNonExistingClass(SimpleTraitAsset::class);
self::assertSame(
sprintf('The provided type "%s" is a trait, and cannot be instantiated', SimpleTraitAsset::class),
$exception->getMessage(),
);
}
public function testFromNonExistingTypeWithInterface(): void
{
$exception = InvalidArgumentException::fromNonExistingClass(InstantiatorInterface::class);
self::assertSame(
sprintf(
'The provided type "%s" is an interface, and cannot be instantiated',
InstantiatorInterface::class,
),
$exception->getMessage(),
);
}
public function testFromAbstractClass(): void
{
$reflection = new ReflectionClass(AbstractClassAsset::class);
$exception = InvalidArgumentException::fromAbstractClass($reflection);
self::assertSame(
sprintf(
'The provided class "%s" is abstract, and cannot be instantiated',
AbstractClassAsset::class,
),
$exception->getMessage(),
);
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTest/Exception/UnexpectedValueExceptionTest.php | tests/DoctrineTest/InstantiatorTest/Exception/UnexpectedValueExceptionTest.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTest\Exception;
use Doctrine\Instantiator\Exception\UnexpectedValueException;
use DoctrineTest\InstantiatorTestAsset\AbstractClassAsset;
use Exception;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use function sprintf;
/**
* Tests for {@see \Doctrine\Instantiator\Exception\UnexpectedValueException}
*
* @covers \Doctrine\Instantiator\Exception\UnexpectedValueException
*/
class UnexpectedValueExceptionTest extends TestCase
{
public function testFromSerializationTriggeredException(): void
{
$reflectionClass = new ReflectionClass($this);
$previous = new Exception();
$exception = UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $previous);
self::assertSame($previous, $exception->getPrevious());
self::assertSame(
'An exception was raised while trying to instantiate an instance of "'
. self::class . '" via un-serialization',
$exception->getMessage(),
);
}
public function testFromUncleanUnSerialization(): void
{
$reflection = new ReflectionClass(AbstractClassAsset::class);
$exception = UnexpectedValueException::fromUncleanUnSerialization($reflection, 'foo', 123, 'bar', 456);
self::assertSame(
sprintf(
'Could not produce an instance of "%s" '
. 'via un-serialization, since an error was triggered in file "bar" at line "456"',
AbstractClassAsset::class,
),
$exception->getMessage(),
);
$previous = $exception->getPrevious();
self::assertInstanceOf(Exception::class, $previous);
self::assertSame('foo', $previous->getMessage());
self::assertSame(123, $previous->getCode());
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php | tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use Serializable;
/**
* Base serializable test asset
*/
class SimpleSerializableAsset implements Serializable
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
public function serialize(): string
{
return '';
}
/**
* {@inheritDoc}
*
* Should not be called
*
* @throws BadMethodCallException
*/
public function unserialize(string $serialized): void
{
throw new BadMethodCallException('Not supposed to be called!');
}
/** @return mixed[] */
public function __serialize(): array
{
return [];
}
/** @param mixed[] $data */
public function __unserialize(array $data): void
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/SerializableFinalInternalChildAsset.php | tests/DoctrineTest/InstantiatorTestAsset/SerializableFinalInternalChildAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayIterator;
/**
* @template TValue
* @template-extends ArrayIterator<int, TValue>
*/
final class SerializableFinalInternalChildAsset extends ArrayIterator
{
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/UnserializeExceptionArrayObjectAsset.php | tests/DoctrineTest/InstantiatorTestAsset/UnserializeExceptionArrayObjectAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use BadMethodCallException;
/**
* A simple asset for an abstract class
*
* @template TValue
* @template-extends ArrayObject<int, TValue>
*/
class UnserializeExceptionArrayObjectAsset extends ArrayObject
{
/**
* {@inheritDoc}
*/
public function __wakeup()
{
throw new BadMethodCallException();
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php | tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use BadMethodCallException;
use Serializable;
/**
* Serializable test asset that also extends an internal class
*
* @template TValue
* @template-extends ArrayObject<int, TValue>
*/
class SerializableArrayObjectAsset extends ArrayObject implements Serializable
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
/**
* {@inheritDoc}
*
* Should not be called
*
* @throws BadMethodCallException
*/
public function unserialize($serialized): void
{
throw new BadMethodCallException('Not supposed to be called!');
}
/** @param mixed[] $data */
public function __unserialize(array $data): void
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php | tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use Exception;
/**
* Test asset that extends an internal PHP base exception
*/
final class FinalExceptionAsset extends Exception
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php | tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use Exception;
/**
* Test asset that extends an internal PHP base exception
*/
class ExceptionAsset extends Exception
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php | tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use BadMethodCallException;
/**
* Test asset that extends an internal PHP class
*
* @template TValue
* @template-extends ArrayObject<int, TValue>
*/
class ArrayObjectAsset extends ArrayObject
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/WakeUpNoticesAsset.php | tests/DoctrineTest/InstantiatorTestAsset/WakeUpNoticesAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use function trigger_error;
/**
* A simple asset for an abstract class
*
* @template TValue
* @template-extends ArrayObject<int, TValue>
*/
class WakeUpNoticesAsset extends ArrayObject
{
/**
* Wakeup method called after un-serialization
*/
public function __wakeup(): void
{
trigger_error('Something went bananas while un-serializing this instance');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php | tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use PharException;
/**
* Test asset that extends an internal PHP class
* This class should be serializable without problems
* and without getting the "Erroneous data format for unserializing"
* error
*/
class PharExceptionAsset extends PharException
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php | tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use XMLReader;
/**
* Test asset that extends an internal PHP class
*/
class XMLReaderAsset extends XMLReader
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php | tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
/**
* A simple trait with no attached logic
*/
trait SimpleTraitAsset
{
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/SimpleEnumAsset.php | tests/DoctrineTest/InstantiatorTestAsset/SimpleEnumAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
enum SimpleEnumAsset
{
case Foo;
case Bar;
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php | tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
/**
* Base un-cloneable asset
*/
class UnCloneableAsset
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
/**
* Magic `__clone` - should not be invoked
*
* @throws BadMethodCallException
*/
public function __clone()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php | tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
/**
* A simple asset for an abstract class
*/
abstract class AbstractClassAsset
{
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php | tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use Phar;
/**
* Test asset that extends an internal PHP class
*/
class PharAsset extends Phar
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
doctrine/instantiator | https://github.com/doctrine/instantiator/blob/a64410ccca65b13a10bc364c3f59d9331beeaae6/tests/DoctrineTest/InstantiatorPerformance/InstantiatorPerformanceBench.php | tests/DoctrineTest/InstantiatorPerformance/InstantiatorPerformanceBench.php | <?php
declare(strict_types=1);
namespace DoctrineTest\InstantiatorPerformance;
use ArrayObject;
use Doctrine\Instantiator\Instantiator;
use DoctrineTest\InstantiatorTestAsset\SerializableArrayObjectAsset;
use DoctrineTest\InstantiatorTestAsset\SimpleSerializableAsset;
use DoctrineTest\InstantiatorTestAsset\UnCloneableAsset;
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
/**
* Performance tests for {@see \Doctrine\Instantiator\Instantiator}
*
* @BeforeMethods({"init"})
*/
class InstantiatorPerformanceBench
{
private Instantiator $instantiator;
public function init(): void
{
$this->instantiator = new Instantiator();
$this->instantiator->instantiate(self::class);
$this->instantiator->instantiate(ArrayObject::class);
$this->instantiator->instantiate(SimpleSerializableAsset::class);
$this->instantiator->instantiate(SerializableArrayObjectAsset::class);
$this->instantiator->instantiate(UnCloneableAsset::class);
}
/** @Revs(20000) */
public function benchInstantiateSelf(): void
{
$this->instantiator->instantiate(self::class);
}
/** @Revs(20000) */
public function benchInstantiateInternalClass(): void
{
$this->instantiator->instantiate(ArrayObject::class);
}
/** @Revs(20000) */
public function benchInstantiateSimpleSerializableAssetClass(): void
{
$this->instantiator->instantiate(SimpleSerializableAsset::class);
}
/** @Revs(20000) */
public function benchInstantiateSerializableArrayObjectAsset(): void
{
$this->instantiator->instantiate(SerializableArrayObjectAsset::class);
}
/** @Revs(20000) */
public function benchInstantiateUnCloneableAsset(): void
{
$this->instantiator->instantiate(UnCloneableAsset::class);
}
}
| php | MIT | a64410ccca65b13a10bc364c3f59d9331beeaae6 | 2026-01-04T15:05:29.173501Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/manage_bulk.php | scripts/manage_bulk.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage bulk jobs'));
$args->setSynopsis(<<<EOSYNOPSIS
**bulk** __command__ [__options__]
Manage and debug bulk jobs.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorBulkManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/__init_script__.php | scripts/__init_script__.php | <?php
require_once dirname(__FILE__).'/init/init-script.php';
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/util/add_macro.php | scripts/util/add_macro.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('load files as image macros'));
$args->setSynopsis(<<<EOHELP
**add_macro.php** __image__ [--as __name__]
Add an image macro. This can be useful for importing a large number
of macros.
EOHELP
);
$args->parseStandardArguments();
$args->parse(
array(
array(
'name' => 'as',
'param' => 'name',
'help' => pht(
'Use a specific name instead of the first part of the image name.'),
),
array(
'name' => 'more',
'wildcard' => true,
),
));
$more = $args->getArg('more');
if (count($more) !== 1) {
$args->printHelpAndExit();
}
$path = head($more);
$data = Filesystem::readFile($path);
$name = $args->getArg('as');
if ($name === null) {
$name = head(explode('.', basename($path)));
}
$existing = id(new PhabricatorFileImageMacro())->loadOneWhere(
'name = %s',
$name);
if ($existing) {
throw new Exception(pht("A macro already exists with the name '%s'!", $name));
}
$file = PhabricatorFile::newFromFileData(
$data,
array(
'name' => basename($path),
'canCDN' => true,
));
$macro = id(new PhabricatorFileImageMacro())
->setFilePHID($file->getPHID())
->setName($name)
->save();
$id = $file->getID();
echo pht("Added macro '%s' (%s).", $name, "F{$id}")."\n";
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/util/emit_test_event.php | scripts/util/emit_test_event.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('emit a test event'));
$args->setSynopsis(<<<EOHELP
**emit_test_event.php** [--listen listener] ...
Emit a test event after installing any specified __listener__s.
EOHELP
);
$args->parseStandardArguments();
$args->parse(
array(
array(
'name' => 'listen',
'param' => 'listener',
'repeat' => true,
),
));
$console = PhutilConsole::getConsole();
foreach ($args->getArg('listen') as $listener) {
$console->writeOut("%s\n", pht("Installing '%s'...", $listener));
newv($listener, array())->register();
}
$console->writeOut("%s\n", pht('Emitting event...'));
PhutilEventEngine::dispatchEvent(
new PhabricatorEvent(
PhabricatorEventType::TYPE_TEST_DIDRUNTEST,
array(
'time' => time(),
)));
$console->writeOut("%s\n", pht('Done.'));
exit(0);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/almanac/manage_almanac.php | scripts/almanac/manage_almanac.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage host directory'));
$args->setSynopsis(<<<EOSYNOPSIS
**almanac** __commmand__ [__options__]
Manage Almanac stuff. NEW AND EXPERIMENTAL.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('AlmanacManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/mail/mail_handler.php | scripts/mail/mail_handler.php | #!/usr/bin/env php
<?php
// NOTE: This script is very oldschool and takes the environment as an argument.
// Some day, we could take a shot at cleaning this up.
if ($argc > 1) {
foreach (array_slice($argv, 1) as $arg) {
if (!preg_match('/^-/', $arg)) {
$_SERVER['PHABRICATOR_ENV'] = $arg;
break;
}
}
}
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
require_once $root.'/externals/mimemailparser/MimeMailParser.class.php';
$args = new PhutilArgumentParser($argv);
$args->parseStandardArguments();
$args->parse(
array(
array(
'name' => 'process-duplicates',
'help' => pht(
"Process this message, even if it's a duplicate of another message. ".
"This is mostly useful when debugging issues with mail routing."),
),
array(
'name' => 'env',
'wildcard' => true,
),
));
$parser = new MimeMailParser();
$parser->setText(file_get_contents('php://stdin'));
$content = array();
foreach (array('text', 'html') as $part) {
$part_body = $parser->getMessageBody($part);
if (strlen($part_body) && !phutil_is_utf8($part_body)) {
$part_headers = $parser->getMessageBodyHeaders($part);
if (!is_array($part_headers)) {
$part_headers = array();
}
$content_type = idx($part_headers, 'content-type');
if (preg_match('/charset="(.*?)"/', $content_type, $matches) ||
preg_match('/charset=(\S+)/', $content_type, $matches)) {
$part_body = phutil_utf8_convert($part_body, 'UTF-8', $matches[1]);
}
}
$content[$part] = $part_body;
}
$headers = $parser->getHeaders();
$headers['subject'] = phutil_decode_mime_header($headers['subject']);
$headers['from'] = phutil_decode_mime_header($headers['from']);
if ($args->getArg('process-duplicates')) {
$headers['message-id'] = Filesystem::readRandomCharacters(64);
}
$received = new PhabricatorMetaMTAReceivedMail();
$received->setHeaders($headers);
$received->setBodies($content);
$attachments = array();
foreach ($parser->getAttachments() as $attachment) {
if (preg_match('@text/(plain|html)@', $attachment->getContentType()) &&
$attachment->getContentDisposition() == 'inline') {
// If this is an "inline" attachment with some sort of text content-type,
// do not treat it as a file for attachment. MimeMailParser already picked
// it up in the getMessageBody() call above. We still want to treat 'inline'
// attachments with other content types (e.g., images) as attachments.
continue;
}
$file = PhabricatorFile::newFromFileData(
$attachment->getContent(),
array(
'name' => $attachment->getFilename(),
'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
));
$attachments[] = $file->getPHID();
}
try {
$received->setAttachments($attachments);
$received->save();
$received->processReceivedMail();
} catch (Exception $e) {
$received
->setMessage(pht('EXCEPTION: %s', $e->getMessage()))
->save();
throw $e;
}
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/mail/manage_mail.php | scripts/mail/manage_mail.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage mail'));
$args->setSynopsis(<<<EOSYNOPSIS
**mail** __command__ [__options__]
Manage Phabricator mail stuff.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorMailManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/cache/manage_cache.php | scripts/cache/manage_cache.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage cache'));
$args->setSynopsis(<<<EOSYNOPSIS
**cache** __command__ [__options__]
Manage Phabricator caches.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorCacheManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/diviner/diviner.php | scripts/diviner/diviner.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('documentation generator'));
$args->setSynopsis(<<<EOHELP
**diviner** __command__ [__options__]
Generate documentation.
EOHELP
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('DivinerWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/ssh/ssh-connect.php | scripts/ssh/ssh-connect.php | #!/usr/bin/env php
<?php
// This is a wrapper script for Git, Mercurial, and Subversion. It primarily
// serves to inject "-o StrictHostKeyChecking=no" into the SSH arguments.
// In some cases, Subversion sends us SIGTERM. If we don't catch the signal and
// react to it, we won't run object destructors by default and thus won't clean
// up temporary files. Declare ticks so we can install a signal handler.
if (function_exists('pcntl_async_signals')) {
pcntl_async_signals(true);
} else {
declare(ticks = 1);
}
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
// Contrary to the documentation, Git may pass a "-p" flag. If it does, respect
// it and move it before the "--" argument.
$args = new PhutilArgumentParser($argv);
$args->parsePartial(
array(
array(
'name' => 'port',
'short' => 'p',
'param' => pht('port'),
'help' => pht('Port number to connect to.'),
),
array(
'name' => 'options',
'short' => 'o',
'param' => pht('options'),
'repeat' => true,
'help' => pht('SSH options.'),
),
));
$unconsumed_argv = $args->getUnconsumedArgumentVector();
if (function_exists('pcntl_signal')) {
pcntl_signal(SIGTERM, 'ssh_connect_signal');
}
function ssh_connect_signal($signo) {
// This is just letting destructors fire. In particular, we want to clean
// up any temporary files we wrote. See T10547.
exit(128 + $signo);
}
$pattern = array();
$arguments = array();
$pattern[] = 'ssh';
$pattern[] = '-o';
$pattern[] = 'StrictHostKeyChecking=no';
// This prevents "known host" failures, and covers for issues where HOME is set
// to something unusual.
$pattern[] = '-o';
$pattern[] = 'UserKnownHostsFile=/dev/null';
$as_device = getenv('PHABRICATOR_AS_DEVICE');
$credential_phid = getenv('PHABRICATOR_CREDENTIAL');
if ($as_device) {
$device = AlmanacKeys::getLiveDevice();
if (!$device) {
throw new Exception(
pht(
'Attempting to create an SSH connection that authenticates with '.
'the current device, but this host is not configured as a cluster '.
'device.'));
}
if ($credential_phid) {
throw new Exception(
pht(
'Attempting to proxy an SSH connection that authenticates with '.
'both the current device and a specific credential. These options '.
'are mutually exclusive.'));
}
}
if ($credential_phid) {
$viewer = PhabricatorUser::getOmnipotentUser();
$key = PassphraseSSHKey::loadFromPHID($credential_phid, $viewer);
$pattern[] = '-l %P';
$arguments[] = $key->getUsernameEnvelope();
$pattern[] = '-i %P';
$arguments[] = $key->getKeyfileEnvelope();
}
if ($as_device) {
$pattern[] = '-l %R';
$arguments[] = AlmanacKeys::getClusterSSHUser();
$pattern[] = '-i %R';
$arguments[] = AlmanacKeys::getKeyPath('device.key');
}
// Subversion passes us a host in the form "domain.com:port", which is not
// valid for normal SSH but which we can parse into a valid "-p" flag.
$passthru_args = $unconsumed_argv;
$host = array_shift($passthru_args);
$parts = explode(':', $host, 2);
$host = $parts[0];
$port = $args->getArg('port');
if (!$port) {
if (count($parts) == 2) {
$port = $parts[1];
}
}
if ($port) {
$pattern[] = '-p %d';
$arguments[] = $port;
}
$options = $args->getArg('options');
$allowed_ssh_options = array('SendEnv=GIT_PROTOCOL');
if (!empty($options)) {
foreach ($options as $option) {
if (array_search($option, $allowed_ssh_options) !== false) {
$pattern[] = '-o %s';
$arguments[] = $option;
} else {
throw new Exception(
pht(
'Disallowed ssh option "%s" given with "-o". '.
'Allowed options are: %s.',
$option,
implode(', ', $allowed_ssh_options)));
}
}
}
$pattern[] = '--';
$pattern[] = '%s';
$arguments[] = $host;
foreach ($passthru_args as $passthru_arg) {
$pattern[] = '%s';
$arguments[] = $passthru_arg;
}
$pattern = implode(' ', $pattern);
array_unshift($arguments, $pattern);
$err = newv('PhutilExecPassthru', $arguments)
->resolve();
exit($err);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/ssh/ssh-auth.php | scripts/ssh/ssh-auth.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/init/init-script.php';
$error_log = id(new PhutilErrorLog())
->setLogName(pht('SSH Error Log'))
->setLogPath(PhabricatorEnv::getEnvConfig('log.ssh-error.path'))
->activateLog();
// TODO: For now, this is using "parseParital()", not "parse()". This allows
// the script to accept (and ignore) additional arguments. This preserves
// backward compatibility until installs have time to migrate to the new
// syntax.
$args = id(new PhutilArgumentParser($argv))
->parsePartial(
array(
array(
'name' => 'sshd-key',
'param' => 'k',
'help' => pht(
'Accepts the "%%k" parameter from "AuthorizedKeysCommand".'),
),
));
$sshd_key = $args->getArg('sshd-key');
// NOTE: We are caching a datastructure rather than the flat key file because
// the path on disk to "ssh-exec" is arbitrarily mutable at runtime. See T12397.
$cache = PhabricatorCaches::getMutableCache();
$authstruct_key = PhabricatorAuthSSHKeyQuery::AUTHSTRUCT_CACHEKEY;
$authstruct_raw = $cache->getKey($authstruct_key);
$authstruct = null;
if ($authstruct_raw !== null && strlen($authstruct_raw)) {
try {
$authstruct = phutil_json_decode($authstruct_raw);
} catch (Exception $ex) {
// Ignore any issues with the cached data; we'll just rebuild the
// structure below.
}
}
if ($authstruct === null) {
$keys = id(new PhabricatorAuthSSHKeyQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withIsActive(true)
->execute();
if (!$keys) {
echo pht('No keys found.')."\n";
exit(1);
}
$key_list = array();
foreach ($keys as $ssh_key) {
$key_argv = array();
$object = $ssh_key->getObject();
if ($object instanceof PhabricatorUser) {
$key_argv[] = '--phabricator-ssh-user';
$key_argv[] = $object->getUsername();
} else if ($object instanceof AlmanacDevice) {
if (!$ssh_key->getIsTrusted()) {
// If this key is not a trusted device key, don't allow SSH
// authentication.
continue;
}
$key_argv[] = '--phabricator-ssh-device';
$key_argv[] = $object->getName();
} else {
// We don't know what sort of key this is; don't permit SSH auth.
continue;
}
$key_argv[] = '--phabricator-ssh-key';
$key_argv[] = $ssh_key->getID();
// Strip out newlines and other nonsense from the key type and key body.
$type = $ssh_key->getKeyType();
$type = preg_replace('@[\x00-\x20]+@', '', $type);
if (!strlen($type)) {
continue;
}
$key = $ssh_key->getKeyBody();
$key = preg_replace('@[\x00-\x20]+@', '', $key);
if (!strlen($key)) {
continue;
}
$key_list[] = array(
'argv' => $key_argv,
'type' => $type,
'key' => $key,
);
}
$authstruct = array(
'keys' => $key_list,
);
$authstruct_raw = phutil_json_encode($authstruct);
$ttl = phutil_units('24 hours in seconds');
$cache->setKey($authstruct_key, $authstruct_raw, $ttl);
}
// If we've received an "--sshd-key" argument and it matches some known key,
// only emit that key. (For now, if the key doesn't match, we'll fall back to
// emitting all keys.)
if ($sshd_key !== null) {
$matches = array();
foreach ($authstruct['keys'] as $key => $key_struct) {
if ($key_struct['key'] === $sshd_key) {
$matches[$key] = $key_struct;
}
}
if ($matches) {
$authstruct['keys'] = $matches;
}
}
$bin = $root.'/bin/ssh-exec';
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
$lines = array();
foreach ($authstruct['keys'] as $key_struct) {
$key_argv = $key_struct['argv'];
$key = $key_struct['key'];
$type = $key_struct['type'];
$cmd = csprintf('%s %Ls', $bin, $key_argv);
if ($instance !== null && strlen($instance)) {
$cmd = csprintf('PHABRICATOR_INSTANCE=%s %C', $instance, $cmd);
}
// This is additional escaping for the SSH 'command="..."' string.
$cmd = addcslashes($cmd, '"\\');
$options = array(
'command="'.$cmd.'"',
'no-port-forwarding',
'no-X11-forwarding',
'no-agent-forwarding',
'no-pty',
);
$options = implode(',', $options);
$lines[] = $options.' '.$type.' '.$key."\n";
}
$authfile = implode('', $lines);
echo $authfile;
exit(0);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/ssh/ssh-exec.php | scripts/ssh/ssh-exec.php | #!/usr/bin/env php
<?php
$ssh_start_time = microtime(true);
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/init/init-script.php';
$error_log = id(new PhutilErrorLog())
->setLogName(pht('SSH Error Log'))
->setLogPath(PhabricatorEnv::getEnvConfig('log.ssh-error.path'))
->activateLog();
$ssh_log = PhabricatorSSHLog::getLog();
$request_identifier = Filesystem::readRandomCharacters(12);
$ssh_log->setData(
array(
'Q' => $request_identifier,
));
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('execute SSH requests'));
$args->setSynopsis(<<<EOSYNOPSIS
**ssh-exec** --phabricator-ssh-user __user__ [--ssh-command __commmand__]
**ssh-exec** --phabricator-ssh-device __device__ [--ssh-command __commmand__]
Execute authenticated SSH requests. This script is normally invoked
via SSHD, but can be invoked manually for testing.
EOSYNOPSIS
);
$args->parseStandardArguments();
$args->parse(
array(
array(
'name' => 'phabricator-ssh-user',
'param' => 'username',
'help' => pht(
'If the request authenticated with a user key, the name of the '.
'user.'),
),
array(
'name' => 'phabricator-ssh-device',
'param' => 'name',
'help' => pht(
'If the request authenticated with a device key, the name of the '.
'device.'),
),
array(
'name' => 'phabricator-ssh-key',
'param' => 'id',
'help' => pht(
'The ID of the SSH key which authenticated this request. This is '.
'used to allow logs to report when specific keys were used, to make '.
'it easier to manage credentials.'),
),
array(
'name' => 'ssh-command',
'param' => 'command',
'help' => pht(
'Provide a command to execute. This makes testing this script '.
'easier. When running normally, the command is read from the '.
'environment (%s), which is populated by sshd.',
'SSH_ORIGINAL_COMMAND'),
),
));
try {
$remote_address = null;
$ssh_client = getenv('SSH_CLIENT');
if ($ssh_client) {
// This has the format "<ip> <remote-port> <local-port>". Grab the IP.
$remote_address = head(explode(' ', $ssh_client));
$ssh_log->setData(
array(
'r' => $remote_address,
));
}
$key_id = $args->getArg('phabricator-ssh-key');
if ($key_id) {
$ssh_log->setData(
array(
'k' => $key_id,
));
}
$user_name = $args->getArg('phabricator-ssh-user');
$device_name = $args->getArg('phabricator-ssh-device');
$user = null;
$device = null;
$is_cluster_request = false;
if ($user_name && $device_name) {
throw new Exception(
pht(
'The %s and %s flags are mutually exclusive. You can not '.
'authenticate as both a user ("%s") and a device ("%s"). '.
'Specify one or the other, but not both.',
'--phabricator-ssh-user',
'--phabricator-ssh-device',
$user_name,
$device_name));
} else if ($user_name !== null && strlen($user_name)) {
$user = id(new PhabricatorPeopleQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withUsernames(array($user_name))
->executeOne();
if (!$user) {
throw new Exception(
pht(
'Invalid username ("%s"). There is no user with this username.',
$user_name));
}
id(new PhabricatorAuthSessionEngine())
->willServeRequestForUser($user);
} else if ($device_name !== null && strlen($device_name)) {
if (!$remote_address) {
throw new Exception(
pht(
'Unable to identify remote address from the %s environment '.
'variable. Device authentication is accepted only from trusted '.
'sources.',
'SSH_CLIENT'));
}
if (!PhabricatorEnv::isClusterAddress($remote_address)) {
throw new Exception(
pht(
'This request originates from outside of the cluster address range. '.
'Requests signed with a trusted device key must originate from '.
'trusted hosts.'));
}
$device = id(new AlmanacDeviceQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withNames(array($device_name))
->executeOne();
if (!$device) {
throw new Exception(
pht(
'Invalid device name ("%s"). There is no device with this name.',
$device_name));
}
if ($device->isDisabled()) {
throw new Exception(
pht(
'This request has authenticated as a device ("%s"), but this '.
'device is disabled.',
$device->getName()));
}
// We're authenticated as a device, but we're going to read the user out of
// the command below.
$is_cluster_request = true;
} else {
throw new Exception(
pht(
'This script must be invoked with either the %s or %s flag.',
'--phabricator-ssh-user',
'--phabricator-ssh-device'));
}
if ($args->getArg('ssh-command')) {
$original_command = $args->getArg('ssh-command');
} else {
$original_command = getenv('SSH_ORIGINAL_COMMAND');
}
$original_argv = id(new PhutilShellLexer())
->splitArguments($original_command);
if ($device) {
// If we're authenticating as a device, the first argument may be a
// "@username" argument to act as a particular user.
$first_argument = head($original_argv);
if (preg_match('/^@/', $first_argument)) {
$act_as_name = array_shift($original_argv);
$act_as_name = substr($act_as_name, 1);
$user = id(new PhabricatorPeopleQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withUsernames(array($act_as_name))
->executeOne();
if (!$user) {
throw new Exception(
pht(
'Device request identifies an acting user with an invalid '.
'username ("%s"). There is no user with this username.',
$act_as_name));
}
} else {
$user = PhabricatorUser::getOmnipotentUser();
}
}
if ($user->isOmnipotent()) {
$user_name = 'device/'.$device->getName();
} else {
$user_name = $user->getUsername();
}
$ssh_log->setData(
array(
'u' => $user_name,
'P' => $user->getPHID(),
));
if (!$device) {
if (!$user->canEstablishSSHSessions()) {
throw new Exception(
pht(
'Your account ("%s") does not have permission to establish SSH '.
'sessions. Visit the web interface for more information.',
$user_name));
}
}
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorSSHWorkflow')
->setUniqueMethod('getName')
->execute();
$command_list = array_keys($workflows);
$command_list = implode(', ', $command_list);
$error_lines = array();
$error_lines[] = pht(
'Welcome to %s.',
PlatformSymbols::getPlatformServerName());
$error_lines[] = pht(
'You are logged in as %s.',
$user_name);
if (!$original_argv) {
$error_lines[] = pht(
'You have not specified a command to run. This means you are requesting '.
'an interactive shell, but this server does not provide interactive '.
'shells over SSH.');
$error_lines[] = pht(
'(Usually, you should run a command like "git clone" or "hg push" '.
'instead of connecting directly with SSH.)');
$error_lines[] = pht(
'Supported commands are: %s.',
$command_list);
$error_lines = implode("\n\n", $error_lines);
throw new PhutilArgumentUsageException($error_lines);
}
$log_argv = implode(' ', $original_argv);
$log_argv = id(new PhutilUTF8StringTruncator())
->setMaximumCodepoints(128)
->truncateString($log_argv);
$ssh_log->setData(
array(
'C' => $original_argv[0],
'U' => $log_argv,
));
$command = head($original_argv);
$parseable_argv = $original_argv;
array_unshift($parseable_argv, 'phabricator-ssh-exec');
$parsed_args = new PhutilArgumentParser($parseable_argv);
if (empty($workflows[$command])) {
$error_lines[] = pht(
'You have specified the command "%s", but that command is not '.
'supported by this server. As received by this server, your entire '.
'argument list was:',
$command);
$error_lines[] = csprintf(' $ ssh ... -- %Ls', $parseable_argv);
$error_lines[] = pht(
'Supported commands are: %s.',
$command_list);
$error_lines = implode("\n\n", $error_lines);
throw new PhutilArgumentUsageException($error_lines);
}
$workflow = $parsed_args->parseWorkflows($workflows);
$workflow->setSSHUser($user);
$workflow->setOriginalArguments($original_argv);
$workflow->setIsClusterRequest($is_cluster_request);
$workflow->setRequestIdentifier($request_identifier);
$sock_stdin = fopen('php://stdin', 'r');
if (!$sock_stdin) {
throw new Exception(pht('Unable to open stdin.'));
}
$sock_stdout = fopen('php://stdout', 'w');
if (!$sock_stdout) {
throw new Exception(pht('Unable to open stdout.'));
}
$sock_stderr = fopen('php://stderr', 'w');
if (!$sock_stderr) {
throw new Exception(pht('Unable to open stderr.'));
}
$socket_channel = new PhutilSocketChannel(
$sock_stdin,
$sock_stdout);
$error_channel = new PhutilSocketChannel(null, $sock_stderr);
$metrics_channel = new PhutilMetricsChannel($socket_channel);
$workflow->setIOChannel($metrics_channel);
$workflow->setErrorChannel($error_channel);
$rethrow = null;
try {
$err = $workflow->execute($parsed_args);
$metrics_channel->flush();
$error_channel->flush();
} catch (Exception $ex) {
$rethrow = $ex;
}
// Always write this if we got as far as building a metrics channel.
$ssh_log->setData(
array(
'i' => $metrics_channel->getBytesRead(),
'o' => $metrics_channel->getBytesWritten(),
));
if ($rethrow) {
throw $rethrow;
}
} catch (Exception $ex) {
fwrite(STDERR, "phabricator-ssh-exec: ".$ex->getMessage()."\n");
$err = 1;
}
$ssh_log->setData(
array(
'c' => $err,
'T' => phutil_microseconds_since($ssh_start_time),
));
exit($err);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/drydock/drydock_control.php | scripts/drydock/drydock_control.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/init/init-script-with-signals.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage drydock software resources'));
$args->setSynopsis(<<<EOSYNOPSIS
**drydock** __commmand__ [__options__]
Manage Drydock stuff. NEW AND EXPERIMENTAL.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('DrydockManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/files/manage_files.php | scripts/files/manage_files.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage files'));
$args->setSynopsis(<<<EOSYNOPSIS
**files** __command__ [__options__]
Manage Phabricator file storage.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFilesManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/repository/commit_hook.php | scripts/repository/commit_hook.php | #!/usr/bin/env php
<?php
// NOTE: This script will sometimes emit a warning like this on startup:
//
// No entry for terminal type "unknown";
// using dumb terminal settings.
//
// This can be fixed by adding "TERM=dumb" to the shebang line, but doing so
// causes some systems to hang mysteriously. See T7119.
// Commit hooks execute in an unusual context where the environment may be
// unavailable, particularly in SVN. The first parameter to this script is
// either a bare repository identifier ("X"), or a repository identifier
// followed by an instance identifier ("X:instance"). If we have an instance
// identifier, unpack it into the environment before we start up. This allows
// subclasses of PhabricatorConfigSiteSource to read it and build an instance
// environment.
$hook_start = microtime(true);
if ($argc > 1) {
$context = $argv[1];
$context = explode(':', $context, 2);
$argv[1] = $context[0];
if (count($context) > 1) {
$_ENV['PHABRICATOR_INSTANCE'] = $context[1];
putenv('PHABRICATOR_INSTANCE='.$context[1]);
}
}
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
if ($argc < 2) {
throw new Exception(pht('usage: commit-hook <repository>'));
}
$engine = id(new DiffusionCommitHookEngine())
->setStartTime($hook_start);
$repository = id(new PhabricatorRepositoryQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withIdentifiers(array($argv[1]))
->needProjectPHIDs(true)
->executeOne();
if (!$repository) {
throw new Exception(pht('No such repository "%s"!', $argv[1]));
}
if (!$repository->isHosted()) {
// In Mercurial, the "pretxnchangegroup" hook fires for both pulls and
// pushes. Normally we only install the hook for hosted repositories, but
// if a hosted repository is later converted into an observed repository we
// can end up with an observed repository that has the hook installed.
// If we're running hooks from an observed repository, just exit without
// taking action. For more discussion, see PHI24.
return 0;
}
$engine->setRepository($repository);
$args = new PhutilArgumentParser($argv);
$args->parsePartial(
array(
array(
'name' => 'hook-mode',
'param' => 'mode',
'help' => pht('Hook execution mode.'),
),
));
$argv = array_merge(
array($argv[0]),
$args->getUnconsumedArgumentVector());
// Figure out which user is writing the commit.
$hook_mode = $args->getArg('hook-mode');
if ($hook_mode !== null) {
$known_modes = array(
'svn-revprop' => true,
);
if (empty($known_modes[$hook_mode])) {
throw new Exception(
pht(
'Invalid Hook Mode: This hook was invoked in "%s" mode, but this '.
'is not a recognized hook mode. Valid modes are: %s.',
$hook_mode,
implode(', ', array_keys($known_modes))));
}
}
$is_svnrevprop = ($hook_mode == 'svn-revprop');
if ($is_svnrevprop) {
// For now, we let these through if the repository allows dangerous changes
// and prevent them if it doesn't. See T11208 for discussion.
$revprop_key = $argv[5];
if ($repository->shouldAllowDangerousChanges()) {
$err = 0;
} else {
$err = 1;
$console = PhutilConsole::getConsole();
$console->writeErr(
pht(
"DANGEROUS CHANGE: Dangerous change protection is enabled for this ".
"repository, so you can not change revision properties (you are ".
"attempting to edit \"%s\").\n".
"Edit the repository configuration before making dangerous changes.",
$revprop_key));
}
exit($err);
} else if ($repository->isGit() || $repository->isHg()) {
$username = getenv(DiffusionCommitHookEngine::ENV_USER);
if ($username === null || !strlen($username)) {
throw new Exception(
pht(
'No Direct Pushes: You are pushing directly to a hosted repository. '.
'This will not work. See "No Direct Pushes" in the documentation '.
'for more information.'));
}
if ($repository->isHg()) {
// We respond to several different hooks in Mercurial.
$engine->setMercurialHook($argv[2]);
}
} else if ($repository->isSVN()) {
// NOTE: In Subversion, the entire environment gets wiped so we can't read
// DiffusionCommitHookEngine::ENV_USER. Instead, we've set "--tunnel-user" to
// specify the correct user; read this user out of the commit log.
if ($argc < 4) {
throw new Exception(pht('usage: commit-hook <repository> <repo> <txn>'));
}
$svn_repo = $argv[2];
$svn_txn = $argv[3];
list($username) = execx('svnlook author -t %s %s', $svn_txn, $svn_repo);
$username = rtrim($username, "\n");
$engine->setSubversionTransactionInfo($svn_txn, $svn_repo);
} else {
throw new Exception(pht('Unknown repository type.'));
}
$user = id(new PhabricatorPeopleQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withUsernames(array($username))
->executeOne();
if (!$user) {
throw new Exception(pht('No such user "%s"!', $username));
}
$engine->setViewer($user);
// Read stdin for the hook engine.
if ($repository->isHg()) {
// Mercurial leaves stdin open, so we can't just read it until EOF.
$stdin = '';
} else {
// Git and Subversion write data into stdin and then close it. Read the
// data.
$stdin = @file_get_contents('php://stdin');
if ($stdin === false) {
throw new Exception(pht('Failed to read stdin!'));
}
}
$engine->setStdin($stdin);
$engine->setOriginalArgv(array_slice($argv, 2));
$remote_address = getenv(DiffusionCommitHookEngine::ENV_REMOTE_ADDRESS);
if ($remote_address !== false && strlen($remote_address)) {
$engine->setRemoteAddress($remote_address);
}
$remote_protocol = getenv(DiffusionCommitHookEngine::ENV_REMOTE_PROTOCOL);
if ($remote_protocol !== false && strlen($remote_protocol)) {
$engine->setRemoteProtocol($remote_protocol);
}
$request_identifier = getenv(DiffusionCommitHookEngine::ENV_REQUEST);
if ($request_identifier !== false && strlen($request_identifier)) {
$engine->setRequestIdentifier($request_identifier);
}
try {
$err = $engine->execute();
} catch (DiffusionCommitHookRejectException $ex) {
$console = PhutilConsole::getConsole();
if (PhabricatorEnv::getEnvConfig('phabricator.serious-business')) {
$preamble = pht('*** PUSH REJECTED BY COMMIT HOOK ***');
} else {
$preamble = pht(<<<EOTXT
+---------------------------------------------------------------+
| * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * |
+---------------------------------------------------------------+
\
\ ^ /^
\ / \ // \
\ |\___/| / \// .\
\ /V V \__ / // | \ \ *----*
/ / \/_/ // | \ \ \ |
@___@` \/_ // | \ \ \/\ \
0/0/| \/_ // | \ \ \ \
0/0/0/0/| \/// | \ \ | |
0/0/0/0/0/_|_ / ( // | \ _\ | /
0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / /
,-} _ *-.|.-~-. .~ ~
* \__/ `/\ / ~-. _ .-~ /
\____(Oo) *. } { /
( (..) .----~-.\ \-` .~
//___\\\\ \ DENIED! ///.----..< \ _ -~
// \\\\ ///-._ _ _ _ _ _ _{^ - - - - ~
EOTXT
);
}
$console->writeErr("%s\n\n", $preamble);
$console->writeErr("%s\n\n", $ex->getMessage());
$err = 1;
}
exit($err);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/repository/manage_repositories.php | scripts/repository/manage_repositories.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage repositories'));
$args->setSynopsis(<<<EOSYNOPSIS
**repository** __command__ [__options__]
Manage and debug Phabricator repository configuration, tracking,
discovery and import.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorRepositoryManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/repository/save_lint.php | scripts/repository/save_lint.php | #!/usr/bin/env php
<?php
require_once dirname(__FILE__).'/../__init_script__.php';
$synopsis = <<<EOT
**save_lint.php**
Discover lint problems and save them to database so that they can
be displayed in Diffusion.
EOT;
$args = id(new PhutilArgumentParser($argv))
->setTagline(pht('save lint errors to database'))
->setSynopsis($synopsis)
->parseStandardArguments()
->parse(array(
array(
'name' => 'all',
'help' => pht(
'Discover problems in the whole repository instead of just changes '.
'since the last run.'),
),
array(
'name' => 'arc',
'param' => 'path',
'default' => 'arc',
'help' => pht('Path to Arcanist executable.'),
),
array(
'name' => 'severity',
'param' => 'string',
'default' => ArcanistLintSeverity::SEVERITY_ADVICE,
'help' => pht(
'Minimum severity, one of %s constants.',
'ArcanistLintSeverity'),
),
array(
'name' => 'chunk-size',
'param' => 'number',
'default' => 256,
'help' => pht('Number of paths passed to `%s` at once.', 'arc'),
),
array(
'name' => 'blame',
'help' => pht(
'Assign lint errors to authors who last modified the line.'),
),
));
echo pht('Saving lint errors to database...')."\n";
$count = id(new DiffusionLintSaveRunner())
->setAll($args->getArg('all', false))
->setArc($args->getArg('arc'))
->setSeverity($args->getArg('severity'))
->setChunkSize($args->getArg('chunk-size'))
->setNeedsBlame($args->getArg('blame'))
->run('.');
echo "\n".pht('Processed %d files.', $count)."\n";
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/fact/manage_facts.php | scripts/fact/manage_facts.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage fact configuration'));
$args->setSynopsis(<<<EOSYNOPSIS
**fact** __command__ [__options__]
Manage and debug Phabricator data extraction, storage and
configuration used to compute statistics.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorFactManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/lipsum/manage_lipsum.php | scripts/lipsum/manage_lipsum.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('synthetic data generator'));
$args->setSynopsis(<<<EOSYNOPSIS
**lipsum** __command__ [__options__]
Generate synthetic test data to make development easier.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorLipsumManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/setup/manage_calendar.php | scripts/setup/manage_calendar.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage Calendar'));
$args->setSynopsis(<<<EOSYNOPSIS
**calendar** __command__ [__options__]
Manage Calendar.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorCalendarManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/setup/manage_celerity.php | scripts/setup/manage_celerity.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/init/init-setup.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage celerity'));
$args->setSynopsis(<<<EOSYNOPSIS
**celerity** __command__ [__options__]
Manage static resources.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('CelerityManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
phacility/phabricator | https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/scripts/setup/manage_bulk.php | scripts/setup/manage_bulk.php | #!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage bulk jobs'));
$args->setSynopsis(<<<EOSYNOPSIS
**bulk** __command__ [__options__]
Manage and debug bulk jobs.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorBulkManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);
| php | Apache-2.0 | 5720a38cfe95b00ca4be5016dd0d2f3195f4fa04 | 2026-01-04T15:03:23.651835Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.