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 |
|---|---|---|---|---|---|---|---|---|
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/MenuPanel/AbstractMenuPanel.php | src/MenuPanel/AbstractMenuPanel.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\MenuPanel;
use Datlechin\FilamentMenuBuilder\Contracts\MenuPanel;
abstract class AbstractMenuPanel implements MenuPanel
{
protected string $name;
protected int $sort = 999;
protected ?string $description = null;
protected ?string $icon = null;
protected bool $collapsible = true;
protected bool $collapsed = false;
protected bool $paginated = false;
protected int $perPage = 5;
public function __construct(string $name)
{
$this->name = $name;
}
public static function make(string $name = 'Static Menu'): static
{
return new static($name);
}
public function getIdentifier(): string
{
return str($this->getName())
->slug()
->toString();
}
public function sort(int $sort): static
{
$this->sort = $sort;
return $this;
}
public function getSort(): int
{
return $this->sort;
}
public function description(string $description): static
{
$this->description = $description;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function icon(string $icon): static
{
$this->icon = $icon;
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function collapsible(bool $collapsible = true): static
{
$this->collapsible = $collapsible;
return $this;
}
public function isCollapsible(): bool
{
return $this->collapsible;
}
public function collapsed(bool $collapsed = true): static
{
$this->collapsed = $collapsed;
return $this;
}
public function isCollapsed(): bool
{
return $this->collapsed;
}
public function paginate(int $perPage = 5, bool $condition = true): static
{
$this->perPage = $perPage;
$this->paginated = $condition;
return $this;
}
public function isPaginated(): bool
{
return $this->paginated;
}
public function getPerPage(): int
{
return $this->perPage;
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/MenuPanel/StaticMenuPanel.php | src/MenuPanel/StaticMenuPanel.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\MenuPanel;
use Closure;
class StaticMenuPanel extends AbstractMenuPanel
{
protected array $items = [];
public function add(string $title, Closure | string $url): static
{
$this->items[] = [
'title' => $title,
'url' => $url,
];
return $this;
}
public function addMany(array $items): static
{
foreach ($items as $title => $url) {
$this->add($title, $url);
}
return $this;
}
public function getItems(): array
{
return $this->items;
}
public function getName(): string
{
return $this->name;
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Services/MenuItemService.php | src/Services/MenuItemService.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Services;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class MenuItemService
{
public function __construct(
protected FilamentMenuBuilderPlugin $plugin = new FilamentMenuBuilderPlugin,
) {
$this->plugin = FilamentMenuBuilderPlugin::get();
}
public function findById(int $id): ?Model
{
return $this->getModel()::query()->find($id);
}
public function findByIdWithRelations(int $id): ?Model
{
return $this->getModel()::query()
->where('id', $id)
->with('linkable')
->first();
}
public function updateOrder(array $order, ?string $parentId = null): void
{
if (empty($order)) {
return;
}
$this->getModel()::query()
->whereIn('id', $order)
->update([
'order' => DB::raw(
'case ' . collect($order)
->map(
fn ($recordKey, int $recordIndex): string => 'when id = ' . DB::getPdo()->quote($recordKey) . ' then ' . ($recordIndex + 1),
)
->implode(' ') . ' end',
),
'parent_id' => $parentId,
]);
}
public function getPreviousSibling(Model $item): ?Model
{
return $this->getModel()::query()
->where('menu_id', $item->menu_id)
->where('parent_id', $item->parent_id)
->where('order', '<', $item->order)
->orderByDesc('order')
->first();
}
public function getMaxOrderForParent(?int $parentId, ?int $menuId = null): int
{
$query = $this->getModel()::query()->where('parent_id', $parentId);
if ($menuId) {
$query->where('menu_id', $menuId);
}
return $query->max('order') ?? 0;
}
public function getSiblings(?int $parentId): Collection
{
return $this->getModel()::query()
->where('parent_id', $parentId)
->orderBy('order')
->get();
}
public function reorderSiblings(?int $parentId): void
{
$siblings = $this->getSiblings($parentId);
$siblings->each(function ($sibling, $index) {
$sibling->update(['order' => $index + 1]);
});
}
public function indent(int $itemId): bool
{
$item = $this->findById($itemId);
if (! $item) {
return false;
}
$previousSibling = $this->getPreviousSibling($item);
if (! $previousSibling) {
return false;
}
$maxOrder = $this->getMaxOrderForParent($previousSibling->id);
$originalParentId = $item->getOriginal('parent_id');
$item->update([
'parent_id' => $previousSibling->id,
'order' => $maxOrder + 1,
]);
$this->reorderSiblings($originalParentId);
return true;
}
public function unindent(int $itemId): bool
{
$item = $this->findById($itemId);
if (! $item || ! $item->parent_id) {
return false;
}
$parent = $item->parent;
if (! $parent) {
return false;
}
$maxOrder = $this->getMaxOrderForParent($parent->parent_id, $item->menu_id);
$oldParentId = $item->parent_id;
$item->update([
'parent_id' => $parent->parent_id,
'order' => $maxOrder + 1,
]);
$this->reorderSiblings($oldParentId);
return true;
}
public function canIndent(int $itemId): bool
{
$item = $this->findById($itemId);
if (! $item) {
return false;
}
return $this->getPreviousSibling($item) !== null;
}
public function canUnindent(int $itemId): bool
{
$item = $this->findById($itemId);
return $item && $item->parent_id !== null;
}
public function delete(int $itemId): bool
{
$item = $this->findById($itemId);
if (! $item) {
return false;
}
return $item->delete();
}
public function update(int $itemId, array $data): bool
{
return $this->getModel()::query()
->where('id', $itemId)
->update($data) > 0;
}
protected function getModel(): string
{
return $this->plugin->getMenuItemModel();
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Contracts/MenuPanelable.php | src/Contracts/MenuPanelable.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Contracts;
interface MenuPanelable
{
public function getMenuPanelName(): string;
public function getMenuPanelTitleColumn(): string;
public function getMenuPanelUrlUsing(): callable;
public function getMenuPanelModifyQueryUsing(): callable;
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Contracts/MenuPanel.php | src/Contracts/MenuPanel.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Contracts;
interface MenuPanel
{
public function getIdentifier(): string;
public function getName(): string;
public function getItems(): array;
public function getSort(): int;
public function getDescription(): ?string;
public function getIcon(): ?string;
public function isCollapsible(): bool;
public function isCollapsed(): bool;
public function isPaginated(): bool;
public function getPerPage(): int;
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Enums/LinkTarget.php | src/Enums/LinkTarget.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Enums;
use Filament\Support\Contracts\HasLabel;
enum LinkTarget: string implements HasLabel
{
case Self = '_self';
case Blank = '_blank';
case Parent = '_parent';
case Top = '_top';
public function getLabel(): ?string
{
return match ($this) {
self::Self => __('filament-menu-builder::menu-builder.open_in.options.self'),
self::Blank => __('filament-menu-builder::menu-builder.open_in.options.blank'),
self::Parent => __('filament-menu-builder::menu-builder.open_in.options.parent'),
self::Top => __('filament-menu-builder::menu-builder.open_in.options.top'),
};
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Concerns/ManagesMenuItemHierarchy.php | src/Concerns/ManagesMenuItemHierarchy.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Concerns;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Datlechin\FilamentMenuBuilder\Services\MenuItemService;
use Filament\Actions\Action;
use Filament\Support\Enums\ActionSize;
trait ManagesMenuItemHierarchy
{
protected ?MenuItemService $menuItemService = null;
public function indent(int $itemId): void
{
$this->getMenuItemService()->indent($itemId);
}
public function unindent(int $itemId): void
{
$this->getMenuItemService()->unindent($itemId);
}
public function canIndent(int $itemId): bool
{
return $this->getMenuItemService()->canIndent($itemId);
}
public function canUnindent(int $itemId): bool
{
return $this->getMenuItemService()->canUnindent($itemId);
}
public function indentAction(): Action
{
return Action::make('indent')
->label(__('filament-menu-builder::menu-builder.actions.indent'))
->icon('heroicon-o-arrow-right')
->color('gray')
->iconButton()
->size(ActionSize::Small)
->action(fn (array $arguments) => $this->indent($arguments['id']))
->visible(fn (array $arguments): bool => $this->isIndentActionVisible($arguments['id']));
}
public function unindentAction(): Action
{
return Action::make('unindent')
->label(__('filament-menu-builder::menu-builder.actions.unindent'))
->icon('heroicon-o-arrow-left')
->color('gray')
->iconButton()
->size(ActionSize::Small)
->action(fn (array $arguments) => $this->unindent($arguments['id']))
->visible(fn (array $arguments): bool => $this->isUnindentActionVisible($arguments['id']));
}
protected function isIndentActionVisible(int $itemId): bool
{
return FilamentMenuBuilderPlugin::get()->isIndentActionsEnabled() &&
$this->canIndent($itemId);
}
protected function isUnindentActionVisible(int $itemId): bool
{
return FilamentMenuBuilderPlugin::get()->isIndentActionsEnabled() &&
$this->canUnindent($itemId);
}
protected function getMenuItemService(): MenuItemService
{
if ($this->menuItemService === null) {
$this->menuItemService = new MenuItemService;
}
return $this->menuItemService;
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Concerns/HasMenuPanel.php | src/Concerns/HasMenuPanel.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Concerns;
use Illuminate\Database\Eloquent\Builder;
trait HasMenuPanel
{
public function getMenuPanelName(): string
{
return str($this->getTable())
->title()
->replace('_', ' ')
->toString();
}
public function getMenuPanelModifyQueryUsing(): callable
{
return fn (Builder $query) => $query;
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Concerns/HasLocationAction.php | src/Concerns/HasLocationAction.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Concerns;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Filament\Actions\Action;
use Filament\Forms\Components;
use Filament\Notifications\Notification;
use Filament\Support\Enums\MaxWidth;
use Illuminate\Support\Collection;
trait HasLocationAction
{
protected ?Collection $menus = null;
protected ?Collection $menuLocations = null;
public function getLocationAction(): Action
{
return Action::make('locations')
->label(__('filament-menu-builder::menu-builder.actions.locations.label'))
->modalHeading(__('filament-menu-builder::menu-builder.actions.locations.heading'))
->modalDescription(__('filament-menu-builder::menu-builder.actions.locations.description'))
->modalSubmitActionLabel(__('filament-menu-builder::menu-builder.actions.locations.submit'))
->modalWidth(MaxWidth::Large)
->modalSubmitAction($this->getRegisteredLocations()->isEmpty() ? false : null)
->color('gray')
->fillForm(fn () => $this->getRegisteredLocations()->map(fn ($location, $key) => [
'location' => $location,
'menu' => $this->getMenuLocations()->where('location', $key)->first()?->menu_id,
])->all())
->action(function (array $data) {
$locations = collect($data)
->map(fn ($item) => $item['menu'] ?? null)
->all();
$this->getMenuLocations()
->pluck('location')
->diff($this->getRegisteredLocations()->keys())
->each(fn ($location) => $this->getMenuLocations()->where('location', $location)->each->delete());
foreach ($locations as $location => $menu) {
if (! $menu) {
$this->getMenuLocations()->where('location', $location)->each->delete();
continue;
}
FilamentMenuBuilderPlugin::get()->getMenuLocationModel()::updateOrCreate(
['location' => $location],
['menu_id' => $menu],
);
}
Notification::make()
->title(__('filament-menu-builder::menu-builder.notifications.locations.title'))
->success()
->send();
})
->form($this->getRegisteredLocations()->map(
fn ($location, $key) => Components\Grid::make(2)
->statePath($key)
->schema([
Components\TextInput::make('location')
->label(__('filament-menu-builder::menu-builder.actions.locations.form.location.label'))
->hiddenLabel($key !== $this->getRegisteredLocations()->keys()->first())
->disabled(),
Components\Select::make('menu')
->label(__('filament-menu-builder::menu-builder.actions.locations.form.menu.label'))
->searchable()
->hiddenLabel($key !== $this->getRegisteredLocations()->keys()->first())
->options($this->getMenus()->pluck('name', 'id')->all()),
]),
)->all() ?: [
Components\View::make('filament-tables::components.empty-state.index')
->viewData([
'heading' => __('filament-menu-builder::menu-builder.actions.locations.empty.heading'),
'icon' => 'heroicon-o-x-mark',
]),
]);
}
protected function getMenus(): Collection
{
return $this->menus ??= FilamentMenuBuilderPlugin::get()->getMenuModel()::all();
}
protected function getMenuLocations(): Collection
{
return $this->menuLocations ??= FilamentMenuBuilderPlugin::get()->getMenuLocationModel()::all();
}
protected function getRegisteredLocations(): Collection
{
return collect(FilamentMenuBuilderPlugin::get()->getLocations());
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Resources/MenuResource.php | src/Resources/MenuResource.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Resources;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Filament\Forms\Components;
use Filament\Forms\Components\Component;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Support\Str;
class MenuResource extends Resource
{
public static function getModel(): string
{
return FilamentMenuBuilderPlugin::get()->getMenuModel();
}
public static function getNavigationLabel(): string
{
return FilamentMenuBuilderPlugin::get()->getNavigationLabel() ?? Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel());
}
public static function getNavigationIcon(): string
{
return FilamentMenuBuilderPlugin::get()->getNavigationIcon();
}
public static function getNavigationSort(): ?int
{
return FilamentMenuBuilderPlugin::get()->getNavigationSort();
}
public static function getNavigationGroup(): ?string
{
return FilamentMenuBuilderPlugin::get()->getNavigationGroup();
}
public static function getNavigationBadge(): ?string
{
return FilamentMenuBuilderPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null;
}
public static function form(Form $form): Form
{
return $form
->columns(1)
->schema([
Components\Grid::make(4)
->schema([
Components\TextInput::make('name')
->label(__('filament-menu-builder::menu-builder.resource.name.label'))
->required()
->columnSpan(3),
Components\ToggleButtons::make('is_visible')
->grouped()
->options([
true => __('filament-menu-builder::menu-builder.resource.is_visible.visible'),
false => __('filament-menu-builder::menu-builder.resource.is_visible.hidden'),
])
->colors([
true => 'primary',
false => 'danger',
])
->required()
->label(__('filament-menu-builder::menu-builder.resource.is_visible.label'))
->default(true),
]),
Components\Group::make()
->visible(fn (Component $component) => $component->evaluate(FilamentMenuBuilderPlugin::get()->getMenuFields()) !== [])
->schema(FilamentMenuBuilderPlugin::get()->getMenuFields()),
]);
}
public static function table(Table $table): Table
{
$locations = FilamentMenuBuilderPlugin::get()->getLocations();
return $table
->modifyQueryUsing(fn ($query) => $query->withCount('menuItems'))
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable()
->label(__('filament-menu-builder::menu-builder.resource.name.label')),
Tables\Columns\TextColumn::make('locations.location')
->label(__('filament-menu-builder::menu-builder.resource.locations.label'))
->default(__('filament-menu-builder::menu-builder.resource.locations.empty'))
->color(fn (string $state) => array_key_exists($state, $locations) ? 'primary' : 'gray')
->formatStateUsing(fn (string $state) => $locations[$state] ?? $state)
->limitList(2)
->sortable()
->badge(),
Tables\Columns\TextColumn::make('menu_items_count')
->label(__('filament-menu-builder::menu-builder.resource.items.label'))
->icon('heroicon-o-link')
->numeric()
->default(0)
->sortable(),
Tables\Columns\IconColumn::make('is_visible')
->label(__('filament-menu-builder::menu-builder.resource.is_visible.label'))
->sortable()
->boolean(),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getPages(): array
{
return [
'index' => MenuResource\Pages\ListMenus::route('/'),
'edit' => MenuResource\Pages\EditMenu::route('/{record}/edit'),
];
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Resources/MenuResource/Pages/EditMenu.php | src/Resources/MenuResource/Pages/EditMenu.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Resources\MenuResource\Pages;
use Datlechin\FilamentMenuBuilder\Concerns\HasLocationAction;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Filament\Actions;
use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Resources\Pages\EditRecord;
class EditMenu extends EditRecord
{
use HasLocationAction;
protected static string $view = 'filament-menu-builder::edit-record';
public static function getResource(): string
{
return FilamentMenuBuilderPlugin::get()->getResource();
}
public function form(Form $form): Form
{
return $form
->schema([
Section::make()->schema($form->getComponents()),
]);
}
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
$this->getLocationAction(),
];
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Resources/MenuResource/Pages/ListMenus.php | src/Resources/MenuResource/Pages/ListMenus.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Resources\MenuResource\Pages;
use Datlechin\FilamentMenuBuilder\Concerns\HasLocationAction;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListMenus extends ListRecords
{
use HasLocationAction;
public static function getResource(): string
{
return FilamentMenuBuilderPlugin::get()->getResource();
}
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
$this->getLocationAction(),
];
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Models/MenuItem.php | src/Models/MenuItem.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Models;
use Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable;
use Datlechin\FilamentMenuBuilder\Enums\LinkTarget;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
/**
* @property int $id
* @property int $menu_id
* @property int|null $parent_id
* @property string $title
* @property string|null $url
* @property string|null $type
* @property string|null $target
* @property int $order
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|MenuItem[] $children
* @property-read int|null $children_count
* @property-read \Illuminate\Database\Eloquent\Model|MenuPanelable|null $linkable
* @property-read \Datlechin\FilamentMenuBuilder\Models\Menu $menu
* @property-read \Datlechin\FilamentMenuBuilder\Models\MenuItem|null $parent
*/
class MenuItem extends Model
{
protected $guarded = [];
protected $with = ['linkable'];
public function getTable(): string
{
return config('filament-menu-builder.tables.menu_items', parent::getTable());
}
protected function casts(): array
{
return [
'order' => 'int',
'target' => LinkTarget::class,
];
}
protected static function booted(): void
{
static::deleted(function (self $menuItem) {
$menuItem->children->each->delete();
});
}
public function menu(): BelongsTo
{
return $this->belongsTo(FilamentMenuBuilderPlugin::get()->getMenuModel());
}
public function parent(): BelongsTo
{
return $this->belongsTo(static::class);
}
public function children(): HasMany
{
return $this->hasMany(static::class, 'parent_id')
->with('children')
->orderBy('order');
}
public function linkable(): MorphTo
{
return $this->morphTo();
}
protected function url(): Attribute
{
return Attribute::get(function (?string $value) {
return match (true) {
$this->linkable instanceof MenuPanelable => $this->linkable->getMenuPanelUrlUsing()($this->linkable),
default => $value,
};
});
}
protected function type(): Attribute
{
return Attribute::get(function () {
return match (true) {
$this->linkable instanceof MenuPanelable => $this->linkable->getMenuPanelName(),
is_null($this->linkable) && is_null($this->url) => __('filament-menu-builder::menu-builder.custom_text'),
default => __('filament-menu-builder::menu-builder.custom_link'),
};
});
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Models/Menu.php | src/Models/Menu.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Models;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property int $id
* @property string $name
* @property bool $is_visible
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\Datlechin\FilamentMenuBuilder\Models\MenuLocation[] $locations
* @property-read int|null $locations_count
* @property-read \Illuminate\Database\Eloquent\Collection|\Datlechin\FilamentMenuBuilder\Models\MenuItem[] $menuItems
* @property-read int|null $menuItems_count
*/
class Menu extends Model
{
protected $guarded = [];
public function getTable(): string
{
return config('filament-menu-builder.tables.menus', parent::getTable());
}
protected function casts(): array
{
return [
'is_visible' => 'bool',
];
}
public function locations(): HasMany
{
return $this->hasMany(FilamentMenuBuilderPlugin::get()->getMenuLocationModel());
}
public function menuItems(): HasMany
{
return $this->hasMany(FilamentMenuBuilderPlugin::get()->getMenuItemModel())
->whereNull('parent_id')
->orderBy('parent_id')
->orderBy('order')
->with('children');
}
public static function location(string $location): ?self
{
return self::query()
->where('is_visible', true)
->whereRelation('locations', 'location', $location)
->with('menuItems')
->first();
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/src/Models/MenuLocation.php | src/Models/MenuLocation.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Models;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property int $menu_id
* @property string $location
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @property-read \Datlechin\FilamentMenuBuilder\Models\Menu $menu
*/
class MenuLocation extends Model
{
protected $guarded = [];
public function getTable(): string
{
return config('filament-menu-builder.tables.menu_locations', parent::getTable());
}
public function menu(): BelongsTo
{
return $this->belongsTo(FilamentMenuBuilderPlugin::get()->getMenuModel());
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/tests/Pest.php | tests/Pest.php | <?php
declare(strict_types=1);
use Datlechin\FilamentMenuBuilder\Tests\TestCase;
uses(TestCase::class)->in(__DIR__);
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/tests/TestCase.php | tests/TestCase.php | <?php
declare(strict_types=1);
namespace Datlechin\FilamentMenuBuilder\Tests;
use BladeUI\Heroicons\BladeHeroiconsServiceProvider;
use BladeUI\Icons\BladeIconsServiceProvider;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderServiceProvider;
use Filament\Actions\ActionsServiceProvider;
use Filament\FilamentServiceProvider;
use Filament\Forms\FormsServiceProvider;
use Filament\Infolists\InfolistsServiceProvider;
use Filament\Notifications\NotificationsServiceProvider;
use Filament\Support\SupportServiceProvider;
use Filament\Tables\TablesServiceProvider;
use Filament\Widgets\WidgetsServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider;
class TestCase extends Orchestra
{
protected function setUp(): void
{
parent::setUp();
Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Datlechin\\FilamentMenuBuilder\\Database\\Factories\\' . class_basename($modelName) . 'Factory',
);
}
protected function getPackageProviders($app)
{
return [
ActionsServiceProvider::class,
BladeCaptureDirectiveServiceProvider::class,
BladeHeroiconsServiceProvider::class,
BladeIconsServiceProvider::class,
FilamentServiceProvider::class,
FormsServiceProvider::class,
InfolistsServiceProvider::class,
LivewireServiceProvider::class,
NotificationsServiceProvider::class,
SupportServiceProvider::class,
TablesServiceProvider::class,
WidgetsServiceProvider::class,
FilamentMenuBuilderServiceProvider::class,
];
}
public function getEnvironmentSetUp($app)
{
config()->set('database.default', 'testing');
$migration = include __DIR__ . '/../database/migrations/create_menus_table.php.stub';
$migration->up();
}
}
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/tests/ArchTest.php | tests/ArchTest.php | <?php
declare(strict_types=1);
it('will not use debugging functions')
->expect(['dd', 'dump', 'ray'])
->each->not->toBeUsed();
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/tests/PluginConfigurationTest.php | tests/PluginConfigurationTest.php | <?php
declare(strict_types=1);
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;
it('can enable indent actions', function () {
$plugin = FilamentMenuBuilderPlugin::make()
->enableIndentActions();
expect($plugin->isIndentActionsEnabled())->toBeTrue();
});
it('can disable indent actions', function () {
$plugin = FilamentMenuBuilderPlugin::make()
->enableIndentActions(false);
expect($plugin->isIndentActionsEnabled())->toBeFalse();
});
it('has indent actions enabled by default', function () {
$plugin = FilamentMenuBuilderPlugin::make();
expect($plugin->isIndentActionsEnabled())->toBeTrue();
});
it('can configure custom link panel', function () {
$plugin = FilamentMenuBuilderPlugin::make()
->showCustomLinkPanel(false);
expect($plugin->isShowCustomLinkPanel())->toBeFalse();
});
it('can configure custom text panel', function () {
$plugin = FilamentMenuBuilderPlugin::make()
->showCustomTextPanel(true);
expect($plugin->isShowCustomTextPanel())->toBeTrue();
});
it('can add locations', function () {
$plugin = FilamentMenuBuilderPlugin::make()
->addLocation('header', 'Header')
->addLocation('footer', 'Footer');
$locations = $plugin->getLocations();
expect($locations)->toHaveKey('header')
->and($locations['header'])->toBe('Header')
->and($locations)->toHaveKey('footer')
->and($locations['footer'])->toBe('Footer');
});
it('can add multiple locations at once', function () {
$plugin = FilamentMenuBuilderPlugin::make()
->addLocations([
'primary' => 'Primary Navigation',
'secondary' => 'Secondary Navigation',
]);
$locations = $plugin->getLocations();
expect($locations)->toHaveKey('primary')
->and($locations['primary'])->toBe('Primary Navigation')
->and($locations)->toHaveKey('secondary')
->and($locations['secondary'])->toBe('Secondary Navigation');
});
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/tests/ExampleTest.php | tests/ExampleTest.php | <?php
declare(strict_types=1);
it('can test', function () {
expect(true)->toBeTrue();
});
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/config/filament-menu-builder.php | config/filament-menu-builder.php | <?php
declare(strict_types=1);
return [
'tables' => [
'menus' => 'menus',
'menu_items' => 'menu_items',
'menu_locations' => 'menu_locations',
],
];
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/lang/en/menu-builder.php | resources/lang/en/menu-builder.php | <?php
declare(strict_types=1);
return [
'form' => [
'title' => 'Title',
'url' => 'URL',
'linkable_type' => 'Type',
'linkable_id' => 'ID',
],
'resource' => [
'name' => [
'label' => 'Name',
],
'locations' => [
'label' => 'Locations',
'empty' => 'Unassigned',
],
'items' => [
'label' => 'Items',
],
'is_visible' => [
'label' => 'Visibility',
'visible' => 'Visible',
'hidden' => 'Hidden',
],
],
'actions' => [
'add' => [
'label' => 'Add to Menu',
],
'indent' => 'Indent',
'unindent' => 'Unindent',
'locations' => [
'label' => 'Locations',
'heading' => 'Manage Locations',
'description' => 'Choose which menu appears at each location.',
'submit' => 'Update',
'form' => [
'location' => [
'label' => 'Location',
],
'menu' => [
'label' => 'Assigned Menu',
],
],
'empty' => [
'heading' => 'No locations registered',
],
],
],
'items' => [
'expand' => 'Expand',
'collapse' => 'Collapse',
'empty' => [
'heading' => 'There are no items in this menu.',
],
],
'custom_link' => 'Custom Link',
'custom_text' => 'Custom Text',
'open_in' => [
'label' => 'Open in',
'options' => [
'self' => 'Same tab',
'blank' => 'New tab',
'parent' => 'Parent tab',
'top' => 'Top tab',
],
],
'notifications' => [
'created' => [
'title' => 'Link created',
],
'locations' => [
'title' => 'Menu locations updated',
],
],
'panel' => [
'empty' => [
'heading' => 'No items found',
'description' => 'There are no items in this menu.',
],
'pagination' => [
'previous' => 'Previous',
'next' => 'Next',
],
],
];
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/lang/vi/menu-builder.php | resources/lang/vi/menu-builder.php | <?php
declare(strict_types=1);
return [
'form' => [
'title' => 'Tiêu đề',
'url' => 'URL',
'linkable_type' => 'Loại',
'linkable_id' => 'ID',
],
'resource' => [
'name' => [
'label' => 'Tên',
],
'locations' => [
'label' => 'Vị trí',
'empty' => 'Chưa gán',
],
'items' => [
'label' => 'Mục',
],
'is_visible' => [
'label' => 'Hiển thị',
'visible' => 'Hiển thị',
'hidden' => 'Ẩn',
],
],
'actions' => [
'add' => [
'label' => 'Thêm vào Menu',
],
'indent' => 'Thụt lề',
'unindent' => 'Thụt lề ngược',
'locations' => [
'label' => 'Vị trí',
'heading' => 'Quản lý vị trí',
'description' => 'Chọn menu nào xuất hiện ở mỗi vị trí.',
'submit' => 'Cập nhật',
'form' => [
'location' => [
'label' => 'Vị trí',
],
'menu' => [
'label' => 'Menu đã gán',
],
],
'empty' => [
'heading' => 'Không có vị trí nào được đăng ký',
],
],
],
'items' => [
'expand' => 'Mở rộng',
'collapse' => 'Thu gọn',
'empty' => [
'heading' => 'Không có mục nào trong menu này.',
],
],
'custom_link' => 'Liên kết Tùy chỉnh',
'custom_text' => 'Custom Text',
'open_in' => [
'label' => 'Mở trong',
'options' => [
'self' => 'Cùng tab',
'blank' => 'Tab mới',
'parent' => 'Tab cha',
'top' => 'Tab trên cùng',
],
],
'notifications' => [
'created' => [
'title' => 'Liên kết đã được tạo',
],
'locations' => [
'title' => 'Cập nhật vị trí menu',
],
],
'panel' => [
'empty' => [
'heading' => 'Không tìm thấy mục nào',
'description' => 'Không có mục nào trong menu này.',
],
'pagination' => [
'previous' => 'Trước',
'next' => 'Tiếp',
],
],
];
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/lang/nl/menu-builder.php | resources/lang/nl/menu-builder.php | <?php
declare(strict_types=1);
return [
'form' => [
'title' => 'Titel',
'url' => 'URL',
'linkable_type' => 'Type',
'linkable_id' => 'ID',
],
'resource' => [
'name' => [
'label' => 'Naam',
],
'locations' => [
'label' => 'Locaties',
'empty' => 'Niet ingesteld',
],
'items' => [
'label' => 'Items',
],
'is_visible' => [
'label' => 'Zichtbaarheid',
'visible' => 'Zichtbaar',
'hidden' => 'Verborgen',
],
],
'actions' => [
'add' => [
'label' => 'Toevoegen aan menu',
],
'indent' => 'Inspringen',
'unindent' => 'Uitspringen',
'locations' => [
'label' => 'Locaties',
'heading' => 'Locaties beheren',
'description' => 'Stel in welk menu op welke locatie wordt getoond.',
'submit' => 'Wijzigingen opslaan',
'form' => [
'location' => [
'label' => 'Locatie',
],
'menu' => [
'label' => 'Gekoppeld menu',
],
],
'empty' => [
'heading' => 'Geen locaties gevonden',
],
],
],
'items' => [
'expand' => 'Uitklappen',
'collapse' => 'Inklappen',
'empty' => [
'heading' => 'Dit menu heeft geen items.',
],
],
'custom_link' => 'Aangepaste link',
'custom_text' => 'Aangepaste tekst',
'open_in' => [
'label' => 'Openen op',
'options' => [
'self' => 'Huidig tabblad',
'blank' => 'Nieuw tabblad',
'parent' => 'Bovenliggend tabblad',
'top' => 'Hoofdtabblad',
],
],
'notifications' => [
'created' => [
'title' => 'Link aangemaakt',
],
'locations' => [
'title' => 'Menulocaties bijgewerkt',
],
],
'panel' => [
'empty' => [
'heading' => 'Geen items gevonden',
'description' => 'Dit menu heeft geen items.',
],
'pagination' => [
'previous' => 'Vorige',
'next' => 'Volgende',
],
],
];
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/lang/fr/menu-builder.php | resources/lang/fr/menu-builder.php | <?php
declare(strict_types=1);
return [
'form' => [
'title' => 'Titre',
'url' => 'URL',
'linkable_type' => 'Type',
'linkable_id' => 'ID',
],
'resource' => [
'name' => [
'label' => 'Nom',
],
'locations' => [
'label' => 'Emplacements',
'empty' => 'Non assigné',
],
'items' => [
'label' => 'Éléments',
],
'is_visible' => [
'label' => 'Visibilité',
'visible' => 'Visible',
'hidden' => 'Masqué',
],
],
'actions' => [
'add' => [
'label' => 'Ajouter au menu',
],
'indent' => 'Indenté',
'unindent' => 'Désindenté',
'locations' => [
'label' => 'Emplacements',
'heading' => 'Gérer les emplacements',
'description' => 'Choisissez quel menu apparaît à chaque emplacement.',
'submit' => 'Mettre à jour',
'form' => [
'location' => [
'label' => 'Emplacement',
],
'menu' => [
'label' => 'Menu assigné',
],
],
'empty' => [
'heading' => 'Aucun emplacement enregistré',
],
],
],
'items' => [
'expand' => 'Développer',
'collapse' => 'Réduire',
'empty' => [
'heading' => 'Il n’y a aucun élément dans ce menu.',
],
],
'custom_link' => 'Lien personnalisé',
'custom_text' => 'Custom Text',
'open_in' => [
'label' => 'Ouvrir dans',
'options' => [
'self' => 'Même onglet',
'blank' => 'Nouvel onglet',
'parent' => 'Onglet parent',
'top' => 'Onglet supérieur',
],
],
'notifications' => [
'created' => [
'title' => 'Lien créé',
],
'locations' => [
'title' => 'Emplacements de menu mis à jour',
],
],
'panel' => [
'empty' => [
'heading' => 'Aucun élément trouvé',
'description' => 'Il n’y a aucun élément dans ce menu.',
],
'pagination' => [
'previous' => 'Précédent',
'next' => 'Suivant',
],
],
];
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/views/edit-record.blade.php | resources/views/edit-record.blade.php | <x-filament-panels::page @class([
'fi-resource-edit-record-page',
'fi-resource-' . str_replace('/', '-', $this->getResource()::getSlug()),
'fi-resource-record-' . $record->getKey(),
])>
@capture($form)
<x-filament-panels::form id="form" :wire:key="$this->getId() . '.forms.' . $this->getFormStatePath()"
wire:submit="save">
{{ $this->form }}
<x-filament-panels::form.actions :actions="$this->getCachedFormActions()" :full-width="$this->hasFullWidthFormActions()" />
</x-filament-panels::form>
@endcapture
@php
$relationManagers = $this->getRelationManagers();
$hasCombinedRelationManagerTabsWithContent = $this->hasCombinedRelationManagerTabsWithContent();
@endphp
@if (!$hasCombinedRelationManagerTabsWithContent || !count($relationManagers))
{{ $form() }}
@endif
@if (count($relationManagers))
<x-filament-panels::resources.relation-managers :active-locale="isset($activeLocale) ? $activeLocale : null" :active-manager="$this->activeRelationManager ??
($hasCombinedRelationManagerTabsWithContent ? null : array_key_first($relationManagers))" :content-tab-label="$this->getContentTabLabel()"
:content-tab-icon="$this->getContentTabIcon()" :content-tab-position="$this->getContentTabPosition()" :managers="$relationManagers" :owner-record="$record" :page-class="static::class">
@if ($hasCombinedRelationManagerTabsWithContent)
<x-slot name="content">
{{ $form() }}
</x-slot>
@endif
</x-filament-panels::resources.relation-managers>
@endif
<div class="grid grid-cols-12 gap-4" wire:ignore>
<div class="flex flex-col col-span-12 gap-4 sm:col-span-4">
@foreach (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->getMenuPanels() as $menuPanel)
<livewire:menu-builder-panel :menu="$record" :menuPanel="$menuPanel" />
@endforeach
@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomLinkPanel())
<livewire:create-custom-link :menu="$record" />
@endif
@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isShowCustomTextPanel())
<livewire:create-custom-text :menu="$record" />
@endif
</div>
<div class="col-span-12 sm:col-span-8">
<x-filament::section>
<livewire:menu-builder-items :menu="$record" />
</x-filament::section>
</div>
</div>
<x-filament-panels::page.unsaved-data-changes-alert />
</x-filament-panels::page>
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/views/components/menu-item.blade.php | resources/views/components/menu-item.blade.php | @props([
'item',
])
@php
/** @var \Datlechin\FilamentMenuBuilder\Models\MenuItem $item */
$hasChildren = $item->children->isNotEmpty();
@endphp
<li
wire:key="{{ $item->getKey() }}"
data-sortable-item="{{ $item->getKey() }}"
x-data="{ open: $persist(true).as('menu-item-' + {{ $item->getKey() }}) }"
>
<div
class="flex justify-between px-3 py-2 bg-white shadow-sm rounded-xl ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10"
>
<div class="flex flex-1 items-center gap-2 truncate">
{{ $this->reorderAction }}
@if ($hasChildren)
<x-filament::icon-button
icon="heroicon-o-chevron-right"
x-on:click="open = !open"
x-bind:title="open ? '{{ trans('filament-menu-builder::menu-builder.items.collapse') }}' : '{{ trans('filament-menu-builder::menu-builder.items.expand') }}'"
color="gray"
class="transition duration-200 ease-in-out"
x-bind:class="{ 'rotate-90': open }"
size="sm"
/>
@endif
@if (\Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin::get()->isIndentActionsEnabled())
{{ ($this->unindentAction)(['id' => $item->getKey()]) }}
{{ ($this->indentAction)(['id' => $item->getKey()]) }}
@endif
<div class="text-sm font-medium leading-6 text-gray-950 dark:text-white whitespace-nowrap">
{{ $item->title }}
</div>
<div class="hidden overflow-hidden text-sm text-gray-500 sm:block dark:text-gray-400 whitespace-nowrap text-ellipsis">
{{ $item->url }}
</div>
</div>
<div class="flex items-center gap-2">
<x-filament::badge :color="$item->type === 'internal' ? 'primary' : 'gray'" class="hidden sm:block">
{{ $item->type }}
</x-filament::badge>
{{ ($this->editAction)(['id' => $item->getKey(), 'title' => $item->title]) }}
{{ ($this->deleteAction)(['id' => $item->getKey(), 'title' => $item->title]) }}
</div>
</div>
<ul
x-collapse
x-show="open"
wire:key="{{ $item->getKey() }}.children"
x-data="menuBuilder({ parentId: {{ $item->getKey() }} })"
class="mt-2 space-y-2 ms-4"
>
@foreach ($item->children as $child)
<x-filament-menu-builder::menu-item :item="$child" />
@endforeach
</ul>
</li>
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/views/livewire/create-custom-text.blade.php | resources/views/livewire/create-custom-text.blade.php | <form wire:submit="save">
<x-filament::section
:heading="__('filament-menu-builder::menu-builder.custom_text')"
:collapsible="true"
:persist-collapsed="true"
id="create-custom-text"
>
{{ $this->form }}
<x-slot:footerActions>
<x-filament::button type="submit">
{{ __('filament-menu-builder::menu-builder.actions.add.label') }}
</x-filament::button>
</x-slot:footerActions>
</x-filament::section>
</form>
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/views/livewire/panel.blade.php | resources/views/livewire/panel.blade.php | <form wire:submit="add">
<x-filament::section
:heading="$name"
:description="$description"
:icon="$icon"
:collapsible="$collapsible"
:collapsed="$collapsed"
:persist-collapsed="true"
id="{{ $id }}-panel"
>
{{ $this->form }}
@if ($this->hasPages())
<div class="flex items-center justify-between mt-4">
@if ($this->hasPreviousPage())
<x-filament::link
tag="button"
wire:click="previousPage"
icon="heroicon-m-chevron-left"
>
{{ __('filament-menu-builder::menu-builder.panel.pagination.previous') }}
</x-filament::link>
@endif
@if ($this->hasNextPage())
<x-filament::link
class="ml-auto"
tag="button"
wire:click="nextPage"
icon="heroicon-m-chevron-right"
iconPosition="after"
>
{{ __('filament-menu-builder::menu-builder.panel.pagination.next') }}
</x-filament::link>
@endif
</div>
@endif
@if ($this->items)
<x-slot:footerActions>
<x-filament::button type="submit">
{{ __('filament-menu-builder::menu-builder.actions.add.label') }}
</x-filament::button>
</x-slot:footerActions>
@endif
</x-filament::section>
</form>
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/views/livewire/create-custom-link.blade.php | resources/views/livewire/create-custom-link.blade.php | <form wire:submit="save">
<x-filament::section
:heading="__('filament-menu-builder::menu-builder.custom_link')"
:collapsible="true"
:persist-collapsed="true"
id="create-custom-link"
>
{{ $this->form }}
<x-slot:footerActions>
<x-filament::button type="submit">
{{ __('filament-menu-builder::menu-builder.actions.add.label') }}
</x-filament::button>
</x-slot:footerActions>
</x-filament::section>
</form>
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
datlechin/filament-menu-builder | https://github.com/datlechin/filament-menu-builder/blob/9e1236f11a11419d4e226cac9ba2d59fa122f084/resources/views/livewire/menu-items.blade.php | resources/views/livewire/menu-items.blade.php | <div>
@if($this->menuItems->isNotEmpty())
<ul
ax-load
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('filament-menu-builder', 'datlechin/filament-menu-builder') }}"
x-data="menuBuilder({ parentId: 0 })"
class="space-y-2"
>
@foreach($this->menuItems as $menuItem)
<x-filament-menu-builder::menu-item
:item="$menuItem"
/>
@endforeach
</ul>
@else
<x-filament-tables::empty-state
icon="heroicon-o-document"
:heading="trans('filament-menu-builder::menu-builder.items.empty.heading')"
/>
@endif
<x-filament-actions::modals />
</div>
| php | MIT | 9e1236f11a11419d4e226cac9ba2d59fa122f084 | 2026-01-05T05:21:51.412797Z | false |
tomschlick/memcached-library | https://github.com/tomschlick/memcached-library/blob/bcc066dd5c9cfe808c9009510c2cd711a3046f45/controllers/example_memcached.php | controllers/example_memcached.php | <?php
class Example_memcached extends Controller
{
public function Example_memcached()
{
parent::Controller();
}
public function test()
{
// Load library
$this->load->library('memcached_library');
// Lets try to get the key
$results = $this->memcached_library->get('test');
// If the key does not exist it could mean the key was never set or expired
if (!$results) {
// Modify this Query to your liking!
$query = $this->db->get('members', 7000);
// Lets store the results
$this->memcached_library->add('test', $query->result());
// Output a basic msg
echo 'Alright! Stored some results from the Query... Refresh Your Browser';
} else {
// Output
var_dump($results);
// Now let us delete the key for demonstration sake!
$this->memcached_library->delete('test');
}
}
public function stats()
{
$this->load->library('memcached_library');
echo $this->memcached_library->getversion();
echo '<br/>';
// We can use any of the following "reset, malloc, maps, cachedump, slabs, items, sizes"
$p = $this->memcached_library->getstats('sizes');
var_dump($p);
}
}
| php | MIT | bcc066dd5c9cfe808c9009510c2cd711a3046f45 | 2026-01-05T05:21:59.121752Z | false |
tomschlick/memcached-library | https://github.com/tomschlick/memcached-library/blob/bcc066dd5c9cfe808c9009510c2cd711a3046f45/libraries/memcached_library.php | libraries/memcached_library.php | <?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Memcached_library
{
private $config;
private $m;
private $client_type;
private $ci;
protected $errors = [];
public function __construct()
{
$this->ci = &get_instance();
// Load the memcached library config
$this->ci->load->config('memcached');
$this->config = $this->ci->config->item('memcached');
// Lets try to load Memcache or Memcached Class
$this->client_type = class_exists($this->config['config']['engine']) ? $this->config['config']['engine'] : false;
if ($this->client_type) {
// Which one should be loaded
switch ($this->client_type) {
case 'Memcached':
$this->m = new Memcached();
break;
case 'Memcache':
$this->m = new Memcache();
// Set Automatic Compression Settings
if ($this->config['config']['auto_compress_tresh']) {
$this->setcompressthreshold($this->config['config']['auto_compress_tresh'], $this->config['config']['auto_compress_savings']);
}
break;
}
log_message('debug', 'Memcached Library: '.$this->client_type.' Class Loaded');
$this->auto_connect();
} else {
log_message('error', 'Memcached Library: Failed to load Memcached or Memcache Class');
}
}
/*
+-------------------------------------+
Name: auto_connect
Purpose: runs through all of the servers defined in
the configuration and attempts to connect to each
@param return : none
+-------------------------------------+
*/
private function auto_connect()
{
foreach ($this->config['servers'] as $key => $server) {
if (!$this->add_server($server)) {
$this->errors[] = "Memcached Library: Could not connect to the server named $key";
log_message('error', 'Memcached Library: Could not connect to the server named "'.$key.'"');
} else {
log_message('debug', 'Memcached Library: Successfully connected to the server named "'.$key.'"');
}
}
}
/*
+-------------------------------------+
Name: add_server
Purpose:
@param return : TRUE or FALSE
+-------------------------------------+
*/
public function add_server($server)
{
extract($server);
return $this->m->addServer($host, $port, $weight);
}
/*
+-------------------------------------+
Name: add
Purpose: add an item to the memcache server(s)
@param return : TRUE or FALSE
+-------------------------------------+
*/
public function add($key = null, $value = null, $expiration = null)
{
if (is_null($expiration)) {
$expiration = $this->config['config']['expiration'];
}
if (is_array($key)) {
foreach ($key as $multi) {
if (!isset($multi['expiration']) || $multi['expiration'] == '') {
$multi['expiration'] = $this->config['config']['expiration'];
}
$this->add($this->key_name($multi['key']), $multi['value'], $multi['expiration']);
}
} else {
switch ($this->client_type) {
case 'Memcache':
$add_status = $this->m->add($this->key_name($key), $value, $this->config['config']['compression'], $expiration);
break;
default:
case 'Memcached':
$add_status = $this->m->add($this->key_name($key), $value, $expiration);
break;
}
return $add_status;
}
}
/*
+-------------------------------------+
Name: set
Purpose: similar to the add() method but uses set
@param return : TRUE or FALSE
+-------------------------------------+
*/
public function set($key = null, $value = null, $expiration = null)
{
if (is_null($expiration)) {
$expiration = $this->config['config']['expiration'];
}
if (is_array($key)) {
foreach ($key as $multi) {
if (!isset($multi['expiration']) || $multi['expiration'] == '') {
$multi['expiration'] = $this->config['config']['expiration'];
}
$this->set($this->key_name($multi['key']), $multi['value'], $multi['expiration']);
}
} else {
switch ($this->client_type) {
case 'Memcache':
$add_status = $this->m->set($this->key_name($key), $value, $this->config['config']['compression'], $expiration);
break;
default:
case 'Memcached':
$add_status = $this->m->set($this->key_name($key), $value, $expiration);
break;
}
return $add_status;
}
}
/*
+-------------------------------------+
Name: get
Purpose: gets the data for a single key or an array of keys
@param return : array of data or multi-dimensional array of data
+-------------------------------------+
*/
public function get($key = null)
{
if ($this->m) {
if (is_null($key)) {
$this->errors[] = 'The key value cannot be NULL';
return false;
}
if (is_array($key)) {
foreach ($key as $n => $k) {
$key[$n] = $this->key_name($k);
}
return $this->m->getMulti($key);
} else {
return $this->m->get($this->key_name($key));
}
}
return false;
}
/*
+-------------------------------------+
Name: delete
Purpose: deletes a single or multiple data elements from the memached servers
@param return : none
+-------------------------------------+
*/
public function delete($key, $expiration = null)
{
if (is_null($key)) {
$this->errors[] = 'The key value cannot be NULL';
return false;
}
if (is_null($expiration)) {
$expiration = $this->config['config']['delete_expiration'];
}
if (is_array($key)) {
foreach ($key as $multi) {
$this->delete($multi, $expiration);
}
} else {
return $this->m->delete($this->key_name($key), $expiration);
}
}
/*
+-------------------------------------+
Name: replace
Purpose: replaces the value of a key that already exists
@param return : none
+-------------------------------------+
*/
public function replace($key = null, $value = null, $expiration = null)
{
if (is_null($expiration)) {
$expiration = $this->config['config']['expiration'];
}
if (is_array($key)) {
foreach ($key as $multi) {
if (!isset($multi['expiration']) || $multi['expiration'] == '') {
$multi['expiration'] = $this->config['config']['expiration'];
}
$this->replace($multi['key'], $multi['value'], $multi['expiration']);
}
} else {
switch ($this->client_type) {
case 'Memcache':
$replace_status = $this->m->replace($this->key_name($key), $value, $this->config['config']['compression'], $expiration);
break;
default:
case 'Memcached':
$replace_status = $this->m->replace($this->key_name($key), $value, $expiration);
break;
}
return $replace_status;
}
}
/*
+-------------------------------------+
Name: increment
Purpose: increments a value
@param return : none
+-------------------------------------+
*/
public function increment($key = null, $by = 1)
{
return $this->m->increment($this->key_name($key), $by);
}
/*
+-------------------------------------+
Name: decrement
Purpose: decrements a value
@param return : none
+-------------------------------------+
*/
public function decrement($key = null, $by = 1)
{
return $this->m->decrement($this->key_name($key), $by);
}
/*
+-------------------------------------+
Name: flush
Purpose: flushes all items from cache
@param return : none
+-------------------------------------+
*/
public function flush()
{
return $this->m->flush();
}
/*
+-------------------------------------+
Name: getversion
Purpose: Get Server Vesion Number
@param Returns a string of server version number or FALSE on failure.
+-------------------------------------+
*/
public function getversion()
{
return $this->m->getVersion();
}
/*
+-------------------------------------+
Name: getstats
Purpose: Get Server Stats
Possible: "reset, malloc, maps, cachedump, slabs, items, sizes"
@param returns an associative array with server's statistics. Array keys correspond to stats parameters and values to parameter's values.
+-------------------------------------+
*/
public function getstats($type = 'items')
{
switch ($this->client_type) {
case 'Memcache':
$stats = $this->m->getStats($type);
break;
default:
case 'Memcached':
$stats = $this->m->getStats();
break;
}
return $stats;
}
/*
+-------------------------------------+
Name: setcompresstreshold
Purpose: Set When Automatic compression should kick-in
@param return TRUE/FALSE
+-------------------------------------+
*/
public function setcompressthreshold($tresh, $savings = 0.2)
{
switch ($this->client_type) {
case 'Memcache':
$setcompressthreshold_status = $this->m->setCompressThreshold($tresh, $savings = 0.2);
break;
default:
$setcompressthreshold_status = true;
break;
}
return $setcompressthreshold_status;
}
/*
+-------------------------------------+
Name: key_name
Purpose: standardizes the key names for memcache instances
@param return : md5 key name
+-------------------------------------+
*/
private function key_name($key)
{
return md5(strtolower($this->config['config']['prefix'].$key));
}
/*
+--------------------------------------+
Name: isConected
Purpose: Check if the memcache server is connected.
+--------------------------------------+
*/
public function isConnected()
{
foreach ($this->getstats() as $key => $server) {
if ($server['pid'] == -1) {
return false;
}
return true;
}
}
}
| php | MIT | bcc066dd5c9cfe808c9009510c2cd711a3046f45 | 2026-01-05T05:21:59.121752Z | false |
tomschlick/memcached-library | https://github.com/tomschlick/memcached-library/blob/bcc066dd5c9cfe808c9009510c2cd711a3046f45/config/memcached.php | config/memcached.php | <?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
// --------------------------------------------------------------------------
// Servers
// --------------------------------------------------------------------------
$memcached['servers'] = [
'default' => [
'host' => 'localhost',
'port' => '11211',
'weight' => '1',
'persistent' => false,
],
];
// --------------------------------------------------------------------------
// Configuration
// --------------------------------------------------------------------------
$memcached['config'] = [
'engine' => 'Memcached', // Set which caching engine you are using. Acceptable values: Memcached or Memcache
'prefix' => '', // Prefixes every key value (useful for multi environment setups)
'compression' => false, // Default: FALSE or MEMCACHE_COMPRESSED Compression Method (Memcache only).
// Not necessary if you already are using 'compression'
'auto_compress_tresh' => false, // Controls the minimum value length before attempting to compress automatically.
'auto_compress_savings' => 0.2, // Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1.
'expiration' => 3600, // Default content expiration value (in seconds)
'delete_expiration' => 0, // Default time between the delete command and the actual delete action occurs (in seconds)
];
$config['memcached'] = $memcached;
/* End of file memcached.php */
/* Location: ./system/application/config/memcached.php */
| php | MIT | bcc066dd5c9cfe808c9009510c2cd711a3046f45 | 2026-01-05T05:21:59.121752Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/scoper.php | scoper.php | <?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
$nowDateTime = new DateTime('now');
$timestamp = $nowDateTime->format('Ym');
// see https://github.com/humbug/php-scoper
return [
'prefix' => 'ClassLeak' . $timestamp,
'expose-constants' => ['#^SYMFONY\_[\p{L}_]+$#'],
'exclude-namespaces' => ['#^TomasVotruba\\\\ClassLeak#', '#^Symfony\\\\Polyfill#'],
'exclude-files' => [
// do not prefix "trigger_deprecation" from symfony - https://github.com/symfony/symfony/commit/0032b2a2893d3be592d4312b7b098fb9d71aca03
// these paths are relative to this file location, so it should be in the root directory
'vendor/symfony/deprecation-contracts/function.php',
],
'patchers' => [
function (string $filePath, string $prefix, string $content): string {
if (! str_ends_with($filePath, 'src/Filtering/PossiblyUnusedClassesFilter.php')) {
return $content;
}
$content = preg_replace_callback('#DEFAULT_TYPES_TO_SKIP = (?<content>.*?)\;#ms', function (array $match) use (
$prefix
) {
$unprefixedValue = preg_replace('#\'' . $prefix . '\\\\#', '\'', $match['content']);
return 'DEFAULT_TYPES_TO_SKIP = ' . $unprefixedValue . ';';
}, $content);
return preg_replace_callback('#DEFAULT_ATTRIBUTES_TO_SKIP = (?<content>.*?)\;#ms', function (array $match) use (
$prefix
) {
$unprefixedValue = preg_replace('#\'' . $prefix . '\\\\#', '\'', $match['content']);
return 'DEFAULT_ATTRIBUTES_TO_SKIP = ' . $unprefixedValue . ';';
}, $content);
},
],
];
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/rector.php | rector.php | <?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withPreparedSets(
deadCode: true, codeQuality: true, codingStyle: true, typeDeclarations: true, typeDeclarationDocblocks: true, privatization: true, naming: true, earlyReturn: true, phpunitCodeQuality: true
)
->withPhpSets()
->withRootFiles()
->withImportNames()
->withSkip(['*/scoper.php', '*/Source/*', '*/Fixture/*']);
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/ecs.php | ecs.php | <?php
declare(strict_types=1);
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withPaths([
__DIR__ . '/bin',
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withSkip([
// invalid syntax test fixture
__DIR__ . '/tests/UseImportsResolver/Fixture/ParseError.php',
])
->withPreparedSets(psr12: true, common: true, symplify: true);
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/ClassNameResolver.php | src/ClassNameResolver.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak;
use PhpParser\NodeTraverser;
use PhpParser\Parser;
use TomasVotruba\ClassLeak\NodeDecorator\FullyQualifiedNameNodeDecorator;
use TomasVotruba\ClassLeak\NodeVisitor\ClassNameNodeVisitor;
use TomasVotruba\ClassLeak\ValueObject\ClassNames;
/**
* @see \TomasVotruba\ClassLeak\Tests\ClassNameResolver\ClassNameResolverTest
*/
final readonly class ClassNameResolver
{
public function __construct(
private Parser $parser,
private FullyQualifiedNameNodeDecorator $fullyQualifiedNameNodeDecorator
) {
}
public function resolveFromFilePath(string $filePath): ?ClassNames
{
/** @var string $fileContents */
$fileContents = file_get_contents($filePath);
$stmts = $this->parser->parse($fileContents);
if ($stmts === null) {
return null;
}
$this->fullyQualifiedNameNodeDecorator->decorate($stmts);
$classNameNodeVisitor = new ClassNameNodeVisitor();
$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor($classNameNodeVisitor);
$nodeTraverser->traverse($stmts);
$className = $classNameNodeVisitor->getClassName();
if (! is_string($className)) {
return null;
}
return new ClassNames(
$className,
$classNameNodeVisitor->hasParentClassOrInterface(),
$classNameNodeVisitor->getAttributes(),
);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/UseImportsResolver.php | src/UseImportsResolver.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak;
use PhpParser\NodeTraverser;
use PhpParser\Parser;
use RuntimeException;
use Throwable;
use TomasVotruba\ClassLeak\NodeDecorator\FullyQualifiedNameNodeDecorator;
use TomasVotruba\ClassLeak\NodeVisitor\UsedClassNodeVisitor;
/**
* @see \TomasVotruba\ClassLeak\Tests\UseImportsResolver\UseImportsResolverTest
*/
final readonly class UseImportsResolver
{
public function __construct(
private Parser $parser,
private FullyQualifiedNameNodeDecorator $fullyQualifiedNameNodeDecorator,
) {
}
/**
* @return string[]
*/
public function resolve(string $filePath): array
{
/** @var string $fileContents */
$fileContents = file_get_contents($filePath);
try {
$stmts = $this->parser->parse($fileContents);
if ($stmts === null) {
return [];
}
} catch (Throwable $throwable) {
throw new RuntimeException(sprintf(
'Could not parse file "%s": %s',
$filePath,
$throwable->getMessage()
), $throwable->getCode(), $throwable);
}
$this->fullyQualifiedNameNodeDecorator->decorate($stmts);
$nodeTraverser = new NodeTraverser();
$usedClassNodeVisitor = new UsedClassNodeVisitor();
$nodeTraverser->addVisitor($usedClassNodeVisitor);
$nodeTraverser->traverse($stmts);
return $usedClassNodeVisitor->getUsedNames();
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/FileSystem/StaticRelativeFilePathHelper.php | src/FileSystem/StaticRelativeFilePathHelper.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\FileSystem;
/**
* @see \TomasVotruba\ClassLeak\Tests\FileSystem\StaticRelativeFilePathHelperTest
*/
final class StaticRelativeFilePathHelper
{
public static function resolveFromCwd(string $filePath): string
{
// make path relative with native PHP
$relativeFilePath = (string) realpath($filePath);
return str_replace(getcwd() . DIRECTORY_SEPARATOR, '', $relativeFilePath);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/Finder/ClassNamesFinder.php | src/Finder/ClassNamesFinder.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Finder;
use Symfony\Component\Console\Helper\ProgressBar;
use TomasVotruba\ClassLeak\ClassNameResolver;
use TomasVotruba\ClassLeak\ValueObject\ClassNames;
use TomasVotruba\ClassLeak\ValueObject\FileWithClass;
final readonly class ClassNamesFinder
{
public function __construct(
private ClassNameResolver $classNameResolver
) {
}
/**
* @param string[] $filePaths
* @return FileWithClass[]
*/
public function resolveClassNamesToCheck(array $filePaths, ?ProgressBar $progressBar): array
{
$filesWithClasses = [];
foreach ($filePaths as $filePath) {
$progressBar?->advance();
$classNames = $this->classNameResolver->resolveFromFilePath($filePath);
if (! $classNames instanceof ClassNames) {
continue;
}
$filesWithClasses[] = new FileWithClass(
$filePath,
$classNames->getClassName(),
$classNames->hasParentClassOrInterface(),
$classNames->getAttributes(),
);
}
return $filesWithClasses;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/Finder/PhpFilesFinder.php | src/Finder/PhpFilesFinder.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Finder;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Webmozart\Assert\Assert;
/**
* @see \TomasVotruba\ClassLeak\Tests\Finder\PhpFilesFinderTest
*/
final class PhpFilesFinder
{
/**
* @param string[] $paths
* @param string[] $fileExtensions
* @param string[] $pathsToSkip
*
* @return string[]
*/
public function findPhpFiles(array $paths, array $fileExtensions, array $pathsToSkip): array
{
Assert::allFileExists($paths);
Assert::allString($fileExtensions);
// fallback to config paths
$filePaths = [];
$currentFileFinder = Finder::create()->files()
->in($paths)
->sortByName();
if ($pathsToSkip !== []) {
$currentFileFinder->exclude($pathsToSkip);
}
foreach ($fileExtensions as $fileExtension) {
$currentFileFinder->name('*.' . $fileExtension);
}
foreach ($currentFileFinder as $fileInfo) {
/** @var SplFileInfo $fileInfo */
$filePaths[] = $fileInfo->getRealPath();
}
return $filePaths;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/NodeVisitor/ClassNameNodeVisitor.php | src/NodeVisitor/ClassNameNodeVisitor.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\NodeVisitor;
use PhpParser\Comment\Doc;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitorAbstract;
final class ClassNameNodeVisitor extends NodeVisitorAbstract
{
/**
* @var string
* @see https://regex101.com/r/LXmPYG/1
*/
private const API_TAG_REGEX = '#@api\b#';
private string|null $className = null;
private bool $hasParentClassOrInterface = false;
/**
* @var string[]
*/
private array $attributes = [];
/**
* @param Node\Stmt[] $nodes
* @return Node\Stmt[]
*/
public function beforeTraverse(array $nodes): array
{
$this->className = null;
$this->hasParentClassOrInterface = false;
$this->attributes = [];
return $nodes;
}
public function enterNode(Node $node): ?int
{
if (! $node instanceof ClassLike) {
return null;
}
if (! $node->name instanceof Identifier) {
return null;
}
if ($this->hasApiTag($node)) {
return null;
}
if (! $node->namespacedName instanceof Name) {
return null;
}
$this->className = $node->namespacedName->toString();
if ($node instanceof Class_) {
if ($node->extends instanceof Name) {
$this->hasParentClassOrInterface = true;
}
if ($node->implements !== []) {
$this->hasParentClassOrInterface = true;
}
}
if ($node instanceof Interface_ && $node->extends !== []) {
$this->hasParentClassOrInterface = true;
}
foreach ($node->attrGroups as $attrGroup) {
foreach ($attrGroup->attrs as $attr) {
$this->attributes[] = $attr->name->toString();
}
}
foreach ($node->getMethods() as $classMethod) {
foreach ($classMethod->attrGroups as $attrGroup) {
foreach ($attrGroup->attrs as $attr) {
$this->attributes[] = $attr->name->toString();
}
}
}
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}
public function getClassName(): ?string
{
return $this->className;
}
public function hasParentClassOrInterface(): bool
{
return $this->hasParentClassOrInterface;
}
/**
* @return string[]
*/
public function getAttributes(): array
{
return array_unique($this->attributes);
}
private function hasApiTag(ClassLike $classLike): bool
{
$doc = $classLike->getDocComment();
if (! $doc instanceof Doc) {
return false;
}
return preg_match(self::API_TAG_REGEX, $doc->getText(), $matches) === 1;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/NodeVisitor/UsedClassNodeVisitor.php | src/NodeVisitor/UsedClassNodeVisitor.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\NodeVisitor;
use PhpParser\Node;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitorAbstract;
final class UsedClassNodeVisitor extends NodeVisitorAbstract
{
/**
* @var string[]
*/
private array $usedNames = [];
/**
* @param Stmt[] $nodes
* @return Stmt[]
*/
public function beforeTraverse(array $nodes): array
{
$this->usedNames = [];
return $nodes;
}
public function enterNode(Node $node): Node|null|int
{
if ($node instanceof ConstFetch) {
return NodeTraverser::DONT_TRAVERSE_CHILDREN;
}
if (! $node instanceof Name) {
return null;
}
if ($this->isNonNameNode($node)) {
return null;
}
// class names itself are skipped automatically, as they are Identifier node
$this->usedNames[] = $node->toString();
return $node;
}
/**
* @return string[]
*/
public function getUsedNames(): array
{
$uniqueUsedNames = array_unique($this->usedNames);
sort($uniqueUsedNames);
return $uniqueUsedNames;
}
private function isNonNameNode(Name $name): bool
{
// skip nodes that are not part of class names
$parent = $name->getAttribute('parent');
if ($parent instanceof Namespace_) {
return true;
}
if ($parent instanceof FuncCall) {
return true;
}
return $parent instanceof ClassMethod;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/DependencyInjection/ContainerFactory.php | src/DependencyInjection/ContainerFactory.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\DependencyInjection;
use Illuminate\Container\Container;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
use TomasVotruba\ClassLeak\Commands\CheckCommand;
/**
* @api
*/
final class ContainerFactory
{
/**
* @api
*/
public function create(): Container
{
$container = new Container();
$container->singleton(Parser::class, static function (): Parser {
$parserFactory = new ParserFactory();
return $parserFactory->createForHostVersion();
});
$container->singleton(
SymfonyStyle::class,
static function (): SymfonyStyle {
// use null output ofr tests to avoid printing
$consoleOutput = defined('PHPUNIT_COMPOSER_INSTALL') ? new NullOutput() : new ConsoleOutput();
return new SymfonyStyle(new ArrayInput([]), $consoleOutput);
}
);
$container->singleton(Application::class, function (Container $container): Application {
/** @var CheckCommand $checkCommand */
$checkCommand = $container->make(CheckCommand::class);
$application = new Application();
$application->add($checkCommand);
$this->hideDefaultCommands($application);
return $application;
});
return $container;
}
/**
* @see https://tomasvotruba.com/blog/how-make-your-tool-commands-list-easy-to-read
*/
private function hideDefaultCommands(Application $application): void
{
$application->get('completion')
->setHidden();
$application->get('help')
->setHidden();
$application->get('list')
->setHidden();
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/ValueObject/ClassNames.php | src/ValueObject/ClassNames.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\ValueObject;
final readonly class ClassNames
{
/**
* @param string[] $attributes
*/
public function __construct(
private string $className,
private bool $hasParentClassOrInterface,
private array $attributes,
) {
}
public function getClassName(): string
{
return $this->className;
}
public function hasParentClassOrInterface(): bool
{
return $this->hasParentClassOrInterface;
}
/**
* @return string[]
*/
public function getAttributes(): array
{
return $this->attributes;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/ValueObject/FileWithClass.php | src/ValueObject/FileWithClass.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\ValueObject;
use JsonSerializable;
use Nette\Utils\FileSystem;
use TomasVotruba\ClassLeak\FileSystem\StaticRelativeFilePathHelper;
final readonly class FileWithClass implements JsonSerializable
{
/**
* @param string[] $attributes
*/
public function __construct(
private string $filePath,
private string $className,
private bool $hasParentClassOrInterface,
private array $attributes,
) {
}
public function getClassName(): string
{
return $this->className;
}
public function getFilePath(): string
{
return StaticRelativeFilePathHelper::resolveFromCwd($this->filePath);
}
public function hasParentClassOrInterface(): bool
{
return $this->hasParentClassOrInterface;
}
/**
* @return string[]
*/
public function getAttributes(): array
{
return $this->attributes;
}
/**
* @return array{file_path: string, class: string, attributes: string[]}
*/
public function jsonSerialize(): array
{
return [
'file_path' => $this->filePath,
'class' => $this->className,
'attributes' => $this->attributes,
];
}
/**
* Is serialized, could be hidden inside json output magic
*/
public function isSerialized(): bool
{
$fileContents = FileSystem::read($this->filePath);
return str_contains($fileContents, '@Serializer');
}
/**
* Dummy check for Doctrine ORM/ODM entity
*/
public function isEntity(): bool
{
$fileContents = FileSystem::read($this->filePath);
if (str_contains($fileContents, 'Doctrine\ODM\MongoDB\Mapping\Annotations')) {
return true;
}
if (str_contains($fileContents, 'Doctrine\ORM\Annotations')) {
return true;
}
if (str_contains($fileContents, '@ORM\Entity')) {
return true;
}
if (str_contains($fileContents, '@Entity')) {
return true;
}
if (str_contains($fileContents, '@ODM\\Document')) {
return true;
}
return str_contains($fileContents, '@Document');
}
public function isTrait(): bool
{
return trait_exists($this->className);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/ValueObject/UnusedClassesResult.php | src/ValueObject/UnusedClassesResult.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\ValueObject;
final readonly class UnusedClassesResult
{
/**
* @param FileWithClass[] $withParentsFileWithClasses
* @param FileWithClass[] $parentLessFileWithClasses
* @param FileWithClass[] $traits
*/
public function __construct(
private array $parentLessFileWithClasses,
private array $withParentsFileWithClasses,
private array $traits,
) {
}
/**
* @return FileWithClass[]
*/
public function getParentLessFileWithClasses(): array
{
return $this->parentLessFileWithClasses;
}
/**
* @return FileWithClass[]
*/
public function getWithParentsFileWithClasses(): array
{
return $this->withParentsFileWithClasses;
}
public function getCount(): int
{
return count($this->parentLessFileWithClasses) + count($this->withParentsFileWithClasses) + count(
$this->traits
);
}
/**
* @return FileWithClass[]
*/
public function getTraits(): array
{
return $this->traits;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/NodeDecorator/FullyQualifiedNameNodeDecorator.php | src/NodeDecorator/FullyQualifiedNameNodeDecorator.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\NodeDecorator;
use PhpParser\Node\Stmt;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor\NameResolver;
use PhpParser\NodeVisitor\NodeConnectingVisitor;
final class FullyQualifiedNameNodeDecorator
{
/**
* @param Stmt[] $stmts
*/
public function decorate(array $stmts): void
{
$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor(new NameResolver());
$nodeTraverser->addVisitor(new NodeConnectingVisitor());
$nodeTraverser->traverse($stmts);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/Filtering/PossiblyUnusedClassesFilter.php | src/Filtering/PossiblyUnusedClassesFilter.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Filtering;
use TomasVotruba\ClassLeak\ValueObject\FileWithClass;
use Webmozart\Assert\Assert;
final readonly class PossiblyUnusedClassesFilter
{
/**
* These class types are used by some kind of collector pattern. Either loaded magically, registered only in config,
* an entry point or a tagged extensions.
*
* @var string[]
*/
private const DEFAULT_TYPES_TO_SKIP = [
// http-kernel
'Symfony\Component\Console\Application',
'Symfony\Component\HttpKernel\DependencyInjection\Extension',
'Symfony\Bundle\FrameworkBundle\Controller\Controller',
'Symfony\Bundle\FrameworkBundle\Controller\AbstractController',
'Livewire\Component',
'Illuminate\Routing\Controller',
'Illuminate\Contracts\Http\Kernel',
'Illuminate\Support\ServiceProvider',
// events
'Symfony\Component\EventDispatcher\EventSubscriberInterface',
'Symfony\Component\Form\FormTypeExtensionInterface',
'Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface',
'Vich\UploaderBundle\Naming\DirectoryNamerInterface',
// validator
'Symfony\Component\Validator\Constraint',
'Symfony\Component\Validator\ConstraintValidator',
'Symfony\Component\Validator\ConstraintValidatorInterface',
'Symfony\Component\Security\Core\Authorization\Voter\VoterInterface',
'Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface',
'Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface',
'Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface',
'Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface',
// symfony forms
'Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface',
'Symfony\Component\Form\AbstractType',
// doctrine
'Doctrine\Common\DataFixtures\FixtureInterface',
'Doctrine\Common\EventSubscriber',
'Nelmio\Alice\ProcessorInterface',
// kernel
'Symfony\Component\HttpKernel\Bundle\BundleInterface',
'Symfony\Component\HttpKernel\KernelInterface',
'Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator',
// console
'Symfony\Component\Console\Command\Command',
'Twig\Extension\ExtensionInterface',
'PhpCsFixer\Fixer\FixerInterface',
'PHPUnit\Framework\TestCase',
'PHPStan\Rules\Rule',
'PHPStan\Command\ErrorFormatter\ErrorFormatter',
// tests
'Behat\Behat\Context\Context',
// jms
'JMS\Serializer\Handler\SubscribingHandlerInterface',
// laravel
'Illuminate\Support\ServiceProvider',
'Illuminate\Foundation\Http\Kernel',
'Illuminate\Contracts\Console\Kernel',
'Illuminate\Routing\Controller',
// Doctrine
'Doctrine\Migrations\AbstractMigration',
];
/**
* @var string[]
*/
private const DEFAULT_ATTRIBUTES_TO_SKIP = [
// Symfony
'Symfony\Component\Console\Attribute\AsCommand',
'Symfony\Component\HttpKernel\Attribute\AsController',
'Symfony\Component\EventDispatcher\Attribute\AsEventListener',
];
/**
* @param FileWithClass[] $filesWithClasses
* @param string[] $usedClassNames
* @param string[] $typesToSkip
* @param string[] $suffixesToSkip
* @param string[] $attributesToSkip
*
* @return FileWithClass[]
*/
public function filter(
array $filesWithClasses,
array $usedClassNames,
array $typesToSkip,
array $suffixesToSkip,
array $attributesToSkip,
bool $shouldIncludeEntities,
): array {
Assert::allString($usedClassNames);
Assert::allString($typesToSkip);
Assert::allString($suffixesToSkip);
$possiblyUnusedFilesWithClasses = [];
$typesToSkip = [...$typesToSkip, ...self::DEFAULT_TYPES_TO_SKIP];
$attributesToSkip = [...$attributesToSkip, ...self::DEFAULT_ATTRIBUTES_TO_SKIP];
foreach ($filesWithClasses as $fileWithClass) {
if (in_array($fileWithClass->getClassName(), $usedClassNames, true)) {
continue;
}
// is excluded interfaces?
if ($this->shouldSkip($fileWithClass->getClassName(), $typesToSkip)) {
continue;
}
if ($shouldIncludeEntities === false && $fileWithClass->isEntity()) {
continue;
}
if ($fileWithClass->isSerialized()) {
continue;
}
// is excluded suffix?
foreach ($suffixesToSkip as $suffixToSkip) {
if (str_ends_with($fileWithClass->getClassName(), $suffixToSkip)) {
continue 2;
}
}
// is excluded attributes?
foreach ($fileWithClass->getAttributes() as $attribute) {
if ($this->shouldSkip($attribute, $attributesToSkip)) {
continue 2;
}
}
$possiblyUnusedFilesWithClasses[] = $fileWithClass;
}
return $possiblyUnusedFilesWithClasses;
}
/**
* @param string[] $skips
*/
private function shouldSkip(string $type, array $skips): bool
{
foreach ($skips as $skip) {
if (! str_contains($type, '*') && is_a($type, $skip, true)) {
return true;
}
if (fnmatch($skip, $type, FNM_NOESCAPE)) {
return true;
}
}
return false;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/Commands/CheckCommand.php | src/Commands/CheckCommand.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Commands;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use TomasVotruba\ClassLeak\Filtering\PossiblyUnusedClassesFilter;
use TomasVotruba\ClassLeak\Finder\ClassNamesFinder;
use TomasVotruba\ClassLeak\Finder\PhpFilesFinder;
use TomasVotruba\ClassLeak\Reporting\UnusedClassesResultFactory;
use TomasVotruba\ClassLeak\Reporting\UnusedClassReporter;
use TomasVotruba\ClassLeak\UseImportsResolver;
final class CheckCommand extends Command
{
public function __construct(
private readonly ClassNamesFinder $classNamesFinder,
private readonly UseImportsResolver $useImportsResolver,
private readonly PossiblyUnusedClassesFilter $possiblyUnusedClassesFilter,
private readonly UnusedClassReporter $unusedClassReporter,
private readonly SymfonyStyle $symfonyStyle,
private readonly PhpFilesFinder $phpFilesFinder,
private readonly UnusedClassesResultFactory $unusedClassesResultFactory,
) {
parent::__construct();
}
protected function configure(): void
{
$this->setName('check');
$this->setDescription('Check classes that are not used in any config and in the code');
$this->addArgument(
'paths',
InputArgument::REQUIRED | InputArgument::IS_ARRAY,
'Files and directories to analyze'
);
$this->addOption(
'skip-type',
null,
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
'Class types that should be skipped'
);
$this->addOption(
'skip-suffix',
null,
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
'Class suffix that should be skipped'
);
$this->addOption(
'skip-path',
null,
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
'Paths to skip (real path or just directory name)'
);
$this->addOption(
'skip-attribute',
null,
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
'Class attribute that should be skipped'
);
$this->addOption(
'include-entities',
null,
InputOption::VALUE_NONE,
'Include Doctrine ORM and ODM entities (skipped by default)',
);
$this->addOption(
'file-extension',
null,
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
'File extensions to check',
['php']
);
$this->addOption('json', null, InputOption::VALUE_NONE, 'Output as JSON');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
/** @var string[] $paths */
$paths = (array) $input->getArgument('paths');
$shouldIncludeEntities = (bool) $input->getOption('include-entities');
/** @var string[] $typesToSkip */
$typesToSkip = (array) $input->getOption('skip-type');
/** @var string[] $suffixesToSkip */
$suffixesToSkip = (array) $input->getOption('skip-suffix');
/** @var string[] $attributesToSkip */
$attributesToSkip = (array) $input->getOption('skip-attribute');
/** @var string[] $pathsToSkip */
$pathsToSkip = (array) $input->getOption('skip-path');
$isJson = (bool) $input->getOption('json');
/** @var string[] $fileExtensions */
$fileExtensions = (array) $input->getOption('file-extension');
// we have to look for usage in every path
$allFilePaths = $this->phpFilesFinder->findPhpFiles($paths, $fileExtensions, []);
// but we only want to check the files that are not in the skipped paths
$phpFilePaths = $this->phpFilesFinder->findPhpFiles($paths, $fileExtensions, $pathsToSkip);
$progressBar = null;
if (! $isJson) {
$this->symfonyStyle->title('1. Finding used classes');
$progressBar = $this->symfonyStyle->createProgressBar(count($allFilePaths));
}
$usedNames = $this->resolveUsedClassNames($allFilePaths, $progressBar);
$this->symfonyStyle->newLine(2);
$progressBar = null;
if (! $isJson) {
$this->symfonyStyle->title('2. Extracting existing files with classes');
$progressBar = $this->symfonyStyle->createProgressBar(count($phpFilePaths));
}
$existingFilesWithClasses = $this->classNamesFinder->resolveClassNamesToCheck($phpFilePaths, $progressBar);
$this->symfonyStyle->newLine(2);
$possiblyUnusedFilesWithClasses = $this->possiblyUnusedClassesFilter->filter(
$existingFilesWithClasses,
$usedNames,
$typesToSkip,
$suffixesToSkip,
$attributesToSkip,
$shouldIncludeEntities,
);
$unusedClassesResult = $this->unusedClassesResultFactory->create($possiblyUnusedFilesWithClasses);
$this->symfonyStyle->newLine();
return $this->unusedClassReporter->reportResult($unusedClassesResult, $isJson);
}
/**
* @param string[] $phpFilePaths
* @return string[]
*/
private function resolveUsedClassNames(array $phpFilePaths, ?ProgressBar $progressBar): array
{
$usedNames = [];
foreach ($phpFilePaths as $phpFilePath) {
$currentUsedNames = $this->useImportsResolver->resolve($phpFilePath);
$usedNames = [...$usedNames, ...$currentUsedNames];
$progressBar?->advance();
}
$usedNames = array_unique($usedNames);
sort($usedNames);
return $usedNames;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/Reporting/UnusedClassesResultFactory.php | src/Reporting/UnusedClassesResultFactory.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Reporting;
use TomasVotruba\ClassLeak\ValueObject\FileWithClass;
use TomasVotruba\ClassLeak\ValueObject\UnusedClassesResult;
final class UnusedClassesResultFactory
{
/**
* @param FileWithClass[] $unusedFilesWithClasses
*/
public function create(array $unusedFilesWithClasses): UnusedClassesResult
{
$parentLessFileWithClasses = [];
$withParentsFileWithClasses = [];
$traits = [];
foreach ($unusedFilesWithClasses as $unusedFileWithClass) {
if ($unusedFileWithClass->hasParentClassOrInterface()) {
$withParentsFileWithClasses[] = $unusedFileWithClass;
} elseif ($unusedFileWithClass->isTrait()) {
$traits[] = $unusedFileWithClass;
} else {
$parentLessFileWithClasses[] = $unusedFileWithClass;
}
}
return new UnusedClassesResult($parentLessFileWithClasses, $withParentsFileWithClasses, $traits);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/src/Reporting/UnusedClassReporter.php | src/Reporting/UnusedClassReporter.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Reporting;
use Nette\Utils\Json;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use TomasVotruba\ClassLeak\ValueObject\FileWithClass;
use TomasVotruba\ClassLeak\ValueObject\UnusedClassesResult;
final readonly class UnusedClassReporter
{
public function __construct(
private SymfonyStyle $symfonyStyle
) {
}
/**
* @return Command::*
*/
public function reportResult(UnusedClassesResult $unusedClassesResult, bool $isJson): int
{
if ($isJson) {
$jsonResult = [
'unused_class_count' => $unusedClassesResult->getCount(),
'unused_parent_less_classes' => $unusedClassesResult->getParentLessFileWithClasses(),
'unused_classes_with_parents' => $unusedClassesResult->getWithParentsFileWithClasses(),
'unused_traits' => $unusedClassesResult->getTraits(),
];
$this->symfonyStyle->writeln(Json::encode($jsonResult, Json::PRETTY));
return Command::SUCCESS;
}
$this->symfonyStyle->newLine(2);
if ($unusedClassesResult->getCount() === 0) {
$this->symfonyStyle->success('All services are used. Great job!');
return Command::SUCCESS;
}
// separate with and without parent, as first one can be removed more easily
if ($unusedClassesResult->getWithParentsFileWithClasses() !== []) {
$this->printLineWIthClasses(
'Classes with a parent/interface',
$unusedClassesResult->getWithParentsFileWithClasses()
);
}
if ($unusedClassesResult->getParentLessFileWithClasses() !== []) {
$this->printLineWIthClasses(
'Classes without any parent/interface - easier to remove',
$unusedClassesResult->getParentLessFileWithClasses()
);
}
if ($unusedClassesResult->getTraits() !== []) {
$this->printLineWIthClasses('Unused traits - the easiest to remove', $unusedClassesResult->getTraits());
}
$this->symfonyStyle->newLine();
$this->symfonyStyle->error(sprintf(
'Found %d unused classes. Remove them or skip them using "--skip-type" option',
$unusedClassesResult->getCount()
));
return Command::FAILURE;
}
/**
* @param FileWithClass[] $fileWithClasses
*/
private function printLineWIthClasses(string $title, array $fileWithClasses): void
{
$this->symfonyStyle->newLine();
$this->symfonyStyle->section($title);
foreach ($fileWithClasses as $fileWithClass) {
$this->symfonyStyle->writeln($fileWithClass->getFilePath());
}
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/AbstractTestCase.php | tests/AbstractTestCase.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests;
use PHPUnit\Framework\TestCase;
use TomasVotruba\ClassLeak\DependencyInjection\ContainerFactory;
use Webmozart\Assert\Assert;
abstract class AbstractTestCase extends TestCase
{
/**
* @template TType as object
* @param class-string<TType> $type
* @return TType
*/
protected function make(string $type): object
{
$containerFactory = new ContainerFactory();
$container = $containerFactory->create();
$service = $container->make($type);
Assert::isInstanceOf($service, $type);
return $service;
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/FileSystem/StaticRelativeFilePathHelperTest.php | tests/FileSystem/StaticRelativeFilePathHelperTest.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\FileSystem;
use PHPUnit\Framework\TestCase;
use TomasVotruba\ClassLeak\FileSystem\StaticRelativeFilePathHelper;
final class StaticRelativeFilePathHelperTest extends TestCase
{
public function test(): void
{
$relativeFilePath = StaticRelativeFilePathHelper::resolveFromCwd(__DIR__ . '/Fixture/some-file.php');
$this->assertSame('tests/FileSystem/Fixture/some-file.php', $relativeFilePath);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/FileSystem/Fixture/some-file.php | tests/FileSystem/Fixture/some-file.php | <?php
declare(strict_types=1);
// some content
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/UseImportsResolverTest.php | tests/UseImportsResolver/UseImportsResolverTest.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver;
use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use RuntimeException;
use TomasVotruba\ClassLeak\Tests\AbstractTestCase;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Fixture\SomeFactory;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\FirstUsedClass;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\FourthUsedClass;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\SecondUsedClass;
use TomasVotruba\ClassLeak\UseImportsResolver;
final class UseImportsResolverTest extends AbstractTestCase
{
private UseImportsResolver $useImportsResolver;
protected function setUp(): void
{
parent::setUp();
$this->useImportsResolver = $this->make(UseImportsResolver::class);
}
/**
* @param string[] $expectedClassUsages
*/
#[DataProvider('provideData')]
public function test(string $filePath, array $expectedClassUsages): void
{
$resolvedClassUsages = $this->useImportsResolver->resolve($filePath);
$this->assertSame($expectedClassUsages, $resolvedClassUsages);
}
/**
* @return Iterator<array<array<int, mixed>, mixed>>
*/
public static function provideData(): Iterator
{
yield [__DIR__ . '/Fixture/FileUsingOtherClasses.php', [FirstUsedClass::class, SecondUsedClass::class]];
yield [__DIR__ . '/Fixture/FileUsesStaticCall.php', [SomeFactory::class, FourthUsedClass::class]];
}
public function testParseError(): void
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage(
'Could not parse file "' . __DIR__ . '/Fixture/ParseError.php": Syntax error, unexpected T_STRING on line 7'
);
$this->useImportsResolver->resolve(__DIR__ . '/Fixture/ParseError.php');
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Source/ThirdUsedClass.php | tests/UseImportsResolver/Source/ThirdUsedClass.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source;
final class ThirdUsedClass
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Source/FourthUsedClass.php | tests/UseImportsResolver/Source/FourthUsedClass.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source;
final class FourthUsedClass
{
public static function create(): array
{
return [];
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Source/FirstUsedClass.php | tests/UseImportsResolver/Source/FirstUsedClass.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source;
final class FirstUsedClass
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Source/SecondUsedClass.php | tests/UseImportsResolver/Source/SecondUsedClass.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source;
final class SecondUsedClass
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Fixture/SomeFactory.php | tests/UseImportsResolver/Fixture/SomeFactory.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Fixture;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\FourthUsedClass;
final class SomeFactory
{
public static function create(): FourthUsedClass
{
return new FourthUsedClass();
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Fixture/FileUsingOtherClasses.php | tests/UseImportsResolver/Fixture/FileUsingOtherClasses.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Fixture;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\FirstUsedClass;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\SecondUsedClass;
final class FileUsingOtherClasses
{
public function run(FirstUsedClass $firstUsedClass): SecondUsedClass
{
return new SecondUsedClass();
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Fixture/FileUsesStaticCall.php | tests/UseImportsResolver/Fixture/FileUsesStaticCall.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\UseImportsResolver\Fixture;
use TomasVotruba\ClassLeak\Tests\UseImportsResolver\Source\FourthUsedClass;
final class FileUsesStaticCall
{
public function other(): FourthUsedClass
{
return SomeFactory::create();
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/UseImportsResolver/Fixture/ParseError.php | tests/UseImportsResolver/Fixture/ParseError.php | <?php
namespace ParseError;
function doFoo() {
// this file intentionally contains this parse error
$x ABC
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/Finder/PhpFilesFinderTest.php | tests/Finder/PhpFilesFinderTest.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\Finder;
use TomasVotruba\ClassLeak\Finder\PhpFilesFinder;
use TomasVotruba\ClassLeak\Tests\AbstractTestCase;
final class PhpFilesFinderTest extends AbstractTestCase
{
private PhpFilesFinder $phpFilesFinder;
protected function setUp(): void
{
parent::setUp();
$this->phpFilesFinder = $this->make(PhpFilesFinder::class);
}
public function test(): void
{
$phpFiles = $this->phpFilesFinder->findPhpFiles([__DIR__ . '/Fixture'], ['php', 'phtml'], []);
$this->assertCount(4, $phpFiles);
$phpFiles = $this->phpFilesFinder->findPhpFiles([__DIR__ . '/Fixture'], ['php'], []);
$this->assertCount(3, $phpFiles);
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/Finder/Fixture/core_file.php | tests/Finder/Fixture/core_file.php | <?php
declare(strict_types=1);
// some content
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/Finder/Fixture/some/file.php | tests/Finder/Fixture/some/file.php | <?php
declare(strict_types=1);
// some content
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/Finder/Fixture/some/more-nested/nested-file.php | tests/Finder/Fixture/some/more-nested/nested-file.php | <?php
declare(strict_types=1);
// some content
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/ClassNameResolver/ClassNameResolverTest.php | tests/ClassNameResolver/ClassNameResolverTest.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\ClassNameResolver;
use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use TomasVotruba\ClassLeak\ClassNameResolver;
use TomasVotruba\ClassLeak\Tests\AbstractTestCase;
use TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture\ClassWithAnyComment;
use TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture\SomeAttribute;
use TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture\SomeClass;
use TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture\SomeMethodAttribute;
use TomasVotruba\ClassLeak\ValueObject\ClassNames;
final class ClassNameResolverTest extends AbstractTestCase
{
private ClassNameResolver $classNameResolver;
protected function setUp(): void
{
parent::setUp();
$this->classNameResolver = $this->make(ClassNameResolver::class);
}
#[DataProvider('provideData')]
public function test(string $filePath, ClassNames $expectedClassNames): void
{
$resolvedClassNames = $this->classNameResolver->resolveFromFilePath($filePath);
$this->assertInstanceOf(ClassNames::class, $resolvedClassNames);
$this->assertSame($expectedClassNames->getClassName(), $resolvedClassNames->getClassName());
$this->assertSame(
$expectedClassNames->hasParentClassOrInterface(),
$resolvedClassNames->hasParentClassOrInterface()
);
$this->assertSame($expectedClassNames->getAttributes(), $resolvedClassNames->getAttributes());
}
/**
* @return Iterator<array<int, (string|ClassNames)>>
*/
public static function provideData(): Iterator
{
yield [
__DIR__ . '/Fixture/SomeClass.php',
new ClassNames(SomeClass::class, false, [SomeAttribute::class, SomeMethodAttribute::class]),
];
yield [
__DIR__ . '/Fixture/ClassWithAnyComment.php',
new ClassNames(ClassWithAnyComment::class, false, []),
];
}
#[DataProvider('provideNoClassContainedData')]
public function testNoClassContained(string $filePath): void
{
$resolvedClassNames = $this->classNameResolver->resolveFromFilePath($filePath);
$this->assertNotInstanceOf(ClassNames::class, $resolvedClassNames);
}
/**
* @return Iterator<array<int, string>>
*/
public static function provideNoClassContainedData(): Iterator
{
yield [__DIR__ . '/Fixture/ClassWithApiComment.php'];
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/ClassNameResolver/Fixture/SomeMethodAttribute.php | tests/ClassNameResolver/Fixture/SomeMethodAttribute.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture;
use Attribute;
#[Attribute(Attribute::TARGET_METHOD)]
class SomeMethodAttribute
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/ClassNameResolver/Fixture/ClassWithApiComment.php | tests/ClassNameResolver/Fixture/ClassWithApiComment.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture;
/** @api */
final class ClassWithApiComment
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/ClassNameResolver/Fixture/SomeAttribute.php | tests/ClassNameResolver/Fixture/SomeAttribute.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture;
use Attribute;
#[Attribute]
class SomeAttribute
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/ClassNameResolver/Fixture/ClassWithAnyComment.php | tests/ClassNameResolver/Fixture/ClassWithAnyComment.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture;
/** some comment */
final class ClassWithAnyComment
{
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/tests/ClassNameResolver/Fixture/SomeClass.php | tests/ClassNameResolver/Fixture/SomeClass.php | <?php
declare(strict_types=1);
namespace TomasVotruba\ClassLeak\Tests\ClassNameResolver\Fixture;
#[SomeAttribute]
final class SomeClass
{
#[SomeMethodAttribute]
public function myMethod(): void
{
}
}
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/build/rector-downgrade-php-72.php | build/rector-downgrade-php-72.php | <?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->parallel(240, 8, 1);
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]);
$rectorConfig->skip([
'*/Tests/*',
'*/tests/*',
__DIR__ . '/../../tests',
# missing "optional" dependency and never used here
'*/symfony/framework-bundle/KernelBrowser.php',
'*/symfony/http-kernel/HttpKernelBrowser.php',
]);
};
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
TomasVotruba/class-leak | https://github.com/TomasVotruba/class-leak/blob/282902699bcc29ed2832ffac04a411d6b15ec0b5/bin/class-leak.php | bin/class-leak.php | <?php
declare(strict_types=1);
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use TomasVotruba\ClassLeak\DependencyInjection\ContainerFactory;
if (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) {
// project's autoload
require_once __DIR__ . '/../../../../vendor/autoload.php';
}
if (file_exists(__DIR__ . '/../vendor/scoper-autoload.php')) {
// A. build downgraded package
require_once __DIR__ . '/../vendor/scoper-autoload.php';
} else {
// B. local repository
require_once __DIR__ . '/../vendor/autoload.php';
}
$containerFactory = new ContainerFactory();
$container = $containerFactory->create();
/** @var Application $application */
$application = $container->make(Application::class);
$exitCode = $application->run(new ArgvInput(), new ConsoleOutput());
exit($exitCode);
| php | MIT | 282902699bcc29ed2832ffac04a411d6b15ec0b5 | 2026-01-05T05:22:22.860445Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/dv_confirm.php | dv_confirm.php | <?php
require('require/top.php');
authorise_user2();
$oid = $_GET['id'];
?>
<div class="path">
<div class="container">
<a href="index.html">Home</a>
/
<a href="index.html">My Orders</a>
</div>
</div>
<section class="myorders">
<section class="myac-body">
<div class="flex row">
<div class="right" style="flex-basis:100%">
<h4><i class="uil uil-box"></i>My Orders</h4>
<div class="col-lg-12 col-md-12" id="bill-sec">
<?php
$uid = $_SESSION['USER_ID'];
$query = "select orders.dv_time,orders.order_status,orders.id,orders.o_id,orders.total_amt,orders.ship_fee_order,orders.final_val,dv_time.from,dv_time.tto from orders,dv_time where orders.id='$oid' and orders.u_id='$uid' and orders.dv_date=dv_time.id and not orders.order_status='1'";
$res = mysqli_query($con, $query);
if (mysqli_num_rows($res) > 0) {
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h6>Order Id: <?php echo $row['o_id']; ?></h6>
<h6>Delivery Timing: <?php echo $row['dv_time']; ?>,<?php echo $row['from']; ?> -
<?php echo $row['tto']; ?></h6>
</div>
<div class="order-body10">
<?php
$oid = $row['id'];
$rs = mysqli_query($con, "select order_detail.delivered_qty,order_detail.qty,product.product_name,product.img1 from order_detail,product where order_detail.oid='$oid' and order_detail.p_id=product.id");
while ($rw = mysqli_fetch_assoc($rs)) {
?>
<ul class="order-dtsll">
<li>
<div class="order-dt-img">
<img src="media/product/<?php echo $rw['img1']; ?>" alt="" />
</div>
</li>
<li>
<div class="order-dt47">
<h4><?php echo $rw['product_name']; ?></h4>
<div class="order-title">
Ordered Qty: <?php echo $rw['qty']; ?> Items
</div>
<div class="order-title">
Delivered Qty: <?php echo $rw['delivered_qty']; ?> Items
</div>
</div>
</li>
</ul>
<?php } ?>
<div class="total-dt">
<div class="total-checkout-group">
<div class="cart-total-dil">
<h4>Sub Total</h4>
<span>₹<?php echo $row['total_amt']; ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Delivery Charges</h4>
<span>₹<?php echo $row['ship_fee_order']; ?></span>
</div>
</div>
<div class="main-total-cart">
<h2>Total</h2>
<span>₹<?php echo $row['final_val']; ?></span>
</div>
</div>
<div class="track-order">
<h4>Track Order</h4>
<?php
$fade = "bs-wizard-dot fade";
$cfade = "bs-wizard-dot";
$progress = "progress-bar";
$fadeBar = "fade-bar";
?>
<div class="bs-wizard" style="border-bottom: 0">
<div class="bs-wizard-step complete">
<div class="text-center bs-wizard-stepnum">Placed</div>
<div class="progress">
<div class="<?php
if ($row['order_status'] == 3 || $row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $progress;
} else {
echo $fadeBar;
} ?>">
</div>
</div>
<a href="#" class="
<?php
echo $cfade; ?>
"></a>
</div>
<div class="bs-wizard-step complete">
<div class="text-center bs-wizard-stepnum">Packed</div>
<div class="progress">
<div class="<?php
if ($row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $progress;
} else {
echo $fadeBar;
} ?>"> </div>
</div>
<a href="#" class="<?php
if ($row['order_status'] == 3 || $row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $cfade;
} else {
echo $fade;
} ?>"></a>
</div>
<div class="bs-wizard-step active">
<div class="text-center bs-wizard-stepnum">
On the way
</div>
<div class="progress">
<div class="<?php
if ($row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $progress;
} else {
echo $fadeBar;
} ?>"> </div>
</div>
<a href="#" class="<?php
if ($row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $cfade;
} else {
echo $fade;
} ?>"></a>
</div>
<div class="bs-wizard-step disabled">
<div class="text-center bs-wizard-stepnum">
<?php
if ($row['order_status'] == 5) {
echo "Delivered";
} else if ($row['order_status'] == 6) {
echo "Undelivered";
} else if ($row['order_status'] == 7) {
echo "Issue";
} else {
echo "Delivered";
}
?>
</div>
<div class="progress" style="width: 0%;">
<div class="progress-bar"></div>
</div>
<a href="#" class="<?php
if ($row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $cfade;
} else {
echo $fade;
} ?>"></a>
</div>
</div>
</div>
<?php
if ($row['order_status'] == 5) {
?>
<div class="call-bill justify-between">
<div class="order-bill-slip">
<a href="javascript:void(0)" class="bill-btn5 hover-btn" onclick="confirm_delivered_order(<?php echo $oid ?>)">Confirm</a>
</div>
<div class="order-bill-slip" style="margin-left:1rem">
<a href="javascript:void(0)" class="bill-btn5 hover-btn" onclick="not_confirm_delivered_order(<?php echo $oid ?>)">Not Confirm</a>
</div>
</div>
<?php } ?>
</div>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/payment_fail.php | payment_fail.php | <?php
echo '<pre>';
print_r($_POST);
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/insert.php | insert.php | <?php
require('utility/utility.php');
//4012 0010 3714 1112
if (isset($_POST['orderId_user'])) {
$order_id = $_POST['orderId_user'];
$query = "select orders.txnid,orders.o_id,orders.final_val,user_address.user_name,user_address.user_mobile,users.email from orders,user_address,users where orders.id='$order_id' and orders.ad_id=user_address.id and orders.u_id=users.id";
$row = mysqli_fetch_assoc(mysqli_query($con, $query));
}
$MERCHANT_KEY = "merchant key";
$SALT = "salt key";
$txnid = $row['txnid'];
$name = $row['user_name'];
$mobile = $row['user_mobile'];
$email = $row['email'];
$amount = $row['final_val'];
$lead = $_SESSION['utm_source'];
$PAYU_BASE_URL = "https://sandboxsecure.payu.in"; // For Sandbox Mode
// $PAYU_BASE_URL = "https://secure.payu.in"; // For Production Mode
$action = '';
$posted = array();
if (!empty($_POST)) {
//print_r($_POST);
foreach ($_POST as $key => $value) {
$posted[$key] = $value;
}
}
$formError = 0;
$txnid = '';
if (empty($posted['txnid'])) {
// Generate random transaction id
$txnid = $row['txnid'];
} else {
$txnid = $posted['txnid'];
}
$hash = '';
// Hash Sequence
$hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
if (empty($posted['hash']) && sizeof($posted) > 0) {
if (
empty($posted['key'])
|| empty($posted['txnid'])
|| empty($posted['amount'])
|| empty($posted['firstname'])
|| empty($posted['email'])
|| empty($posted['phone'])
|| empty($posted['productinfo'])
|| empty($posted['surl'])
|| empty($posted['furl'])
|| empty($posted['service_provider'])
) {
$formError = 1;
} else {
$hashVarsSeq = explode('|', $hashSequence);
$hash_string = '';
foreach ($hashVarsSeq as $hash_var) {
$hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
$hash_string .= '|';
}
$hash_string .= $SALT;
$hash = strtolower(hash('sha512', $hash_string));
$action = $PAYU_BASE_URL . '/_payment';
}
} elseif (!empty($posted['hash'])) {
$hash = $posted['hash'];
$action = $PAYU_BASE_URL . '/_payment';
}
?>
<html>
<head>
<script>
var hash = '<?php echo $hash ?>';
function submitPayuForm() {
if (hash == '') {
return;
}
var payuForm = document.forms.payuForm;
payuForm.submit();
}
</script>
</head>
<body onload="submitPayuForm()">
<form id="payForm" action="<?php echo $action; ?>" method="post" name="payuForm">
<input type="hidden" name="key" value="<?php echo $MERCHANT_KEY ?>" />
<input type="hidden" name="hash" value="<?php echo $hash ?>" />
<input type="hidden" name="txnid" value="<?php echo $txnid ?>" />
<input type="hidden" name="amount" value="<?php echo $amount ?>" />
<input type="hidden" name="email" value="<?php echo $email ?>" />
<input type="hidden" name="productinfo" value="<?php echo $lead ?>" />
<input type="hidden" name="orderId_user" value="<?php echo $_POST['orderId_user']; ?>" />
<input type="hidden" name="surl" value="http://localhost/backend_projects/grocerry/payment_complete.php" />
<input type="hidden" name="furl" value="http://localhost/backend_projects/grocerry/payment_fail.php" />
<input type="hidden" name="service_provider" value="payu_paisa" size="64" />
<input type="hidden" name="firstname" value="<?php echo $name ?>" />
<input type="hidden" name="phone" value="<?php echo $mobile ?>" />
</form>
</body>
<script type="text/javascript">
window.onload = function() {
document.getElementById("payForm").submit();
}
</script>
</html> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/edit_address.php | edit_address.php | <?php
require('require/top.php');
authorise_user2();
$userid = $_SESSION['USER_ID'];
if (!isset($_GET['ad-id'])) {
redirect('address.php');
die();
}
$id = $_GET['ad-id'];
$query = "select * from user_address where id='$id' and uid='$userid'";
if (mysqli_num_rows(mysqli_query($con, $query)) == 0) {
redirect('address.php');
die();
}
$row = mysqli_fetch_assoc(mysqli_query($con, $query));
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="address.php">My Address</a>
/
<a href="edit_address.php">Edit Address</a>
</div>
</div>
<section class="newaddress">
<?php require('require/headbanner.php'); ?>
<section class="myac-body">
<div class="flex row">
<?php require('require/ac-left.php'); ?>
<div class="right">
<h4><i class="uil uil-location-point"></i>Add New Address</h4>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title">
<h4>Add Address</h4>
</div>
<div class="formbody">
<form action="javascript:void(0)">
<div class="form-group">
<div class="product-radio">
<ul class="product-now">
<li>
<input type="radio" id="ad1" name="address1" <?php if ($row['type_ad'] == "Home") {
echo "checked";
} ?> value="Home" />
<label for="ad1">Home</label>
</li>
<li>
<input type="radio" id="ad2" name="address1" <?php if ($row['type_ad'] == "Office") {
echo "checked";
} ?> value="Office" />
<label for="ad2">Office</label>
</li>
<li>
<input type="radio" id="ad3" name="address1" <?php if ($row['type_ad'] == "Other") {
echo "checked";
} ?> value="Other" />
<label for="ad3">Other</label>
</li>
</ul>
</div>
</div>
<div class="address-fieldset">
<div class="row">
<div class="row2">
<div class="lt">
<label for="ft">Name*</label>
<input type="text" placeholder="Name" id="dv-name" value="<?php echo $row['user_name'] ?>""
/>
</div>
<div class=" ft">
<label for="ft">Mobile*</label>
<input type="number" placeholder="Number" id="dv-number" oninput="validate_number()" value="<?php echo $row['user_mobile'] ?>" />
</div>
</div>
<label for="ft">City*</label>
<select name="" id="dv-city">
<option value="#">Select City</option>
<?php
$querys = "select * from city order by id desc";
$ress = mysqli_query($con, $querys);
while ($rows = mysqli_fetch_assoc($ress)) {
if ($row['user_city'] == $rows['id']) {
?>
<option value="<?php echo $rows['id'] ?>" selected>
<?php echo $rows['city_name'] ?></option>
<?php
} else {
?>
<option value="<?php echo $rows['id'] ?>">
<?php echo $rows['city_name'] ?></option>
<?php
}
}
?>
</select>
<label for="ft">Flat / House / Office No.*</label>
<input type="text" placeholder="Address" id="dv-address" value="<?php echo $row['user_add'] ?>" />
<div class="row2">
<div class="lt">
<label for="ft">Pincode*</label>
<input type="text" placeholder="Pincode" id="dv-pin" value="<?php echo $row['user_pin'] ?>" />
</div>
<div class="ft">
<label for="ft">Landmark*</label>
<input type="text" placeholder="Landmark" id="dv-land" value="<?php echo $row['user_local'] ?>" />
</div>
</div>
<div class="row2">
<button class="save-address" onclick="update_address(<?php echo $id; ?>)">
Update
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/view.php | view.php | <?php
require('require/top.php');
$categories = get_all_categories($con);
$subcategories = get_all_sub_categories($con, $_GET['n']);
$all_product = array();
$key = $_GET['k'];
$cat = $_GET['n'];
if (isset($_GET['n']) && !isset($_GET['scat']) && !isset($_GET['filter']) && !isset($_GET['subfilter'])) {
$all_product = search_product($con, $key, $cat);
} else if (isset($_GET['n']) && isset($_GET['scat']) && !isset($_GET['filter']) && !isset($_GET['subfilter'])) {
$scat = $_GET['scat'];
$all_product = search_product($con, $key, $cat, $scat);
} else if (isset($_GET['n']) && isset($_GET['scat']) && isset($_GET['filter']) && !isset($_GET['subfilter'])) {
$filter = $_GET['filter'];
$scat = $_GET['scat'];
$all_product = search_product($con, $key, $cat, $scat, $filter);
} else if (isset($_GET['n']) && isset($_GET['scat']) && isset($_GET['filter']) && isset($_GET['subfilter'])) {
$filter = $_GET['filter'];
$scat = $_GET['scat'];
$sfilter = $_GET['subfilter'];
$all_product = search_product($con, $key, $cat, $scat, $filter, $sfilter);
}
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="">Search</a>
</div>
</div>
<section class="view-product">
<div class="row">
<section class="search">
<div class="searchrow">
<div class="left">
<div class="shop-by-depertment">
<h2>Shop by depertment</h2>
<ul>
<?php
foreach ($categories as $cat) {
?>
<li><a href="view.php?n=<?php echo $cat['id']; ?>&k="><?php echo $cat['category']; ?></a></li>
<?php } ?>
</ul>
</div>
<div class="shop-by-depertment" style="margin-top:2rem;">
<h2>price range</h2>
<ul>
<input type="range" name="price" id="price-input" min="1" max="1000" value="1000" oninput="getprice()" style="accent-color:#f55d2c;border:none">
<div class="inrow" style="margin-top: 1.5rem;">
<div class="in">
<h4>₹0</h4>
</div>
<div class="in">
<h4>₹<span id="fnlp">1000</span></h4>
</div>
<div class="in">
<h4 class="underline" onclick="filterPrice()" style="cursor:pointer">filter</h4>
</div>
</div>
</ul>
</div>
<div class="shop-by-depertment" style="border-top: 0;">
<h2>sub category</h2>
<ul>
<?php
foreach ($subcategories as $cat) {
if (isset($_GET['scat']) && $_GET['scat'] == $cat['id']) {
?>
<li>
<input type="checkbox" name="check" value="<?php echo $cat['id']; ?>" onchange="checksubcat(this)" checked> <label for="none"><?php echo $cat['subcat']; ?></label>
</li>
<?php
} else {
?>
<li>
<input type="checkbox" name="check" value="<?php echo $cat['id']; ?>" onchange="checksubcat(this)"> <label for="none"><?php echo $cat['subcat']; ?></label>
</li>
<?php
}
} ?>
</ul>
</div>
<?php if (isset($_GET['scat'])) {
$filters = array();
$filters = get_all_sub_categories_filters($con, $_GET['scat']);
?>
<div class="shop-by-depertment" style="border-top: 0;">
<h2>filter</h2>
<ul>
<?php
foreach ($filters as $filter) {
if (isset($_GET['filter']) && $_GET['filter'] == $filter['id']) {
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checkfilter(this)" checked> <label for="none"><?php echo $filter['filter']; ?></label>
</li>
<?php
} else {
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checkfilter(this)"> <label for="none"><?php echo $filter['filter']; ?></label>
</li>
<?php
}
} ?>
</ul>
</div>
<?php }
if (isset($_GET['filter'])) {
$subfilters = array();
$subfilters = get_all_sub_filters($con, $_GET['filter']);
?>
<div class="shop-by-depertment" style="border-top: 0;">
<h2>sub filter</h2>
<ul>
<?php
foreach ($subfilters as $filter) {
if (isset($_GET['subfilter']) && $_GET['subfilter'] == $filter['id']) {
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checksfilter(this)" checked> <label for="none"><?php echo $filter['subfilter']; ?></label>
</li>
<?php
} else {
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checksfilter(this)"> <label for="none"><?php echo $filter['subfilter']; ?></label>
</li>
<?php
}
} ?>
</ul>
</div>
<?php } ?>
</div>
<div class="right">
<h1>Shop</h1>
<div class="outerbox">
<?php
if (count($all_product) != 0) {
foreach ($all_product as $product) {
?>
<div class="product" style="background:#fff">
<div class="image">
<img src="media/product/<?php echo $product['img1'] ?>" alt="product">
</div>
<div class="detail">
<h4>
<a href="product_detail.php?pid=<?php echo ($product['id']); ?>&type='detail'&show='2'"><?php echo $product['product_name'] ?></a>
</h4>
<p class="price">₹<span class="ftrp"><?php echo $product['fa'] ?></span></p>
</div>
</div>
<?php
}
} else {
echo "<h1>Nothing Found</h1>";
}
?>
</div>
</div>
</div>
</section>
</div>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/add_address.php | add_address.php | <?php
require('require/top.php');
authorise_user2();
$userid = $_SESSION['USER_ID'];
$userData = mysqli_fetch_assoc(mysqli_query($con, "select users.*,user_wallet.ballance from users,user_wallet where users.id='$userid' and user_wallet.user_id=users.id"));
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="address.php">My Address</a>
/
<a href="add_address.php">Add Address</a>
</div>
</div>
<section class="newaddress">
<?php require('require/headbanner.php'); ?>
<section class="myac-body">
<div class="flex row">
<?php require('require/ac-left.php'); ?>
<div class="right">
<h4><i class="uil uil-location-point"></i>Add New Address</h4>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title">
<h4>Add Address</h4>
</div>
<div class="formbody">
<form action="javascript:void(0)">
<div class="form-group">
<div class="product-radio">
<ul class="product-now">
<li>
<input type="radio" id="ad1" name="address1" checked="" />
<label for="ad1">Home</label>
</li>
<li>
<input type="radio" id="ad2" name="address1" />
<label for="ad2">Office</label>
</li>
<li>
<input type="radio" id="ad3" name="address1" />
<label for="ad3">Other</label>
</li>
</ul>
</div>
</div>
<div class="address-fieldset">
<div class="row">
<div class="row2">
<div class="lt">
<label for="ft">Name*</label>
<input type="text" placeholder="Name" id="dv-name" />
</div>
<div class="ft">
<label for="ft">Mobile*</label>
<input type="number" placeholder="Number" id="dv-number" oninput="validate_number()" />
</div>
</div>
<label for="ft">City*</label>
<select name="" id="dv-city">
<option value="#">Select City</option>
<?php
$querys = "select * from city order by id desc";
$ress = mysqli_query($con, $querys);
while ($rows = mysqli_fetch_assoc($ress)) {
?>
<option value="<?php echo $rows['id'] ?>">
<?php echo $rows['city_name'] ?></option>
<?php
}
?>
</select>
<label for="ft">Flat / House / Office No.*</label>
<input type="text" placeholder="Address" id="dv-address" />
<div class="row2">
<div class="lt">
<label for="ft">Pincode*</label>
<input type="text" placeholder="Pincode" id="dv-pin" />
</div>
<div class="ft">
<label for="ft">Landmark*</label>
<input type="text" placeholder="Landmark" id="dv-land" />
</div>
</div>
<div class="row2">
<button class="save-address" onclick="add_new_address()">
Save
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/address.php | address.php | <?php
require('require/top.php');
authorise_user2();
$userid = $_SESSION['USER_ID'];
$userData = mysqli_fetch_assoc(mysqli_query($con, "select users.*,user_wallet.ballance from users,user_wallet where users.id='$userid' and user_wallet.user_id=users.id"));
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="address.php">My Address</a>
</div>
</div>
<section class="address">
<?php require('require/headbanner.php'); ?>
<section class="myac-body">
<div class="flex row">
<?php require('require/ac-left.php'); ?>
<div class="right">
<h4><i class="uil uil-location-point"></i>My Address</h4>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title">
<h4>My Address</h4>
</div>
<div class="add-btn">
<button onclick="control.redirect('add_address.php')">Add New Address</button>
</div>
<?php
$template = '';
$uid = $_SESSION['USER_ID'];
$res = mysqli_query($con, "select user_address.*,city.city_name from user_address,city where user_address.uid='$uid' and user_address.user_city=city.id");
while ($row = mysqli_fetch_assoc($res)) {
$template = $template . '
<div class="address-item">
<div class="address-icon1">
<i class="uil uil-home"></i>
</div>
<div class="address-dt-all">
<h4>' . $row['type_ad'] . '</h4>
<p>
' . $row['user_name'] . ', ' . $row['user_local'] . ', ' . $row['user_add'] . ',
' . $row['city_name'] . ', ' . $row['user_pin'] . ',<br>' . $row['user_mobile'] . '
</p>
<ul class="action-btns">
<li>
<a href="edit_address.php?ad-id=' . $row['id'] . '" class="action-btn"
><i class="uil uil-edit"></i
></a>
</li>
<li>
<a href="javascript:void(0)" class="action-btn" onclick="del_address(' . $row['id'] . ')"
><i class="uil uil-trash-alt"></i
></a>
</li>
</ul>
</div>
</div>
';
}
echo $template;
?>
</div>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/product_detail.php | product_detail.php | <?php
require('require/top.php');
$pid = $_GET['pid'];
$product = product_detail($con, $pid);
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href=""><?php echo $product['product_name']; ?></a>
</div>
</div>
<section class="single-product">
<div class="row">
<div class="container">
<div class="innerrow">
<div class="left">
<div class="mainImage">
<img src="media/product/<?php echo $product['img1']; ?>" alt="main-image" id="mi" />
</div>
<div class="subimages flex">
<div class="sub">
<img src="media/product/<?php echo $product['img1']; ?>" alt="sub-image" id="mi" onclick="view(this)" />
</div>
<div class="sub">
<img src="media/product/<?php echo $product['img2']; ?>" alt="sub-image" id="mi" onclick="view(this)" />
</div>
<div class="sub">
<img src="media/product/<?php echo $product['img3']; ?>" alt="sub-image" id="mi" onclick="view(this)" />
</div>
<div class="sub">
<img src="media/product/<?php echo $product['img4']; ?>" alt="sub-image" id="mi" onclick="view(this)" />
</div>
</div>
</div>
<div class="right">
<h2 class="mt2"><?php echo $product['product_name']; ?></h2>
<div class="no-stock">
<p class="pd-no">Product No.<span><?php echo $product['sku']; ?></span></p>
<p class="stock-qty">
<?php
if ($product['qty'] > 0) {
echo "Available<span>(In Stock)</span>";
} else {
echo "Unavailable<span>(Out of Stock)</span>";
} ?></p>
</div>
<p class="pp-descp">
<?php echo $product['shrt_desc']; ?>
</p>
<div class="product-group-dt">
<ul>
<li>
<div class="main-price color-discount">
Discount Price<span>₹<?php echo $product['fa']; ?></span>
</div>
</li>
<li>
<div class="main-price mrp-price">
MRP Price<span>₹<?php echo $product['price']; ?></span>
</div>
</li>
</ul>
<ul class="gty-wish-share">
<li>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
if (isset($_SESSION['USER_CART'])) {
if (in_array($product['id'], $_SESSION['USER_CART'])) {
$index = array_search($product['id'], $_SESSION['USER_CART']);
?>
<div class="qty-product">
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $_SESSION['CART_QTY'][$index]; ?>" class="input-text qty text" style="width:5rem" id="single-product-qty" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
</div>
<?php
} else {
?>
<div class="qty-product">
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="input-text qty text" style="width:5rem" id="single-product-qty" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
</div>
<?php
}
} else {
?>
<div class="qty-product">
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="input-text qty text" style="width:5rem" id="single-product-qty" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
</div>
<?php
}
} else {
$p_idd = $product['id'];
$u_id = $_SESSION['USER_ID'];
$query = "select cart.u_id,cart_detail.qty from cart,cart_detail where cart.u_id='$u_id' and cart_detail.p_id='$p_idd' and cart_detail.cart_id=cart.id";
$rs = mysqli_query($con, $query);
$i = mysqli_num_rows($rs);
if ($i > 0) {
$g = mysqli_fetch_assoc($rs);
?>
<div class="qty-product">
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $g['qty'] ?>" class="input-text qty text" style="width:5rem" id="single-product-qty" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
</div>
<?php
} else {
?>
<div class="qty-product">
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="input-text qty text" style="width:5rem" id="single-product-qty" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
</div>
<?php
}
}
?>
</li>
<li>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
?>
<i class="uil uil-heart" onclick="addwish(<?php echo $product['id']; ?>)"></i>
<?php
} else {
$pid = $product['id'];
$uid = $_SESSION['USER_ID'];
$n = mysqli_num_rows(mysqli_query($con, "select * from wishlist where u_id='$uid' and p_id='$pid'"));
if ($n > 0) {
?>
<i class="uil uil-heart" onclick="gowish()"></i>
<?php
} else {
?>
<i class="uil uil-heart" onclick="addwish(<?php echo $product['id']; ?>)"></i>
<?php
}
}
?>
</li>
</ul>
<ul class="ordr-crt-share">
<li>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
if (isset($_SESSION['USER_CART'])) {
if (in_array($product['id'], $_SESSION['USER_CART'])) {
?>
<button class="order-btn hover-btn" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i> Go to Cart
</button>
<?php
} else {
?>
<button class="order-btn hover-btn" onclick="addToCart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i> Add to Cart
</button>
<?php
}
} else {
?>
<button class="order-btn hover-btn" onclick="addToCart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i> Add to Cart
</button>
<?php
}
} else {
$p_idd = $product['id'];
$u_id = $_SESSION['USER_ID'];
$query = "select cart.u_id,cart_detail.qty from cart,cart_detail where cart.u_id='$u_id' and cart_detail.p_id='$p_idd' and cart_detail.cart_id=cart.id";
$rs = mysqli_query($con, $query);
$i = mysqli_num_rows($rs);
if ($i > 0) {
?>
<button class="order-btn hover-btn" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i> Go to Cart
</button>
<?php
} else {
?>
<button class="order-btn hover-btn" onclick="addToCart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i> Add to Cart
</button>
<?php
}
}
?>
</li>
</ul>
</div>
<div class="down">
<ul class="flex">
<li>
<div class="pdp-group-dt">
<div class="pdp-icon">
<i class="uil uil-usd-circle"></i>
</div>
<div class="pdp-text-dt">
<span>Lowest Price Guaranteed</span>
<p>
Get difference refunded if you find it cheaper
anywhere else.
</p>
</div>
</div>
</li>
<li>
<div class="pdp-group-dt">
<div class="pdp-icon">
<i class="uil uil-cloud-redo"></i>
</div>
<div class="pdp-text-dt">
<span>Easy Returns & Refunds</span>
<p>
Return products at doorstep and get refund in seconds.
</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="secondrow">
<div class="innerrow">
<div class="mlt">
<div class="container">
<div class="heading">
<h4>more like this</h4>
</div>
<div class="product-container">
<?php
$catid = $product['cat_id'];
$rs = mysqli_query($con, "select * from product where cat_id='$catid' and status='1'");
if (mysqli_num_rows($rs) > 0) {
while ($row = mysqli_fetch_assoc($rs)) {
?>
<div class="card">
<a href="product_detail.php?pid=<?php echo $row['id']; ?>">
<img src="media/product/<?php echo $row['img1']; ?>" alt="main-image" />
</a>
<div class="detail">
<h4><?php echo $row['product_name']; ?></h4>
<div class="qty-group">
<div class="cart-item-price">
₹<?php echo $row['fa']; ?>
<span>₹<?php echo $row['price']; ?></span>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
</div>
</div>
<div class="alldesc">
<div class="container">
<div class="heading">
<h4>Product details</h4>
</div>
<div class="desc-body">
<div class="pdct-dts-1">
<div class="pdct-dt-step">
<h4>Description</h4>
<p>
<?php echo $product['description']; ?>
</p>
</div>
<div class="pdct-dt-step">
<h4>Tearms & Conditions</h4>
<div class="product_attr">
<?php echo $product['disclaimer']; ?>
</div>
</div>
<div class="pdct-dt-step">
<h4>Seller</h4>
<div class="product_attr">
<?php
$t = $product['added_by'];
$ti = $product['id'];
$h = mysqli_fetch_assoc(mysqli_query($con, "select b_name from sellers where id='$t'"));
$hi = mysqli_fetch_assoc(mysqli_query($con, "select added_on from product_ad_on where pid='$ti'"));
echo $h['b_name']; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/payment_complete.php | payment_complete.php | <?php
require('utility/utility.php');
$payment_mode = $_POST['mode'];
$pay_id = $_POST['mihpayid'];
$status = $_POST["status"];
$firstname = $_POST["firstname"];
$amount = $_POST["amount"];
$txnid = $_POST["txnid"];
$posted_hash = $_POST["hash"];
$key = $_POST["key"];
$productinfo = $_POST["productinfo"];
$email = $_POST["email"];
$MERCHANT_KEY = "merchant key";
$SALT = "salt key";
$udf5 = '';
$keyString = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $productinfo . '|' . $firstname . '|' . $email . '|||||' . $udf5 . '|||||';
$keyArray = explode("|", $keyString);
$reverseKeyArray = array_reverse($keyArray);
$reverseKeyString = implode("|", $reverseKeyArray);
$saltString = $SALT . '|' . $status . '|' . $reverseKeyString;
$sentHashString = strtolower(hash('sha512', $saltString));
if ($sentHashString != $posted_hash) {
$statusse = "Failed";
echo $statusse;
$placed = "Failed";
mysqli_query($con, "update orders set payment_status='$statusse',order_status='$placed',payu_status='$status', mihpayid='$pay_id' where txnid='$txnid'");
?>
<script>
alert('Failed');
window.location.href = 'index.php';
</script>
<?php
} else {
$statusse = "Successfull";
echo $statusse;
$placed = "2";
$_SESSION['USER_LOGIN'] = "YES";
$q = mysqli_fetch_assoc(mysqli_query($con, "select * from orders where txnid='$txnid'"));
$_SESSION['USER_ID'] = $q['u_id'];
$_SESSION['utm_source'] = $productinfo;
$uid = $q['u_id'];
mysqli_query($con, "update orders set payment_status='1',order_status='$placed',payu_status='$status', mihpayid='$pay_id' where txnid='$txnid'");
$rw = mysqli_fetch_assoc(mysqli_query($con, "select * from orders where txnid='$txnid'"));
$oid = $rw['id'];
mysqli_query($con, "insert into order_time(oid,o_status) values('$oid','2')");
$cart = mysqli_fetch_assoc(mysqli_query($con, "select * from cart where u_id='$uid' and belonging_city='$productinfo'"));
$cart_id = $cart['id'];
mysqli_query($con, "delete from cart where id='$cart_id'");
mysqli_query($con, "delete from cart_detail where cart_id='$cart_id'");
$orderRes = mysqli_query($con, "select * from order_detail where oid='$oid'");
while ($rw = mysqli_fetch_assoc($orderRes)) {
$pidt = $rw['p_id'];
$qt = $rw['qty'];
mysqli_query($con, "update product set qty=qty-'$qt' where id='$pidt'");
}
?>
<form action="orderPlaced.php" method="POST" id="codform">
<input type="hidden" name="orderId_user" value="<?php echo $oid; ?>">
</form>
<script>
document.getElementById("codform").submit();
</script>
<?php
}
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/cart.php | cart.php | <?php
require('require/top.php');
$cart = get_cart_products($con);
$total_subtotal = 0;
// print_r($_SESSION['USER_CART']);
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="cart.php">Cart</a>
</div>
</div>
<section class="cart">
<section class="myac-body">
<div class="flex row">
<div class="right">
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h4>
<i class="uil uil-shopping-cart-alt"></i> My Cart
</h4>
</div>
<div class="order-body10">
<table>
<thead>
<th>
<h5>Product</h5>
</th>
<th>
<h5>Price</h5>
</th>
<th>
<h5>Quantity</h5>
</th>
<th>
<h5>Subtotal</h5>
</th>
<th>
<h5>Delete</h5>
</th>
</thead>
<tbody>
<?php
if (count($cart) > 0) {
foreach ($cart as $product) {
if (!isset($_SESSION['USER_LOGIN'])) {
$p_qy = $product['product_qty'];
} else {
$p_qy = $product['qty'];
}
?>
<tr>
<td>
<div class="product">
<a href="">
<img src="media/product/<?php echo $product['img1'] ?>" alt="" />
</a>
<h6><?php echo $product['product_name'] ?></h6>
</div>
</td>
<td>
<div class="price">
<h6>₹<?php echo $product['fa'] ?></h6>
</div>
</td>
<td>
<div class="qty">
<div class="box">
<input type="text" value="<?php echo $p_qy; ?>" />
<div class="btnbv">
<button onclick="inc(this,<?php echo $product['id']; ?>)">+</button>
<button onclick="de_sc(this,<?php echo $product['id']; ?>)">-</button>
</div>
</div>
</div>
</td>
<td>
<div class="price">
<h6>₹<?php
$sftp = $p_qy * $product['fa'];
$total_subtotal += $sftp;
echo $sftp;
?></h6>
</div>
</td>
<td>
<div class="price">
<h6>
<i class="uil uil-trash-alt" onclick="del_cart(<?php echo $product['id'] ?>)"></i>
</h6>
</div>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="left">
<div class="ul-wrapper">
<h4>Cart Totals</h4>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
if ($total_subtotal > 0) {
?>
<table>
<tr>
<td>
<h6>Subtotal</h6>
</td>
<td>
<h6>₹<?php echo $total_subtotal; ?></h6>
</td>
</tr>
</table>
<div class="cktout">
<button onclick="control.redirect('checkout.php')">Proceed To Checkout</button>
</div>
<?php
}
} else {
$utm = $_SESSION['utm_source'];
$uid = $_SESSION['USER_ID'];
$rs = mysqli_query($con, "select * from cart where u_id='$uid' and belonging_city='$utm'");
if (mysqli_num_rows($rs) > 0) {
$ct = mysqli_fetch_assoc($rs);
if ($ct['total'] > 0) {
?>
<table>
<tr>
<td>
<h6>Subtotal</h6>
</td>
<td>
<h6>₹<?php echo $ct['total']; ?></h6>
</td>
</tr>
<tr>
<td>
<h6>Shipping</h6>
</td>
<td>
<h6>₹
<?php
echo $ct['ship_fee'];
?></h6>
</td>
</tr>
<?php
if ($ct['is_applied']) {
?>
<tr>
<td>
<h6>Promo</h6>
</td>
<td>
<h6>-₹
<?php
echo $ct['promo'];
?></h6>
</td>
</tr>
<?php }
if ($ct['is_add_w']) {
?>
<tr>
<td>
<h6>From Wallet</h6>
</td>
<td>
<h6>-₹
<?php
echo $ct['wl_amt'];
?></h6>
</td>
</tr>
<?php
}
?>
<tr>
<td>
<h6>Grand Total</h6>
</td>
<td>
<h6>₹<?php echo $ct['final_amt']; ?></h6>
</td>
</tr>
</table>
<div class="cktout">
<button onclick="control.redirect('checkout.php')">Proceed To Checkout</button>
</div>
<?php
}
?>
<?php }
}
?>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/process.php | process.php | <?php
require('utility/utility.php');
if (isset($_POST['order-id'])) {
$order_id = $_POST['order-id'];
$order = mysqli_fetch_assoc(mysqli_query($con, "select * from orders where id='$order_id'"));
$payment_type = $order['payment_type'];
if ($payment_type == 1) {
mysqli_query($con, "update orders set order_status='2' where id='$order_id'");
mysqli_query($con, "insert into order_time(oid,o_status) values('$order_id','2')");
$uid = $_SESSION['USER_ID'];
$utm = $_SESSION['utm_source'];
$cart = mysqli_fetch_assoc(mysqli_query($con, "select * from cart where u_id='$uid' and belonging_city='$utm'"));
$cart_id = $cart['id'];
mysqli_query($con, "delete from cart where id='$cart_id'");
mysqli_query($con, "delete from cart_detail where cart_id='$cart_id'");
$orderRes = mysqli_query($con, "select * from order_detail where oid='$order_id'");
while ($rw = mysqli_fetch_assoc($orderRes)) {
$pidt = $rw['p_id'];
$qt = $rw['qty'];
mysqli_query($con, "update product set qty=qty-'$qt' where id='$pidt'");
}
?>
<form action="orderPlaced.php" method="POST" id="codform">
<input type="hidden" name="orderId_user" value="<?php echo $order_id; ?>">
</form>
<script>
document.getElementById("codform").submit();
</script>
<?php
} else {
?>
<form action="insert.php" method="POST" id="codform">
<input type="hidden" name="orderId_user" value="<?php echo $order_id; ?>">
</form>
<script>
document.getElementById("codform").submit();
</script>
<?php
}
}
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/index.php | index.php | <?php require('require/top.php'); ?>
<div class="main-banner-slider">
<div class="container">
<div class="row">
<div class="owl-carousel owl-theme main-slider">
<div class="item">
<img src="assets/images/sample/offer-1.jpg" alt="banner" />
<div class="detail">
<h5>20% off</h5>
<h5>Get it now</h5>
<h5>lorem ispum</h5>
</div>
</div>
<div class="item">
<img src="assets/images/sample/offer-1.jpg" alt="banner" />
<div class="detail">
<h5>20% off</h5>
<h5>Get it now</h5>
<h5>lorem ispum</h5>
</div>
</div>
<div class="item">
<img src="assets/images/sample/offer-1.jpg" alt="banner" />
<div class="detail">
<h5>20% off</h5>
<h5>Get it now</h5>
<h5>lorem ispum</h5>
</div>
</div>
<div class="item">
<img src="assets/images/sample/offer-1.jpg" alt="banner" />
<div class="detail">
<h5>20% off</h5>
<h5>Get it now</h5>
<h5>lorem ispum</h5>
</div>
</div>
<div class="item">
<img src="assets/images/sample/offer-1.jpg" alt="banner" />
<div class="detail">
<h5>20% off</h5>
<h5>Get it now</h5>
<h5>lorem ispum</h5>
</div>
</div>
<div class="item">
<img src="assets/images/sample/offer-1.jpg" alt="banner" />
<div class="detail">
<h5>20% off</h5>
<h5>Get it now</h5>
<h5>lorem ispum</h5>
</div>
</div>
</div>
</div>
</div>
</div>
<section class="defaultPadding mt4">
<div class="container mrlAuto">
<div class="heading">
<span>Shop By</span>
<h2>Categories</h2>
</div>
<div class="row mt3 ct-row">
<div class="owl-carousel owl-theme cate-slider">
<?php
$res = mysqli_query($con, "select * from categories");
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="item">
<a class="category-Item" href="view.php?n=<?php echo $row['id'] ?>&k=">
<div class="cate-img">
<img src="assets/images/svg/icon-7.svg" alt="" />
</div>
<h4><?php
echo $row['category'];
?></h4>
</a>
</div>
<?php } ?>
</div>
</div>
</div>
</section>
<?php
if (isset($_GET['utm_source']) || isset($_SESSION['utm_source'])) {
$s = '';
if (isset($_SESSION['utm_source']) && !isset($_GET['utm_source'])) {
$s = $_SESSION['utm_source'];
} else {
$s = $_GET['utm_source'];
}
verify_source($con, $s);
$featured = get_featured_products($con);
// prx($featured);
?>
<section class="defaultPadding mt4">
<div class="container mrlAuto">
<div class="heading">
<span>For You</span>
<h2>Top Featured Products</h2>
</div>
<div class="row mt3 ct-row">
<div class="owl-carousel owl-theme product-slider">
<?php
if (count($featured) > 0) {
foreach ($featured as $product) {
?>
<div class="item">
<div class="productBox">
<a href="javascript:void(0)" class="product-image">
<img src="media/product/<?php echo $product['img1']; ?>" alt="product" />
<div class="topOption">
<span class="offer"><?php
$offn = ($product['fa'] * 100) / $product['price'];
$off = round(100 - $offn);
echo $off . '%';
?></span>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
?>
<span class="wishlist" onclick="addwish(<?php echo $product['id']; ?>)">
<i class="uil uil-heart"></i>
</span>
<?php
} else {
$pid = $product['id'];
$uid = $_SESSION['USER_ID'];
$n = mysqli_num_rows(mysqli_query($con, "select * from wishlist where u_id='$uid' and p_id='$pid'"));
if ($n > 0) {
?>
<span class="wishlist" onclick="gowish()">
<i class="uil uil-heart"></i>
</span>
<?php
} else {
?>
<span class="wishlist" onclick="addwish(<?php echo $product['id']; ?>)">
<i class="uil uil-heart"></i>
</span>
<?php
}
}
?>
</div>
</a>
<div class="product-detail">
<p><?php
if ($product['qty'] > 0) {
echo "Available(In Stock)";
} else {
echo "Unavailable(Out of Stock)";
} ?></p>
<h4 style="cursor:pointer" onclick="control.redirect('product_detail.php?pid=<?php echo $product['id'] ?>')"><?php echo $product['product_name']; ?></h4>
<div class="price">₹<?php echo $product['fa']; ?>
<span>₹<?php echo $product['price']; ?></span>
</div>
<div class="cartqt">
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
if (isset($_SESSION['USER_CART'])) {
if (in_array($product['id'], $_SESSION['USER_CART'])) {
$index = array_search($product['id'], $_SESSION['USER_CART']);
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $_SESSION['CART_QTY'][$index]; ?>" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="add_cart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
}
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="add_cart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
}
} else {
$p_idd = $product['id'];
$u_id = $_SESSION['USER_ID'];
$query = "select cart.u_id,cart_detail.qty from cart,cart_detail where cart.u_id='$u_id' and cart_detail.p_id='$p_idd' and cart_detail.cart_id=cart.id";
$rs = mysqli_query($con, $query);
$i = mysqli_num_rows($rs);
if ($i > 0) {
$g = mysqli_fetch_assoc($rs);
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $g['qty'] ?>" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="add_cart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
</div>
</div>
</section>
<section class="defaultPadding mt4">
<div class="container mrlAuto">
<div class="heading">
<span>Offers</span>
<h2>Best Values</h2>
</div>
<div class="row mt3 ct-row banner-row">
<div class="row1">
<div class="ban">
<a href="#">
<img src="assets/images/banner/offer-1.jpg" alt="banner1" />
</a>
</div>
<div class="ban">
<a href="#">
<img src="assets/images/banner/offer-2.jpg" alt="banner1" />
</a>
</div>
<div class="ban">
<a href="#">
<img src="assets/images/banner/offer-3.jpg" alt="banner1" />
</a>
</div>
</div>
<div class="row1">
<a href="#" class="long-banner">
<img src="assets/images/banner/offer-4.jpg" alt="banner1" />
</a>
</div>
</div>
</div>
</section>
<section class="defaultPadding mt4">
<div class="container mrlAuto">
<div class="heading">
<span>For You</span>
<h2> Fresh Products</h2>
</div>
<div class="row mt3 ct-row">
<div class="owl-carousel owl-theme product-slider">
<?php
if (count($featured) > 0) {
foreach ($featured as $product) {
?>
<div class="item">
<div class="productBox">
<a href="javascript:void(0)" class="product-image">
<img src="media/product/<?php echo $product['img1']; ?>" alt="product" />
<div class="topOption">
<span class="offer"><?php
$offn = ($product['fa'] * 100) / $product['price'];
$off = round(100 - $offn);
echo $off . '%';
?></span>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
?>
<span class="wishlist" onclick="addwish(<?php echo $product['id']; ?>)">
<i class="uil uil-heart"></i>
</span>
<?php
} else {
$pid = $product['id'];
$uid = $_SESSION['USER_ID'];
$n = mysqli_num_rows(mysqli_query($con, "select * from wishlist where u_id='$uid' and p_id='$pid'"));
if ($n > 0) {
?>
<span class="wishlist" onclick="gowish()">
<i class="uil uil-heart"></i>
</span>
<?php
} else {
?>
<span class="wishlist" onclick="addwish(<?php echo $product['id']; ?>)">
<i class="uil uil-heart"></i>
</span>
<?php
}
}
?>
</div>
</a>
<div class="product-detail">
<p><?php
if ($product['qty'] > 0) {
echo "Available(In Stock)";
} else {
echo "Unavailable(Out of Stock)";
} ?></p>
<h4 style="cursor:pointer" onclick="control.redirect('product_detail.php?pid=<?php echo $product['id'] ?>')"><?php echo $product['product_name']; ?></h4>
<div class="price">₹<?php echo $product['fa']; ?>
<span>₹<?php echo $product['price']; ?></span>
</div>
<div class="cartqt">
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
if (isset($_SESSION['USER_CART'])) {
if (in_array($product['id'], $_SESSION['USER_CART'])) {
$index = array_search($product['id'], $_SESSION['USER_CART']);
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $_SESSION['CART_QTY'][$index]; ?>" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="add_cart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
}
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="add_cart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
}
} else {
$p_idd = $product['id'];
$u_id = $_SESSION['USER_ID'];
$query = "select cart.u_id,cart_detail.qty from cart,cart_detail where cart.u_id='$u_id' and cart_detail.p_id='$p_idd' and cart_detail.cart_id=cart.id";
$rs = mysqli_query($con, $query);
$i = mysqli_num_rows($rs);
if ($i > 0) {
$g = mysqli_fetch_assoc($rs);
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $g['qty'] ?>" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="add_cart(<?php echo $product['id']; ?>,this)">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
</div>
</div>
</section>
<section class="defaultPadding mt4">
<div class="container mrlAuto">
<div class="heading">
<span>For You</span>
<h2>New Products</h2>
</div>
<div class="row mt3 ct-row">
<div class="owl-carousel owl-theme product-slider">
<?php
if (count($featured) > 0) {
foreach ($featured as $product) {
?>
<div class="item">
<div class="productBox">
<a href="javascript:void(0)" class="product-image">
<img src="media/product/<?php echo $product['img1']; ?>" alt="product" />
<div class="topOption">
<span class="offer"><?php
$offn = ($product['fa'] * 100) / $product['price'];
$off = round(100 - $offn);
echo $off . '%';
?></span>
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
?>
<span class="wishlist" onclick="addwish(<?php echo $product['id']; ?>)">
<i class="uil uil-heart"></i>
</span>
<?php
} else {
$pid = $product['id'];
$uid = $_SESSION['USER_ID'];
$n = mysqli_num_rows(mysqli_query($con, "select * from wishlist where u_id='$uid' and p_id='$pid'"));
if ($n > 0) {
?>
<span class="wishlist" onclick="gowish()">
<i class="uil uil-heart"></i>
</span>
<?php
} else {
?>
<span class="wishlist" onclick="addwish(<?php echo $product['id']; ?>)">
<i class="uil uil-heart"></i>
</span>
<?php
}
}
?>
</div>
</a>
<div class="product-detail">
<p><?php
if ($product['qty'] > 0) {
echo "Available(In Stock)";
} else {
echo "Unavailable(Out of Stock)";
} ?></p>
<h4 style="cursor:pointer" onclick="control.redirect('product_detail.php?pid=<?php echo $product['id'] ?>')"><?php echo $product['product_name']; ?></h4>
<div class="price">₹<?php echo $product['fa']; ?>
<span>₹<?php echo $product['price']; ?></span>
</div>
<div class="cartqt">
<?php
if (!isset($_SESSION['USER_LOGIN'])) {
if (isset($_SESSION['USER_CART'])) {
if (in_array($product['id'], $_SESSION['USER_CART'])) {
$index = array_search($product['id'], $_SESSION['USER_CART']);
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="<?php echo $_SESSION['CART_QTY'][$index]; ?>" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
<div class="ct-icon" onclick="go_to_cart()">
<i class="uil uil-shopping-cart-alt"></i>
</div>
<?php
} else {
?>
<div class="quantity buttons_added">
<input type="button" value="-" class="minus minus-btn" onclick="decrement(this)" />
<input type="number" name="quantity" value="1" class="qty-text" />
<input type="button" value="+" class="plus plus-btn" onclick="increment(this)" />
</div>
| php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | true |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/myac.php | myac.php | <?php
require('require/top.php');
authorise_user2();
?>
<div class="path">
<div class="container">
<a href="index.html">Home</a>
/
<a href="index.html">My Orders</a>
</div>
</div>
<section class="myorders">
<?php require('require/headbanner.php'); ?>
<section class="myac-body">
<div class="flex row">
<?php require('require/ac-left.php'); ?>
<div class="right">
<h4><i class="uil uil-box"></i>My Orders</h4>
<div class="col-lg-12 col-md-12" id="bill-sec">
<?php
$uid = $_SESSION['USER_ID'];
$query = "select orders.is_p_app,orders.is_w_ap,orders.prmo,orders.wlmt,orders.u_cnfrm,orders.dv_time,orders.order_status,orders.id,orders.o_id,orders.total_amt,orders.ship_fee_order,orders.final_val,dv_time.from,dv_time.tto from orders,dv_time where orders.u_id='$uid' and orders.dv_date=dv_time.id and not orders.order_status='1' order by orders.id desc";
$res = mysqli_query($con, $query);
if (mysqli_num_rows($res) > 0) {
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h6>Order Id: <?php echo $row['o_id']; ?></h6>
<h6>Delivery Timing: <?php echo $row['dv_time']; ?>,<?php echo $row['from']; ?> -
<?php echo $row['tto']; ?></h6>
</div>
<div class="order-body10">
<?php
$oid = $row['id'];
$rs = mysqli_query($con, "select order_detail.qty,product.product_name,product.img1 from order_detail,product where order_detail.oid='$oid' and order_detail.p_id=product.id order by order_detail.id desc");
while ($rw = mysqli_fetch_assoc($rs)) {
?>
<ul class="order-dtsll">
<li>
<div class="order-dt-img">
<img src="media/product/<?php echo $rw['img1']; ?>" alt="" />
</div>
</li>
<li>
<div class="order-dt47">
<h4><?php echo $rw['product_name']; ?></h4>
<div class="order-title">
<?php echo $rw['qty']; ?> Items
</div>
</div>
</li>
</ul>
<?php } ?>
<div class="total-dt">
<div class="total-checkout-group">
<div class="cart-total-dil">
<h4>Sub Total</h4>
<span>₹<?php echo $row['total_amt']; ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Delivery Charges</h4>
<span>₹<?php echo $row['ship_fee_order']; ?></span>
</div>
<?php
if ($row['is_p_app'] == 1) {
?>
<div class="cart-total-dil pt-3">
<h4>From Promo</h4>
<span>-₹<?php echo $row['prmo']; ?></span>
</div>
<?php
}
if ($row['is_w_ap'] == 1) {
?>
<div class="cart-total-dil pt-3">
<h4>From Wallet</h4>
<span>-₹<?php echo $row['wlmt']; ?></span>
</div>
<?php
}
?>
</div>
<div class="main-total-cart">
<h2>Total</h2>
<span>₹<?php echo $row['final_val']; ?></span>
</div>
</div>
<div class="track-order">
<h4>Track Order</h4>
<?php
$fade = "bs-wizard-dot fade";
$cfade = "bs-wizard-dot";
$progress = "progress-bar";
$fadeBar = "fade-bar";
?>
<div class="bs-wizard" style="border-bottom: 0">
<div class="bs-wizard-step complete">
<div class="text-center bs-wizard-stepnum">Placed</div>
<div class="progress">
<div class="<?php
if ($row['order_status'] == 3 || $row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $progress;
} else {
echo $fadeBar;
} ?>">
</div>
</div>
<a href="#" class="
<?php
echo $cfade; ?>
"></a>
</div>
<div class="bs-wizard-step complete">
<div class="text-center bs-wizard-stepnum">Packed</div>
<div class="progress">
<div class="<?php
if ($row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $progress;
} else {
echo $fadeBar;
} ?>"> </div>
</div>
<a href="#" class="<?php
if ($row['order_status'] == 3 || $row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $cfade;
} else {
echo $fade;
} ?>"></a>
</div>
<div class="bs-wizard-step active">
<div class="text-center bs-wizard-stepnum">
On the way
</div>
<div class="progress">
<div class="<?php
if ($row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $progress;
} else {
echo $fadeBar;
} ?>"> </div>
</div>
<a href="#" class="<?php
if ($row['order_status'] == 4 || $row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $cfade;
} else {
echo $fade;
} ?>"></a>
</div>
<div class="bs-wizard-step disabled">
<div class="text-center bs-wizard-stepnum">
<?php
if ($row['order_status'] == 5) {
echo "Delivered";
} else if ($row['order_status'] == 6) {
echo "Undelivered";
} else if ($row['order_status'] == 7) {
echo "Issue";
} else {
echo "Delivered";
}
?>
</div>
<div class="progress" style="width: 0%;">
<div class="progress-bar"></div>
</div>
<a href="#" class="<?php
if ($row['order_status'] == 5 || $row['order_status'] == 6 || $row['order_status'] == 7) {
echo $cfade;
} else {
echo $fade;
} ?>"></a>
</div>
</div>
</div>
<?php
if ($row['order_status'] == 5 && $row['u_cnfrm'] == 0) {
?>
<div class="call-bill">
<div class="order-bill-slip">
<a href="dv_confirm.php?id=<?php echo $row['id'] ?>" class="bill-btn5 hover-btn">Confirm</a>
</div>
</div>
<?php } ?>
</div>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/verify_ME.php | verify_ME.php | <?php
require('require/top.php');
authorise_user2();
user_vfd_efd2($con);
$id = $_SESSION['USER_ID'];
$gui = mysqli_fetch_assoc(mysqli_query($con, "select * from users where id='$id'"));
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="verify_ME.php">Verification</a>
</div>
</div>
<section class="newaddress">
<section class="myac-body">
<div class="flex row flex-center">
<div class="right">
<h4><i class="uil uil-location-point"></i>Verify Mobile & Email</h4>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title">
<h4>Mobile</h4>
</div>
<div class="formbody">
<form action="javascript:void(0)">
<div class="address-fieldset">
<div class="row">
<label for="ft">Mobile</label>
<input type="number" placeholder="Mobile Number" id="verify_mobile" value="<?php echo $gui['mobile'] ?>" oninput="validate_number2()" />
<label for="ft" id="verifymobile_otp_label" style="display:none;">OTP</label>
<input type="text" placeholder="Enter OTP" id="verifymobile_otp" style="display:none;" />
<div class="row2">
<?php
if (!is_mobile_verified($con)) {
?>
<button class="save-address" onclick="mobile_sent_otp()" id="mobile-sent_otp">
Sent OTP
</button>
<?php } else {
?>
<button class="save-address" id="mobile-sent_otp">
Verified
</button>
<?php
} ?>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title">
<h4>Email</h4>
</div>
<div class="formbody">
<form action="javascript:void(0)">
<div class="address-fieldset">
<div class="row">
<label for="ft">Email</label>
<input type="email" placeholder="Email Address" id="verify_email" value="<?php echo $gui['email'] ?>" />
<label for="ft" id="verifyemail_otp_label" style="display:none;">OTP</label>
<input type="text" placeholder="Enter OTP" id="verifyemail_otp" style="display:none;" />
<div class="row2">
<?php
if (!is_email_verified($con)) {
?>
<button class="save-address" onclick="email_sent_otp()" id="email-sent_otp">
Sent OTP
</button>
<?php } else {
?>
<button class="save-address" id="email-sent_otp">
Verified
</button>
<?php
} ?>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/wallet.php | wallet.php | <?php
require('require/top.php');
authorise_user2();
$sid = $_SESSION['USER_ID'];
$r = mysqli_fetch_assoc(mysqli_query($con, "select * from user_wallet where user_id='$sid'"));
$sr = mysqli_query($con, "select * from user_w_msg where u_id='$sid'");
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="wallet.php">My Wallet</a>
</div>
</div>
<section class="mywallet">
<?php require('require/headbanner.php'); ?>
<section class="myac-body">
<div class="flex row">
<?php require('require/ac-left.php'); ?>
<div class="right">
<h4><i class="uil uil-wallet"></i>My Wallet</h4>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg2">
<div class="imgbox">
<img src="assets/images/money.svg" alt="">
</div>
<span class="rewrd-title">My Balance</span>
<h4 class="cashbk-price">₹<?php echo $r['ballance']; ?></h4>
</div>
<div class="pdpt-bg">
<div class="pdpt-title">
<h4>History</h4>
</div>
<div class="order-body10">
<ul class="history-list">
<?php
while ($row = mysqli_fetch_assoc($sr)) {
?>
<li>
<div class="purchase-history">
<div class="purchase-history-left">
<h4><?php
if ($row['cod'] == 1) {
echo "Credited";
} else {
echo "Debited";
}
?></h4>
<p>Message: <ins><?php echo $row['msg'] ?></ins></p>
<span> <?php
echo $row['added_on'];
?></span>
</div>
<div class="purchase-history-right">
<span>
<?php
if ($row['cod'] == 1) {
echo "+";
} else {
echo "-";
}
echo "₹" . $row['balance'];
?>
</span>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/checkout.php | checkout.php | <?php
require('require/top.php');
authorise_user();
user_vfd_efd($con);
$checkout = array();
$checkout = get_chekout_products($con);
$subtotal = 0;
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="checkout.php">Checkout</a>
</div>
</div>
<section class="checkout">
<section class="myac-body">
<div class="flex row">
<div class="right">
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<form action="process.php" method="POST" id="checkout-form">
<div class="step">
<div class="tittle" onclick="open_address(this)" id="ct-ad">
<span>1</span>
<h4>Delivery Address</h4>
</div>
<div class="span" id="chekout_address" style="height: 0">
<div class="formbody">
<div class="form-group">
<div class="product-radio">
<ul class="product-now">
<li>
<input type="radio" id="ad1" name="address1" checked="" value="Home" />
<label for="ad1">Home</label>
</li>
<li>
<input type="radio" id="ad2" name="address1" value="Office" />
<label for="ad2">Office</label>
</li>
<li>
<input type="radio" id="ad3" name="address1" value="Other" />
<label for="ad3">Other</label>
</li>
</ul>
</div>
</div>
<div class="address-fieldset">
<div class="row">
<div class="row2">
<div class="lt">
<label for="ft">Name*</label>
<input type="text" placeholder="Name" id="dv-name" />
</div>
<div class="ft">
<label for="ft">Mobile*</label>
<input type="number" placeholder="Number" id="dv-number" oninput="validate_number()" />
</div>
</div>
<label for="ft">City*</label>
<select name="" id="dv-city">
<option value="#">Select City</option>
<?php
$querys = "select * from city order by id desc";
$ress = mysqli_query($con, $querys);
while ($rows = mysqli_fetch_assoc($ress)) {
?>
<option value="<?php echo $rows['id'] ?>">
<?php echo $rows['city_name'] ?></option>
<?php
}
?>
</select>
<label for="ft">Flat / House / Office No.*</label>
<input type="text" placeholder="Address" id="dv-address" />
<div class="row2">
<div class="lt">
<label for="ft">Pincode*</label>
<input type="text" placeholder="Pincode" id="dv-pin" />
</div>
<div class="ft">
<label for="ft">Landmark*</label>
<input type="text" placeholder="Landmark" id="dv-land" />
</div>
</div>
<div class="row2">
<a href="javascript:void(0)" onclick="add_new_address()" class="save-address">Save</a>
<a href="javascript:void(0)" class="next-step" onclick="nex_ad()">Next</a>
</div>
<br>
<h4>Added Address</h4>
<div class="row2 mt2" style="display:block" id="ad-ad">
<?php
$template = '';
$uid = $_SESSION['USER_ID'];
$res = mysqli_query($con, "select user_address.*,city.city_name from user_address,city where user_address.uid='$uid' and user_address.user_city=city.id");
while ($row = mysqli_fetch_assoc($res)) {
$template = $template . '
<div class="address-item">
<input type="radio" name="dv-ad" value="' . $row['id'] . '"
style="width:2rem; height:1.5rem;margin-right:0.8rem;margin-top:0;">
<div class="address-icon1">
<i class="uil uil-home"></i>
</div>
<div class="address-dt-all">
<h4>' . $row['type_ad'] . '</h4>
<p>
' . $row['user_name'] . ', ' . $row['user_local'] . ', ' . $row['user_add'] . ',
' . $row['city_name'] . ', ' . $row['user_pin'] . ',<br>' . $row['user_mobile'] . '
</p>
</div>
</div>
';
}
echo $template;
?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="step">
<div class="tittle" onclick="open_dvt(this)" id="ct-dt">
<span>2</span>
<h4>Delivery Time & Date</h4>
</div>
<div class="span" id="chekout_dvt" style="height: 0">
<div class="formbody">
<div class="form-group">
<div class="product-radio">
<ul class="product-now">
<li>
<input type="radio" id="ad5" name="address3" checked="" value="Today" />
<label for="ad5">Today</label>
</li>
<li>
<input type="radio" id="ad4" name="address3" value="Tomorrow" />
<label for="ad4">Tomorrow</label>
</li>
</ul>
</div>
</div>
<div class="time-radio">
<div class="form">
<div class="fields">
<?php
$res = mysqli_query($con, "select * from dv_time");
while ($r = mysqli_fetch_assoc($res)) {
?>
<div class="field">
<div class="ui radio checkbox chck-rdio">
<input type="radio" name="fruit" tabindex="0" class="hidden" value="<?php echo $r['id'] ?>" />
<label><?php echo $r['from'] ?> - <?php echo $r['tto'] ?></label>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="row2">
<a href="javascript:void(0)" class="next-step" onclick="nex_pt()">Proceed To
Pay</a>
</div>
</div>
</div>
<div class="step">
<div class="tittle" onclick="open_pt(this)" id="ct-pt">
<span>3</span>
<h4>Payment</h4>
</div>
<div class="span" id="chekout_pt" style="height: 0">
<div class="formbody">
<div class="rpt100">
<ul class="radio--group-inline-container_1" style="flex-direction:column;display:flex;">
<li style="width:100%;height:6rem;">
<div class="radio-item_1">
<input id="cashondelivery1" value="1" name="paymentmethod" type="radio" />
<label for="cashondelivery1" class="radio-label_1">Cash on
Delivery</label>
</div>
</li>
<li style="width:100%; height:6rem;">
<div class="radio-item_1">
<input id="card1" value="2" name="paymentmethod" type="radio" />
<label for="card1" class="radio-label_1">Credit / Debit
Card</label>
</div>
</li>
</ul>
</div>
</div>
<input type="hidden" name="order-id" id="order-id">
<div class="row2">
<button class="next-step">Place Order</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="left">
<div class="ul-wrapper">
<h4>Order Summary</h4>
<?php foreach ($checkout as $product) { ?>
<div class="cart-item border_radius">
<div class="cart-product-img">
<img src="media/product/<?php echo $product['img1']; ?>" alt="" />
<div class="offer-badge">
<?php
$offn = ($product['fa'] * 100) / $product['price'];
$off = round(100 - $offn);
echo $off . '%';
?>
</div>
</div>
<div class="cart-text">
<h4><?php echo $product['product_name']; ?></h4>
<div class="cart-item-price">₹<?php echo $product['fa'];
$subtotal += $product['fa'] * $product['qty'];
?>
<span>₹<?php echo $product['price']; ?></span>
</div>
<br>
<div class="cart-item-price">
<?php echo "x" . $product['qty']; ?>
</div>
</div>
</div>
<?php } ?>
<div class="total-checkout-group">
<div class="cart-total-dil">
<h4>Subtotal</h4>
<span>₹<?php echo $product['total']; ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Delivery Charges</h4>
<span>₹<?php
echo $product['ship_fee'];
?></span>
</div>
<?php
if ($product['is_applied']) {
?>
<div class="cart-total-dil pt-3">
<h4>Promo Applied</h4>
<span>- ₹<?php
echo $product['promo'];
?></span>
</div>
<?php } ?>
<?php
if ($product['is_add_w']) {
?>
<div class="cart-total-dil pt-3">
<h4>From Wallet</h4>
<span>- ₹<?php
echo $product['wl_amt'];
?></span>
</div>
<?php } ?>
</div>
<div class="main-total-cart">
<h2>Total</h2>
<span>₹<?php echo $product['final_amt']; ?></span>
</div>
<div class="cktout">
<i class="uil uil-padlock"></i> Secure Checkout
</div>
</div>
<div class="promocode">
<a href="javascript:void(0)" onclick="show_promo()">Have A Promocode?</a>
</div>
<div class="promoform" id="promoform">
<form action="javascript:void(0)">
<?php
if ($product['is_applied'] == 0) {
?>
<input type="text" placeholder="Enter Promocode" id="promocode" />
<button onclick="apply_promo()">Apply</button>
<?php } else {
?>
<button onclick="remove_promo()" style="width:100%;border-radius:0;">Remove Promo</button>
<?php
} ?>
</form>
</div>
<div class="promocode">
<a href="javascript:void(0)" onclick="show_wt()">Use wallet Ballance</a>
</div>
<div class="promoform" id="wt">
<form action="javascript:void(0)">
<?php
if ($product['is_add_w'] == 0) {
?>
<button onclick="apply_wallet()" style="width:100%;border-radius:0;">Use</button>
<?php } else {
?>
<button onclick="remove_wallet()" style="width:100%;border-radius:0;">Remove</button>
<?php
} ?>
</form>
</div>
</div>
</div>
</section>
</section>
<script src="assets/js/ckt.js"></script>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/orderPlaced.php | orderPlaced.php | <?php
require('require/top.php');
if (isset($_POST['orderId_user'])) {
$order_id = $_POST['orderId_user'];
$query = "select orders.o_id,orders.final_val,orders.payment_type,user_address.user_name,user_address.user_mobile,user_address.user_add,user_address.user_pin,user_address.user_local,city.city_name,dv_time.from,dv_time.tto from orders,user_address,city,dv_time where orders.id='$order_id' and orders.ad_id=user_address.id and user_address.user_city=city.id and orders.dv_date=dv_time.id";
$row = mysqli_fetch_assoc(mysqli_query($con, $query));
} else {
redirect('index.php');
}
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="orderPlaced.php">My Orders</a>
</div>
</div>
<section class="order-placed">
<div class="all-product-grid">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-6 col-md-8">
<div class="order-placed-dt">
<i class="uil uil-check-circle icon-circle"></i>
<h2>Order Successfully Placed</h2>
<p>
Thank you for your order! will received order timing -
<span>(Today, <?php echo $row['from'] ?> - <?php echo $row['tto'] ?>)</span>
</p>
<div class="delivery-address-bg">
<div class="title585">
<div class="pln-icon">
<i class="uil uil-box"></i>
</div>
<h4>Order Id: <?php echo $row['o_id'] ?></h4>
</div>
<div class="title585">
<div class="pln-icon">
<i class="uil uil-telegram-alt"></i>
</div>
<h4>Your order will be sent to this address</h4>
</div>
<ul class="address-placed-dt1">
<li>
<p>
<i class="uil uil-map-marker-alt"></i>Address :<span><?php echo $row['user_local'] ?>,<?php echo $row['user_add'] ?>,<?php echo $row['city_name'] ?>,<?php echo $row['user_pin'] ?></span>
</p>
</li>
<li>
<p>
<i class="uil uil-phone-alt"></i>Phone Number :<span>+91<?php echo $row['user_mobile'] ?></span>
</p>
</li>
</ul>
<div class="stay-invoice">
<div class="st-hm">
Stay Home<i class="uil uil-smile"></i>
</div>
<a href="myac.php" class="invc-link hover-btn">Ok</a>
</div>
<?php
if ($row['payment_type'] == 1) {
?>
<div class="placed-bottom-dt">
The payment of <span>₹<?php echo $row['final_val'] ?></span> you'll make when the deliver
arrives with your order.
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/wishlist.php | wishlist.php | <?php
require('require/top.php');
authorise_user2();
?>
<div class="path">
<div class="container">
<a href="index.html">Home</a>
/
<a href="index.html">My Wishlist</a>
</div>
</div>
<section class="wishlist">
<?php require('require/headbanner.php'); ?>
<section class="myac-body">
<div class="flex row">
<?php require('require/ac-left.php'); ?>
<div class="right">
<h4><i class="uil uil-heart"></i>My Wishlist</h4>
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<?php
$uid = $_SESSION['USER_ID'];
$query = "select wishlist.id,wishlist.p_id,product.product_name,product.price,product.fa,product.img1 from wishlist,product where wishlist.u_id='$uid' and wishlist.p_id=product.id";
$res = mysqli_query($con, $query);
if (mysqli_num_rows($res) > 0) {
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="wish-item">
<div class="cart-product-img">
<img src="media/product/<?php echo $row['img1'] ?>" alt="" />
<div class="offer-badge">
<?php
$offn = ($row['fa'] * 100) / $row['price'];
$off = round(100 - $offn);
echo $off . '%';
?>
</div>
</div>
<div class="cart-text">
<h4><?php echo $row['product_name'] ?></h4>
<div class="cart-item-price">₹<?php echo $row['fa']; ?> <span>₹<?php echo $row['price']; ?></span></div>
<button type="button" class="cart-close-btn" onclick="del_wish(<?php echo $row['id']; ?>)">
<i class="uil uil-trash-alt"></i>
</button>
</div>
</div>
<?php }
} ?>
</div>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/deliveryBoy/order-detail.php | deliveryBoy/order-detail.php | <?php
require("require/top.php");
$oid = $_GET['id'];
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="order-detail.php?id=<?php echo $oid; ?>">Order Detail</a>
</div>
</div>
<div class="cartrow" id="catrow">
<div class="gh">
<?php
$query = "select orders.dv_time,orders.order_status,orders.id,orders.o_id,orders.total_amt,orders.ship_fee_order,orders.final_val,dv_time.from,dv_time.tto,order_status.o_status from orders,dv_time,order_status where orders.id='$oid' and orders.dv_date=dv_time.id and not orders.order_status='1' and orders.order_status=order_status.id";
$res = mysqli_query($con, $query);
if (mysqli_num_rows($res) > 0) {
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h6>Order Id: <?php echo $row['o_id']; ?></h6>
<h6>Delivery Timing: <?php echo $row['dv_time']; ?>,<?php echo $row['from']; ?>
-
<?php echo $row['tto']; ?></h6>
</div>
<div class="order-body10">
<?php
$oid = $row['id'];
$rs = mysqli_query($con, "select order_detail.hover,order_detail.rcvd,order_detail.qty,product.product_name,product.img1,product.id from order_detail,product where order_detail.oid='$oid' and order_detail.p_id=product.id");
while ($rw = mysqli_fetch_assoc($rs)) {
?>
<ul class="order-dtsll">
<li>
<div class="order-dt-img">
<img src="../media/product/<?php echo $rw['img1']; ?>" alt="" />
</div>
</li>
<li>
<div class="order-dt47">
<h4><?php echo $rw['product_name']; ?></h4>
<div class="order-title">
<?php echo $rw['qty']; ?> Items
</div>
<?php
if ($rw['hover'] == 1) {
?>
<div class="order-title">
Handed Over <i class="uil uil-check-circle"></i>
</div>
<?php
if ($rw['rcvd'] == 1) {
?>
<div class="order-title">
Received <i class="uil uil-check-circle"></i>
</div>
<?php
} else {
?>
<div class="order-title">
Received <input type="checkbox" id="h-hover" value="<?php echo $rw['id'] ?>" oninput="rcvd(this,<?php echo $oid; ?>)">
</div>
<?php
}
} else {
?>
<div class="order-title">
Not Handed Over
</div>
<?php
}
?>
</div>
</li>
</ul>
<?php } ?>
<div class="total-dt">
<div class="total-checkout-group">
<div class="cart-total-dil">
<h4>Sub Total</h4>
<span>₹<?php echo $row['total_amt']; ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Delivery Charges</h4>
<span>₹<?php echo $row['ship_fee_order']; ?></span>
</div>
</div>
<div class="main-total-cart">
<h2>Total</h2>
<span>₹<?php echo $row['final_val']; ?></span>
</div>
</div>
<div class="track-order flex justify-between">
<span class="badge green"> <?php echo $row['o_status']; ?> </span>
<?php
if ($row['o_status'] != "Delivered") {
if (mysqli_num_rows(mysqli_query($con, "select * from ofd where od_id='$oid'")) == 0) {
?>
<button onclick="out(<?php echo $oid; ?>)">Out for Delivery</button>
<?php } else {
?>
<button onclick="control.redirect('final_delivery.php?id=<?php echo $oid ?>')">Delivered</button>
<button onclick="out_undelivered(<?php echo $oid; ?>)">Undelivered</button>
<?php
}
}
?>
</div>
</div>
</div>
<?php }
} ?>
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h4>Delivery Address</h4>
</div>
<?php
$f = "select orders.ad_id,user_address.*,city.city_name from orders,user_address,city where orders.id='$oid' and orders.ad_id=user_address.id and user_address.user_city=city.id";
$d = mysqli_fetch_assoc(mysqli_query($con, $f));
?>
<div class="order-body10">
<div class="total-dt">
<div class="total-checkout-group bt0">
<div class="cart-total-dil">
<h4>Name</h4>
<span><?php echo $d['user_name'] ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Phone</h4>
<span><?php echo $d['user_mobile'] ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Address</h4>
<span style="word-wrap:break-word;"><?php echo $d['user_local'] ?>, <br>
<?php echo $d['user_add'] ?>, <br>
<?php echo $d['city_name'] ?>,<?php echo $d['user_pin'] ?></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
require("require/foot.php");
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/deliveryBoy/order_assigned.php | deliveryBoy/order_assigned.php | <?php
require("require/top.php");
$did = $_SESSION['DELIVERY_ID'];
$res = mysqli_query($con, "select assigned_orders.od_id,orders.o_id,orders.id,order_time.added_on from assigned_orders,orders,order_time where assigned_orders.dv_id='$did' and assigned_orders.od_id=orders.id and order_time.oid=orders.id and order_time.o_status=orders.order_status");
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="order_assigned.php">Assigned Orders</a>
</div>
</div>
<div class="cartrow" id="catrow">
<div class="gh">
<div class="heading">
<h3>Assigned Orders</h3>
</div>
<div class="maincontainer">
<table class="wishlist">
<thead>
<th>#</th>
<th>Id</th>
<th>Time</th>
<th>Status</th>
<th>Action</th>
</thead>
<tbody>
<?php
$i = 1;
while ($rw = mysqli_fetch_assoc($res)) {
?>
<tr>
<td><?php echo $i;
$i++; ?></td>
<td><?php echo $rw['o_id']; ?></td>
<td><?php echo $rw['added_on']; ?></td>
<td>
<span class="badge green"> Assigned </span>
</td>
<td>
<div class="acn">
<a href="order-detail.php?id=<?php echo $rw['id'] ?>" class="view">
<i class="uil uil-eye"></i>
</a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<?php
require("require/foot.php");
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/deliveryBoy/final_delivery.php | deliveryBoy/final_delivery.php | <?php
require("require/top.php");
$oid = $_GET['id'];
?>
<div class="path">
<div class="container">
<a href="index.html">Home</a>
/
<a href="index.html">Orders</a>
</div>
</div>
<div class="cartrow" id="catrow">
<div class="gh">
<?php
$query = "select orders.dv_time,orders.order_status,orders.id,orders.o_id,orders.total_amt,orders.ship_fee_order,orders.final_val,dv_time.from,dv_time.tto,order_status.o_status from orders,dv_time,order_status where orders.id='$oid' and orders.dv_date=dv_time.id and not orders.order_status='1' and orders.order_status=order_status.id";
$res = mysqli_query($con, $query);
if (mysqli_num_rows($res) > 0) {
while ($row = mysqli_fetch_assoc($res)) {
?>
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h6>Order Id: <?php echo $row['o_id']; ?></h6>
<h6>Delivery Timing: <?php echo $row['dv_time']; ?>,<?php echo $row['from']; ?>
-
<?php echo $row['tto']; ?></h6>
</div>
<div class="order-body10">
<?php
$oid = $row['id'];
$rs = mysqli_query($con, "select order_detail.delivered_qty,order_detail.hover,order_detail.rcvd,order_detail.qty,product.product_name,product.img1,product.id from order_detail,product where order_detail.oid='$oid' and order_detail.p_id=product.id");
while ($rw = mysqli_fetch_assoc($rs)) {
?>
<ul class="order-dtsll">
<li>
<div class="order-dt-img">
<img src="../media/product/<?php echo $rw['img1']; ?>" alt="" />
</div>
</li>
<li>
<div class="order-dt47">
<h4><?php echo $rw['product_name']; ?></h4>
<div class="order-title">
<?php echo $rw['qty']; ?> Items
</div>
<div class="order-title">
<select name="" id="" style="padding:0.5rem; border:1px solid #eaeaea;">
<option value="#">Delivered Qty</option>
<?php
for ($g = 0; $g <= $rw['qty']; $g++) {
if ($rw['delivered_qty'] == $g) {
?>
<option value="<?php echo $g ?>" selected><?php echo $g ?></option>
<?php
} else {
?>
<option value="<?php echo $g ?>"><?php echo $g ?></option>
<?php
}
}
?>
</select>
<button onclick="final_submit(this,<?php echo $rw['id'] ?>,<?php echo $oid ?>)">Submit</button>
</div>
</li>
</ul>
<?php } ?>
<div class="total-dt">
<div class="total-checkout-group">
<div class="cart-total-dil">
<h4>Sub Total</h4>
<span>₹<?php echo $row['total_amt']; ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Delivery Charges</h4>
<span>₹<?php echo $row['ship_fee_order']; ?></span>
</div>
</div>
<div class="main-total-cart">
<h2>Total</h2>
<span>₹<?php echo $row['final_val']; ?></span>
</div>
</div>
<div class="track-order flex justify-between">
<span class="badge green"> <?php echo $row['o_status']; ?> </span>
<button onclick="delivered(<?php echo $oid ?>)">Delivered</button>
</div>
</div>
</div>
<?php }
} ?>
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h4>Delivery Address</h4>
</div>
<?php
$f = "select orders.ad_id,user_address.*,city.city_name from orders,user_address,city where orders.id='$oid' and orders.ad_id=user_address.id and user_address.user_city=city.id";
$d = mysqli_fetch_assoc(mysqli_query($con, $f));
?>
<div class="order-body10">
<div class="total-dt">
<div class="total-checkout-group bt0">
<div class="cart-total-dil">
<h4>Name</h4>
<span><?php echo $d['user_name'] ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Phone</h4>
<span><?php echo $d['user_mobile'] ?></span>
</div>
<div class="cart-total-dil pt-3">
<h4>Address</h4>
<span style="word-wrap:break-word;"><?php echo $d['user_local'] ?>, <br>
<?php echo $d['user_add'] ?>, <br>
<?php echo $d['city_name'] ?>,<?php echo $d['user_pin'] ?></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
require("require/foot.php");
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/deliveryBoy/undelivery_cnfrm.php | deliveryBoy/undelivery_cnfrm.php | <?php
require("require/top.php");
$did = $_SESSION['DELIVERY_ID'];
$res = mysqli_query($con, "select cnfrm_undelivery.od_id,orders.o_id,orders.id,order_time.added_on from cnfrm_undelivery,orders,order_time where cnfrm_undelivery.dv_id='$did' and cnfrm_undelivery.od_id=orders.id and order_time.oid=orders.id and order_time.o_status=orders.order_status");
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="delivery_confirmation.php">Undelivery confirmations</a>
</div>
</div>
<div class="cartrow" id="catrow">
<div class="gh">
<div class="heading">
<h3>Undelivery confirmation</h3>
</div>
<div class="maincontainer">
<table class="wishlist">
<thead>
<th>#</th>
<th>Id</th>
<th>Time</th>
<th>Status</th>
<th>Confirmed</th>
</thead>
<tbody>
<?php
$i = 1;
while ($rw = mysqli_fetch_assoc($res)) {
?>
<tr>
<td><?php echo $i;
$i++; ?></td>
<td><?php echo $rw['o_id']; ?></td>
<td><?php echo $rw['added_on']; ?></td>
<td>
<span class="badge green"> Undelivered</span>
</td>
<td>
<span class="badge orange"> No </span>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<?php
require("require/foot.php");
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
detronetdip/E-commerce | https://github.com/detronetdip/E-commerce/blob/a9368863c2fb493bb9f14582bcf6410377e06521/deliveryBoy/index.php | deliveryBoy/index.php | <?php
require("require/top.php");
?>
<div class="row">
<div class="col-xxl-6">
<div class="card">
<div class="bg-secondary card-border"></div>
<div class="card-body">
<div class="media align-items-center">
<div class="media-body mr-3">
<h2 class="num-text text-black font-w700">78</h2>
<span class="fs-14">Total Project Handled</span>
</div>
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M34.422 13.9831C34.3341 13.721 34.1756 13.4884 33.9638 13.3108C33.7521 13.1332 33.4954 13.0175 33.222 12.9766L23.649 11.5141L19.353 2.36408C19.2319 2.10638 19.0399 1.88849 18.7995 1.73587C18.5591 1.58325 18.2803 1.5022 17.9955 1.5022C17.7108 1.5022 17.4319 1.58325 17.1915 1.73587C16.9511 1.88849 16.7592 2.10638 16.638 2.36408L12.342 11.5141L2.76902 12.9766C2.49635 13.0181 2.24042 13.1341 2.02937 13.3117C1.81831 13.4892 1.6603 13.7215 1.57271 13.9831C1.48511 14.2446 1.47133 14.5253 1.53287 14.7941C1.59441 15.063 1.72889 15.3097 1.92152 15.5071L8.89802 22.6501L7.24802 32.7571C7.20299 33.0345 7.23679 33.3189 7.34555 33.578C7.45431 33.8371 7.63367 34.0605 7.86319 34.2226C8.09271 34.3847 8.36315 34.4791 8.64371 34.495C8.92426 34.5109 9.20365 34.4477 9.45002 34.3126L18 29.5906L26.55 34.3126C26.7964 34.4489 27.0761 34.5131 27.3573 34.4978C27.6384 34.4826 27.9096 34.3885 28.1398 34.2264C28.37 34.0643 28.5499 33.8406 28.659 33.5811C28.768 33.3215 28.8018 33.0365 28.7565 32.7586L27.1065 22.6516L34.0785 15.5071C34.2703 15.3091 34.4037 15.0622 34.4643 14.7933C34.5249 14.5245 34.5103 14.2441 34.422 13.9831Z" fill="#864AD1"></path>
</svg>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-xxl-6 col-lg-6 col-sm-6">
<div class="card card-bd">
<div class="bg-warning card-border"></div>
<div class="card-body">
<div class="media align-items-center">
<div class="media-body mr-3">
<h2 class="num-text text-black font-w700">214</h2>
<span class="fs-14">Contacts You Have</span>
</div>
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.8935 22.5C23.6925 22.5 28.3935 17.799 28.3935 12C28.3935 6.20101 23.6925 1.5 17.8935 1.5C12.0945 1.5 7.39351 6.20101 7.39351 12C7.39351 17.799 12.0945 22.5 17.8935 22.5Z" fill="#FFB930"></path>
<path d="M29.5605 21.3344C29.217 20.9909 28.851 20.6699 28.476 20.3564C27.2159 21.96 25.6078 23.2562 23.7733 24.1472C21.9388 25.0382 19.9259 25.5007 17.8864 25.4996C15.847 25.4986 13.8345 25.0342 12.0009 24.1414C10.1673 23.2486 8.56051 21.9507 7.30199 20.3459C5.447 21.8906 3.95577 23.8256 2.9347 26.013C1.91364 28.2003 1.3879 30.586 1.39499 32.9999C1.39499 33.3978 1.55303 33.7793 1.83433 34.0606C2.11564 34.3419 2.49717 34.4999 2.89499 34.4999H32.895C33.2928 34.4999 33.6743 34.3419 33.9557 34.0606C34.237 33.7793 34.395 33.3978 34.395 32.9999C34.4004 30.8324 33.9759 28.6854 33.146 26.683C32.3162 24.6807 31.0975 22.8627 29.5605 21.3344Z" fill="#FFB930"></path>
</svg>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-xxl-6 col-lg-6 col-sm-6">
<div class="card card-bd">
<div class="bg-primary card-border"></div>
<div class="card-body">
<div class="media align-items-center">
<div class="media-body mr-3">
<h2 class="num-text text-black font-w700">93</h2>
<span class="fs-14">Total Unfinished Task</span>
</div>
<svg class="primary-icon" width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.9999 1.5H5.99994C3.51466 1.5 1.49994 3.51472 1.49994 6V29.8125C1.49994 32.2977 3.51466 34.3125 5.99994 34.3125H11.9999C14.4852 34.3125 16.4999 32.2977 16.4999 29.8125V6C16.4999 3.51472 14.4852 1.5 11.9999 1.5Z" fill="#20F174"></path>
<path d="M30 1.5H24C21.5147 1.5 19.5 3.51472 19.5 6V12C19.5 14.4853 21.5147 16.5 24 16.5H30C32.4853 16.5 34.5 14.4853 34.5 12V6C34.5 3.51472 32.4853 1.5 30 1.5Z" fill="#20F174"></path>
<path d="M30 19.5H24C21.5147 19.5 19.5 21.5147 19.5 24V30C19.5 32.4853 21.5147 34.5 24 34.5H30C32.4853 34.5 34.5 32.4853 34.5 30V24C34.5 21.5147 32.4853 19.5 30 19.5Z" fill="#20F174"></path>
</svg>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-xxl-6 col-lg-6 col-sm-6">
<div class="card card-bd">
<div class="bg-info card-border"></div>
<div class="card-body">
<div class="media align-items-center">
<div class="media-body mr-3">
<h2 class="num-text text-black font-w700">12</h2>
<span class="fs-14">Unread Messages</span>
</div>
<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M34.4999 1.91663H11.4999C8.95917 1.91967 6.52338 2.93032 4.72682 4.72688C2.93026 6.52345 1.91961 8.95924 1.91656 11.5V26.8333C1.91935 29.0417 2.6834 31.1816 4.07994 32.8924C5.47648 34.6031 7.42011 35.7801 9.58323 36.225V42.1666C9.58318 42.5136 9.67733 42.8541 9.85564 43.1518C10.0339 43.4495 10.2897 43.6932 10.5957 43.8569C10.9016 44.0206 11.2463 44.0982 11.5929 44.0813C11.9395 44.0645 12.275 43.9539 12.5636 43.7613L23.5749 36.4166H34.4999C37.0406 36.4136 39.4764 35.4029 41.273 33.6064C43.0695 31.8098 44.0802 29.374 44.0832 26.8333V11.5C44.0802 8.95924 43.0695 6.52345 41.273 4.72688C39.4764 2.93032 37.0406 1.91967 34.4999 1.91663ZM30.6666 24.9166H15.3332C14.8249 24.9166 14.3374 24.7147 13.9779 24.3552C13.6185 23.9958 13.4166 23.5083 13.4166 23C13.4166 22.4916 13.6185 22.0041 13.9779 21.6447C14.3374 21.2852 14.8249 21.0833 15.3332 21.0833H30.6666C31.1749 21.0833 31.6624 21.2852 32.0219 21.6447C32.3813 22.0041 32.5832 22.4916 32.5832 23C32.5832 23.5083 32.3813 23.9958 32.0219 24.3552C31.6624 24.7147 31.1749 24.9166 30.6666 24.9166ZM34.4999 17.25H11.4999C10.9916 17.25 10.5041 17.048 10.1446 16.6886C9.78517 16.3291 9.58323 15.8416 9.58323 15.3333C9.58323 14.825 9.78517 14.3374 10.1446 13.978C10.5041 13.6186 10.9916 13.4166 11.4999 13.4166H34.4999C35.0082 13.4166 35.4957 13.6186 35.8552 13.978C36.2146 14.3374 36.4166 14.825 36.4166 15.3333C36.4166 15.8416 36.2146 16.3291 35.8552 16.6886C35.4957 17.048 35.0082 17.25 34.4999 17.25Z" fill="#3ECDFF"></path>
</svg>
</div>
</div>
</div>
</div>
</div>
<?php
require("require/foot.php");
?> | php | MIT | a9368863c2fb493bb9f14582bcf6410377e06521 | 2026-01-05T05:22:32.990752Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.