Changeset 1809 for sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
- Timestamp:
- 08/05/2015 03:21:30 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r1773 r1809 773 773 return true; 774 774 } 775 776 /** 777 * Import theme strings to GlotPress on upload for previously-live themes. 778 * 779 * @param object $theme The WP_Theme instance of the uploaded theme. 780 * @param WP_post $theme_post The WP_Post representing the theme. 781 */ 782 function wporg_themes_glotpress_import_on_update( $theme, $theme_post ) { 783 $status = (array) get_post_meta( $theme_post->ID, '_status', true ); 784 if ( array_search( 'live', $status ) ) { 785 // Previously live, import updated strings immediately. 786 $version = $theme->get( 'Version' ); 787 wporg_themes_glotpress_import( $theme_post, $version ); 788 } 789 } 790 add_action( 'theme_upload', 'wporg_themes_glotpress_theme_update_uploaded', 100, 2 ); 791 792 /** 793 * Import theme strings to GlotPress on approval. 794 * 795 * @param WP_Post|int $theme_post The WP_Post (or post_id) representing the theme. 796 * @param string $version The version of the theme to import. 797 */ 798 function wporg_themes_glotpress_import( $theme_post, $version ) { 799 $theme_post = get_post( $theme_post ); 800 801 if ( ! $theme_post || ! $version ) { 802 return; 803 } 804 805 $cmd = '/usr/local/bin/php ' . WPORGPATH . 'translate/bin/projects/add-wp-themes-project.php ' . escapeshellarg( $theme_post->post_name ) . ' ' . escapeshellarg( $version ); 806 807 $output = shell_exec( $cmd ); 808 809 // Temporary Debug. 810 if ( function_exists( 'slack_dm' ) ) { 811 $backtrace = wp_debug_backtrace_summary(); 812 slack_dm( print_r( compact( 'cmd', 'theme_post', 'version', 'output', 'backtrace' ), true ), 'dd32' ); 813 } 814 } 815 add_action( 'wporg_themes_update_version_live', 'wporg_themes_glotpress_import', 100, 2 ); 816
Note: See TracChangeset
for help on using the changeset viewer.