option-functions.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485
  1. <?php
  2. trait OptionsFunction
  3. {
  4. public function settingsOptionGroup($options = [])
  5. {
  6. $settings = [];
  7. foreach ($options as $option) {
  8. $optionType = $option[0] ? $option[0] : false;
  9. $optionName = $option[1] ? $option[1] : null;
  10. $optionExtras = $option[2] ? $option[2] : [];
  11. $setting = $this->settingsOption($optionType, $optionName, $optionExtras);
  12. array_push($settings, $setting);
  13. }
  14. return $settings;
  15. }
  16. public function settingsOption($type, $name = null, $extras = null)
  17. {
  18. $type = strtolower(str_replace('-', '', $type));
  19. $setting = [
  20. 'name' => $name,
  21. 'value' => $this->config[$name] ?? ''
  22. ];
  23. switch ($type) {
  24. case 'enable':
  25. $settingMerge = [
  26. 'type' => 'switch',
  27. 'label' => 'Enable',
  28. ];
  29. break;
  30. case 'auth':
  31. $this->setGroupOptionsVariable();
  32. $settingMerge = [
  33. 'type' => 'select',
  34. 'label' => 'Minimum Authentication',
  35. 'options' => $this->groupOptions
  36. ];
  37. break;
  38. case 'refresh':
  39. $settingMerge = [
  40. 'type' => 'select',
  41. 'label' => 'Refresh Seconds',
  42. 'options' => $this->timeOptions()
  43. ];
  44. break;
  45. case 'combine':
  46. case 'combine-downloader':
  47. $settingMerge = [
  48. 'type' => 'switch',
  49. 'label' => 'Add to Combined Downloader',
  50. ];
  51. break;
  52. case 'test':
  53. $settingMerge = [
  54. 'type' => 'button',
  55. 'label' => 'Test Connection',
  56. 'icon' => 'fa fa-flask',
  57. 'class' => 'pull-right',
  58. 'text' => 'Test Connection',
  59. 'attr' => 'onclick="testAPIConnection(\'' . $name . '\')"',
  60. 'help' => 'Remember! Please save before using the test button!'
  61. ];
  62. break;
  63. case 'url':
  64. $settingMerge = [
  65. 'type' => 'input',
  66. 'label' => 'URL',
  67. 'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
  68. 'placeholder' => 'http(s)://hostname:port'
  69. ];
  70. break;
  71. case 'multipleurl':
  72. $settingMerge = [
  73. 'type' => 'select2',
  74. 'class' => 'select2-multiple',
  75. 'id' => $name . '-select-' . $this->random_ascii_string(6),
  76. 'label' => 'Multiple URL\'s',
  77. 'help' => 'Please make sure to use local IP address and port - You also may use local dns name too.',
  78. 'placeholder' => 'http(s)://hostname:port',
  79. 'options' => $this->makeOptionsFromValues($this->config[$name]),
  80. 'settings' => '{tags: true, selectOnClose: true, closeOnSelect: true, allowClear: true}',
  81. ];
  82. break;
  83. case 'multiple':
  84. $settingMerge = [
  85. 'type' => 'select2',
  86. 'class' => 'select2-multiple',
  87. 'id' => $name . '-select-' . $this->random_ascii_string(6),
  88. 'label' => 'Multiple Values\'s',
  89. 'options' => $this->makeOptionsFromValues($this->config[$name]),
  90. 'settings' => '{tags: true, selectOnClose: true, closeOnSelect: true, allowClear: true}',
  91. ];
  92. break;
  93. case 'cron':
  94. $settingMerge = [
  95. 'type' => 'cron',
  96. 'label' => 'Cron Schedule',
  97. 'help' => 'You may use either Cron format or - @hourly, @daily, @monthly',
  98. 'placeholder' => '* * * * *'
  99. ];
  100. break;
  101. case 'folder':
  102. $settingMerge = [
  103. 'type' => 'folder',
  104. 'label' => 'Save Path',
  105. 'help' => 'Folder path',
  106. 'placeholder' => '/path/to/folder'
  107. ];
  108. break;
  109. case 'cronfile':
  110. $path = $this->root . DIRECTORY_SEPARATOR . 'cron.php';
  111. $server = $this->serverIP();
  112. $installInstruction = ($this->docker) ?
  113. '<p lang="en">No action needed. Organizr\'s docker image comes with the Cron job built-in</p>' :
  114. '<p lang="en">Setup a Cron job so it\'s call will originate from either the server\'s IP address or a local IP address. Please use the following information to set up the Cron Job correctly.</p>
  115. <h5>Cron Information</h5>
  116. <ul class="list-icons">
  117. <li><i class="fa fa-caret-right text-info"></i> <b lang="en">Schedule</b> <small>* * * * *</small></li>
  118. <li><i class="fa fa-caret-right text-info"></i> <b lang="en">File Path</b> <small>' . $path . '</small></li>
  119. </ul>
  120. <h5>Command Examples</h5>
  121. <ul class="list-icons">
  122. <li><i class="ti-angle-right"></i> * * * * * /path/to/php ' . $path . '</li>
  123. <li><i class="ti-angle-right"></i> * * * * * curl -XGET -sL "http://' . $server . '/cron.php"</li>
  124. </ul>
  125. ';
  126. $settingMerge = [
  127. 'type' => 'html',
  128. 'override' => 12,
  129. 'label' => '',
  130. 'html' => '
  131. <div class="row">
  132. <div class="col-lg-12">
  133. <div class="panel panel-info">
  134. <div class="panel-heading">
  135. <span lang="en">Organizr Enable Cron Instructions</span>
  136. </div>
  137. <div class="panel-wrapper collapse in" aria-expanded="true">
  138. <div class="panel-body">
  139. <h3 lang="en">Instructions for your install type</h3>
  140. <span>' . $installInstruction . '</span>
  141. <button type="button" onclick="checkCronFile();" class="btn btn-outline btn-info btn-lg btn-block" lang="en">Check Cron Status</button>
  142. <div class="m-t-15 hidden cron-results-container">
  143. <div class="well">
  144. <pre class="cron-results"></pre>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. '
  153. ];
  154. break;
  155. case 'username':
  156. $settingMerge = [
  157. 'type' => 'input',
  158. 'label' => 'Username',
  159. ];
  160. break;
  161. case 'password':
  162. $settingMerge = [
  163. 'type' => 'password',
  164. 'label' => 'Password',
  165. ];
  166. break;
  167. case 'passwordalt':
  168. $settingMerge = [
  169. 'type' => 'password-alt',
  170. 'label' => 'Password',
  171. ];
  172. break;
  173. case 'passwordaltcopy':
  174. $settingMerge = [
  175. 'type' => 'password-alt-copy',
  176. 'label' => 'Password',
  177. ];
  178. break;
  179. case 'apikey':
  180. case 'token':
  181. $settingMerge = [
  182. 'type' => 'password-alt',
  183. 'label' => 'API Key/Token',
  184. ];
  185. break;
  186. case 'multipleapikey':
  187. case 'multipletoken':
  188. $settingMerge = [
  189. 'type' => 'select2',
  190. 'class' => 'select2-multiple',
  191. 'id' => $name . '-select-' . $this->random_ascii_string(6),
  192. 'label' => 'Multiple API Key/Token\'s',
  193. 'options' => $this->makeOptionsFromValues($this->config[$name]),
  194. 'settings' => '{tags: true, theme: "default", selectionCssClass: "password-alt", selectOnClose: true, closeOnSelect: true, allowClear: true}',
  195. ];
  196. break;
  197. case 'notice':
  198. $settingMerge = [
  199. 'type' => 'html',
  200. 'override' => 12,
  201. 'label' => '',
  202. 'html' => '
  203. <div class="row">
  204. <div class="col-lg-12">
  205. <div class="panel panel-' . ($extras['notice'] ?? 'info') . '">
  206. <div class="panel-heading">
  207. <span lang="en">' . ($extras['title'] ?? 'Attention') . '</span>
  208. </div>
  209. <div class="panel-wrapper collapse in" aria-expanded="true">
  210. <div class="panel-body">
  211. <span lang="en">' . ($extras['body'] ?? '') . '</span>
  212. <span>' . ($extras['bodyHTML'] ?? '') . '</span>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. '
  219. ];
  220. break;
  221. case 'socks':
  222. $settingMerge = [
  223. 'type' => 'html',
  224. 'override' => 12,
  225. 'label' => '',
  226. 'html' => '
  227. <div class="panel panel-default">
  228. <div class="panel-wrapper collapse in">
  229. <div class="panel-body">' . $this->socksHeadingHTML($name) . '</div>
  230. </div>
  231. </div>'
  232. ];
  233. break;
  234. case 'about':
  235. $settingMerge = [
  236. 'type' => 'html',
  237. 'override' => 12,
  238. 'label' => '',
  239. 'html' => '
  240. <div class="panel panel-default">
  241. <div class="panel-wrapper collapse in">
  242. <div class="panel-body">
  243. <h3 lang="en">' . ucwords($name) . ' Homepage Item</h3>
  244. <p lang="en">' . $extras["about"] . '</p>
  245. </div>
  246. </div>
  247. </div>'
  248. ];
  249. break;
  250. case 'title':
  251. $settingMerge = [
  252. 'type' => 'input',
  253. 'label' => 'Title',
  254. 'help' => 'Sets the title of this homepage module',
  255. ];
  256. break;
  257. case 'toggletitle':
  258. $settingMerge = [
  259. 'type' => 'switch',
  260. 'label' => 'Toggle Title',
  261. 'help' => 'Shows/hides the title of this homepage module'
  262. ];
  263. break;
  264. case 'disablecertcheck':
  265. $settingMerge = [
  266. 'type' => 'switch',
  267. 'label' => 'Disable Certificate Check',
  268. ];
  269. break;
  270. case 'usecustomcertificate':
  271. $settingMerge = [
  272. 'type' => 'switch',
  273. 'label' => 'Use Custom Certificate',
  274. ];
  275. break;
  276. case 'hideseeding':
  277. $settingMerge = [
  278. 'type' => 'switch',
  279. 'label' => 'Hide Seeding',
  280. ];
  281. break;
  282. case 'hidecompleted':
  283. $settingMerge = [
  284. 'type' => 'switch',
  285. 'label' => 'Hide Completed',
  286. ];
  287. break;
  288. case 'hidestatus':
  289. $settingMerge = [
  290. 'type' => 'switch',
  291. 'label' => 'Hide Status',
  292. ];
  293. break;
  294. case 'limit':
  295. $settingMerge = [
  296. 'type' => 'number',
  297. 'label' => 'Item Limit',
  298. ];
  299. break;
  300. case 'mediasearchserver':
  301. $settingMerge = [
  302. 'type' => 'select',
  303. 'label' => 'Media Search Server',
  304. 'options' => $this->mediaServerOptions()
  305. ];
  306. break;
  307. case 'imagecachequality':
  308. $settingMerge = [
  309. 'type' => 'select',
  310. 'label' => 'Image Cache Quality',
  311. 'options' => [
  312. [
  313. 'name' => 'Low',
  314. 'value' => '.5'
  315. ],
  316. [
  317. 'name' => '1x',
  318. 'value' => '1'
  319. ],
  320. [
  321. 'name' => '2x',
  322. 'value' => '2'
  323. ],
  324. [
  325. 'name' => '3x',
  326. 'value' => '3'
  327. ]
  328. ]
  329. ];
  330. break;
  331. case 'blank':
  332. $settingMerge = [
  333. 'type' => 'blank',
  334. 'label' => '',
  335. ];
  336. break;
  337. case 'plexlibraryexclude':
  338. $settingMerge = [
  339. 'type' => 'select2',
  340. 'class' => 'select2-multiple',
  341. 'id' => $name . '-exclude-select-' . $this->random_ascii_string(6),
  342. 'label' => 'Libraries to Exclude',
  343. 'options' => $extras['options']
  344. ];
  345. break;
  346. case 'plexlibraryinclude':
  347. $settingMerge = [
  348. 'type' => 'select2',
  349. 'class' => 'select2-multiple',
  350. 'id' => $name . '-include-select-' . $this->random_ascii_string(6),
  351. 'label' => 'Libraries to Include',
  352. 'options' => $extras['options']
  353. ];
  354. break;
  355. // HTML ITEMS
  356. // precodeeditor possibly not needed anymore
  357. case 'precodeeditor':
  358. $settingMerge = [
  359. 'type' => 'textbox',
  360. 'class' => 'hidden ' . $name . 'Textarea',
  361. 'label' => '',
  362. ];
  363. break;
  364. case 'codeeditor':
  365. $mode = strtolower($extras['mode'] ?? 'css');
  366. switch ($mode) {
  367. case 'html':
  368. case 'javascript':
  369. $mode = 'ace/mode/' . $mode;
  370. break;
  371. case 'js':
  372. $mode = 'ace/mode/javascript';
  373. break;
  374. default:
  375. $mode = 'ace/mode/css';
  376. break;
  377. }
  378. $settingMerge = [
  379. 'type' => 'html',
  380. 'override' => 12,
  381. 'label' => 'Custom Code',
  382. 'html' => '
  383. <textarea data-changed="false" class="form-control hidden ' . $name . 'Textarea" name="' . $name . '" data-type="textbox" autocomplete="new-password">' . $this->config[$name] . '</textarea>
  384. <div id="' . $name . 'Editor" style="height:300px">' . htmlentities($this->config[$name]) . '</div>
  385. <script>
  386. let mode = ace.require("' . $mode . '").Mode;
  387. ' . str_replace('-', '', $name) . ' = ace.edit("' . $name . 'Editor");
  388. ' . str_replace('-', '', $name) . '.session.setMode(new mode());
  389. ' . str_replace('-', '', $name) . '.setTheme("ace/theme/idle_fingers");
  390. ' . str_replace('-', '', $name) . '.setShowPrintMargin(false);
  391. ' . str_replace('-', '', $name) . '.session.on("change", function(delta) {
  392. $(".' . $name . 'Textarea").val(' . str_replace('-', '', $name) . '.getValue());
  393. $(".' . $name . 'Textarea").trigger("change");
  394. });
  395. </script>
  396. '
  397. ];
  398. break;
  399. // CALENDAR ITEMS
  400. case 'calendarstart':
  401. $settingMerge = [
  402. 'type' => 'number',
  403. 'label' => '# of Days Before'
  404. ];
  405. break;
  406. case 'calendarend':
  407. $settingMerge = [
  408. 'type' => 'number',
  409. 'label' => '# of Days After'
  410. ];
  411. break;
  412. case 'calendarstartingday':
  413. case 'calendarstartday':
  414. case 'calendarstart':
  415. $settingMerge = [
  416. 'type' => 'select',
  417. 'label' => 'Start Day',
  418. 'options' => $this->daysOptions()
  419. ];
  420. break;
  421. case 'calendardefaultview':
  422. $settingMerge = [
  423. 'type' => 'select',
  424. 'label' => 'Default View',
  425. 'options' => $this->calendarDefaultOptions()
  426. ];
  427. break;
  428. case 'calendartimeformat':
  429. $settingMerge = [
  430. 'type' => 'select',
  431. 'label' => 'Time Format',
  432. 'options' => $this->timeFormatOptions()
  433. ];
  434. break;
  435. case 'calendarlocale':
  436. $settingMerge = [
  437. 'type' => 'select',
  438. 'label' => 'Locale',
  439. 'options' => $this->calendarLocaleOptions()
  440. ];
  441. break;
  442. case 'calendarlimit':
  443. $settingMerge = [
  444. 'type' => 'select',
  445. 'label' => 'Items Per Day',
  446. 'options' => $this->limitOptions()
  447. ];
  448. break;
  449. case 'color':
  450. $settingMerge = [
  451. 'type' => 'input',
  452. 'label' => 'Color',
  453. 'class' => 'pick-a-color-custom-options',
  454. 'attr' => 'data-original="' . $this->config[$name] . '"'
  455. ];
  456. break;
  457. case 'calendarlinkurl':
  458. $settingMerge = [
  459. 'type' => 'select-input',
  460. 'label' => 'Target URL',
  461. 'help' => 'Set the primary URL used when clicking on calendar icon.',
  462. 'options' => $this->makeOptionsFromValues($this->config[str_replace('CalendarLink', '', $name) . 'URL'], true, 'Use Default'),
  463. ];
  464. break;
  465. case 'calendarframetarget':
  466. $settingMerge = [
  467. 'type' => 'select',
  468. 'label' => 'Target Tab',
  469. 'help' => 'Set the tab used when clicking on calendar icon. If not set, link will open in new window.',
  470. 'options' => $this->getIframeTabs($this->config[str_replace('FrameTarget', 'CalendarLink', $name)])
  471. ];
  472. break;
  473. default:
  474. $settingMerge = [
  475. 'type' => strtolower($type),
  476. 'label' => ''
  477. ];
  478. break;
  479. }
  480. $setting = array_merge($settingMerge, $setting);
  481. if ($extras) {
  482. if (gettype($extras) == 'array') {
  483. $setting = array_merge($setting, $extras);
  484. }
  485. }
  486. return $setting;
  487. }
  488. public function getIframeTabs($url = "")
  489. {
  490. if (!empty($url)) {
  491. $response = [
  492. array(
  493. 'function' => 'fetchAll',
  494. 'query' => array(
  495. "SELECT * FROM tabs WHERE `enabled`='1' AND `type`='1' AND `group_id`>=? AND (`url` = '" . $url . "' OR `url_local` = '" . $url . "') ORDER BY `order` ASC",
  496. $this->getUserLevel(),
  497. )
  498. )
  499. ];
  500. } else {
  501. $response = [
  502. array(
  503. 'function' => 'fetchAll',
  504. 'query' => array(
  505. "SELECT * FROM tabs WHERE `enabled`='1' AND `type`='1' AND `group_id`>=? ORDER BY `order` ASC",
  506. $this->getUserLevel()
  507. )
  508. )
  509. ];
  510. }
  511. $formattedValues[] = [
  512. 'name' => 'Open in New Window',
  513. 'value' => ''
  514. ];
  515. foreach ($this->processQueries($response) as $result) {
  516. $formattedValues[] = [
  517. 'name' => $result['name'],
  518. 'value' => $result['id']
  519. ];
  520. }
  521. return $formattedValues;
  522. }
  523. public function makeOptionsFromValues($values = null, $appendBlank = null, $blankLabel = null)
  524. {
  525. if ($appendBlank === true) {
  526. $formattedValues[] = [
  527. 'name' => (!empty($blankLabel)) ? $blankLabel : 'Select option...',
  528. 'value' => ''
  529. ];
  530. } else {
  531. $formattedValues = [];
  532. }
  533. if (strpos($values, ',') !== false) {
  534. $explode = explode(',', $values);
  535. foreach ($explode as $item) {
  536. $formattedValues[] = [
  537. 'name' => $item,
  538. 'value' => $item
  539. ];
  540. }
  541. } elseif ($values == '') {
  542. $formattedValues = '';
  543. } else {
  544. $formattedValues[] = [
  545. 'name' => $values,
  546. 'value' => $values
  547. ];
  548. }
  549. return $formattedValues;
  550. }
  551. public function logLevels()
  552. {
  553. return [
  554. [
  555. 'name' => 'Debug',
  556. 'value' => 'DEBUG'
  557. ],
  558. [
  559. 'name' => 'Info',
  560. 'value' => 'INFO'
  561. ],
  562. [
  563. 'name' => 'Notice',
  564. 'value' => 'NOTICE'
  565. ],
  566. [
  567. 'name' => 'Warning',
  568. 'value' => 'WARNING'
  569. ],
  570. [
  571. 'name' => 'Error',
  572. 'value' => 'ERROR'
  573. ],
  574. [
  575. 'name' => 'Critical',
  576. 'value' => 'CRITICAL'
  577. ],
  578. [
  579. 'name' => 'Alert',
  580. 'value' => 'ALERT'
  581. ],
  582. [
  583. 'name' => 'Emergency',
  584. 'value' => 'EMERGENCY'
  585. ]
  586. ];
  587. }
  588. public function sandboxOptions()
  589. {
  590. return [
  591. [
  592. 'name' => 'Allow Presentation',
  593. 'value' => 'allow-presentation'
  594. ],
  595. [
  596. 'name' => 'Allow Forms',
  597. 'value' => 'allow-forms'
  598. ],
  599. [
  600. 'name' => 'Allow Same Origin',
  601. 'value' => 'allow-same-origin'
  602. ],
  603. [
  604. 'name' => 'Allow Orientation Lock',
  605. 'value' => 'allow-orientation-lock'
  606. ],
  607. [
  608. 'name' => 'Allow Pointer Lock',
  609. 'value' => 'allow-pointer-lock'
  610. ],
  611. [
  612. 'name' => 'Allow Scripts',
  613. 'value' => 'allow-scripts'
  614. ],
  615. [
  616. 'name' => 'Allow Popups',
  617. 'value' => 'allow-popups'
  618. ],
  619. [
  620. 'name' => 'Allow Popups To Escape Sandbox',
  621. 'value' => 'allow-popups-to-escape-sandbox'
  622. ],
  623. [
  624. 'name' => 'Allow Modals',
  625. 'value' => 'allow-modals'
  626. ],
  627. [
  628. 'name' => 'Allow Top Navigation',
  629. 'value' => 'allow-top-navigation'
  630. ],
  631. [
  632. 'name' => 'Allow Top Navigation By User Activation',
  633. 'value' => 'allow-top-navigation-by-user-activation'
  634. ],
  635. [
  636. 'name' => 'Allow Downloads',
  637. 'value' => 'allow-downloads'
  638. ],
  639. ];
  640. }
  641. public function iframeAllowOptions()
  642. {
  643. return [
  644. [
  645. 'name' => 'Allow Clipboard Read',
  646. 'value' => 'clipboard-read'
  647. ],
  648. [
  649. 'name' => 'Allow Clipboard Write',
  650. 'value' => 'clipboard-write'
  651. ],
  652. [
  653. 'name' => 'Allow Camera',
  654. 'value' => 'camera'
  655. ],
  656. [
  657. 'name' => 'Allow Microphone',
  658. 'value' => 'microphone'
  659. ],
  660. [
  661. 'name' => 'Allow Speaker Selection',
  662. 'value' => 'speaker-selection'
  663. ],
  664. [
  665. 'name' => 'Allow Encrypted Media',
  666. 'value' => 'encrypted-media'
  667. ],
  668. [
  669. 'name' => 'Allow Web Share',
  670. 'value' => 'web-share'
  671. ],
  672. [
  673. 'name' => 'Allow Capture the Screen',
  674. 'value' => 'display-capture'
  675. ],
  676. [
  677. 'name' => 'Allow Screen Wake Lock',
  678. 'value' => 'screen-wake-lock'
  679. ],
  680. [
  681. 'name' => 'Allow Geolocation',
  682. 'value' => 'geolocation'
  683. ],
  684. [
  685. 'name' => 'Allow Autoplay Media',
  686. 'value' => 'autoplay'
  687. ],
  688. [
  689. 'name' => 'Allow USB',
  690. 'value' => 'usb'
  691. ],
  692. [
  693. 'name' => 'Allow MIDI',
  694. 'value' => 'midi'
  695. ],
  696. [
  697. 'name' => 'Allow Fullscreen',
  698. 'value' => 'fullscreen'
  699. ],
  700. [
  701. 'name' => 'Allow Payment',
  702. 'value' => 'payment'
  703. ],
  704. [
  705. 'name' => 'Allow Picture-in-Picture',
  706. 'value' => 'picture-in-picture'
  707. ],
  708. [
  709. 'name' => 'Allow Gamepad',
  710. 'value' => 'gamepad'
  711. ],
  712. [
  713. 'name' => 'Allow WebXR Spatial Tracking (VR)',
  714. 'value' => 'xr-spatial-tracking'
  715. ],
  716. [
  717. 'name' => 'Allow Accelerometer Sensor',
  718. 'value' => 'accelerometer'
  719. ],
  720. [
  721. 'name' => 'Allow Gyroscope Sensor',
  722. 'value' => 'gyroscope'
  723. ],
  724. [
  725. 'name' => 'Allow Magnetometer Sensor',
  726. 'value' => 'magnetometer'
  727. ],
  728. [
  729. 'name' => 'Allow Ambient Light Sensor',
  730. 'value' => 'ambient-light-sensor'
  731. ],
  732. [
  733. 'name' => 'Allow Battery Status',
  734. 'value' => 'battery'
  735. ],
  736. [
  737. 'name' => 'Allow Sync XMLHttpRequest',
  738. 'value' => 'sync-xhr'
  739. ],
  740. ];
  741. }
  742. public function calendarLocaleOptions()
  743. {
  744. return [
  745. [
  746. 'name' => 'Arabic (Standard)',
  747. 'value' => 'ar',
  748. ],
  749. [
  750. 'name' => 'Arabic (Morocco)',
  751. 'value' => 'ar-ma',
  752. ],
  753. [
  754. 'name' => 'Arabic (Saudi Arabia)',
  755. 'value' => 'ar-sa'
  756. ],
  757. [
  758. 'value' => 'ar-tn',
  759. 'name' => 'Arabic (Tunisia)'
  760. ],
  761. [
  762. 'value' => 'bg',
  763. 'name' => 'Bulgarian'
  764. ],
  765. [
  766. 'value' => 'ca',
  767. 'name' => 'Catalan'
  768. ],
  769. [
  770. 'value' => 'cs',
  771. 'name' => 'Czech'
  772. ],
  773. [
  774. 'value' => 'da',
  775. 'name' => 'Danish'
  776. ],
  777. [
  778. 'value' => 'de',
  779. 'name' => 'German (Standard)'
  780. ],
  781. [
  782. 'value' => 'de-at',
  783. 'name' => 'German (Austria)'
  784. ],
  785. [
  786. 'value' => 'el',
  787. 'name' => 'Greek'
  788. ],
  789. [
  790. 'value' => 'en',
  791. 'name' => 'English'
  792. ],
  793. [
  794. 'value' => 'en-au',
  795. 'name' => 'English (Australia)'
  796. ],
  797. [
  798. 'value' => 'en-ca',
  799. 'name' => 'English (Canada)'
  800. ],
  801. [
  802. 'value' => 'en-gb',
  803. 'name' => 'English (United Kingdom)'
  804. ],
  805. [
  806. 'value' => 'es',
  807. 'name' => 'Spanish'
  808. ],
  809. [
  810. 'value' => 'fa',
  811. 'name' => 'Farsi'
  812. ],
  813. [
  814. 'value' => 'fi',
  815. 'name' => 'Finnish'
  816. ],
  817. [
  818. 'value' => 'fr',
  819. 'name' => 'French (Standard)'
  820. ],
  821. [
  822. 'value' => 'fr-ca',
  823. 'name' => 'French (Canada)'
  824. ],
  825. [
  826. 'value' => 'he',
  827. 'name' => 'Hebrew'
  828. ],
  829. [
  830. 'value' => 'hi',
  831. 'name' => 'Hindi'
  832. ],
  833. [
  834. 'value' => 'hr',
  835. 'name' => 'Croatian'
  836. ],
  837. [
  838. 'value' => 'hu',
  839. 'name' => 'Hungarian'
  840. ],
  841. [
  842. 'value' => 'id',
  843. 'name' => 'Indonesian'
  844. ],
  845. [
  846. 'value' => 'is',
  847. 'name' => 'Icelandic'
  848. ],
  849. [
  850. 'value' => 'it',
  851. 'name' => 'Italian'
  852. ],
  853. [
  854. 'value' => 'ja',
  855. 'name' => 'Japanese'
  856. ],
  857. [
  858. 'value' => 'ko',
  859. 'name' => 'Korean'
  860. ],
  861. [
  862. 'value' => 'lt',
  863. 'name' => 'Lithuanian'
  864. ],
  865. [
  866. 'value' => 'lv',
  867. 'name' => 'Latvian'
  868. ],
  869. [
  870. 'value' => 'nb',
  871. 'name' => 'Norwegian (Bokmal)'
  872. ],
  873. [
  874. 'value' => 'nl',
  875. 'name' => 'Dutch (Standard)'
  876. ],
  877. [
  878. 'value' => 'pl',
  879. 'name' => 'Polish'
  880. ],
  881. [
  882. 'value' => 'pt',
  883. 'name' => 'Portuguese'
  884. ],
  885. [
  886. 'value' => 'pt-br',
  887. 'name' => 'Portuguese (Brazil)'
  888. ],
  889. [
  890. 'value' => 'ro',
  891. 'name' => 'Romanian'
  892. ],
  893. [
  894. 'value' => 'ru',
  895. 'name' => 'Russian'
  896. ],
  897. [
  898. 'value' => 'sk',
  899. 'name' => 'Slovak'
  900. ],
  901. [
  902. 'value' => 'sl',
  903. 'name' => 'Slovenian'
  904. ],
  905. [
  906. 'value' => 'sr',
  907. 'name' => 'Serbian'
  908. ],
  909. [
  910. 'value' => 'sv',
  911. 'name' => 'Swedish'
  912. ],
  913. [
  914. 'value' => 'th',
  915. 'name' => 'Thai'
  916. ],
  917. [
  918. 'value' => 'tr',
  919. 'name' => 'Turkish'
  920. ],
  921. [
  922. 'value' => 'uk',
  923. 'name' => 'Ukrainian'
  924. ],
  925. [
  926. 'value' => 'vi',
  927. 'name' => 'Vietnamese'
  928. ],
  929. [
  930. 'value' => 'zh-cn',
  931. 'name' => 'Chinese (PRC)'
  932. ],
  933. [
  934. 'value' => 'zh-tw',
  935. 'name' => 'Chinese (Taiwan)'
  936. ]
  937. ];
  938. }
  939. public function daysOptions()
  940. {
  941. return array(
  942. array(
  943. 'name' => 'Sunday',
  944. 'value' => '0'
  945. ),
  946. array(
  947. 'name' => 'Monday',
  948. 'value' => '1'
  949. ),
  950. array(
  951. 'name' => 'Tueday',
  952. 'value' => '2'
  953. ),
  954. array(
  955. 'name' => 'Wednesday',
  956. 'value' => '3'
  957. ),
  958. array(
  959. 'name' => 'Thursday',
  960. 'value' => '4'
  961. ),
  962. array(
  963. 'name' => 'Friday',
  964. 'value' => '5'
  965. ),
  966. array(
  967. 'name' => 'Saturday',
  968. 'value' => '6'
  969. )
  970. );
  971. }
  972. public function mediaServerOptions()
  973. {
  974. return array(
  975. array(
  976. 'name' => 'N/A',
  977. 'value' => ''
  978. ),
  979. array(
  980. 'name' => 'Plex',
  981. 'value' => 'plex'
  982. ),
  983. array(
  984. 'name' => 'Emby [Not Available]',
  985. 'value' => 'emby'
  986. )
  987. );
  988. }
  989. public function requestTvOptions($includeUserOption = false)
  990. {
  991. $options = [
  992. [
  993. 'name' => 'All Seasons',
  994. 'value' => 'all'
  995. ],
  996. [
  997. 'name' => 'First Season Only',
  998. 'value' => 'first'
  999. ],
  1000. [
  1001. 'name' => 'Last Season Only',
  1002. 'value' => 'last'
  1003. ],
  1004. ];
  1005. $userOption = [
  1006. 'name' => 'Let User Select',
  1007. 'value' => 'user'
  1008. ];
  1009. if ($includeUserOption) {
  1010. array_push($options, $userOption);
  1011. }
  1012. return $options;
  1013. }
  1014. public function requestServiceOptions()
  1015. {
  1016. return [
  1017. [
  1018. 'name' => 'Ombi',
  1019. 'value' => 'ombi'
  1020. ],
  1021. [
  1022. 'name' => 'Overseerr',
  1023. 'value' => 'overseerr'
  1024. ]
  1025. ];
  1026. }
  1027. public function limitOptions()
  1028. {
  1029. return array(
  1030. array(
  1031. 'name' => '1 Item',
  1032. 'value' => '1'
  1033. ),
  1034. array(
  1035. 'name' => '2 Items',
  1036. 'value' => '2'
  1037. ),
  1038. array(
  1039. 'name' => '3 Items',
  1040. 'value' => '3'
  1041. ),
  1042. array(
  1043. 'name' => '4 Items',
  1044. 'value' => '4'
  1045. ),
  1046. array(
  1047. 'name' => '5 Items',
  1048. 'value' => '5'
  1049. ),
  1050. array(
  1051. 'name' => '6 Items',
  1052. 'value' => '6'
  1053. ),
  1054. array(
  1055. 'name' => '7 Items',
  1056. 'value' => '7'
  1057. ),
  1058. array(
  1059. 'name' => '8 Items',
  1060. 'value' => '8'
  1061. ),
  1062. array(
  1063. 'name' => 'Unlimited',
  1064. 'value' => '1000'
  1065. ),
  1066. );
  1067. }
  1068. public function notificationTypesOptions()
  1069. {
  1070. return array(
  1071. array(
  1072. 'name' => 'Toastr',
  1073. 'value' => 'toastr'
  1074. ),
  1075. array(
  1076. 'name' => 'Izi',
  1077. 'value' => 'izi'
  1078. ),
  1079. array(
  1080. 'name' => 'Alertify',
  1081. 'value' => 'alertify'
  1082. ),
  1083. array(
  1084. 'name' => 'Noty',
  1085. 'value' => 'noty'
  1086. ),
  1087. );
  1088. }
  1089. public function notificationPositionsOptions()
  1090. {
  1091. return array(
  1092. array(
  1093. 'name' => 'Bottom Right',
  1094. 'value' => 'br'
  1095. ),
  1096. array(
  1097. 'name' => 'Bottom Left',
  1098. 'value' => 'bl'
  1099. ),
  1100. array(
  1101. 'name' => 'Bottom Center',
  1102. 'value' => 'bc'
  1103. ),
  1104. array(
  1105. 'name' => 'Top Right',
  1106. 'value' => 'tr'
  1107. ),
  1108. array(
  1109. 'name' => 'Top Left',
  1110. 'value' => 'tl'
  1111. ),
  1112. array(
  1113. 'name' => 'Top Center',
  1114. 'value' => 'tc'
  1115. ),
  1116. array(
  1117. 'name' => 'Center',
  1118. 'value' => 'c'
  1119. ),
  1120. );
  1121. }
  1122. public function timeOptions()
  1123. {
  1124. return array(
  1125. array(
  1126. 'name' => '2.5',
  1127. 'value' => '2500'
  1128. ),
  1129. array(
  1130. 'name' => '5',
  1131. 'value' => '5000'
  1132. ),
  1133. array(
  1134. 'name' => '10',
  1135. 'value' => '10000'
  1136. ),
  1137. array(
  1138. 'name' => '15',
  1139. 'value' => '15000'
  1140. ),
  1141. array(
  1142. 'name' => '30',
  1143. 'value' => '30000'
  1144. ),
  1145. array(
  1146. 'name' => '60 [1 Minute]',
  1147. 'value' => '60000'
  1148. ),
  1149. array(
  1150. 'name' => '300 [5 Minutes]',
  1151. 'value' => '300000'
  1152. ),
  1153. array(
  1154. 'name' => '600 [10 Minutes]',
  1155. 'value' => '600000'
  1156. ),
  1157. array(
  1158. 'name' => '900 [15 Minutes]',
  1159. 'value' => '900000'
  1160. ),
  1161. array(
  1162. 'name' => '1800 [30 Minutes]',
  1163. 'value' => '1800000'
  1164. ),
  1165. array(
  1166. 'name' => '3600 [1 Hour]',
  1167. 'value' => '3600000'
  1168. ),
  1169. );
  1170. }
  1171. public function netdataOptions()
  1172. {
  1173. return [
  1174. [
  1175. 'name' => 'Disk Read',
  1176. 'value' => 'disk-read',
  1177. ],
  1178. [
  1179. 'name' => 'Disk Write',
  1180. 'value' => 'disk-write',
  1181. ],
  1182. [
  1183. 'name' => 'CPU',
  1184. 'value' => 'cpu'
  1185. ],
  1186. [
  1187. 'name' => 'Network Inbound',
  1188. 'value' => 'net-in',
  1189. ],
  1190. [
  1191. 'name' => 'Network Outbound',
  1192. 'value' => 'net-out',
  1193. ],
  1194. [
  1195. 'name' => 'Used RAM',
  1196. 'value' => 'ram-used',
  1197. ],
  1198. [
  1199. 'name' => 'Used Swap',
  1200. 'value' => 'swap-used',
  1201. ],
  1202. [
  1203. 'name' => 'Disk space used',
  1204. 'value' => 'disk-used',
  1205. ],
  1206. [
  1207. 'name' => 'Disk space available',
  1208. 'value' => 'disk-avail',
  1209. ],
  1210. [
  1211. 'name' => 'Custom',
  1212. 'value' => 'custom',
  1213. ]
  1214. ];
  1215. }
  1216. public function netdataChartOptions()
  1217. {
  1218. return [
  1219. [
  1220. 'name' => 'Easy Pie Chart',
  1221. 'value' => 'easypiechart',
  1222. ],
  1223. [
  1224. 'name' => 'Gauge',
  1225. 'value' => 'gauge'
  1226. ]
  1227. ];
  1228. }
  1229. public function netdataColourOptions()
  1230. {
  1231. return [
  1232. [
  1233. 'name' => 'Red',
  1234. 'value' => 'fe3912',
  1235. ],
  1236. [
  1237. 'name' => 'Green',
  1238. 'value' => '46e302',
  1239. ],
  1240. [
  1241. 'name' => 'Purple',
  1242. 'value' => 'CC22AA'
  1243. ],
  1244. [
  1245. 'name' => 'Blue',
  1246. 'value' => '5054e6',
  1247. ],
  1248. [
  1249. 'name' => 'Yellow',
  1250. 'value' => 'dddd00',
  1251. ],
  1252. [
  1253. 'name' => 'Orange',
  1254. 'value' => 'd66300',
  1255. ]
  1256. ];
  1257. }
  1258. public function netdataSizeOptions()
  1259. {
  1260. return [
  1261. [
  1262. 'name' => 'Large',
  1263. 'value' => 'lg',
  1264. ],
  1265. [
  1266. 'name' => 'Medium',
  1267. 'value' => 'md',
  1268. ],
  1269. [
  1270. 'name' => 'Small',
  1271. 'value' => 'sm'
  1272. ]
  1273. ];
  1274. }
  1275. public function timeFormatOptions()
  1276. {
  1277. return array(
  1278. array(
  1279. 'name' => '6p',
  1280. 'value' => 'h(:mm)t'
  1281. ),
  1282. array(
  1283. 'name' => '6:00p',
  1284. 'value' => 'h:mmt'
  1285. ),
  1286. array(
  1287. 'name' => '6pm',
  1288. 'value' => 'h(:mm)a'
  1289. ),
  1290. array(
  1291. 'name' => '6:00pm',
  1292. 'value' => 'h:mma'
  1293. ),
  1294. array(
  1295. 'name' => '6:00',
  1296. 'value' => 'h:mm'
  1297. ),
  1298. array(
  1299. 'name' => '18',
  1300. 'value' => 'H(:mm)'
  1301. ),
  1302. array(
  1303. 'name' => '18:00',
  1304. 'value' => 'H:mm'
  1305. )
  1306. );
  1307. }
  1308. public function rTorrentSortOptions()
  1309. {
  1310. return array(
  1311. array(
  1312. 'name' => 'Date Desc',
  1313. 'value' => 'dated'
  1314. ),
  1315. array(
  1316. 'name' => 'Date Asc',
  1317. 'value' => 'datea'
  1318. ),
  1319. array(
  1320. 'name' => 'Hash Desc',
  1321. 'value' => 'hashd'
  1322. ),
  1323. array(
  1324. 'name' => 'Hash Asc',
  1325. 'value' => 'hasha'
  1326. ),
  1327. array(
  1328. 'name' => 'Name Desc',
  1329. 'value' => 'named'
  1330. ),
  1331. array(
  1332. 'name' => 'Name Asc',
  1333. 'value' => 'namea'
  1334. ),
  1335. array(
  1336. 'name' => 'Size Desc',
  1337. 'value' => 'sized'
  1338. ),
  1339. array(
  1340. 'name' => 'Size Asc',
  1341. 'value' => 'sizea'
  1342. ),
  1343. array(
  1344. 'name' => 'Label Desc',
  1345. 'value' => 'labeld'
  1346. ),
  1347. array(
  1348. 'name' => 'Label Asc',
  1349. 'value' => 'labela'
  1350. ),
  1351. array(
  1352. 'name' => 'Status Desc',
  1353. 'value' => 'statusd'
  1354. ),
  1355. array(
  1356. 'name' => 'Status Asc',
  1357. 'value' => 'statusa'
  1358. ),
  1359. );
  1360. }
  1361. public function qBittorrentApiOptions()
  1362. {
  1363. return array(
  1364. array(
  1365. 'name' => 'V1',
  1366. 'value' => '1'
  1367. ),
  1368. array(
  1369. 'name' => 'V2',
  1370. 'value' => '2'
  1371. ),
  1372. );
  1373. }
  1374. public function qBittorrentSortOptions()
  1375. {
  1376. return array(
  1377. array(
  1378. 'name' => 'Hash',
  1379. 'value' => 'hash'
  1380. ),
  1381. array(
  1382. 'name' => 'Name',
  1383. 'value' => 'name'
  1384. ),
  1385. array(
  1386. 'name' => 'Size',
  1387. 'value' => 'size'
  1388. ),
  1389. array(
  1390. 'name' => 'Progress',
  1391. 'value' => 'progress'
  1392. ),
  1393. array(
  1394. 'name' => 'Download Speed',
  1395. 'value' => 'dlspeed'
  1396. ),
  1397. array(
  1398. 'name' => 'Upload Speed',
  1399. 'value' => 'upspeed'
  1400. ),
  1401. array(
  1402. 'name' => 'Priority',
  1403. 'value' => 'priority'
  1404. ),
  1405. array(
  1406. 'name' => 'Number of Seeds',
  1407. 'value' => 'num_seeds'
  1408. ),
  1409. array(
  1410. 'name' => 'Number of Seeds in Swarm',
  1411. 'value' => 'num_complete'
  1412. ),
  1413. array(
  1414. 'name' => 'Number of Leechers',
  1415. 'value' => 'num_leechs'
  1416. ),
  1417. array(
  1418. 'name' => 'Number of Leechers in Swarm',
  1419. 'value' => 'num_incomplete'
  1420. ),
  1421. array(
  1422. 'name' => 'Ratio',
  1423. 'value' => 'ratio'
  1424. ),
  1425. array(
  1426. 'name' => 'ETA',
  1427. 'value' => 'eta'
  1428. ),
  1429. array(
  1430. 'name' => 'State',
  1431. 'value' => 'state'
  1432. ),
  1433. array(
  1434. 'name' => 'Category',
  1435. 'value' => 'category'
  1436. )
  1437. );
  1438. }
  1439. public function calendarDefaultOptions()
  1440. {
  1441. return array(
  1442. array(
  1443. 'name' => 'Month',
  1444. 'value' => 'month'
  1445. ),
  1446. array(
  1447. 'name' => 'Day',
  1448. 'value' => 'basicDay'
  1449. ),
  1450. array(
  1451. 'name' => 'Week',
  1452. 'value' => 'basicWeek'
  1453. ),
  1454. array(
  1455. 'name' => 'List',
  1456. 'value' => 'list'
  1457. )
  1458. );
  1459. }
  1460. }