./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package rinaldi.array | |
| { | |
| import rinaldi.string.isInString; | |
| /** | |
| * | |
| * Search something inside an array, using filters similars to "LIKE" filters from Oracle. | |
| * The search is case sensitive! | |
| * | |
| * @param p_arr Data provider. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| /** | |
| * Offers functionality similar to mkdir -p | |
| * | |
| * Asynchronous operation. No arguments other than a possible exception | |
| * are given to the completion callback. | |
| */ | |
| function mkdir_p(path, mode, callback, position) { | |
| mode = mode || 0777; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # setup msmtp for sending out email | |
| # as an alternative to sendmail | |
| # i prefer this because it is easier to install and configure than sendmail | |
| # especially when using Gmail smtp servers | |
| sudo -i | |
| apt-get install msmtp | |
| ln -s /usr/bin/msmtp /usr/sbin/sendmail | |
| touch /var/log/msmtprc && chmod 666 /var/log/msmtprc | |
| vim /etc/msmtprc | |
| # config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * DOMParser HTML extension | |
| * 2019-11-13 | |
| * | |
| * By Eli Grey, http://eligrey.com | |
| * Public domain. | |
| * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
| */ | |
| /*! @source https://gist.github.com/1129031 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Upload your files</title> | |
| </head> | |
| <body> | |
| <form enctype="multipart/form-data" action="upload.php" method="POST"> | |
| <p>Upload your file</p> | |
| <input type="file" name="uploaded_file"></input><br /> | |
| <input type="submit" value="Upload"></input> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (!function_exists('get_post_id_by_meta_key_and_value')) { | |
| /** | |
| * Get post id from meta key and value | |
| * @param string $key | |
| * @param mixed $value | |
| * @return int|bool | |
| * @author David Mårtensson <david.martensson@gmail.com> | |
| */ | |
| function get_post_id_by_meta_key_and_value($key, $value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //return an array of objects according to key, value, or key and value matching | |
| function getObjects(obj, key, val) { | |
| var objects = []; | |
| for (var i in obj) { | |
| if (!obj.hasOwnProperty(i)) continue; | |
| if (typeof obj[i] == 'object') { | |
| objects = objects.concat(getObjects(obj[i], key, val)); | |
| } else | |
| //if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
| if (i == key && obj[i] == val || i == key && val == '') { // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Requires JQuery and CORS enabled for the Origin you're testing from. | |
| // Uncomment the next 4 lines to import JQuery | |
| // var script= document.createElement('script'); | |
| // script.type= 'text/javascript'; | |
| // script.src= '//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js'; | |
| // document.head.appendChild(script); | |
| // Set up the multipart form using HTML5 FormData object | |
| // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/FormData | |
| var form = new FormData(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $file = '/path/to/file.png'; | |
| $filename = basename($file); | |
| $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
| if (!$upload_file['error']) { | |
| $wp_filetype = wp_check_filetype($filename, null ); | |
| $attachment = array( | |
| 'post_mime_type' => $wp_filetype['type'], | |
| 'post_parent' => $parent_post_id, |
OlderNewer