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
| SELECT CONCAT( "ALTER TABLE ", table_name, " ENGINE=InnoDB;" ) | |
| FROM information_schema.tables | |
| WHERE engine = 'MyISAM' | |
| AND table_schema = 'DBName'; |
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 | |
| spl_autoload_register( function ( $className ) { | |
| if ( file_exists( $file = sprintf( '%1$s/%2$s.php', dirname( __FILE__ ), str_replace( "\\", '/', $className ) ) ) ) { | |
| require_once( $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
| <?php | |
| /** | |
| * Imports an image from URL into media libarary. | |
| * | |
| * @param string $url The image URL | |
| * @param string|null $title The title to use for image in the media library (also will be added as ALT text) | |
| * @param int $post_parent_id Post parent ID if applicable | |
| * | |
| * @return int|\WP_Error ID of the newly created attachment or Wp_Error object on failure |
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 | |
| trait Singleton { | |
| /** | |
| * @var static $instance | |
| */ | |
| protected static $instance; | |
| /** | |
| * @return static |
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 | |
| /** | |
| * PSR-4 Autoloader. | |
| */ | |
| spl_autoload_register( function ( $class ) { | |
| // validate namespace | |
| if ( | |
| strncmp( |
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 | |
| /** | |
| * WordPress classes autoloader. | |
| */ | |
| spl_autoload_register( function ( $class ) { | |
| if ( file_exists( | |
| $file = join( | |
| DIRECTORY_SEPARATOR, | |
| array( |
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 | |
| /** | |
| * Sets _wp_attachment_image_alt meta key for attachment images based on title. | |
| * | |
| * @return array | |
| */ | |
| function set_images_alt_text_from_title() { | |
| global $wpdb; |
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 | |
| /** | |
| * Load plugin text domain. | |
| */ | |
| add_action( 'plugins_loaded', function () { | |
| load_plugin_textdomain( 'text-domain', false, basename( dirname( __FILE__ ) . '/languages' ) ); | |
| }, 10, 0 ); |
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 | |
| /** | |
| * Returns current stylesheet handle used in wp_register_style() function or NULL if not found. | |
| * | |
| * @return string|null | |
| */ | |
| function get_current_stylesheet_handle() { | |
| $pattern = sprintf( | |
| '/%1$s\/style\.(min\.)?css/', |