-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Session, DB, Eloquent, Route追加
- Loading branch information
Showing
10 changed files
with
88 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
--- | ||
Title: Bulding an HTML Attribute String From an Array | ||
Title: HTMLの属性を配列で作成する | ||
Topics: html | ||
Code: Form::macro(), HTML::attributes(), HTML::macro() | ||
Id: 196 | ||
Position: 16 | ||
--- | ||
|
||
{problem} | ||
You have an associative array of attributes for an HTML element and want to convert it to a string. | ||
HTMLを構成する属性を配列から文字列に変換したい | ||
{/problem} | ||
|
||
{solution} | ||
Use the `HTML::attributes()` method. | ||
`HTML::attributes()`メソッドを利用します | ||
|
||
{php} | ||
echo HTML::attributes(array('id' => '123', 'class' => 'myclass')); | ||
{/php} | ||
```php | ||
echo \HTML::attributes(['id' => '123', 'class' => 'myclass']); | ||
``` | ||
|
||
The above will build a string where the keys of the array are the attribute names and the values of the array are the attribute values. The output will be. | ||
配列のキーは属性名、配列の値は属性値となります | ||
出力は次の様になります | ||
|
||
{text} | ||
```text | ||
id="123" class="myclass" | ||
{/text} | ||
``` | ||
{/solution} | ||
|
||
{discussion} | ||
This is useful in HTML or Form macros. | ||
これはHTMLまたはFormマクロに使用されるケースが多いでしょう | ||
|
||
It's useful whenever you need to build tag attributes in HTML or even XML. | ||
HTMLあるいはXMLを構築する場合に便利です。 | ||
|
||
See [[Creating Form Macros]] | ||
and [[Creating HTML Macros]]. | ||
[[Formマクロを作成する]] と | ||
[[HTMLマクロを作成する]] をご覧ください | ||
{/discussion} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
--- | ||
Title: Decoding HTML Entities to a String | ||
Title: HTMLエンティティのデコード | ||
Topics: html | ||
Code: HTML::decode(), HTML::entities() | ||
Id: 182 | ||
Position: 2 | ||
--- | ||
|
||
{problem} | ||
You have a string encoded by `HTML::entities()` and want to decode it back to the original string. | ||
`HTML::entities()`でエンコードされた文字列をデコードしたい | ||
{/problem} | ||
|
||
{solution} | ||
Use the `HTML::decode()` method. | ||
`HTML::decode()`メソッドを利用します | ||
|
||
This is the opposite of `HTML::entities()`. For example. | ||
これは`HTML::entities()`の逆です | ||
|
||
{php} | ||
$string HTML::decode('<h1>Hello</h1>'); | ||
{/php} | ||
```php | ||
$string = \HTML::decode('<h1>Hello</h1>'); | ||
``` | ||
|
||
In this example `$string` will equal "<h1>Hello</h1>"; | ||
`$string` は "<h1>Hello</h1>" となります | ||
{/solution} | ||
|
||
{discussion} | ||
This method wraps the PHP `html_entity_decode()` function. | ||
このメソッドはPHPの`html_entity_decode()`ラッパー関数です | ||
|
||
Specifically it calls `html_entity_decode($value, ENT_QUOTES, 'UTF-8')`. These options compliment the ones passed to `htmlentities()` by the `HTML::entities()` method. | ||
具体的には`html_entity_decode($value, ENT_QUOTES, 'UTF-8')`をコールしています | ||
これらのオプションは`HTML::entities()`で`htmlentities()`に指定されたものを補完しています | ||
{/discussion} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
--- | ||
Title: Obfuscating an Email Address | ||
Title: メールアドレスを難読化 | ||
Topics: html | ||
Code: HTML::email(), HTML::obfuscate() | ||
Id: 193 | ||
Position: 13 | ||
--- | ||
|
||
{problem} | ||
You want to obfuscate an e-mail address to prevent spam-bots from sniffing it. | ||
スパムボットなどに収集されるのを防ぐために電子メールアドレスを難読化したい | ||
{/problem} | ||
|
||
{solution} | ||
Use the `HTML::email()` method. | ||
`HTML::email()`メソッドを利用します | ||
|
||
This method takes one argument, the email address. | ||
このメソッドで指定するのは、メールアドレスだけです | ||
|
||
{php} | ||
$email = HTML::email('me@local.com'); | ||
{/php} | ||
```php | ||
$email = \HTML::email('me@local.com'); | ||
``` | ||
|
||
Now `$email` will display correctly in browsers, but it will randomly contain characters that make it hard to read. | ||
`$email`はブラウザでは正しく表示されますが、 | ||
読みづらい文字列が含まれる様になります | ||
|
||
{html} | ||
```html | ||
Email is <b>&#x6d;e&#x40;l&#111;ca&#x6c;.c&#x6f;m</b> | ||
{/html} | ||
``` | ||
{/solution} | ||
|
||
{discussion} | ||
This method uses the `HTML::obfuscate()` method to obfuscate the email address. | ||
このメソッドは`HTML::obfuscate()`を利用して難読化されています | ||
|
||
See [[Obfuscating a String]]. | ||
[[文字列を難読化]] をご覧ください | ||
{/discussion} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,65 @@ | ||
--- | ||
Title: Generating a HTML Link to an Email Address | ||
Title: メールアドレスのHTMLリンクを生成する | ||
Topics: html | ||
Code: HTML::mailto(), HTML::obfuscate() | ||
Id: 192 | ||
Position: 12 | ||
--- | ||
|
||
{problem} | ||
You want to add a `mailto:` link to your Blade template. | ||
Bladeテンプレートで`mailto:`リンクを追加したい | ||
|
||
You want the email address to be obfuscated so that screen scrapers won't easily be able to harvest the email address. | ||
スパムボットやスクリーンスクレイパーなどに収集されにくくする為にも、難読化をしてみましょう | ||
{/problem} | ||
|
||
{solution} | ||
Use the `HTML::mailto()` method. | ||
`HTML::mailto()`メソッドを利用します | ||
|
||
The first argument to the method is the email address. | ||
第一引数は、メールアドレスを指定します | ||
|
||
{html} | ||
{{ HTML::mailto('a@b.c') }} | ||
{/html} | ||
```html | ||
{{HTML::mailto('a@b.c')}} | ||
``` | ||
|
||
This will create the mailto link and display the email address as the link text. Notice that Laravel automatically and randomly obfuscates the address. But the address will appear correctly in browsers. | ||
mailtoのリンクを作成し、リンクテキストとして電子メールアドレスが表示されます | ||
_注意:Laravelが自動的にランダムでアドレスを難読化します_ | ||
これらはブラウザ等では正常に表示されます | ||
|
||
{html} | ||
```html | ||
<a href="ma&#105;&#x6c;&#116;o&#58;&#97;&#64; \ | ||
&#x62;.&#99;">&#97;&#64;&#x62;.&#99;</a> | ||
{/html} | ||
``` | ||
|
||
_(Note backslash above is used to continue line for smaller screens.)_ | ||
第二引数はリンクテキストの文字列です | ||
|
||
If you pass a second argument, that becomes the link text. | ||
```html | ||
{{HTML::mailto('a@b.c', 'Email Me')}} | ||
``` | ||
|
||
{html} | ||
{{ HTML::mailto('a@b.c', 'Email Me') }} | ||
{/html} | ||
下記の様な文字列が出力されます(ランダムですので実際の難読化は異なります) | ||
|
||
That will produce something similar to below (the actual obfuscation will vary). | ||
|
||
{html} | ||
```html | ||
<a href="m&#x61;i&#108;&#x74;&#x6f;&#x3a;&#x61; \ | ||
&#x40;&#98;&#46;&#x63;">Email Me</a> | ||
{/html} | ||
|
||
_(Backslash above is used to continue the line for smaller screens.)_ | ||
``` | ||
|
||
|
||
You can pass a third argument as an array of attributes to apply to the anchor tag. | ||
属性を追加する場合は、第三引数に配列を利用します | ||
|
||
{html} | ||
```html | ||
{{ HTML::mailto('a@b.c', 'Email Me', array('class' => 'btn')) }} | ||
{/html} | ||
``` | ||
|
||
Now the anchor has a class attribute. | ||
`class`が追加されます | ||
|
||
{html} | ||
```html | ||
<a href="&#109;&#97;&#105;&#108;&#x74;o&#x3a; \ | ||
&#97;&#64;b.&#x63;" class="btn">Email Me</a> | ||
{/html} | ||
``` | ||
{/solution} | ||
|
||
{discussion} | ||
This method uses the `HTML::obfuscate()` method to obfuscate the email address. | ||
このメソッドは`HTML::obfuscate()`を利用してメールアドレスを難読化しています | ||
|
||
See [[Obfuscating a String]]. | ||
[[文字列を難読化]] をご覧ください | ||
{/discussion} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,41 @@ | ||
--- | ||
Title: Obfuscating a String | ||
Title: 文字列を難読化 | ||
Topics: html | ||
Code: HTML::obfuscate() | ||
Id: 197 | ||
Position: 17 | ||
--- | ||
|
||
{problem} | ||
You want to prevent spam-bots from sniffing a string on your web page. | ||
Webページ上の文字列がスパムボットに収集されるのを防ぎたい。 | ||
{/problem} | ||
|
||
{solution} | ||
Use the `HTML::obfuscate()` method. | ||
`HTML::obfuscate()`メソッドを利用します | ||
|
||
This method randomly replaces characters in a string with HTML entities. This allows the string to appear correctly in web pages, but many screen scrapers will see the string as garbage. | ||
このメソッドは、ランダムにHTMLエンティティを文字列内の文字を置き換えます | ||
この文字列は、ブラウザ等では正しく表示されますが、 | ||
多くのスクリーンスクレーパーにはごみとして扱われます | ||
|
||
This is used most frequently for email addresses. For example. | ||
電子メールアドレスのために頻繁に利用されるでしょう | ||
たとえば... | ||
|
||
{html} | ||
```html | ||
{{-- Blade template --}} | ||
{{ HTML::obfuscate('me@gmail.com') }} | ||
{/html} | ||
{{HTML::obfuscate('me@gmail.com')}} | ||
``` | ||
|
||
The above would output something similar to below. | ||
下記のように出力されます | ||
|
||
{html} | ||
```html | ||
&#x6d;&#x65;&#x40;&#x67;&#x6d;&#97;i&#x6c;. \ | ||
&#99;&#x6f;&#x6d; | ||
{/html} | ||
``` | ||
{/solution} | ||
|
||
{discussion} | ||
This is used by both `HTML::email()` and `HTML::mailto()`. | ||
これは`HTML::email()` と `HTML::mailto()`の両方で利用しています | ||
|
||
Those methods will obfuscate emails. See [[Obfuscating an Email Address]] | ||
and [[Generating a HTML Link to an Email Address]]. | ||
これを用いて電子メールを難読化します [[メールアドレスを難読化]]、 | ||
[[メールアドレスのHTMLリンクを生成する]] をご覧ください | ||
{/discussion} |
Empty file.
Empty file.