schpnc

PHPStorm LiveTemplates

Oct 1st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 8.11 KB | None | 0 0
  1. шаблоны лежат в %HOMEPATH%\.<product><version>\config\templates
  2.  
  3. ## PHP
  4. <template name="bx_doc_component" value="/**&#10; * @var array $arParams&#10; * @var array $arResult&#10; * @global CMain $APPLICATION&#10; * @global CUser $USER&#10; * @global CDatabase $DB&#10; * @var CBitrixComponent $this&#10; * @var string $componentPath&#10; * @var string $componentName&#10; * @var string $componentTemplate&#10; * @var string $parentComponentPath&#10; * @var string $parentComponentName&#10; * @var string $parentComponentTemplate&#10; * @var CBitrixComponent $component&#10; */&#10;" description="bitrix component.php phpdoc" toReformat="false" toShortenFQNames="true">
  5.   <context>
  6.     <option name="PHP Statement" value="true" />
  7.   </context>
  8. </template>
  9.  
  10. <template name="bx_doc_component_epilog" value="/**&#10; * @var array $arParams&#10; * @var array $arResult&#10; * @global CMain $APPLICATION&#10; * @global CUser $USER&#10; * @global CDatabase $DB&#10; * @var CBitrixComponent $this&#10; * @var string $componentPath&#10; * @var string $templateName&#10; * @var string $templateFile&#10; * @var string $templateFolder&#10; * @var string $templateData&#10; * @var CBitrixComponent $component&#10; */&#10;" description="bitrix component_epilog.php phpdoc" toReformat="false" toShortenFQNames="true">
  11.   <context>
  12.     <option name="PHP Statement" value="true" />
  13.   </context>
  14. </template>
  15.  
  16. <template name="bx_doc_result_modifier" value="/**&#10; * @var array $arParams&#10; * @var array $arResult&#10; * @global CMain $APPLICATION&#10; * @global CUser $USER&#10; * @global CDatabase $DB&#10; * @var CBitrixComponentTemplate $this&#10; */&#10;" description="bitrix result_modifier.php phpdoc" toReformat="false" toShortenFQNames="true">
  17.   <context>
  18.     <option name="PHP Statement" value="true" />
  19.   </context>
  20. </template>
  21.  
  22. <template name="bx_doc_template" value="/**&#10; * @var array $arParams&#10; * @var array $arResult&#10; * @global CMain $APPLICATION&#10; * @global CUser $USER&#10; * @global CDatabase $DB&#10; * @var CBitrixComponentTemplate $this&#10; * @var string $componentPath&#10; * @var string $templateName&#10; * @var string $templateFile&#10; * @var string $templateFolder&#10; * @var string $templateData&#10; */&#10;" description="bitrix template.php phpdoc" toReformat="false" toShortenFQNames="true">
  23.   <context>
  24.     <option name="PHP Statement" value="true" />
  25.   </context>
  26. </template>
  27.  
  28. <template name="bx_prolog_ifdef" value="if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();" description="insert bitrix ifdef prolog" toReformat="false" toShortenFQNames="true">
  29.   <context>
  30.     <option name="PHP Statement" value="true" />
  31.   </context>
  32. </template>
  33.  
  34. <template name="pre" value="echo'&lt;pre class=&quot;php_pre&quot; style=&quot;display:block;&quot;&gt;',print_r($END$, true),'&lt;/pre&gt;';//TODO:delete" description="php pre to html" toReformat="false" toShortenFQNames="true">
  35.   <context>
  36.     <option name="PHP Statement" value="true" />
  37.   </context>
  38. </template>
  39.  
  40. <template name="fpre" value="file_put_contents($_SERVER['DOCUMENT_ROOT'].'/$FILE$.txt', date(&quot;d.m.Y H:i:s\n&quot;).print_r($END$, true).&quot;\n&quot;.str_repeat('-', 20).&quot;\n&quot;, FILE_APPEND | LOCK_EX);//TODO:delete" description="pre to file" toReformat="false" toShortenFQNames="true">
  41.   <variable name="FILE" expression="" defaultValue="" alwaysStopAt="true" />
  42.   <context>
  43.     <option name="PHP Statement" value="true" />
  44.   </context>
  45. </template>
  46.  
  47.  
  48. ## HTML
  49. <template name="ec" value="&lt;?= $END$ ?&gt;" description="short echo" toReformat="false" toShortenFQNames="true">
  50.   <context>
  51.     <option name="HTML" value="true" />
  52.   </context>
  53. </template>
  54.  
  55. <template name="fore" value="&lt;? foreach ($ARRAY$ as $ITEM$): ?&gt;&#10;    $END$&#10;&lt;? endforeach; ?&gt;" description="surround with &lt;?foreach?&gt;&lt;?endforeach?&gt;" toReformat="true" toShortenFQNames="true">
  56.   <variable name="ARRAY" expression="" defaultValue="" alwaysStopAt="true" />
  57.   <variable name="ITEM" expression="" defaultValue="" alwaysStopAt="true" />
  58.   <context>
  59.     <option name="HTML_TEXT" value="true" />
  60.   </context>
  61. </template>
  62.  
  63. <template name="forek" value="&lt;? foreach ($ARRAY$ as $KEY$ =&gt; $VALUE$): ?&gt;&#10;    $END$&#10;&lt;? endforeach; ?&gt;" description="surround with &lt;?foreach?&gt;&lt;?endforeach?&gt; with k=&gt;v" toReformat="true" toShortenFQNames="true">
  64.   <variable name="ARRAY" expression="" defaultValue="" alwaysStopAt="true" />
  65.   <variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
  66.   <variable name="VALUE" expression="" defaultValue="" alwaysStopAt="true" />
  67.   <context>
  68.     <option name="HTML_TEXT" value="true" />
  69.   </context>
  70. </template>
  71.  
  72. <template name="if" value="&lt;? if ($CONDITION$): ?&gt;&#10;    $YES$&#10;&lt;? else: ?&gt;&#10;    $END$&#10;&lt;? endif; ?&gt;" description="print &lt;?if?&gt;&lt;?else?&gt;&lt;?endif?&gt; block" toReformat="true" toShortenFQNames="true">
  73.   <variable name="CONDITION" expression="" defaultValue="" alwaysStopAt="true" />
  74.   <variable name="YES" expression="" defaultValue="" alwaysStopAt="true" />
  75.   <context>
  76.     <option name="HTML_TEXT" value="true" />
  77.   </context>
  78. </template>
  79.  
  80. <template name="ifi" value="&lt;?= ($CONDITION$) ? $YES$ : $END$ ?&gt;" description="inline condotional echo" toReformat="true" toShortenFQNames="true">
  81.   <variable name="CONDITION" expression="" defaultValue="" alwaysStopAt="true" />
  82.   <variable name="YES" expression="" defaultValue="" alwaysStopAt="true" />
  83.   <context>
  84.     <option name="HTML" value="true" />
  85.   </context>
  86. </template>
  87.  
  88. <template name="loc" value="&lt;?= Loc::getMessage(&quot;$END$&quot;) ?&gt;" description="bitrix Loc::getMessage" toReformat="false" toShortenFQNames="true">
  89.   <context>
  90.     <option name="HTML" value="true" />
  91.   </context>
  92. </template>
  93.  
  94. <template name="pre" value="&lt;pre class=&quot;php_pre&quot; style=&quot;display:block;&quot;&gt;&lt;?print_r($END$);?&gt;&lt;/pre&gt;&lt;!-- //TODO:delete --&gt;" description="php pre" toReformat="false" toShortenFQNames="true">
  95.   <context>
  96.     <option name="HTML" value="true" />
  97.   </context>
  98. </template>
  99.  
  100. <template name="surround_fore" value="&lt;? foreach ($ARRAY$ as $END$): ?&gt;&#10;    $SELECTION$&#10;&lt;? endforeach; ?&gt;" description="surround with &lt;?foreach?&gt;&lt;?endforeach?&gt;" toReformat="true" toShortenFQNames="true">
  101.   <variable name="ARRAY" expression="" defaultValue="" alwaysStopAt="true" />
  102.   <context>
  103.     <option name="HTML_TEXT" value="true" />
  104.   </context>
  105. </template>
  106.  
  107. <template name="surround_forek" value="&lt;? foreach ($ARRAY$ as $KEY$ =&gt; $END$): ?&gt;&#10;    $SELECTION$&#10;&lt;? endforeach; ?&gt;" description="surround with &lt;?foreach?&gt;&lt;?endforeach?&gt; with k=&gt;v" toReformat="true" toShortenFQNames="true">
  108.   <variable name="ARRAY" expression="" defaultValue="" alwaysStopAt="true" />
  109.   <variable name="KEY" expression="" defaultValue="" alwaysStopAt="true" />
  110.   <context>
  111.     <option name="HTML_TEXT" value="true" />
  112.   </context>
  113. </template>
  114.  
  115. <template name="surround_if" value="&lt;? if ($END$): ?&gt;&#10;    $SELECTION$&#10;&lt;? endif; ?&gt;" description="surround with &lt;?if?&gt;&lt;?endif?&gt;" toReformat="true" toShortenFQNames="true">
  116.   <context>
  117.     <option name="HTML_TEXT" value="true" />
  118.   </context>
  119. </template>
  120.  
  121. <template name="surround_ifi" value="&lt;?= ($END$) ? &quot;$SELECTION$&quot; : ''; ?&gt;" description="surround with optional echo in tags" toReformat="false" toShortenFQNames="true">
  122.   <context>
  123.     <option name="HTML" value="true" />
  124.     <option name="HTML_TEXT" value="false" />
  125.   </context>
  126. </template>
  127.  
  128. <template name="surround_ifl" value="&lt;? if ($END$): ?&gt;$SELECTION$&lt;? endif; ?&gt;" description="surround with &lt;?if?&gt;&lt;?endif?&gt; in tags" toReformat="false" toShortenFQNames="true">
  129.   <context>
  130.     <option name="HTML" value="true" />
  131.     <option name="HTML_TEXT" value="false" />
  132.   </context>
  133. </template>
  134.  
  135.  
  136. ## JS
  137. <template name="pre" value="console.log($END$);" description="log to console" toReformat="false" toShortenFQNames="true">
  138.   <context>
  139.     <option name="JS_STATEMENT" value="true" />
  140.   </context>
  141. </template>
Add Comment
Please, Sign In to add comment