當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Theme::find方法代碼示例

本文整理匯總了PHP中Theme::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Theme::find方法的具體用法?PHP Theme::find怎麽用?PHP Theme::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Theme的用法示例。


在下文中一共展示了Theme::find方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: url

 /**
  * Attach theme paths to a local Url. The Url must be a resource located on the asset path
  * of the current theme or it's parents.
  *
  * @param  string $url
  * @return string
  */
 public function url($url)
 {
     // return external URLs unmodified
     if (preg_match('/^((http(s?):)?\\/\\/)/i', $url)) {
         return $url;
     }
     // Is it on AWS? Dont lookup parent themes...
     if (preg_match('/^((http(s?):)?\\/\\/)/i', $this->assetPath)) {
         return $this->assetPath . '/' . ltrim($url, '/');
     }
     // Lookup asset in current's theme asset path
     $fullUrl = (empty($this->assetPath) ? '' : '/') . $this->assetPath . '/' . ltrim($url, '/');
     if (file_exists($fullPath = public_path($fullUrl))) {
         return $fullUrl;
     }
     // If not found then lookup in parent's theme asset path
     if ($this->getParent()) {
         return $this->getParent()->url($url);
     }
     // Asset not found at all. Error handling
     $action = \Config::get('themes.asset_not_found', 'LOG_ERROR');
     if ($action == 'THROW_EXCEPTION') {
         throw new themeException("Asset not found [{$url}]");
     } elseif ($action == 'LOG_ERROR') {
         \Log::warning("Asset not found [{$url}] in Theme [" . \Theme::get() . "]");
     } elseif ($action === 'ASSUME_EXISTS') {
         $assetPath = \Theme::find(\Theme::get())->assetPath;
         return (empty($assetPath) ? '' : '/') . $assetPath . '/' . ltrim($url, '/');
     }
 }
開發者ID:igaster,項目名稱:laravel-theme,代碼行數:37,代碼來源:Theme.php

示例2: postThemes

 public function postThemes()
 {
     if (!Input::has('id')) {
         return Redirect::route('setting.themes.form')->with('error', 'Required parameter(s) missing.');
     }
     try {
         $input = Input::all();
         $setting = Theme::find($input['id']);
         $setting->fill($input);
         $this->flash($setting->save());
         return Redirect::route('setting.themes.form');
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         App::abort(404);
     }
 }
開發者ID:guilhermefilippo,項目名稱:access-manager,代碼行數:15,代碼來源:SettingsController.php

示例3: current_section

/**
 * Get the information whether the current section is backend, admin or public
 * @return array
 */
function current_section()
{
    if (Schema::hasTable('themes') && Theme::all()->count() == 0) {
        // If for some reason, there are no themes in theme table, seed with the default data
        Artisan::call('db:seed', array('ThemesTableSeeder'));
    }
    if (Request::is('backend*') || Request::is('login/backend*')) {
        $link_type = 'backend';
        $link = 'backend/';
        $theme = Schema::hasTable('themes') ? Theme::find(Setting::value('backend_theme', 1))->directory : 'default';
        $layout = "backend.{$theme}._layouts._layout";
    } elseif (Request::is('admin*') || Request::is('login/admin*')) {
        $link_type = 'admin';
        $link = 'admin/';
        $theme = Schema::hasTable('themes') ? Theme::find(Setting::value('admin_theme', 1))->directory : 'default';
        $layout = "admin.{$theme}._layouts._layout";
    } else {
        $link_type = 'public';
        $link = '';
        $theme = Schema::hasTable('themes') ? Theme::find(Setting::value('public_theme', 1))->directory : 'default';
        $layout = "public.{$theme}._layouts._layout";
    }
    return array($link_type, $link, $layout, $theme);
}
開發者ID:ratno,項目名稱:Doptor,代碼行數:28,代碼來源:helpers.php

示例4: editTheme

 public function editTheme($id)
 {
     return View::make('slate::admin.themes-modal', ['theme' => Theme::find($id)]);
 }
開發者ID:vanderlin,項目名稱:Gear2,代碼行數:4,代碼來源:AdminController.php

示例5: edit

 /**
  * Show the form for editing the specified theme.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['theme'] = Theme::find($id);
     $data['category'] = Category::getAll();
     $data['powerful'] = Powerful::getAll();
     $data['theme_images'] = Theme::find($id)->themeImage;
     $data['theme_logs'] = Theme::find($id)->themeLog;
     return View::make('themes.edit', $data);
 }
開發者ID:vnzacky,項目名稱:exp_services,代碼行數:15,代碼來源:ThemesController.php

示例6: postOption

 /**
  * post All Option in base
  *
  * @return Response
  */
 public function postOption()
 {
     //Making adaptive rules for site_name
     $site_name_rules = array();
     $site_name_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'site_name_') !== false) {
             $site_name_rules[$k] = Config::get('validator.admin.option_site_name');
             $site_name_locales[] = mb_substr($k, strlen('site_name_'), strlen($k) - strpos($k, 'site_name_'));
         }
     }
     //Making adaptive rules for social_title
     $social_title_rules = array();
     $social_title_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'social_title_') !== false) {
             $social_title_rules[$k] = Config::get('validator.admin.option_social_title');
             $social_title_locales[] = mb_substr($k, strlen('social_title_'), strlen($k) - strpos($k, 'social_title_'));
         }
     }
     //Making adaptive rules for social_description
     $social_description_rules = array();
     $social_description_locales = array();
     foreach (Input::all() as $k => $v) {
         if (strpos($k, 'social_description_') !== false) {
             $social_description_rules[$k] = Config::get('validator.admin.option_social_description');
             $social_description_locales[] = mb_substr($k, strlen('social_description_'), strlen($k) - strpos($k, 'social_description_'));
         }
     }
     $rules = array_merge($site_name_rules, $social_title_locales, $social_description_locales, Config::get('validator.admin.option'));
     // Validate the inputs
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         //Themes
         $activeThemePublic = Theme::where('type', 'public')->where('active', 1)->first();
         $activeThemeAdmin = Theme::where('type', 'admin')->where('active', 1)->first();
         //Change or not?
         if ($activeThemePublic->id != Input::get('theme_public')) {
             $activeThemePublic->active = false;
             $activeThemePublic->save();
             $newThemePublic = Theme::find(Input::get('theme_public'));
             $newThemePublic->active = true;
             $newThemePublic->save();
         }
         if ($activeThemeAdmin->id != Input::get('theme_admin')) {
             $activeThemeAdmin->active = false;
             $activeThemeAdmin->save();
             $newThemeAdmin = Theme::find(Input::get('theme_public'));
             $newThemeAdmin->active = true;
             $newThemeAdmin->save();
         }
         //Delete Cache
         Cache::forget('DB_ThemeByType');
         //Options
         $options = Option::all();
         foreach ($options as $option) {
             if ($option->key == "site_url") {
                 $option->value = Input::get('site_url');
             }
             if ($option->key == "cover_path") {
                 $option->value = Input::get('cover_path');
             }
             if ($option->key == "admin_email") {
                 $option->value = Input::get('admin_email');
             }
             if ($option->key == "analytics") {
                 $option->value = Input::get('analytics');
             }
             if ($option->key == "i18n_site_name") {
                 //Update translations
                 foreach ($site_name_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('site_name_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_site_name_update_error'));
                     }
                 }
             }
             if ($option->key == "i18n_social_title") {
                 //Update translations
                 foreach ($social_title_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('social_title_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_social_title_update_error'));
                     }
                 }
             }
             if ($option->key == "i18n_social_description") {
                 //Update translations
                 foreach ($social_description_locales as $locale) {
                     if (!I18n::find($option->value)->updateText($locale, Input::get('social_description_' . $locale))) {
                         return Redirect::to('admin/option')->with('error', Lang::get('admin.option_social_description_update_error'));
                     }
                 }
             }
             $option->save();
         }
//.........這裏部分代碼省略.........
開發者ID:Metrakit,項目名稱:dynamix,代碼行數:101,代碼來源:AdminController.php

示例7: current_theme

/**
 * Get the current theme
 * @param  string $target
 * @return string
 */
function current_theme($target = 'public')
{
    return Schema::hasTable('themes') ? Theme::find(Setting::value("{$target}_theme", 1))->directory : 'default';
}
開發者ID:doptor,項目名稱:doptor,代碼行數:9,代碼來源:helpers.php


注:本文中的Theme::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。