aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Controller/DeveloperController.php38
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ClientType.php44
-rw-r--r--src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css131
-rw-r--r--src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js9
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig21
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig25
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig32
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig12
8 files changed, 267 insertions, 45 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php
index edbcec4b..3b9da318 100644
--- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php
+++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php
@@ -5,17 +5,17 @@ namespace Wallabag\CoreBundle\Controller;
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Component\HttpFoundation\Request; 6use Symfony\Component\HttpFoundation\Request;
7use Symfony\Bundle\FrameworkBundle\Controller\Controller; 7use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8use Wallabag\ApiBundle\Entity\Client;
9use Wallabag\CoreBundle\Form\Type\ClientType;
8 10
9class DeveloperController extends Controller 11class DeveloperController extends Controller
10{ 12{
11 /** 13 /**
12 * @param Request $request
13 *
14 * @Route("/developer", name="developer") 14 * @Route("/developer", name="developer")
15 * 15 *
16 * @return \Symfony\Component\HttpFoundation\Response 16 * @return \Symfony\Component\HttpFoundation\Response
17 */ 17 */
18 public function indexAction(Request $request) 18 public function indexAction()
19 { 19 {
20 return $this->render('WallabagCoreBundle:Developer:index.html.twig'); 20 return $this->render('WallabagCoreBundle:Developer:index.html.twig');
21 } 21 }
@@ -29,26 +29,38 @@ class DeveloperController extends Controller
29 */ 29 */
30 public function createClientAction(Request $request) 30 public function createClientAction(Request $request)
31 { 31 {
32 $clientManager = $this->container->get('fos_oauth_server.client_manager.default'); 32 $em = $this->getDoctrine()->getManager();
33 $client = $clientManager->createClient(); 33 $client = new Client();
34 $client->setRedirectUris(array('http://www.example.com')); 34 $clientForm = $this->createForm(ClientType::class, $client);
35 $client->setAllowedGrantTypes(array('token', 'authorization_code')); 35 $clientForm->handleRequest($request);
36 $clientManager->updateClient($client); 36
37 if ($clientForm->isValid()) {
38 $client->setAllowedGrantTypes(array('token', 'authorization_code'));
39 $em->persist($client);
40 $em->flush();
41
42 $this->get('session')->getFlashBag()->add(
43 'notice',
44 'New client created.'
45 );
46
47 return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array(
48 'client_id' => $client->getPublicId(),
49 'client_secret' => $client->getSecret(),
50 ));
51 }
37 52
38 return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( 53 return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
39 'client_id' => $client->getPublicId(), 54 'form' => $clientForm->createView(),
40 'client_secret' => $client->getSecret(),
41 )); 55 ));
42 } 56 }
43 57
44 /** 58 /**
45 * @param Request $request
46 *
47 * @Route("/developer/howto/first-app", name="howto-firstapp") 59 * @Route("/developer/howto/first-app", name="howto-firstapp")
48 * 60 *
49 * @return \Symfony\Component\HttpFoundation\Response 61 * @return \Symfony\Component\HttpFoundation\Response
50 */ 62 */
51 public function howtoFirstAppAction(Request $request) 63 public function howtoFirstAppAction()
52 { 64 {
53 return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig'); 65 return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig');
54 } 66 }
diff --git a/src/Wallabag/CoreBundle/Form/Type/ClientType.php b/src/Wallabag/CoreBundle/Form/Type/ClientType.php
new file mode 100644
index 00000000..79feae65
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Form/Type/ClientType.php
@@ -0,0 +1,44 @@
1<?php
2
3namespace Wallabag\CoreBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\CallbackTransformer;
7use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8use Symfony\Component\Form\Extension\Core\Type\UrlType;
9use Symfony\Component\Form\FormBuilderInterface;
10use Symfony\Component\OptionsResolver\OptionsResolver;
11
12class ClientType extends AbstractType
13{
14 public function buildForm(FormBuilderInterface $builder, array $options)
15 {
16 $builder
17 ->add('redirect_uris', UrlType::class, array('required' => true))
18 ->add('save', SubmitType::class)
19 ;
20
21 $builder->get('redirect_uris')
22 ->addModelTransformer(new CallbackTransformer(
23 function ($originalUri) {
24 return $originalUri;
25 },
26 function ($submittedUri) {
27 return array($submittedUri);
28 }
29 ))
30 ;
31 }
32
33 public function configureOptions(OptionsResolver $resolver)
34 {
35 $resolver->setDefaults(array(
36 'data_class' => 'Wallabag\ApiBundle\Entity\Client',
37 ));
38 }
39
40 public function getBlockPrefix()
41 {
42 return 'client';
43 }
44}
diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css b/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css
new file mode 100644
index 00000000..65075559
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/public/themes/_global/css/prism.css
@@ -0,0 +1,131 @@
1/* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+bash+php+yaml */
2/**
3 * prism.js Dark theme for JavaScript, CSS and HTML
4 * Based on the slides of the talk “/Reg(exp){2}lained/”
5 * @author Lea Verou
6 */
7
8code[class*="language-"],
9pre[class*="language-"] {
10 color: white;
11 background: none;
12 text-shadow: 0 -.1em .2em black;
13 font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
14 direction: ltr;
15 text-align: left;
16 white-space: pre;
17 word-spacing: normal;
18 word-break: normal;
19 word-wrap: normal;
20 line-height: 1.5;
21
22 -moz-tab-size: 4;
23 -o-tab-size: 4;
24 tab-size: 4;
25
26 -webkit-hyphens: none;
27 -moz-hyphens: none;
28 -ms-hyphens: none;
29 hyphens: none;
30}
31
32@media print {
33 code[class*="language-"],
34 pre[class*="language-"] {
35 text-shadow: none;
36 }
37}
38
39pre[class*="language-"],
40:not(pre) > code[class*="language-"] {
41 background: hsl(30, 20%, 25%);
42}
43
44/* Code blocks */
45pre[class*="language-"] {
46 padding: 1em;
47 margin: .5em 0;
48 overflow: auto;
49 border: .3em solid hsl(30, 20%, 40%);
50 border-radius: .5em;
51 box-shadow: 1px 1px .5em black inset;
52}
53
54/* Inline code */
55:not(pre) > code[class*="language-"] {
56 padding: .15em .2em .05em;
57 border-radius: .3em;
58 border: .13em solid hsl(30, 20%, 40%);
59 box-shadow: 1px 1px .3em -.1em black inset;
60 white-space: normal;
61}
62
63.token.comment,
64.token.prolog,
65.token.doctype,
66.token.cdata {
67 color: hsl(30, 20%, 50%);
68}
69
70.token.punctuation {
71 opacity: .7;
72}
73
74.namespace {
75 opacity: .7;
76}
77
78.token.property,
79.token.tag,
80.token.boolean,
81.token.number,
82.token.constant,
83.token.symbol {
84 color: hsl(350, 40%, 70%);
85}
86
87.token.selector,
88.token.attr-name,
89.token.string,
90.token.char,
91.token.builtin,
92.token.inserted {
93 color: hsl(75, 70%, 60%);
94}
95
96.token.operator,
97.token.entity,
98.token.url,
99.language-css .token.string,
100.style .token.string,
101.token.variable {
102 color: hsl(40, 90%, 60%);
103}
104
105.token.atrule,
106.token.attr-value,
107.token.keyword {
108 color: hsl(350, 40%, 70%);
109}
110
111.token.regex,
112.token.important {
113 color: #e90;
114}
115
116.token.important,
117.token.bold {
118 font-weight: bold;
119}
120.token.italic {
121 font-style: italic;
122}
123
124.token.entity {
125 cursor: help;
126}
127
128.token.deleted {
129 color: red;
130}
131
diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js b/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js
new file mode 100644
index 00000000..0235e52d
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/public/themes/_global/js/prism.js
@@ -0,0 +1,9 @@
1/* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+bash+php+yaml */
2var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=n.util.type(e);switch(t){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=n.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return n.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){r=r||n.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==t)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return n.languages.DFS(n.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,t,a,r){r=r||{};for(var l in e)e.hasOwnProperty(l)&&(t.call(e,l,e[l],a||l),"Object"!==n.util.type(e[l])||r[n.util.objId(e[l])]?"Array"!==n.util.type(e[l])||r[n.util.objId(e[l])]||(r[n.util.objId(e[l])]=!0,n.languages.DFS(e[l],t,l,r)):(r[n.util.objId(e[l])]=!0,n.languages.DFS(e[l],t,null,r)))}},plugins:{},highlightAll:function(e,t){var a={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",a);for(var r,l=a.elements||document.querySelectorAll(a.selector),i=0;r=l[i++];)n.highlightElement(r,e===!0,a.callback)},highlightElement:function(t,a,r){for(var l,i,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1],i=n.languages[l]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=t.textContent,u={element:t,language:l,grammar:i,code:s};if(!s||!i)return n.hooks.run("complete",u),void 0;if(n.hooks.run("before-highlight",u),a&&_self.Worker){var c=new Worker(n.filename);c.onmessage=function(e){u.highlightedCode=e.data,n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=n.highlight(u.code,u.grammar,u.language),n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(t),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},highlight:function(e,t,r){var l=n.tokenize(e,t);return a.stringify(n.util.encode(l),r)},tokenize:function(e,t){var a=n.Token,r=[e],l=t.rest;if(l){for(var i in l)t[i]=l[i];delete t.rest}e:for(var i in t)if(t.hasOwnProperty(i)&&t[i]){var o=t[i];o="Array"===n.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],c=u.inside,g=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){g&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,b=y+v,k=d.slice(0,y+1),w=d.slice(b+1),_=[p,1];k&&_.push(k);var P=new a(i,c?n.tokenize(m,c):m,h);_.push(P),w&&_.push(w),Array.prototype.splice.apply(r,_)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",n.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
3Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
4Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
5Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
6Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
7!function(e){var t={variable:[{pattern:/\$?\(\([\w\W]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\w\W]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,lookbehind:!0,inside:t},{pattern:/(["'])(?:\\\\|\\?[^\\])*?\1/g,inside:t}],variable:t.variable,"function":{pattern:/(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,lookbehind:!0},keyword:{pattern:/(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,lookbehind:!0},"boolean":{pattern:/(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var a=t.variable[1].inside;a["function"]=e.languages.bash["function"],a.keyword=e.languages.bash.keyword,a.boolean=e.languages.bash.boolean,a.operator=e.languages.bash.operator,a.punctuation=e.languages.bash.punctuation}(Prism);
8Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),Prism.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),Prism.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(e){"php"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(a){return e.tokenStack.push(a),"{{{PHP"+e.tokenStack.length+"}}}"}))}),Prism.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),Prism.hooks.add("after-highlight",function(e){if("php"===e.language){for(var a,n=0;a=e.tokenStack[n];n++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(n+1)+"}}}",Prism.highlight(a,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),Prism.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'<span class="token php">$1</span>'))}),Prism.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:Prism.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/}));
9Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*[:\-,[{\r\n?][ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./};
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig
index 08d1cb15..061f4631 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig
@@ -8,13 +8,20 @@
8 <div class="card-panel settings"> 8 <div class="card-panel settings">
9 9
10 <div class="row"> 10 <div class="row">
11 <h3>My client parameters</h3> 11 <p>{% trans %}You will create a new client. Please fill the field below for the redirect URI of your application:{% endtrans %}</p>
12 <p>Here are your client parameters.</p> 12 {{ form_start(form) }}
13 <ul> 13 {{ form_errors(form) }}
14 <li>Client ID: {{ client_id }}</li> 14 <div class="input-field col s12">
15 <li>Client secret: {{ client_secret }}</li> 15 {{ form_label(form.redirect_uris) }}
16 </ul> 16 {{ form_errors(form.redirect_uris) }}
17 <a class="waves-effect waves-light btn" href="{{ path('developer') }}">Back to Developer main page</a> 17 {{ form_widget(form.redirect_uris) }}
18 </div>
19 <div class="hidden">{{ form_rest(form) }}</div>
20
21 <a href="{{ path('developer') }}" class="waves-effect waves-light grey btn">{% trans %}Back{% endtrans %}</a>
22 <button class="btn waves-effect waves-light" type="submit" name="action">
23 {% trans %}Create new client{% endtrans %}
24 </button>
18 </div> 25 </div>
19 26
20 </div> 27 </div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig
new file mode 100644
index 00000000..8e3966b9
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client_parameters.html.twig
@@ -0,0 +1,25 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}Client parameters{% endtrans %}{% endblock %}
4
5{% block content %}
6<div class="row">
7 <div class="col s12">
8 <div class="card-panel settings">
9 <div class="row">
10 <p>{% trans %}Here are your client parameters.{% endtrans %}</p>
11 <p><strong>{% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}</strong></p>
12 <ul>
13 <li>{% trans %}Client ID:{% endtrans %} <strong><pre>{{ client_id }}</pre></strong></li>
14 <li>{% trans %}Client secret:{% endtrans %} <strong><pre>{{ client_secret }}</pre></strong></li>
15 </ul>
16
17 <a href="{{ path('developer') }}" class="waves-effect waves-light grey btn">{% trans %}Back{% endtrans %}</a>
18 <a href="{{ path('howto-firstapp') }}" class="btn waves-effect waves-light">{% trans %}Read the howto "Create my first application"{% endtrans %}</a>
19 </div>
20 </div>
21
22 </div>
23 </div>
24</div>
25{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig
index 2db15b16..497bb308 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig
@@ -2,6 +2,11 @@
2 2
3{% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %} 3{% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %}
4 4
5{% block css %}
6 {{ parent() }}
7 <link rel="stylesheet" href="{{ asset('bundles/wallabagcore/themes/_global/css/prism.css') }}">
8{% endblock %}
9
5{% block content %} 10{% block content %}
6<div class="row"> 11<div class="row">
7 <div class="col s12"> 12 <div class="col s12">
@@ -13,22 +18,16 @@
13 <p>To create this token, you need <a href="{{ path('create_client') }}">to create a new client</a>.</p> 18 <p>To create this token, you need <a href="{{ path('create_client') }}">to create a new client</a>.</p>
14 <p>Now, create your token (replace client_id, client_secret, username and password with the good values):</p> 19 <p>Now, create your token (replace client_id, client_secret, username and password with the good values):</p>
15 <p> 20 <p>
16 <code> 21 <pre><code class="language-bash">http POST http://v2.wallabag.org/oauth/v2/token \
17 <pre>
18http POST http://v2.wallabag.org/oauth/v2/token \
19 grant_type=password \ 22 grant_type=password \
20 client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \ 23 client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \
21 client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \ 24 client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \
22 username=yourUsername \ 25 username=yourUsername \
23 password=yourPassw0rd 26 password=yourPassw0rd</code></pre>
24 </pre>
25 </code>
26 </p> 27 </p>
27 <p>The API will return a response like this:</p> 28 <p>The API will return a response like this:</p>
28 <p> 29 <p>
29 <code> 30 <pre><code class="language-bash">HTTP/1.1 200 OK
30 <pre>
31HTTP/1.1 200 OK
32Cache-Control: no-store, private 31Cache-Control: no-store, private
33Connection: close 32Connection: close
34Content-Type: application/json 33Content-Type: application/json
@@ -44,25 +43,20 @@ X-Powered-By: PHP/5.5.9-1ubuntu4.13
44 "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg", 43 "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg",
45 "scope": null, 44 "scope": null,
46 "token_type": "bearer" 45 "token_type": "bearer"
47} 46}</code></pre>
48 </pre>
49 </code>
50 </p> 47 </p>
51 <p>The access_token is useful to do a call to the API endpoint. For example:</p> 48 <p>The access_token is useful to do a call to the API endpoint. For example:</p>
52 <p> 49 <p>
53 <code> 50 <pre><code class="language-bash">http GET http://v2.wallabag.org/api/entries.json \
54 <pre> 51 "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"</code></pre>
55http GET http://v2.wallabag.org/api/entries.json \
56 "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw"
57 </pre>
58 </code>
59 </p> 52 </p>
60 <p>This call will return all the entries for your user.</p> 53 <p>This call will return all the entries for your user.</p>
61 <p>If you want to see all the API endpoints, you can have a look <a href="{{ path('nelmio_api_doc_index') }}">to our API documentation</a>.</p> 54 <p>If you want to see all the API endpoints, you can have a look <a href="{{ path('nelmio_api_doc_index') }}">to our API documentation</a>.</p>
62 <p><a class="waves-effect waves-light btn" href="{{ path('developer') }}">Back to Developer main page</a></p> 55 <p><a href="{{ path('developer') }}" class="waves-effect waves-light grey btn">{% trans %}Back{% endtrans %}</a></p>
63 </div> 56 </div>
64 57
65 </div> 58 </div>
66 </div> 59 </div>
67</div> 60</div>
61 <script src="{{ asset('bundles/wallabagcore/themes/_global/js/prism.js') }}"></script>
68{% endblock %} 62{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
index 3507b654..b983883f 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
@@ -8,18 +8,18 @@
8 <div class="card-panel settings"> 8 <div class="card-panel settings">
9 9
10 <div class="row"> 10 <div class="row">
11 <h3>Welcome to the wallabag API</h3> 11 <h3>{% trans %}Welcome to the wallabag API{% endtrans %}</h3>
12 12
13 <h4>Documentation</h4> 13 <h4>{% trans %}Documentation{% endtrans %}</h4>
14 14
15 <ul> 15 <ul>
16 <li><a href="{{ path('howto-firstapp') }}">How to create my first application</a></li> 16 <li><a href="{{ path('howto-firstapp') }}">{% trans %}How to create my first application{% endtrans %}</a></li>
17 <li><a href="{{ path('nelmio_api_doc_index') }}">View full API documentation</a></li> 17 <li><a href="{{ path('nelmio_api_doc_index') }}">{% trans %}View full API documentation{% endtrans %}</a></li>
18 </ul> 18 </ul>
19 19
20 <h4>My clients</h4> 20 <h4>{% trans %}Clients{% endtrans %}</h4>
21 <ul> 21 <ul>
22 <li><a href="{{ path('create_client') }}">Create a new client</a></li> 22 <li><a href="{{ path('create_client') }}">{% trans %}Create a new client{% endtrans %}</a></li>
23 </ul> 23 </ul>
24 24
25 </div> 25 </div>