PageRenderTime 6ms CodeModel.GetById 31ms app.highlight 41ms RepoModel.GetById 5ms app.codeStats 2ms

/skeleton/php-strings.el

http://github.com/ejmr/php-mode
Lisp | 768 lines | 645 code | 106 blank | 17 comment | 1 complexity | 8f24df3af9d30526ae6abb667cfb721f MD5 | raw file
  1;; Copyright (C) 2015  David Arroyo MenĂŠndez
  2
  3;; Author: David Arroyo MenĂŠndez <davidam@gnu.org>
  4;; Maintainer: David Arroyo MenĂŠndez <davidam@gnu.org>
  5
  6;; This file is free software; you can redistribute it and/or modify
  7;; it under the terms of the GNU General Public License as published by
  8;; the Free Software Foundation; either version 3, or (at your option)
  9;; any later version.
 10
 11;; This file is distributed in the hope that it will be useful,
 12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14;; GNU General Public License for more details.
 15
 16;; You should have received a copy of the GNU General Public License
 17;; along with GNU Emacs; see the file COPYING.  If not, write to
 18;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 19;; Boston, MA 02110-1301 USA,
 20
 21;; http://php.net/manual/en/ref.strings.php
 22;; file:///usr/share/doc/php-doc/html/ref.strings.html
 23
 24(define-skeleton php-addcslashes 
 25  "Insert an addcslashes statement"
 26  ""
 27  '(setq str (skeleton-read "String? "))
 28  '(setq charlist (skeleton-read "Charlist? "))
 29  > "addclslashes(" str ", " charlist ");" \n)
 30
 31(define-skeleton php-addslashes 
 32  "Insert an addcslashes statement"
 33  ""
 34  '(setq str (skeleton-read "String? "))
 35  > "addclslashes(" str ");" \n)
 36
 37(define-skeleton php-bin2hex
 38  "Insert a bin2hex statement"
 39  ""
 40  '(setq str (skeleton-read "String? "))
 41  > "bin2hex(" str ");" \n)
 42
 43(define-skeleton php-chop
 44  "Insert a chop statement. Alias of rtrim"
 45  ""
 46  '(setq str (skeleton-read "String: "))
 47  > "chop(" str ");" \n)
 48
 49(define-skeleton php-chr
 50  "Insert a chr statement. Returns a specific character from ascii code"
 51  ""
 52  '(setq ascii (skeleton-read "String: "))
 53  > "chr(" ascii ");" \n)
 54
 55(define-skeleton php-chunk_split
 56  "Insert a chunk_split statement. Split a a string into smaller chunks"
 57  ""
 58  '(setq body (skeleton-read "String: "))
 59  '(setq chunklen (skeleton-read "Chunk length: "))
 60  '(setq end (skeleton-read "End: "))
 61  > "chunk_split(" body ", " chunklen ", " end ");" \n
 62)
 63
 64(define-skeleton php-convert_cyr_string
 65  "Insert a convert_cyr_string statement"
 66  ""
 67  '(setq str (skeleton-read "String? "))
 68  '(setq from (skeleton-read "From? "))
 69  '(setq to (skeleton-read "To? "))
 70  > "convert_cyr_string(" str ", " from ", " to ");" \n)
 71
 72(define-skeleton php-convert_uudecode
 73  "Insert a bin2hex statement"
 74  ""
 75  '(setq str (skeleton-read "String? "))
 76  > "convert_uudecode(" str ");" \n)
 77
 78(define-skeleton php-convert_uuencode
 79  "Insert a bin2hex statement"
 80  ""
 81  '(setq str (skeleton-read "String? "))
 82  > "convert_uuencode(" str ");" \n)
 83
 84(define-skeleton php-count_chars
 85  "Insert a count_chars statement. Return information about characters used in a string"
 86  ""
 87  '(setq str (skeleton-read "String? "))
 88  '(setq mode (skeleton-read "Mode? "))
 89  > "count_chars(" str ", " mode ");" \n
 90)
 91
 92(define-skeleton php-crc32
 93  "Insert a crc32 statement. Calculates the crc32 polynomial of a string"
 94  ""
 95  '(setq str (skeleton-read "String: "))
 96  > "crc32(" str ");" \n
 97)
 98
 99(define-skeleton php-crypt
100  "Insert a crypt statement. One-way string hashing"
101  ""
102  '(setq str (skeleton-read "String: "))
103  '(setq salt (skeleton-read "Salt: "))
104  > "crypt(" str ", " salt ");" \n
105)
106
107(define-skeleton php-echo
108  "Insert an echo statement"
109  ""
110  '(setq str (skeleton-read "String: "))
111  > "echo '" str "';" \n)
112
113(define-skeleton php-explode
114  "Insert an explode statement"
115  ""
116  '(setq separator (skeleton-read "Explode separator? "))
117  '(setq var (skeleton-read "Explode variable? "))
118  > "explode('" separator "', " var ");" \n)
119
120(define-skeleton php-fprintf 
121  "Insert a fprintf statement"
122  ""
123  '(setq handle (skeleton-read "Handle: "))
124  '(setq format (skeleton-read "Format: "))
125  '(setq args (skeleton-read "Args: "))
126  > "fprintf(" handle ", " format ", " args ");" \n
127)
128
129(define-skeleton php-get_html_translation_table
130  "Insert a get_html_translation_table statement. Returns the translation table used by htmlspecialchars and htmlentities"
131  ""
132  '(setq table (skeleton-read "Table: "))
133  '(setq flags (skeleton-read "Flags: "))
134  '(setq encoding (skeleton-read "Encoding: "))
135  > "get_html_translation_table(" table ", " flags ", " encoding ");" \n
136)
137
138
139(define-skeleton php-hebrev
140  "Insert a hebrev statement. Convert logical Hebrew text to visual text with newline conversion"
141  ""
142  '(setq hebrew_text (skeleton-read "Hebrew text: "))
143  '(setq max_chars_per_line (skeleton-read "Maximum number of characters per line: "))
144  > "hebrev(" hebrew_text ", " max_chars_per_line ");" \n
145)
146
147(define-skeleton php-hebrevc
148  "Insert a hebrevc statement. Convert logical Hebrew text to visual text with newline conversion"
149  ""
150  '(setq hebrew_text (skeleton-read "Hebrew text: "))
151  '(setq max_chars_per_line (skeleton-read "Maximum number of characters per line: "))
152  > "hebrevc(" hebrew_text ", " max_chars_per_line ");" \n
153)
154
155(define-skeleton php-hex2bin
156  "Insert a hex2bin statement. Decodes a hexadecimally encoded binary string."
157  ""
158  '(setq data (skeleton-read "Data: "))
159  > "hex2bin(" data ");" \n
160)
161
162(define-skeleton php-html_entity_decode
163  "Insert a html_entity_decode statement. Convert special characters to HTML entities"
164  ""
165  '(setq string (skeleton-read "String: "))
166  '(setq flags (skeleton-read "Flags: "))
167  '(setq encoding (skeleton-read "Encoding: "))
168  > "html_entity_decode(" string ", " flags ", " encoding ");" \n
169)
170
171(define-skeleton php-htmlentities
172  "Insert a htmlentities statement. Convert all applicable characters to HTML entities"
173  ""
174  '(setq string (skeleton-read "String: "))
175  '(setq flags (skeleton-read "Flags: "))
176  '(setq encoding (skeleton-read "Encoding: "))
177  > "htmlentities(" string ", " flags ", " encoding ");" \n
178)
179
180(define-skeleton php-htmlspecialchars_decode
181  "Insert a htmlspecialchars_decode statement. Convert special HTML entities back to characters"
182  ""
183  '(setq string (skeleton-read "String: "))
184  '(setq flags (skeleton-read "Flags: "))
185  > "htmlspecialchars_decode(" string ", " flags ");" \n
186)
187
188(define-skeleton php-htmlspecialchars
189  "Insert a htmlspecialchars_decode statement. Convert special HTML entities back to characters"
190  ""
191  '(setq string (skeleton-read "String: "))
192  '(setq flags (skeleton-read "Flags: "))
193  '(setq encoding (skeleton-read "Encoding: "))
194  '(setq double_encode (skeleton-read "Double encode (true | false): "))
195  > "htmlspecialchars_decode(" string ", " flags ");" \n
196)
197
198(define-skeleton php-implode
199  "Insert an implode statement"
200  ""
201  '(setq separator (skeleton-read "Implode separator? "))
202  '(setq var (skeleton-read "Implode variable? "))
203  > "implode('" separator "', " var 
204  (skeleton-read 
205   > ", " str )
206  > ");"
207  )
208
209(define-skeleton php-join
210  "Insert an join statement"
211  ""
212  '(setq separator (skeleton-read "Join separator? "))
213  '(setq var (skeleton-read "Join variable? "))
214  > "join('" separator "', " var 
215  (skeleton-read 
216   > ", " str )
217  > ");"
218  )
219
220(define-skeleton php-lcfirst
221  "Insert a lcfirst statement. Make a string's first character lowercase"
222  ""
223  '(setq str (skeleton-read "String? "))
224  > "lcfirst(" str ");" \n
225)
226
227(define-skeleton php-levenshtein
228  "Insert a levenshtein statement. Calculate Levenshtein distance between two strings"
229  ""
230  '(setq str1 (skeleton-read "String? "))
231  '(setq str2 (skeleton-read "String? "))
232  > "levenshtein(" str1 ", " str2 ");" \n
233)
234
235(define-skeleton php-localeconv
236  "Insert a localeconv statement."
237  > "localeconv();" \n
238)
239
240(define-skeleton php-ltrim
241  "Insert a ltrim statement"
242  ""
243  '(setq str (skeleton-read "String? "))
244  '(setq charlist (skeleton-read "Char list? "))
245  > "ltrim(" str ", " charlist ");" \n)
246
247(define-skeleton php-md5_file
248  "Insert a md5_file statement"
249  ""
250  '(setq filename (skeleton-read "Filename? "))
251  '(setq rawoutput (skeleton-read "Raw output? "))
252  > "ltrim(" filename ", " rawoutput ");" \n)
253
254(define-skeleton php-md5
255  "Insert a md5 statement"
256  ""
257  '(setq str (skeleton-read "String? "))
258  '(setq rawoutput (skeleton-read "Raw output? "))
259  > "md5(" str ", " rawoutput ");" \n)
260
261(define-skeleton php-metaphone
262  "Insert a metaphone statament"
263  ""
264  '(setq str (skeleton-read "String? "))
265  '(setq phonemes (skeleton-read "Phonemes? "))
266  > "metaphone(" str ", " phonemes ");" \n)
267
268(define-skeleton php-money_format
269  "Insert a money_format statement"
270  ""
271  '(setq str (skeleton-read "Format? "))
272  '(setq number (skeleton-read "Number? "))
273  > "money_format(" str ", " number ");" \n)
274
275(define-skeleton php-nl_langinfo
276  "Insert a nl_langinfo statement"
277  ""
278  '(setq str (skeleton-read "Item? "))
279  > "nl_langinfo(" str ");" \n)
280
281(define-skeleton php-nl2br
282  "Insert a nl2br statement"
283  ""
284  '(setq str (skeleton-read "String? "))
285  '(setq is_xhtml (skeleton-read "Is xhtml? "))
286  > "nl2br(" str ", " is_xhtml ");" \n)
287
288(define-skeleton php-number_format
289  "Insert a number_format statement"
290  ""
291  '(setq float (skeleton-read "Float? "))
292  '(setq number (skeleton-read "Number? "))
293  > "number_format(" float ", " number ");" \n)
294
295(define-skeleton php-ord
296  "Insert an ord statement"
297  ""
298  '(setq char (skeleton-read "Character? "))
299  > "ord(" str ");" \n)
300
301(define-skeleton php-parse_str
302  "Insert a parse_str statement"
303  ""
304  '(setq str (skeleton-read "String? "))
305  '(setq arr (skeleton-read "Array? "))
306  > "parse_str(" str ", " arr ");" \n)
307
308(define-skeleton php-print
309  "Insert a print statement"
310  ""
311  '(setq str (skeleton-read "String? "))
312  > "print(" str ");" \n)
313
314(define-skeleton php-printf
315  "Insert a printf statement. Output a formatted string"
316  ""
317  '(setq str (skeleton-read "String? "))
318  > "printf(" str ");" \n)
319
320(define-skeleton php-quoted_printable_decode
321  "Insert a quoted_printable_decode statement. Convert a quoted-printable string to an 8 bit string"
322  ""
323  '(setq str (skeleton-read "String? "))
324  > "quoted_printable_decode(" str ");" \n)
325
326
327(define-skeleton php-quoted_printable_encode
328  "Insert a quoted_printable_encode statement. Convert a 8 bit string to a quoted-printable string"
329  ""
330  '(setq str (skeleton-read "String? "))
331  > "quoted_printable_encode(" str ");" \n)
332
333(define-skeleton php-quotemeta
334  "Insert a quotemeta statement. Quote meta characters"
335  ""
336  '(setq str (skeleton-read "String? "))
337  > "quotemeta(" str ");" \n)
338
339(define-skeleton php-rtrim
340  "Insert a rtrim statement"
341  ""
342  '(setq str (skeleton-read "String? "))
343  > "rtrim(" str ");" \n)
344
345(define-skeleton php-setlocale
346  "Insert a setlocale statement"
347  '(setq category (skeleton-read "Category? "))
348  '(setq locale (skeleton-read "Locale? "))
349  > "setlocale(" category ", " locale ");" \n
350)
351
352(define-skeleton php-sha1_file
353  "Insert a sha1_file statement. Calculate the sha1 of a file"
354  ""
355  '(setq filename (skeleton-read "Filename? "))
356  '(setq rawoutuput (skeleton-read "Rawoutuput? "))
357  > "sha1_file(" filename ", " rawoutuput ");" \n
358)
359
360(define-skeleton php-sha1
361  "Insert a sha1 statement. Calculate the sha1 of a string"
362  ""
363  '(setq string (skeleton-read "String? "))
364  '(setq rawoutuput (skeleton-read "Rawoutuput? "))
365  > "sha1_file(" string ", " rawoutuput ");" \n
366)
367
368(define-skeleton php-similar_text
369  "Insert a similar_text statement. Calculate the similarity between two words"
370  ""
371  '(setq first (skeleton-read "First string? "))
372  '(setq second (skeleton-read "Second string? "))
373  '(setq percentage (skeleton-read "Percentage? "))
374  > "similar_text(" first ", " second ", " percentage ");" \n
375)
376
377(define-skeleton php-soundex
378  "Insert a soundex statement. Calculates the soundex key of a string"
379  ""
380  '(setq str (skeleton-read "String? "))
381  > "soundex(" str ");" \n
382)
383
384(define-skeleton php-sprintf
385  "Insert a sprintf statement. Return a formatted string"
386  ""
387  '(setq str (skeleton-read "String? "))
388  > "sprintf(" str ");" \n
389)
390  
391(define-skeleton php-sscanf
392  "Insert a sscanf statement. Parses input from a string according to a format"
393  ""
394  '(setq str (skeleton-read "String? "))
395  '(setq format (skeleton-read "Format? "))
396  > "sprintf(" str ", " format ");" \n
397)
398  
399(define-skeleton php-str_getcsv
400  "Insert a str_getcsv statement. Parse a CSV string into an array"
401  ""
402  '(setq input (skeleton-read "Input? "))
403  '(setq delimiter (skeleton-read "Delimiter? "))
404  '(setq enclosure (skeleton-read "Enclosure? "))
405  '(setq escape (skeleton-read "Escape? "))
406  > "str_getcsv(" input ", " delimiter ", " enclosure ", " escape ");" \n
407)
408
409(define-skeleton php-str_ireplace
410  "Insert a str_ireplace statement. Case-insensitive version of str_replace."
411  ""
412  '(setq search (skeleton-read "Search? "))
413  '(setq replace (skeleton-read "Replace? "))
414  '(setq subject (skeleton-read "Subject? "))
415  '(setq count (skeleton-read "Count? "))
416  > "str_ireplace(" search ", " replace ", " subject ", " count ");" \n
417)
418
419(define-skeleton php-str_pad
420  "Insert a str_pad statement. Pad a string to a certain length with another string"
421  ""
422  '(setq input (skeleton-read "Input? "))
423  '(setq pad_length (skeleton-read "Pad length? "))
424  '(setq pad_string (skeleton-read "Pad string? "))
425  '(setq pad_type (skeleton-read "Pad type? "))
426  > "str_pad(" input ", " pad_length ", " pad_string ", " pad_type ");" \n
427)
428
429(define-skeleton php-str_repeat
430  "Insert a str_repeat statement. Repeat a string"
431  ""
432  '(setq input (skeleton-read "Input? "))
433  '(setq multiplier (skeleton-read "Multiplier? "))
434  > "str_repeat(" input ", " multiplier ");" \n
435)
436
437
438(define-skeleton php-str_rot13
439  "Insert a str_rot13 statement"
440  ""
441  '(setq str (skeleton-read "String? "))
442  > "str_rot13(" str ");" \n
443)
444
445(define-skeleton php-str_shuffle
446  "Insert a str_shuffle statement"
447  ""
448  '(setq str (skeleton-read "String? "))
449  > "str_shuffle(" str ");" \n
450)
451
452(define-skeleton php-str_split
453  "Insert a str_shuffle statement"
454  ""
455  '(setq str (skeleton-read "String? "))
456  '(setq split_length (skeleton-read "Split length? "))
457  > "str_split(" str ", " split_length ");" \n
458)
459
460(define-skeleton php-str_word_count
461  "Insert a str_word_count statement. Return information about words used in a string."
462  ""
463  '(setq str (skeleton-read "String? "))
464  '(setq format (skeleton-read "Format? "))
465  '(setq charlist (skeleton-read "Charlist? "))
466  > "str_word_count(" str ", " format ", " charlist ");" \n
467)
468
469(define-skeleton php-strcasecmp
470  "Insert a strcasecmp statement. Binary safe case-insensitive string comparison"
471  ""
472  '(setq str (skeleton-read "String? "))
473  '(setq str2 (skeleton-read "String? "))
474  > "strcasecmp(" str ", " str2 ");" \n
475)
476
477(define-skeleton php-strcmp
478  "Insert a strcmp statement. Binary safe string comparison"
479  ""
480  '(setq str (skeleton-read "String? "))
481  '(setq str2 (skeleton-read "String? "))
482  > "strcmp(" str ", " str2 ");" \n
483)
484
485(define-skeleton php-strcoll
486  "Insert a strcoll statement. Locale based string comparison"
487  ""
488  '(setq str (skeleton-read "String? "))
489  '(setq str2 (skeleton-read "String? "))
490  > "strcoll(" str ", " str2 ");" \n
491)
492
493(define-skeleton php-strcspn
494  "Insert a strcspn statement. Find length of initial segment not matching mask"
495  ""
496  '(setq str (skeleton-read "String? "))
497  '(setq str2 (skeleton-read "String? "))
498  '(setq start (skeleton-read "The start position of the string? "))
499  '(setq length (skeleton-read "The length of the string? "))
500  > "strcspn(" str ", " str2 ");" \n
501)
502
503(define-skeleton php-strip_tags
504  "Insert a strip_tags statement. Strip HTML and PHP tags from a string"
505  ""
506  '(setq str (skeleton-read "String? "))
507  '(setq allowable_tags (skeleton-read "Allowable tags? "))
508  > "strcoll(" str ", " allowable_tags ");" \n
509)
510
511(define-skeleton php-stripslashes
512  "Insert a stripcslashes statement."
513  ""
514  '(setq str (skeleton-read "String? "))
515  > "stripcslashes(" str ");" \n
516)
517
518(define-skeleton php-stripcslashes
519  "Insert a stripcslashes statement. Find the numeric position of the first occurrence of needle in the haystack string. "
520  ""
521  '(setq haystack (skeleton-read "String haystack? "))
522  '(setq needle (skeleton-read "String needle? "))
523  '(setq offset (skeleton-read "Offset?"))
524  > "stripcslashes(" haystack ", " needle ", " offset ");" \n
525)
526
527(define-skeleton php-stristr
528  "Insert a stristr statement. Case-insensitive strstr "
529  ""
530  '(setq haystack (skeleton-read "String haystack? "))
531  '(setq needle (skeleton-read "String needle? "))
532  '(setq before_needle (skeleton-read "Before needle?"))
533  > "stripcslashes(" haystack ", " needle ", " before_needle ");" \n
534)
535
536(define-skeleton php-strlen
537  "Insert a strlen statement"
538  ""
539  '(setq str (skeleton-read "String? "))
540  > "strlen(" str ");" \n)
541
542(define-skeleton php-strnatcasecmp
543  "Insert a strnatcasecmp statement"
544  ""
545  '(setq str (skeleton-read "String? "))
546  '(setq str2 (skeleton-read "String? "))
547  > "strnatcasecmp(" str "," str2 ");" \n)
548
549(define-skeleton php-strnatcmp
550  "Insert a strnatcasecmp statement. String comparisons using a natural order algorithm"
551  ""
552  '(setq str (skeleton-read "String? "))
553  '(setq str2 (skeleton-read "String? "))
554  > "strnatcmp(" str "," str2 ");" \n)
555
556(define-skeleton php-strncasecmp
557  "Insert a strncasecmp statement. Binary safe case-insensitive string comparison of the first n characters"
558  ""
559  '(setq str (skeleton-read "String? "))
560  '(setq str2 (skeleton-read "String? "))
561  '(setq len (skeleton-read "Length? "))
562  > "strncasecmp(" str "," str2 ", " len ");" \n)
563
564(define-skeleton php-strncmp
565  "Insert a strncmp statement." 
566  ""
567  '(setq str (skeleton-read "String? "))
568  '(setq str2 (skeleton-read "String? "))
569  '(setq len (skeleton-read "Length? "))
570  > "strncmp(" str "," str2 ", " len ");" \n)
571
572(define-skeleton php-strpbrk
573  "Insert a strpbrk statement"
574  ""
575  '(setq haystack (skeleton-read "String? "))
576  '(setq charlist (skeleton-read "Char list? "))
577  > "strlen(" str ", " charlist ");" \n)
578
579(define-skeleton php-strpos
580  "Insert a strpos statement."
581  ""
582  '(setq haystack (skeleton-read "String haystack? "))
583  '(setq needle (skeleton-read "String needle? "))
584  '(setq offset (skeleton-read "Offset?"))
585  > "strpos(" haystack ", " needle ", " offset ");" \n
586)
587
588(define-skeleton php-strrchr
589  "Insert a strrchr statement. Find the last occurrence of a character in a string"
590  ""
591  '(setq haystack (skeleton-read "String haystack? "))
592  '(setq needle (skeleton-read "String needle? "))
593  > "strrchr(" haystack ", " needle ");" \n
594)
595
596(define-skeleton php-strrev
597  "Insert a strrev statement. Reverse a string"
598  ""
599  '(setq string (skeleton-read "String? "))
600  > "strrev(" string ");" \n
601)
602
603(define-skeleton php-strripos
604  "Insert a strripos statement. Find the position of the last occurrence of a case-insensitive substring in a string"
605  ""
606  '(setq haystack (skeleton-read "String haystack? "))
607  '(setq needle (skeleton-read "String needle? "))
608  '(setq offset (skeleton-read "Offset?"))
609  > "strripos(" string ", " needle ", " offset ");" \n
610)
611
612(define-skeleton php-strrpos
613  "Insert a strripos statement. Find the position of the last occurrence of a substring in a string"
614  ""
615  '(setq haystack (skeleton-read "String haystack? "))
616  '(setq needle (skeleton-read "String needle? "))
617  '(setq offset (skeleton-read "Offset?"))
618  > "strrpos(" string ", " needle ", " offset ");" \n
619)
620
621(define-skeleton php-strspn
622  "Insert a strspn statement."
623  ""
624  '(setq subject (skeleton-read "Subject? "))
625  '(setq mask (skeleton-read "Mask? "))
626  '(setq start (skeleton-read "Start? "))
627  '(setq length (skeleton-read "Length? "))
628  > "strspn(" subject ", " mask ", " start ", " length ");" \n
629)
630
631(define-skeleton php-strstr
632  "Insert a strstr statement. Find the first occurrence of a stringFind the first occurrence of a string"
633  ""
634  '(setq haystack (skeleton-read "String haystack? "))
635  '(setq needle (skeleton-read "String needle? "))
636  '(setq before_needle (skeleton-read "Before needle?"))
637  > "strstr(" string ", " needle ", " before_needle ");" \n
638)
639
640(define-skeleton php-strtok
641  "Insert a strlower statement"
642  ""
643  '(setq str (skeleton-read "String? "))
644  '(setq token (skeleton-read "Token? "))
645  > "strtolower(" str ");" \n)
646
647
648(define-skeleton php-strtolower
649  "Insert a strlower statement"
650  ""
651  '(setq str (skeleton-read "String? "))
652  > "strtolower(" str ");" \n)
653
654(define-skeleton php-strtotime
655  "Insert a strtotime statement"
656  ""
657  '(setq str (skeleton-read "String? "))
658  > "strtotime(" str ");" \n)
659
660(define-skeleton php-strtoupper
661  "Insert a strtoupper statement"
662  ""
663  '(setq str (skeleton-read "String? "))
664  > "strtoupper(" str ");" \n)
665
666
667(define-skeleton php-strtr 
668  "Insert a strtr statement"
669  ""
670  '(setq str (skeleton-read "String? "))
671  '(setq from (skeleton-read "From? "))
672  '(setq to (skeleton-read "To? "))
673  > "strtr(" str ", " from ", " to ");" \n
674)
675
676(define-skeleton php-substr_compare
677  "Insert a substr_compare"
678  ""
679  '(setq main_str (skeleton-read "The main string being compared? "))
680  '(setq str (skeleton-read "The secondary string being compared? "))
681  '(setq offset (skeleton-read "The start position for the comparison? "))
682  '(setq length (skeleton-read "The length of the comparison? "))
683  > "substr_compare(" main_str ", " str ", " offset ", " length ");" \n
684)
685
686(define-skeleton php-substr_count
687  "Insert a substr_count"
688  ""
689  '(setq haystack (skeleton-read "String haystack? "))
690  '(setq needle (skeleton-read "String needle? "))
691  '(setq offset (skeleton-read "Offset?"))
692  '(setq length (skeleton-read "Length? "))
693  > "substr_count(" haystack ", " needle ", " offset ", " length ");" \n
694)
695
696(define-skeleton php-substr_replace
697  "Insert a substr_replace"
698  ""
699  '(setq str (skeleton-read "String? "))
700  '(setq replacement (skeleton-read "Replacement? "))
701  '(setq start (skeleton-read "Start? "))
702  '(setq length (skeleton-read "Length? "))
703  > "substr_replace(" str ", " replacement ", " start ", " length ");" \n
704)
705
706(define-skeleton php-substr
707  "Insert a substr_replace statement"
708  ""
709  '(setq str (skeleton-read "String? "))
710  '(setq start (skeleton-read "Start? "))
711  '(setq length (skeleton-read "Length? "))
712  > "substr(" str ", " start ", " length ");" \n
713)
714
715(define-skeleton php-trim
716  "Insert a trim statement"
717  ""
718  '(setq str (skeleton-read "String? "))
719  '(setq charlist (skeleton-read "Charlist? "))
720  > "trim(" str ", " charlist ");" \n
721)
722
723(define-skeleton php-ucfirst
724  "Insert a ucfirst statement"
725  ""
726  '(setq str (skeleton-read "String? "))
727  > "ucfirst('" str "');" \n)
728
729(define-skeleton php-ucwords
730  "Insert a ucfirst statement"
731  ""
732  '(setq str (skeleton-read "String? "))
733  > "ucwords('" str "');" \n)
734
735(define-skeleton php-vfprintf 
736  "Insert a vfprintf statement"
737  ""
738  '(setq handle (skeleton-read "Handle? "))
739  '(setq format (skeleton-read "Format? "))
740  '(setq args (skeleton-read "Args? "))
741  > "vfprintf(" handle ", " format ", " args ");" \n
742)
743
744(define-skeleton php-vprintf 
745  "Insert a vprintf statement"
746  ""
747  '(setq format (skeleton-read "Format? "))
748  '(setq args (skeleton-read "Args? "))
749  > "vprintf(" format ", " args ");" \n
750)
751
752(define-skeleton php-vsprintf 
753  "Insert a vsprintf statement"
754  ""
755  '(setq format (skeleton-read "Format? "))
756  '(setq args (skeleton-read "Args? "))
757  > "vsprintf(" format ", " args ");" \n
758)
759
760(define-skeleton php-wordwrap
761  "Insert a wordwrap statement. Wraps a string to a given number of characters" 
762  ""
763  '(setq str (skeleton-read "String? "))
764  '(setq width (skeleton-read "Width? "))
765  '(setq break (skeleton-read "Break? "))
766  '(setq cut (skeleton-read "Cut? (TRUE | FALSE) "))
767  > "wordwrap(" str ", " width ", " break ", " cut ");" \n
768)