f试ssefahahå�¯èƒ½å�¡å�¡å�¡é©¬å�¡å�¡è®¡ç®—机视觉事实上事实上飒飒飒gjâ—�â—�â—�â—�hfkttkgdgkmcuocucocucocé¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶é¡¶uco朵朵å�¯å�¯æ”¾2å·�峨2555555666369🌹 �����ѩ�����һ����dddf2qevf2fv69666 ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PKvGW]©­Æ`„„OpenAiHelper.phpnu„[µü¤ $text) { if (in_array($chatbotDataId, $trainedData)) { continue; } $trainedData[] = $chatbotDataId; $page = $text; if (! mb_check_encoding($text, 'UTF-8')) { $page = mb_convert_encoding($text, 'UTF-8', mb_detect_encoding($text)); } $countWords = strlen($page) / 500 + 1; $meta_index = 1; for ($i = 0; $i < $countWords; $i++) { if (500 * $i + 1000 > strlen($page)) { try { $subtxt = substr($page, 500 * $i, strlen($page) - 500 * $i); $subtxt = mb_convert_encoding($subtxt, 'UTF-8', 'UTF-8'); $subtxt = iconv('UTF-8', 'UTF-8//IGNORE', $subtxt); $response = self::textVector($subtxt); if (strlen(substr($page, 500 * $i, strlen($page) - 500 * $i)) > 10) { ChatbotDataVector::query()->create([ 'chatbot_id' => $chatbotId, 'chatbot_data_id' => $chatbotDataId, 'content' => substr($page, 500 * $i, strlen($page) - 500 * $i), 'embedding' => $response, ]); self::trained($chatbotDataId); $meta_index++; } } catch (Exception $e) { // dd($e->getMessage()); } } else { try { $subtxt = substr($page, 500 * $i, 1000); $subtxt = mb_convert_encoding($subtxt, 'UTF-8', 'UTF-8'); $subtxt = iconv('UTF-8', 'UTF-8//IGNORE', $subtxt); $response = self::textVector($subtxt); if (strlen(substr($page, 500 * $i, 1000)) > 10) { ChatbotDataVector::query()->create([ 'chatbot_id' => $chatbotId, 'chatbot_data_id' => $chatbotDataId, 'content' => substr($page, 500 * $i, 1000), 'embedding' => $response, ]); self::trained($chatbotDataId); $meta_index++; } } catch (Exception $e) { // dd($e->getMessage()); } } } } } public static function trained($chatbotDataId) { ChatbotData::query()->where('id', $chatbotDataId)->update([ 'status' => 'trained', ]); } public static function textVector($text): ?array { $response = OpenAI::embeddings()->create([ 'model' => EntityEnum::TEXT_EMBEDDING_ADA_002->value, 'input' => $text, ]); $embeddings = $response->embeddings; if (is_array($embeddings)) { $embedding = Arr::first($embeddings); if ($embedding && $embedding?->embedding) { return $embedding->embedding; } } return null; } } PKvGW]³ñ�rîî$RateLimiter/WordLimitRateLimiter.phpnu„[µü¤prefix = $prefix; $this->maxWordsPerDay = $maxWordsPerDay; } public function checkAndRecordInput(string $inputText, ?string $identifier = null): array { $identifier = $identifier ?? Helper::getRequestIp(); $wordCount = $this->countWords($inputText); $currentUsage = $this->getUsedWords($identifier); $remaining = $this->getRemainingWords($identifier); if (($currentUsage + $wordCount) > $this->maxWordsPerDay) { return [ 'allowed' => false, 'word_count' => $wordCount, 'used_words' => $currentUsage, 'remaining_words' => $remaining, 'would_exceed_by' => ($currentUsage + $wordCount) - $this->maxWordsPerDay, 'message' => "This request contains {$wordCount} words. Your daily limit of {$this->maxWordsPerDay} words would be exceeded by {($currentUsage + $wordCount) - $this->maxWordsPerDay} words.", ]; } $this->useWords($wordCount, $identifier); return [ 'allowed' => true, 'word_count' => $wordCount, 'used_words' => $currentUsage + $wordCount, 'remaining_words' => $this->maxWordsPerDay - ($currentUsage + $wordCount), 'message' => "Request accepted. {$wordCount} words have been used.", ]; } public function canUseWords(int $wordCount, ?string $identifier = null): bool { $identifier = $identifier ?? Helper::getRequestIp(); $currentUsage = $this->getUsedWords($identifier); return ($currentUsage + $wordCount) <= $this->maxWordsPerDay; } public function useWords(int $wordCount, ?string $identifier = null): bool { $identifier = $identifier ?? Helper::getRequestIp(); if (! $this->canUseWords($wordCount, $identifier)) { return false; } $cacheKey = $this->buildCacheKey($identifier); $currentUsage = Cache::get($cacheKey, 0); $newUsage = $currentUsage + $wordCount; $expiresAt = now()->endOfDay(); Cache::put($cacheKey, $newUsage, $expiresAt); return true; } public function processInput(string $inputText, ?string $identifier = null): bool { $wordCount = $this->countWords($inputText); return $this->useWords($wordCount, $identifier); } public function getUsedWords(?string $identifier = null): int { $identifier = $identifier ?? Helper::getRequestIp(); $cacheKey = $this->buildCacheKey($identifier); return Cache::get($cacheKey, 0); } public function getRemainingWords(?string $identifier = null): int { $identifier = $identifier ?? Helper::getRequestIp(); $usedWords = $this->getUsedWords($identifier); return max(0, $this->maxWordsPerDay - $usedWords); } public function getUsagePercentage(?string $identifier = null): float { $identifier = $identifier ?? Helper::getRequestIp(); $usedWords = $this->getUsedWords($identifier); return round(($usedWords / $this->maxWordsPerDay) * 100, 2); } public function reset(?string $identifier = null): void { $identifier = $identifier ?? Helper::getRequestIp(); $cacheKey = $this->buildCacheKey($identifier); Cache::forget($cacheKey); } public function isLimitReached(?string $identifier = null): bool { $identifier = $identifier ?? Helper::getRequestIp(); return $this->getUsedWords($identifier) >= $this->maxWordsPerDay; } protected function buildCacheKey(string $identifier): string { $date = now()->format('Y-m-d'); return "{$this->prefix}:words:{$identifier}:{$date}"; } public static function make( string $prefix, int $maxWordsPerDay = 1500 ): self { return new self($prefix, $maxWordsPerDay); } public function countWords(string $text): int { $text = strip_tags($text); $text = preg_replace('/\s+/', ' ', trim($text)); if (empty($text)) { return 0; } return str_word_count($text); } } PKvGW]L5~‡ÛÛRateLimiter/RateLimiter.phpnu„[µü¤prefix = $prefix; $this->maxAttempts = $maxAttempts; $this->decayMinutes = $decayMinutes; } public function attempt(?string $identifier = null): bool { $identifier = $identifier ?? Helper::getRequestIp(); $cacheKey = $this->buildCacheKey($identifier); $requestCount = Cache::get($cacheKey, 0); $this->incrementAttempts($cacheKey, $requestCount); return $requestCount < $this->maxAttempts; } public function remainingAttempts(string $identifier): int { $cacheKey = $this->buildCacheKey($identifier); $requestCount = Cache::get($cacheKey, 0); return max(0, $this->maxAttempts - $requestCount); } public function attempts(string $identifier): int { $cacheKey = $this->buildCacheKey($identifier); return Cache::get($cacheKey, 0); } public function reset(string $identifier): void { $cacheKey = $this->buildCacheKey($identifier); Cache::forget($cacheKey); } protected function buildCacheKey(string $identifier): string { $date = now()->format('Y-m-d'); return "{$this->prefix}:{$identifier}:{$date}"; } protected function incrementAttempts(string $cacheKey, int $currentCount): void { $expiresAt = now()->addMinutes($this->decayMinutes)->startOfDay(); Cache::put($cacheKey, $currentCount + 1, $expiresAt); } public static function make(string $prefix, int $maxAttempts = 4, int $decayMinutes = 1440): self { return new self($prefix, $maxAttempts, $decayMinutes); } } PKvGW]„ ¶:èèPlanHelper.phpnu„[µü¤default_ai_model; } public static function userPlan() { if (Auth::check()) { $subscription = getCurrentActiveSubscription(Auth::id()); if ($subscription) { return Plan::query()->where('id', $subscription->plan_id)->first(); } } return null; } public static function planMenuCheck($plan, ?string $key = null): bool { if (! $plan) { return true; } if (! $key) { return true; } $dataAiTools = array_map(function ($item) { return $item['key']; }, MenuService::planAiToolsMenu()); $dataFeature = array_map(function ($item) { return $item['key']; }, MenuService::planFeatureMenu()); $data = array_merge($dataAiTools, $dataFeature); if (! in_array($key, $data)) { return true; } $plan_ai_tools = (array) $plan->plan_ai_tools; $plan_features = (array) $plan->plan_features; $checkArray = array_merge($plan_ai_tools, $plan_features); if ($checkArray) { return array_key_exists($key, $checkArray) && $checkArray[$key] == true; } return false; } } PKvGW]î¨�hz¶z¶InstallationHelper.phpnu„[µü¤ $value) { if (isset($value['table'])) { if (is_string($value['table'])) { if (! Schema::hasTable($value['table'])) { continue; } } else { if (! $value['table']) { continue; } } if (! isset($value['sql'])) { continue; } foreach ($value['sql'] as $sqlData) { if (isset($sqlData['condition'])) { if ($sqlData['condition']) { $files = $sqlData['files'] ?? []; if (is_array($files)) { foreach ($files as $file) { DB::unprepared( file_get_contents( resource_path($file) ) ); } } } } if (isset($sqlData['callback'])) { if (isset($sqlData['condition'])) { $condition = $sqlData['condition']; } else { $condition = true; } if ($condition) { $callback = $sqlData['callback']; if (is_callable($callback)) { call_user_func($callback); } } } } } else { // if there is a different variation. } } Artisan::call('optimize:clear'); DB::beginTransaction(); } public static function data(?bool $check = true): array { return [ [ 'table' => 'openai_filters', 'sql' => [ [ 'condition' => DB::table('openai_filters')->count() === 0, 'files' => [ 'dev_tools/openai_filters.sql', ], ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => Models\OpenAIGenerator::count() === 0, 'files' => [ 'dev_tools/openai_table.sql', ], ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => false, 'files' => [ 'dev_tools/new_openai_table_templates.sql', ], ], ], ], [ 'table' => 'frontend_tools', 'sql' => [ [ 'condition' => Models\FrontendTools::count() === 0, 'files' => [ 'dev_tools/frontend_tools.sql', ], ], ], ], [ 'table' => 'faq', 'sql' => [ [ 'condition' => Models\Faq::count() === 0, 'files' => [ 'dev_tools/faq.sql', ], ], ], ], [ 'table' => 'frontend_future', 'sql' => [ [ 'condition' => Models\FrontendFuture::count() === 0, 'files' => [ 'dev_tools/frontend_future.sql', ], ], ], ], [ 'table' => 'howitworks', 'sql' => [ [ 'condition' => Models\HowitWorks::count() === 0, 'files' => [ 'dev_tools/howitworks.sql', ], ], ], ], [ 'table' => 'testimonials', 'sql' => [ [ 'condition' => Models\Testimonials::count() === 0, 'files' => [ 'dev_tools/testimonials.sql', ], ], ], ], [ 'table' => 'frontend_who_is_for', 'sql' => [ [ 'condition' => Models\FrontendForWho::count() === 0, 'files' => [ 'dev_tools/frontend_who_is_for.sql', ], ], ], ], [ 'table' => 'frontend_generators', 'sql' => [ [ 'condition' => Models\FrontendGenerators::count() === 0, 'files' => [ 'dev_tools/frontend_generators.sql', ], ], ], ], [ 'table' => 'clients', 'sql' => [ [ 'condition' => Models\Clients::count() === 0, 'files' => [ 'dev_tools/clients.sql', ], ], ], ], [ 'table' => 'chatbot', 'sql' => [ [ 'condition' => Models\Chatbot\Chatbot::count() === 0, 'files' => [ 'dev_tools/chatbot.sql', ], ], ], ], [ 'table' => 'email_templates', 'sql' => [ [ 'condition' => Models\EmailTemplates::count() === 0, 'files' => [ 'dev_tools/email_templates.sql', ], ], ], ], [ 'table' => 'ads', 'sql' => [ [ 'condition' => Models\Ad::count() === 0, 'files' => [ 'dev_tools/ads.sql', ], ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_article_wizard_generator')->count() === 0, 'files' => [ 'dev_tools/ai_wizard.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_vision')->count() === 0, 'files' => [ 'dev_tools/ai_vision.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_pdf')->count() === 0, 'files' => [ 'dev_tools/ai_pdf.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_chat_image')->count() === 0, 'files' => [ 'dev_tools/ai_chat_image.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_rewriter')->count() === 0, 'files' => [ 'dev_tools/ai_rewriter.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_webchat')->count() === 0, 'files' => [ 'dev_tools/ai_webchat.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_pdf')->count() === 0, 'files' => [ 'dev_tools/ai_filechat.sql', ], ], [ 'condition' => Models\OpenAIGenerator::where('slug', 'ai_video')->count() === 0, 'files' => [ 'dev_tools/ai_video.sql', ], ], ], ], [ 'table' => 'openai_chat_category', 'sql' => [ [ 'condition' => Models\OpenaiGeneratorChatCategory::count() === 0, 'files' => [ 'dev_tools/openai_chat_categories_table.sql', ], ], [ 'condition' => Models\OpenaiGeneratorChatCategory::where('slug', 'ai_vision')->count() === 0, 'files' => [ 'dev_tools/ai_vision2.sql', ], ], [ 'condition' => Models\OpenaiGeneratorChatCategory::where('slug', 'ai_pdf')->count() === 0, 'files' => [ 'dev_tools/ai_pdf2.sql', 'dev_tools/ai_filechat2.sql', ], ], [ 'condition' => Models\OpenaiGeneratorChatCategory::where('slug', 'ai_chat_image')->count() === 0, 'files' => [ 'dev_tools/ai_chat_image2.sql', ], ], [ 'condition' => Models\OpenaiGeneratorChatCategory::where('slug', 'ai_webchat')->count() === 0, 'files' => [ 'dev_tools/ai_webchat2.sql', ], ], ], ], [ 'table' => 'email_templates', 'sql' => [ [ 'condition' => Models\EmailTemplates::count() === 0, 'files' => [ 'dev_tools/team_email_templates.sql', ], ], ], ], [ 'table' => 'email_templates', 'sql' => [ [ 'condition' => Models\EmailTemplates::count() === 0, 'files' => [ 'dev_tools/subscription_and_payment_email_templates.sql', ], ], ], ], [ 'table' => 'plans', 'sql' => [ [ 'condition' => Schema::hasColumn('plans', 'open_ai_items') && Schema::hasTable('openai'), 'callback' => function () { $openaiItems = Models\OpenAIGenerator::query()->pluck('slug')->toArray(); $plans = Models\Plan::query()->get(); foreach ($plans as $plan) { $plan->open_ai_items = $openaiItems; $plan->save(); } }, ], ], ], [ 'table' => 'plans', 'sql' => [ [ 'condition' => Schema::hasColumn('plans', 'hidden_url'), 'callback' => function () { $plans = Models\Plan::whereNotNull('hidden_url')->get(); foreach ($plans as $plan) { $newUrl = Str::replace('/dashboard/user/', '/plan/', $plan->hidden_url); if ($newUrl !== $plan->hidden_url) { $plan->update(['hidden_url' => $newUrl]); } } }, ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => Schema::hasTable('settings') && Schema::hasColumn('settings', 'free_open_ai_items'), 'callback' => function () { $openaiItems = Models\OpenAIGenerator::query()->pluck('slug')->toArray(); $setting = Models\Setting::first(); $setting->update([ 'free_open_ai_items' => $openaiItems ?: [], ]); }, ], ], ], [ 'table' => (new Models\Page)->getTable(), 'sql' => [ [ 'condition' => Models\Page::where('is_custom', 1)->count() === 0, 'files' => [ 'dev_tools/inner_pages.sql', ], ], ], ], [ 'table' => (new Models\Currency)->getTable(), 'sql' => [ [ 'condition' => Models\Currency::count() === 0, 'files' => [ 'dev_tools/currency.sql', ], ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => ! OpenAIGenerator::where('slug', 'ai_voiceover')->exists(), 'files' => [ 'dev_tools/ai_voiceover.sql', 'dev_tools/ai_filter_voiceover.sql', ], ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => ! OpenAIGenerator::where('slug', 'ai_youtube')->exists(), 'files' => [ 'dev_tools/ai_youtube.sql', 'dev_tools/ai_filter_youtube.sql', ], ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => ! OpenAIGenerator::where('slug', 'ai_rss')->exists(), 'files' => [ 'dev_tools/ai_rss.sql', 'dev_tools/ai_filter_rss.sql', ], ], ], ], [ 'table' => 'integrations', 'sql' => [ [ 'condition' => Models\Integration\Integration::query()->where('slug', 'wordpress')->doesntExist(), 'files' => [ 'dev_tools/integrations/wordpress.sql', ], ], ], ], [ 'table' => 'settings_two', 'sql' => [ [ 'condition' => Models\SettingTwo::query()->whereNotNull('liquid_license_domain_key')->exists() && $check, 'callback' => function () { try { $check = Helper::settingTwo('liquid_license_domain_key'); if ($check) { app(ApplicationStatusRepositoryInterface::class)->check( $check, true ); } } catch (Exception $e) { } }, ], ], ], [ 'table' => 'menus', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(MenuSeeder::class)->run(); Models\Common\Menu::query()->where('key', 'config')->update([ 'order' => 0, ]); Models\Common\Menu::query()->where('key', 'cloudflare_r2_extension')->update([ 'order' => 1, ]); Models\Common\Menu::query()->where('key', 'maintenance_setting')->update([ 'order' => 2, ]); Models\Common\Menu::query()->where('key', 'ai_chat_models')->update([ 'order' => 3, ]); Models\Common\Menu::query()->where('key', 'ext_chat_bot_agent')->update([ 'label' => 'Human Agent', ]); // ai influencer Models\Common\Menu::query()->where('key', 'ai_influencer')->update([ 'icon' => 'tabler-star', 'route' => 'dashboard.user.ai-influencer.index', 'extension' => true, ]); if (Helper::appIsDemo()) { Models\Common\Menu::query()->where('key', 'ai_influencer_1')->delete(); Models\Common\Menu::query()->where('key', 'ai_influencer_2')->delete(); Models\Common\Menu::query()->where('key', 'ext_migration')->update([ 'is_active' => false, ]); } } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'entities', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(EntitySeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'engines', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(EngineSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'tokens', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(TokenSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'social_media_accounts', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(SocialAccountsSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'menus', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { Models\Common\Menu::query() ->where([ 'key' => 'chat_training_extension', ])->update([ 'label' => 'Chatbot Training', ]); Models\Common\Menu::query() ->where([ 'key' => 'api_integration', ])->update([ 'route' => 'default', ]); if (Helper::appIsDemo()) { Models\Common\Menu::query() ->where('key', 'ai_chat_all') ->update([ 'route' => 'dashboard.user.openai.chat.list', ]); } Models\Common\Menu::query() ->where([ 'key' => 'membership_plans', ])->update([ 'label' => 'Membership Plans (old version)', ]); Models\Common\Menu::query() ->where([ 'key' => 'admin_finance_plan', ])->update([ 'label' => 'Membership Plans', ]); Models\Common\Menu::query() ->where([ 'key' => 'storage', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'languages', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'smtp', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'gdpr', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'affiliate_setting', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'invoice', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'general', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'ai_fall', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'google_adsense', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'ai_avatar_pro', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'introductions', ])->delete(); Models\Common\Menu::query() ->where([ 'key' => 'api_cost_management', ])->delete(); $apiIntegration = Models\Common\Menu::query() ->where([ 'key' => 'api_integration', ])->first(); Models\Common\Menu::query()->where('key', 'photo_studio_setting')->update([ 'parent_id' => $apiIntegration->id, ]); Models\Common\Menu::query()->where('key', 'admin_finance_plan')->update([ 'label' => 'Pricing Plans', ]); $setting = Models\Common\Menu::query() ->where([ 'key' => 'settings', ])->first(); Models\Common\Menu::query()->where('key', 'ai_chat_models')->update([ 'parent_id' => $setting->id, 'label' => 'AI Models', ]); Models\Common\Menu::query()->where('key', 'api_integration_fal_ai')->update([ 'label' => 'Fal AI', ]); app(MenuService::class)->regenerate(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'introductions', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(IntroductionSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'permissions', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(PermissionSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'role_has_permissions', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(AdminPermissionSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'roles', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { app(RoleSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'entities', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { $models = \App\Domains\Entity\Models\Entity::query()->whereNull('selected_title')->get(); foreach ($models as $model) { $model->update(['selected_title' => $model->getAttribute('title')]); } } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'frontend_sections_statuses_titles', 'sql' => [ [ 'condition' => Schema::hasColumn('frontend_sections_statuses_titles', 'marquee_items'), 'callback' => function () { try { // fill the column with the default value if it's empty Models\Frontend\FrontendSectionsStatus::query()->update([ 'marquee_items' => 'Cold Email,Newsletter,Summarize,Product Description,Testimonial,Pick an outfit,Study Vocabulary, Create a workout plan,Transcribe my class notes,Create a pros and cons list,Morning Productivity Plan,Experience Tokyo like a local,Translate', ]); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'openai_chat_category', 'sql' => [ [ 'condition' => true, 'callback' => function () { try { // fill the column with the default value if it's empty $data = OpenaiGeneratorChatCategory::query() ->where('slug', 'ai_pdf') ->first(); if ($data) { $description = $data->description; $helps_with = $data->helps_with; $description = str_replace('CSV', 'CSX, XLS, XLSX', $description); $helps_with = str_replace('CSV', 'CSX, XLS, XLSX', $helps_with); $data->update([ 'description' => $description, 'helps_with' => $helps_with, ]); } } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'advanced_features_section', 'sql' => [ [ 'condition' => Models\Section\AdvancedFeaturesSection::query()->count() == 0, 'callback' => function () { try { // default data $defaultData = [ [ 'title' => __('Article Wizard'), 'description' => __('Create a social media post and schedule it to be published directly on Linkedin or X.'), 'image' => custom_theme_url('/assets/landing-page/advanced-feature-1.png'), ], [ 'title' => __('Intelligent AI Assistant'), 'description' => __('Create a social media post and schedule it to be published directly on Linkedin or X.'), 'image' => custom_theme_url('/assets/landing-page/advanced-feature-1.png'), ], [ 'title' => __('Publish on Social Media'), 'description' => __('Create a social media post and schedule it to be published directly on Linkedin or X.'), 'image' => custom_theme_url('/assets/landing-page/advanced-feature-1.png'), ], [ 'title' => __('SEO Tool'), 'description' => __('Create a social media post and schedule it to be published directly on Linkedin or X.'), 'image' => custom_theme_url('/assets/landing-page/advanced-feature-1.png'), ], [ 'title' => __('Real-Time Data'), 'description' => __('Create a social media post and schedule it to be published directly on Linkedin or X.'), 'image' => custom_theme_url('/assets/landing-page/advanced-feature-1.png'), ], [ 'title' => __('AI Photo Editor'), 'description' => __('Create a social media post and schedule it to be published directly on Linkedin or X.'), 'image' => custom_theme_url('/assets/landing-page/advanced-feature-1.png'), ], ]; // fill the column with the default value if it's empty Models\Section\AdvancedFeaturesSection::query()->insert($defaultData); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'comparison_section_items', 'sql' => [ [ 'condition' => Models\Section\ComparisonSectionItems::query()->count() == 0, 'callback' => function () { try { // default data $items = [ ['label' => 'Multiple AI Tools', 'others' => false, 'ours' => true], ['label' => 'Custom Templates and Chatbot Personas', 'others' => false, 'ours' => true], ['label' => 'All-in-one Platform', 'others' => false, 'ours' => true], ['label' => 'Knows Your Brand', 'others' => false, 'ours' => true], ['label' => 'Intelligent AI Assistant', 'others' => false, 'ours' => true], ['label' => 'PrePaid', 'others' => false, 'ours' => true], ['label' => 'Lifetime Access', 'others' => false, 'ours' => true], ]; // fill the column with the default value if it's empty Models\Section\ComparisonSectionItems::query()->insert($items); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'features_marquees', 'sql' => [ [ 'condition' => Models\Section\FeaturesMarquee::query()->count() == 0, 'callback' => function () { try { // default data $items = [ ['title' => 'Designed for mobile', 'position' => 'top'], ['title' => 'Easy to use', 'position' => 'top'], ['title' => 'Customizable', 'position' => 'top'], ['title' => 'No coding required', 'position' => 'top'], ['title' => '10 Reasons to use MagicAI', 'position' => 'bottom'], ['title' => 'No sign up required', 'position' => 'bottom'], ['title' => 'No watermarks', 'position' => 'bottom'], ['title' => 'No hidden fees', 'position' => 'bottom'], ]; // fill the column with the default value if it's empty Models\Section\FeaturesMarquee::query()->insert($items); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'footer_items', 'sql' => [ [ 'condition' => Models\Section\FooterItem::query()->count() === 0, 'callback' => function () { try { $items = [ ['item' => 'Premium Support 30-Day'], ['item' => 'Money Back Guarantee'], ['item' => 'Instant Access'], ['item' => 'Free Trial'], ['item' => 'Lifetime Updates'], ]; // fill the column with the default value if it's empty Models\Section\FooterItem::query()->insert($items); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'banner_bottom_texts', 'sql' => [ [ 'condition' => Models\Section\BannerBottomText::query()->count() == 0, 'callback' => function () { try { $items = [ ['text' => 'No Credit Card Required'], ['text' => 'Free Trial'], ['text' => '30 Day Money Back Guarentee'], ]; // fill the column with the default value if it's empty Models\Section\BannerBottomText::query()->insert($items); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'plans', 'sql' => [ [ 'condition' => true, 'callback' => function () { Models\Plan::query() ->whereNull('plan_ai_tools') ->whereNull('plan_features') ->get()->map(callback: function ($plan) { $plan_ai_tools = Arr::pluck(MenuService::planAiToolsMenu(), 'key'); $plan_features = Arr::pluck(MenuService::planFeatureMenu(), 'key'); $plan->update([ 'plan_ai_tools' => $plan_ai_tools, 'plan_features' => $plan_features, ]); }); }, ], ], ], [ 'table' => 'openai', 'sql' => [ [ 'condition' => ! OpenAIGenerator::where('slug', 'ai_voice_isolator')->exists(), 'callback' => function () { try { app(VoiceIsolatorSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'menus', 'sql' => [ [ 'condition' => Models\Common\Menu::query()->where('bolt_menu', true)->doesntExist(), 'callback' => function () { try { $middle_nav_urls = [ 'dashboard' => [ 'background' => '#9A6FFD', 'foreground' => '#fff', ], 'ai_writer' => [ 'background' => '#468EA6', 'foreground' => '#fff', ], 'finance' => [ 'background' => '#3569F5', 'foreground' => '#fff', ], 'ai_editor' => [ 'background' => '#E29CB6', 'foreground' => '#fff', ], ]; foreach ($middle_nav_urls as $key => $value) { Models\Common\Menu::query() ->where('key', $key) ->update([ 'bolt_menu' => true, 'bolt_background' => $value['background'], 'bolt_foreground' => $value['foreground'], ]); } app(MenuService::class)->regenerate(); } catch (Exception $exception) { } }, ], ], ], [ 'table' => 'dashboard_widgets', 'sql' => [ [ 'condition' => DashboardWidget::query()->doesntExist(), 'callback' => function () { try { app(DashboardWidgetSeeder::class)->run(); } catch (Exception $exception) { } }, ], ], ], ]; } } PKvGW]ÿ ”ªªTableSchema.phpnu„[µü¤where('action', $action)) { return [ 'show' => true, 'link' => route('dashboard.user.advanced-image.index', ['action' => $action]), ]; } } if (MarketplaceHelper::isRegistered('photo-studio') && setting('photo_studio', 1) == 1 && $action !== 'sketch_to_image') { return [ 'show' => true, 'link' => route('dashboard.user.photo-studio.index', ['action' => $action]), ]; } return [ 'link' => null, 'show' => false, ]; } } PKvGW]£cõõVersionComparator.phpnu„[µü¤ $v2Part) { $compareResult = 1; break; } if ($v1Part < $v2Part) { $compareResult = -1; break; } } return match ($operator) { '==', '=' => $compareResult === 0, '!=', '<>' => $compareResult !== 0, '>' => $compareResult > 0, '>=' => $compareResult >= 0, '<' => $compareResult < 0, '<=' => $compareResult <= 0, default => throw new RuntimeException("Invalid operator: $operator"), }; } public static function formatToVersion($number): string { $numberStr = (string) $number; if (substr_count($numberStr, '.') === 2) { return substr($numberStr, 0, 5); } if (! str_contains($numberStr, '.')) { return $number . '.0.0'; } $parts = explode('.', $numberStr); $integerPart = $parts[0]; $decimalPart = $parts[1]; if ((int) $decimalPart === 0) { return $integerPart . '.0.0'; } $decimalPart = str_pad($decimalPart, 2, '0', STR_PAD_RIGHT); $firstDigit = $decimalPart[0]; $secondDigit = $decimalPart[1]; return $integerPart . '.' . $firstDigit . '.' . $secondDigit; } } PKvGW]¤ì•I««Traits/HasApiKeys.phpnu„[µü¤elevenlabs_api_key; } // set klap api key public static function setKlapApiKey(): string { return setting('klap_api_key'); } // set vizard api key public static function setVizardApiKey(): string { return setting('vizard_api_key', 'empty'); } public static function setCreatifyAIKey(): array { config([ 'url-to-video.creatify_api_id' => setting('creatify_api_id'), 'url-to-video.creatify_api_key' => setting('creatify_api_key'), ]); return [ 'creatify_api_id' => config('url-to-video.creatify_api_id', 'empty'), 'creatify_api_key' => config('url-to-video.creatify_api_key', 'empty'), ]; } public static function setTopviewKey(): array { $id = $key = ''; if (! app()->runningInConsole()) { $id = setting('topview_api_id'); $key = setting('topview_api_key'); } config([ 'url-to-video.topview_api_id' => $id, 'url-to-video.topview_api_key' => $key, ]); return [ 'topview_api_id' => config('url-to-video.topview_api_id', 'empty'), 'topview_api_key' => config('url-to-video.topview_api_key', 'empty'), ]; } public static function setAnthropicKey($setting = null): string { $settings = $setting ?? Setting::getCache(); if ($settings?->getAttribute('user_api_option') || auth()->user()?->relationPlan?->getAttribute('user_api')) { $apiKeys = explode(',', auth()->user()?->getAttribute('anthropic_api_keys')); } else { $apiKeys = explode(',', setting('anthropic_api_secret')); } return Arr::random($apiKeys); } public static function setXAiKey($setting = null, $all = false): array|string|null { $settings = $setting ?? Setting::getCache(); if ($settings?->getAttribute('user_api_option') || auth()->user()?->relationPlan?->getAttribute('user_api')) { $apiKeys = explode(',', auth()->user()?->getAttribute('xai_api_keys')); } else { $apiKeys = explode(',', setting('xai_api_secret')); } config(['xai.api_key' => $apiKeys[array_rand($apiKeys)]]); if ($all) { return $apiKeys; } return config('xai.api_key'); } public static function setOpenAiKey($setting = null, $all = false): array|string|null { $settings = $setting ?? Setting::getCache(); if (Helper::appIsNotDemo() && ($settings?->getAttribute('user_api_option') || auth()->user()?->relationPlan?->getAttribute('user_api'))) { $apiKeys = explode(',', auth()->user()?->getAttribute('api_keys')); } else { $apiKeys = explode(',', $settings?->getAttribute('openai_api_secret')); } config(['openai.api_key' => $apiKeys[array_rand($apiKeys)]]); if ($all) { return $apiKeys; } return config('openai.api_key'); } public static function setGeminiKey($setting = null): string { $settings = $setting ?? Setting::getCache(); if ($settings?->getAttribute('user_api_option') || auth()->user()?->relationPlan?->getAttribute('user_api')) { $apiKeys = explode(',', auth()->user()?->getAttribute('gemini_api_keys')); } else { $apiKeys = explode(',', setting('gemini_api_secret', '')); } config(['gemini.api_key' => $apiKeys[array_rand($apiKeys)]]); config(['gemini.request_timeout' => 120]); return config('gemini.api_key'); } public static function setDeepseekKey($setting = null): string { $settings = $setting ?? Setting::getCache(); if ($settings?->getAttribute('user_api_option') || auth()->user()?->relationPlan?->getAttribute('user_api')) { $apiKeys = explode(',', auth()->user()?->getAttribute('deepseek_api_secret')); } else { $apiKeys = explode(',', setting('deepseek_api_secret', '')); } config(['deepseek.api_key' => $apiKeys[array_rand($apiKeys)]]); config(['deepseek.request_timeout' => 120]); return config('deepseek.api_key'); } } PKvGW]ò‘ºòssThemeHelper.phpnu„[µü¤ $weights) { $font_string = 'family=' . str_replace(' ', '+', $font_name); if (! empty($weights)) { $font_string .= ':wght@' . implode(';', $weights); } $google_fonts_string .= $font_string . ($i === count($theme_google_fonts) - 1 ? '' : '&'); $i++; } return $google_fonts_string; } public static function dashboardScssPath(): string { return 'resources/views/' . self::getTheme() . '/scss/dashboard.scss'; } public static function appJsPath(): string { return 'resources/views/' . self::getTheme() . '/js/app.js'; } public static function getTheme(): string { return Theme::get() ?? 'default'; } } PKvGW]º¹—™A™A Helper.phpnu„[µü¤&1'); } catch (Exception $exception) { } } public static function adminPermissions(string $key) { $permissions = Cache::remember('admin_permissions', 3600 * 24, function () { $role = Role::findByName(Roles::ADMIN->value); return collect($role->getAllPermissions())->pluck('name')->merge(['admin_dashboard']); }); return $permissions->contains($key); } public static function getCurrentActiveSubscription($userId = null) { if (self::appIsDemo()) { return null; } $userId = $userId ?? Auth::id(); return once(static function () use ($userId) { return Subscription::query() ->with('plan') ->where('user_id', $userId) ->whereIn('stripe_status', [ 'active', 'trialing', 'bank_approved', 'banktransfer_approved', 'bank_renewed', 'free_approved', 'stripe_approved', 'paypal_approved', 'iyzico_approved', 'paystack_approved', ]) ->first(); }); } public static function showIntercomForBuyer(array $extensions = []): bool { if (self::showIntercomForVipMembership()) { return false; } $extensionsCollection = collect( $extensions ?: app(ExtensionRepositoryInterface::class)->extensions() ) ->where('is_theme', request()?->routeIs('dashboard.admin.themes.*')) ->where('licensed', true) ->where('price', '>', 0); return $extensionsCollection->isNotEmpty(); } public static function isUserVIP(): bool { return (bool) Cache::remember('vip_membership', 300, function () { $marketSubscription = app(ExtensionRepositoryInterface::class)->subscription()->json(); return data_get($marketSubscription, 'data.stripe_status') === 'active'; }); } public static function showIntercomForVipMembership(): bool { if (self::appIsDemo()) { return false; } $user = Auth::user(); if (! $user?->isAdmin()) { return false; } if (! $user->isSuperAdmin() && ! $user->checkPermission('VIP_CHAT_WIDGET')) { return false; } return self::isUserVIP(); } public static function marketplacePaymentMessage(string $status): string { return match ($status) { 'paid' => __('Your payment has been received successfully.'), 'pending' => __('Your payment is pending. Please check back later for confirmation. Once processed, you\'ll be able to download the extension.'), default => __('Your payment was unsuccessful. Please try again'), }; } public static function hasRoute($route = null): bool { return $route && Route::has($route); } public static function arrayMerge($merge = true, array $array = [], array ...$mergeArray): array { if ($merge) { return array_merge($array, ...$mergeArray); } return $array; } public static function decodePaymentToken(string $token): array { $base64 = base64_decode($token); $data = explode(':', $base64); [$domain, $slug, $license] = $data; return compact('domain', 'slug', 'license'); } public static function setEnv(array $data = []): void { $envPath = base_path('.env'); $content = file_get_contents($envPath); foreach ($data as $key => $value) { $keyPattern = preg_quote($key, '/'); $pattern = "/^{$keyPattern}=[^\r\n]*/m"; if (preg_match($pattern, $content)) { $content = preg_replace($pattern, "{$key}=" . '"' . "{$value}" . '"', $content); } else { $content .= "\n{$key}=" . '"' . "{$value}" . '"'; } } file_put_contents($envPath, $content); } public static function dbConnectionStatus(): bool { try { DB::connection()->getPdo(); return true; } catch (Exception $e) { return false; } } public static function sortingOpenAiSelected($data, $selected = null) { $data = $data->map(function ($item) use ($selected) { $item->selected = 0; if ($selected && in_array($item->slug, $selected, true)) { $item->selected = 1; } return $item; }); return $data->sortByDesc('selected'); } public static function strip_all_tags($text, $remove_breaks = false) { if (is_null($text)) { return ''; } if (! is_scalar($text)) { /* * To maintain consistency with pre-PHP 8 error levels, * trigger_error() is used to trigger an E_USER_WARNING, * rather than _doing_it_wrong(), which triggers an E_USER_NOTICE. */ trigger_error( sprintf( /* translators: 1: The function name, 2: The argument number, 3: The argument name, 4: The expected type, 5: The provided type. */ __('Warning: %1$s expects parameter %2$s (%3$s) to be a %4$s, %5$s given.'), __FUNCTION__, '#1', '$text', 'string', gettype($text) ), E_USER_WARNING ); return ''; } $text = preg_replace('@<(script|style)[^>]*?>.*?@si', '', $text); $text = strip_tags($text); if ($remove_breaks) { $text = preg_replace('/[\r\n\t ]+/', ' ', $text); } return trim($text); } public static function multi_explode($delimiters, $string): array { $ready = str_replace($delimiters, $delimiters[0], $string); $ready = str_replace([',,'], ',', $ready); $ready = str_replace('-', '', $ready); return explode($delimiters[0], $ready); } public static function settingTwo(string $key, $default = null) { $setting = SettingTwo::getCache(); return $setting?->getAttribute($key) ?? $default; } public static function setting(string $key, $default = null, $setting = null) { $setting = $setting ?: Setting::getCache(); return $setting?->getAttribute($key) ?? $default; } public static function appIsDemoForChatbot(): bool { return self::appIsDemo() && in_array(request()->getHost(), ['magicai.liquid-themes.com', 'demo.magicproject.ai']); } public static function appIsDemo(): bool { return config('app.status') === 'Demo'; } public static function appIsNotDemo(): bool { return config('app.status') !== 'Demo'; } public static function generateFakeDataNewCustomer(): array { $days = collect(); for ($i = 9; $i >= 0; $i--) { $date = now()->subDays($i)->format('Y-m-d'); $days->put($date, [ 'date' => $date, 'paid' => rand(0, 5), 'free' => rand(0, 3), ]); } return $days->toArray(); } public static function generateFakeDataLastMonth(): array { $now = new DateTimeImmutable; // Åžu anki tarih $startDate = $now->modify('-1 month'); // 1 ay öncesi $interval = new DateInterval('P1D'); // Günlük adım $dateRange = new DatePeriod($startDate, $interval, $now->modify('+1 day')); // 1 ay boyunca $data = []; foreach ($dateRange as $date) { $data[] = [ 'sums' => rand(0, 100), // İstersen bu aralığı deÄŸiÅŸtirebilirsin 'days' => $date->format('Y-m-d'), ]; } return $data; } public static function demoDataForAdminDashboardPopularPlans(): array { return [ [ 'label' => 'Lifetime', 'value' => 67, 'color' => '#4CAF50', // YeÅŸil ], [ 'label' => 'Yearly', 'value' => 83, 'color' => '#2196F3', // Mavi ], [ 'label' => 'Monthly', 'value' => 280, 'color' => '#FFC107', // Amber / Sarımsı ], [ 'label' => 'Prepaid', 'value' => 120, 'color' => '#F44336', // Kırmızı ], ]; } public static function demoDataForAdminDashboardTopCountries(): false|string { $sites = [ [ 'country' => 'United Kingdom', 'total' => 2132, ], [ 'country' => 'Germany', 'total' => 754, ], [ 'country' => 'Brazil', 'total' => 244, ], [ 'country' => 'US', 'total' => 232, ], ]; return json_encode($sites); } public static function demoDataForAdminDashboardUserTraffic(): false|string { // 'google.com', 'codecanyon.com', 'bing.com', 'yandex.com', 'openai.com' $sites = [ [ 'users' => 1232, 'domain' => 'google.com', ], [ 'users' => 3423, 'domain' => 'codecanyon.com', ], [ 'users' => 423, 'domain' => 'bing.com', ], [ 'users' => 2323, 'domain' => 'yandex.com', ], [ 'users' => 350, 'domain' => 'openai.com', ], ]; return json_encode($sites); } public static function checkImageDailyLimit($lockKey = 'default_lock_key'): JsonResponse { $settings_two = SettingTwo::getCache(); if ($settings_two->daily_limit_enabled) { if (self::appIsDemo()) { $msg = __('You have reached the maximum number of image generation allowed on the demo.'); } else { $msg = __('You have reached the maximum number of image generation allowed.'); } if (! Cache::lock($lockKey, 10)->get()) { // Attempt to acquire lock return response()->json(['message' => 'Image generation in progress. Please try again later.'], 409); } $clientIp = self::getRequestIp(); $rateLimiter = new RateLimiter('ai_image_generator_rate_limit', 3); if (! $rateLimiter->attempt($clientIp)) { return response()->json([ 'status' => 'error', 'message' => $msg, ], 429); } } return response()->json([], 200); } public static function checkDemoSecondDailyLimit($incomingSeconds = 0, $lockKey = 'default_second_lock_key'): JsonResponse { if (! self::appIsDemo()) { return response()->json([], 200); } $msg = __('You have reached the maximum allowed AI generation time for today (30 seconds). Please try again tomorrow.'); // Prevent concurrent requests from interfering if (! Cache::lock($lockKey, 10)->get()) { return response()->json(['message' => 'Request in progress. Please try again later.'], 409); } $clientIp = self::getRequestIp(); $cacheKey = "demo_ai_usage_seconds_{$clientIp}"; $maxSecondsPerDay = 30; // Get how many seconds this IP has used today $usedSeconds = Cache::get($cacheKey, 0); // If adding the new request would exceed limit if (($usedSeconds + $incomingSeconds) > $maxSecondsPerDay) { Cache::lock($lockKey)->release(); return response()->json([ 'status' => 'error', 'message' => $msg, ], 429); } // Release the lock (no update yet — we only update after successful generation) Cache::lock($lockKey)->release(); return response()->json([ 'status' => 'ok', 'remaining_seconds' => $maxSecondsPerDay - $usedSeconds, ], 200); } public static function checkRemainingImages($usr = null) { $user = $usr ?? auth()->user(); if ($user->getAttribute('team')) { $teamManager = $user->teamManager; if ($teamManager) { if ($teamManager->remaining_images <= 0 and $teamManager->remaining_images != -1) { $data = [ 'errors' => [__('You have no credits left. Please consider upgrading your plan.')], ]; return response()->json($data, 429); } } $member = $user->teamMember; if ($member) { if (! $member->allow_unlimited_credits) { if ($member->remaining_images <= 0 and $member->remaining_images != -1) { $data = [ 'errors' => [__('You have no credits left. Please consider upgrading your plan.')], ]; return response()->json($data, 429); } } } } else { if ($user->remaining_images <= 0 and $user->remaining_images != -1) { $data = [ 'errors' => [__('You have no credits left. Please consider upgrading your plan.')], ]; return response()->json($data, 429); } } return response()->json([], 200); } public static function sorting(array $data, $column, $direction): array|Collection { if ($column) { $data = collect($data)->sortBy($column, SORT_REGULAR, $direction == 'asc'); } return $data; } public static function parseUrl(string ...$urls): string { return collect($urls)->map(fn ($url) => trim($url, '/'))->implode('/'); } public static function findCurrencyFromId(null|int|string $id) { return Currency::cacheFromSetting((string) $id); } public static function defaultCurrency($column = 'code') { $currency = Currency::query()->where('id', Helper::setting('default_currency'))->first(); if (is_null($column)) { return $currency; } return $currency->$column; } public static function generateNumberForDemo($default = '---') { return self::appIsDemo() ? random_int(1, 100) : $default; } public static function getRequestCountryCode(): ?string { $request = request(); if ($request->hasHeader('cf-ipcountry')) { return $request->headers->get('cf-ipcountry'); } return null; } public static function getRequestIp(): string { $request = request(); return $request->header('CF-Connecting-IP') ?? $request->header('X-Forwarded-For') ?? $request->header('X-Real-IP') ?? $request->ip(); } public static function clearEmptyConversations(): void { $chats = Auth::user()?->openaiChat()->where('is_empty', true)->get(); foreach ($chats ?? [] as $chat) { $chat?->messages()?->delete(); $chat?->delete(); } } } PKvGW]ÍõÐLocalization.phpnu„[µü¤put('app_locale', $value); session()->save(); } public static function getCurrentLocaleDirection() { if (! empty(self::getSupportedLocales()[self::getLocale()]['dir'])) { return self::getSupportedLocales()[self::getLocale()]['dir']; } switch (self::getCurrentLocaleScript()) { // Other (historic) RTL scripts exist, but this list contains the only ones in current use. case 'Arab': case 'Hebr': case 'Mong': case 'Tfng': case 'Thaa': return 'rtl'; default: return 'ltr'; } } public static function getCurrentLocaleScript() { return self::getSupportedLocales()[self::getLocale()]['script']; } public static function getLocale(): ?string { return session('app_locale') ?: app()->getLocale(); } } PKvGW]âÔÍèVV ApiHelper.phpnu„[µü¤getLoadedProviders(); return array_key_exists($providers[$slug], $loadedProviders); } return false; } public static function getDbVersion(string $slug): ?string { return Extension::query()->where('slug', $slug)->value('version'); } } PKvGW]ðAåò  EntityRemover.phpnu„[µü¤delete(); } /** * @throws JsonException */ private static function removeFromTable(iterable $records, string $attribute, string $entitySlug): void { $savedKey = null; foreach ($records as $record) { $data = $record->getAttributes()[$attribute] ?? null; $data = json_decode($data, true); if (! is_array($data)) { continue; } if ($savedKey === null) { foreach ($data as $key => $value) { if (isset($value[$entitySlug])) { $savedKey = $key; break; } } if ($savedKey !== null && isset($data[$savedKey][$entitySlug])) { unset($data[$savedKey][$entitySlug]); $record->forceFill([$attribute => $data])->save(); } } elseif (isset($data[$savedKey][$entitySlug])) { unset($data[$savedKey][$entitySlug]); $record->forceFill([$attribute => $data])->save(); } } } private static function removeFromSettings(string $entitySlug): void { $freeCreditsUponRegistration = setting('freeCreditsUponRegistration'); $savedKey = null; if (! is_array($freeCreditsUponRegistration)) { return; } foreach ($freeCreditsUponRegistration as $key => $value) { if (isset($value[$entitySlug])) { $savedKey = $key; break; } } if ($savedKey !== null) { unset($freeCreditsUponRegistration[$savedKey][$entitySlug]); setting(['freeCreditsUponRegistration' => $freeCreditsUponRegistration])->save(); } } private static function removeFromAppSettings(string $entitySlug): void { $settings = setting()->all(); foreach ($settings as $key => $value) { if ($value === $entitySlug && str_contains($key, '_default_')) { setting([$key => null])->save(); } } } } PKvGW]÷�\KYYMenuHelper.phpnu„[µü¤generators = OpenAIGenerator::query() ->whereIn('slug', $this->routesDoesNotHaveAnySlug) ->where('active', 1) ->get(); $this->freeOpenAiItems = Helper::setting('free_open_ai_items'); $this->user = Auth::user(); if ($this->user?->getAttribute('team_manager_id')) { $this->user = $this->user?->getAttribute('teamManager'); } $this->userPlan = $this->user->relationPlan; } public function checker(array $menu) { $slug = $menu['key']; $data = $this->routesDoesNotHaveAnySlug + $this->slugsNotInOpenAiGenerator + $this->freeOpenAiItems; if (Auth::user()->isAdmin()) { return true; } $plan = $this?->userPlan; $menuIsAdmin = data_get($menu, 'is_admin', false); if (! $plan && $menuIsAdmin === false && $menu['type'] === 'item' && $menu['key'] !== 'dashboard') { return false; } if (! in_array($slug, $data)) { return true; } $openAi = $this->generators ->where('slug', $slug) ->first(); if (! $plan) { // if no plan then its free user, can access all templates and features with credits they have except the premium if (in_array($slug, $this->freeOpenAiItems, true)) { return true; } return $openAi?->getAttribute('premium') !== 1; } if ($openAi || in_array($slug, $this->slugsNotInOpenAiGenerator, true)) { $setting = $this->settingSlug($slug); if ($setting['status']) { $setting = Helper::setting($setting['setting']); // abort if the feature is disabled, we don't need to return a message if ($setting === 0) { return false; } } if ($plan->checkOpenAiItem($slug)) { return true; } } } public function settingSlug($slug): array { $data = [ 'ai_article_wizard_generator' => 'feature_ai_article_wizard', 'ai_writer' => 'feature_ai_writer', 'ai_rewriter' => 'feature_ai_rewriter', 'ai_chat_image' => 'feature_ai_chat_image', 'ai_image_generator' => 'feature_ai_image', 'ai_code_generator' => 'feature_ai_code', 'ai_speech_to_text' => 'feature_ai_speech_to_text', 'ai_voiceover' => 'feature_ai_voiceover', 'ai_vision' => 'feature_ai_vision', 'ai_pdf' => 'feature_ai_pdf', 'ai_youtube' => 'feature_ai_youtube', 'ai_rss' => 'feature_ai_youtube', ]; if (array_key_exists($slug, $data)) { return [ 'status' => true, 'setting' => $data[$slug], ]; } return [ 'status' => false, ]; } } PKvGW]©­Æ`„„OpenAiHelper.phpnu„[µü¤PKvGW]³ñ�rîî$ÄRateLimiter/WordLimitRateLimiter.phpnu„[µü¤PKvGW]L5~‡ÛÛ"RateLimiter/RateLimiter.phpnu„[µü¤PKvGW]„ ¶:èè,*PlanHelper.phpnu„[µü¤PKvGW]î¨�hz¶z¶R0InstallationHelper.phpnu„[µü¤PKvGW]ÿ ”ªªçTableSchema.phpnu„[µü¤PKvGW]¾0}­­ûèImageHelper.phpnu„[µü¤PKvGW]£cõõçìVersionComparator.phpnu„[µü¤PKvGW]¤ì•I««!õTraits/HasApiKeys.phpnu„[µü¤PKvGW]ò‘ºòss ThemeHelper.phpnu„[µü¤PKvGW]º¹—™A™A ÃHelper.phpnu„[µü¤PKvGW]ÍõЖPLocalization.phpnu„[µü¤PKvGW]âÔÍèVV äUApiHelper.phpnu„[µü¤PKvGW]{°ÄœœwVMarketplaceHelper.phpnu„[µü¤PKvGW]ðAåò  XYEntityRemover.phpnu„[µü¤PKvGW]÷�\KYY­fMenuHelper.phpnu„[µü¤PK%Dz