当前位置: 首页>>代码示例>>PHP>>正文


PHP themes_api函数代码示例

本文整理汇总了PHP中themes_api函数的典型用法代码示例。如果您正苦于以下问题:PHP themes_api函数的具体用法?PHP themes_api怎么用?PHP themes_api使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了themes_api函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _retrieve_data

 /**
  * @access protected
  *
  * @return bool
  */
 public function _retrieve_data()
 {
     require_once ABSPATH . 'wp-admin/includes/theme.php';
     $args = array('author' => $this->options['username'], 'per_page' => 30, 'fields' => array('description' => false, 'compatibility' => false, 'icons' => true, 'downloaded' => true, 'last_updated' => true));
     $data = themes_api('query_themes', $args);
     if ($data && isset($data->themes)) {
         $data = array('data' => $data->themes, 'expiration' => time() + $this->expiration);
         update_post_meta($this->post->ID, '_themes', $data);
         return $data;
     }
     return false;
 }
开发者ID:Steadroy,项目名称:wptalents,代码行数:17,代码来源:Theme_Collector.php

示例2: wp_ajax_install_theme

/**
 * AJAX handler for installing a theme.
 *
 * @since 4.X.0
 */
function wp_ajax_install_theme()
{
    check_ajax_referer('updates');
    if (empty($_POST['slug'])) {
        wp_send_json_error(array('errorCode' => 'no_theme_specified'));
    }
    $status = array('install' => 'theme', 'slug' => sanitize_key($_POST['slug']));
    if (!current_user_can('install_themes')) {
        $status['error'] = __('You do not have sufficient permissions to install themes on this site.');
        wp_send_json_error($status);
    }
    include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    include_once ABSPATH . 'wp-admin/includes/theme.php';
    $api = themes_api('theme_information', array('slug' => $status['slug'], 'fields' => array('sections' => false)));
    if (is_wp_error($api)) {
        $status['error'] = $api->get_error_message();
        wp_send_json_error($status);
    }
    $upgrader = new Theme_Upgrader(new Automatic_Upgrader_Skin());
    $result = $upgrader->install($api->download_link);
    if (defined('WP_DEBUG') && WP_DEBUG) {
        $status['debug'] = $upgrader->skin->get_upgrade_messages();
    }
    if (is_wp_error($result)) {
        $status['error'] = $result->get_error_message();
        wp_send_json_error($status);
    } else {
        if (is_null($result)) {
            global $wp_filesystem;
            $status['errorCode'] = 'unable_to_connect_to_filesystem';
            $status['error'] = __('Unable to connect to the filesystem. Please confirm your credentials.');
            // Pass through the error from WP_Filesystem if one was raised.
            if ($wp_filesystem instanceof WP_Filesystem_Base && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
                $status['error'] = $wp_filesystem->errors->get_error_message();
            }
            wp_send_json_error($status);
        }
    }
    // Never switch to theme (unlike plugin activation).
    // See WP_Theme_Install_List_Table::_get_theme_status() if we wanted to check on post-install status.
    wp_send_json_success($status);
}
开发者ID:afragen,项目名称:shiny-updates,代码行数:47,代码来源:ajax-actions.php

示例3: _wprp_install_theme

/**
 * Install a theme
 *
 * @param  mixed $theme
 * @param array $args
 * @return array|bool
 */
function _wprp_install_theme($theme, $args = array())
{
    if (defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS) {
        return new WP_Error('disallow-file-mods', __("File modification is disabled with the DISALLOW_FILE_MODS constant.", 'wpremote'));
    }
    if (wp_get_theme($theme)->exists()) {
        return new WP_Error('theme-installed', __('Theme is already installed.'));
    }
    include_once ABSPATH . 'wp-admin/includes/admin.php';
    include_once ABSPATH . 'wp-admin/includes/upgrade.php';
    include_once ABSPATH . 'wp-includes/update.php';
    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-theme-upgrader-skin.php';
    // Access the themes_api() helper function
    include_once ABSPATH . 'wp-admin/includes/theme-install.php';
    $api_args = array('slug' => $theme, 'fields' => array('sections' => false));
    $api = themes_api('theme_information', $api_args);
    if (is_wp_error($api)) {
        return $api;
    }
    $skin = new WPRP_Theme_Upgrader_Skin();
    $upgrader = new Theme_Upgrader($skin);
    // The best way to get a download link for a specific version :(
    // Fortunately, we can depend on a relatively consistent naming pattern
    if (!empty($args['version']) && 'stable' != $args['version']) {
        $api->download_link = str_replace($api->version . '.zip', $args['version'] . '.zip', $api->download_link);
    }
    $result = $upgrader->install($api->download_link);
    if (is_wp_error($result)) {
        return $result;
    } else {
        if (!$result) {
            return new WP_Error('unknown-install-error', __('Unknown error installing theme.', 'wpremote'));
        }
    }
    return array('status' => 'success');
}
开发者ID:phpwomen,项目名称:combell,代码行数:44,代码来源:wprp.themes.php

示例4: prepareInstall

 public static function prepareInstall()
 {
     include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
     if (!isset($_POST['url'])) {
         if ($_POST['type'] == 'plugin') {
             $api = plugins_api('plugin_information', array('slug' => $_POST['slug'], 'fields' => array('sections' => false)));
             //Save on a bit of bandwidth.
         } else {
             $api = themes_api('theme_information', array('slug' => $_POST['slug'], 'fields' => array('sections' => false)));
             //Save on a bit of bandwidth.
         }
         $url = $api->download_link;
     } else {
         $url = $_POST['url'];
         $mwpDir = MainWPUtility::getMainWPDir();
         $mwpUrl = $mwpDir[1];
         if (stristr($url, $mwpUrl)) {
             $fullFile = $mwpDir[0] . str_replace($mwpUrl, '', $url);
             $url = admin_url('?sig=' . md5(filesize($fullFile)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir[0], "", $fullFile)));
         }
     }
     $output = array();
     $output['url'] = $url;
     $output['sites'] = array();
     if ($_POST['selected_by'] == 'site') {
         //Get sites
         foreach ($_POST['selected_sites'] as $enc_id) {
             $websiteid = $enc_id;
             if (MainWPUtility::ctype_digit($websiteid)) {
                 $website = MainWPDB::Instance()->getWebsiteById($websiteid);
                 $output['sites'][$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name'));
             }
         }
     } else {
         //Get sites from group
         foreach ($_POST['selected_groups'] as $enc_id) {
             $groupid = $enc_id;
             if (MainWPUtility::ctype_digit($groupid)) {
                 $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupId($groupid));
                 while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                     if ($website->sync_errors != '') {
                         continue;
                     }
                     $output['sites'][$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name'));
                 }
                 @MainWPDB::free_result($websites);
             }
         }
     }
     die(json_encode($output));
 }
开发者ID:HasClass0,项目名称:mainwp,代码行数:51,代码来源:MainWPInstallBulk.page.php

示例5: array_map

     $themes = array_map('urldecode', $themes);
     $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
     $nonce = 'bulk-update-themes';
     wp_enqueue_script('updates');
     iframe_header();
     $upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url')));
     $upgrader->bulk_upgrade($themes);
     iframe_footer();
 } elseif ('install-theme' == $action) {
     if (!current_user_can('install_themes')) {
         wp_die(__('You do not have sufficient permissions to install themes on this site.'));
     }
     include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     //for themes_api..
     check_admin_referer('install-theme_' . $theme);
     $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false)));
     //Save on a bit of bandwidth.
     if (is_wp_error($api)) {
         wp_die($api);
     }
     wp_enqueue_script('customize-loader');
     $title = __('Install Themes');
     $parent_file = 'themes.php';
     $submenu_file = 'themes.php';
     require_once ABSPATH . 'wp-admin/admin-header.php';
     $title = sprintf(__('Installing Theme: %s'), $api->name . ' ' . $api->version);
     $nonce = 'install-theme_' . $theme;
     $url = 'update.php?action=install-theme&theme=' . urlencode($theme);
     $type = 'web';
     //Install theme type, From Web or an Upload.
     $upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:31,代码来源:update.php

示例6: prepare_items

	function prepare_items() {
		include( ABSPATH . 'wp-admin/includes/theme-install.php' );

		global $tabs, $tab, $paged, $type, $term, $theme_field_defaults;

		wp_reset_vars( array( 'tab' ) );

		$paged = $this->get_pagenum();

		$per_page = 30;

		// These are the tabs which are shown on the page,
		$tabs = array();
		$tabs['dashboard'] = __( 'Search' );
		if ( 'search' == $tab )
			$tabs['search']	= __( 'Search Results' );
		$tabs['upload'] = __( 'Upload' );
		$tabs['featured'] = _x( 'Featured','Theme Installer' );
		//$tabs['popular']  = _x( 'Popular','Theme Installer' );
		$tabs['new']      = _x( 'Newest','Theme Installer' );
		$tabs['updated']  = _x( 'Recently Updated','Theme Installer' );

		$nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item.

		$tabs = apply_filters( 'install_themes_tabs', $tabs );
		$nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );

		// If a non-valid menu tab has been selected, And its not a non-menu action.
		if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) )
			$tab = key( $tabs );

		$args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults );

		switch ( $tab ) {
			case 'search':
				$type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
				$term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';

				switch ( $type ) {
					case 'tag':
						$terms = explode( ',', $term );
						$terms = array_map( 'trim', $terms );
						$terms = array_map( 'sanitize_title_with_dashes', $terms );
						$args['tag'] = $terms;
						break;
					case 'term':
						$args['search'] = $term;
						break;
					case 'author':
						$args['author'] = $term;
						break;
				}

				if ( !empty( $_POST['features'] ) ) {
					$terms = $_POST['features'];
					$terms = array_map( 'trim', $terms );
					$terms = array_map( 'sanitize_title_with_dashes', $terms );
					$args['tag'] = $terms;
					$_REQUEST['s'] = implode( ',', $terms );
					$_REQUEST['type'] = 'tag';
				}

				add_action( 'install_themes_table_header', 'install_theme_search_form' );
				break;

			case 'featured':
			//case 'popular':
			case 'new':
			case 'updated':
				$args['browse'] = $tab;
				break;

			default:
				$args = false;
		}

		if ( !$args )
			return;

		$api = themes_api( 'query_themes', $args );

		if ( is_wp_error( $api ) )
			wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' );

		$this->items = $api->themes;

		$this->set_pagination_args( array(
			'total_items' => $api->info['results'],
			'per_page' => $per_page,
		) );
	}
开发者ID:realfluid,项目名称:umbaugh,代码行数:91,代码来源:class-wp-theme-install-list-table.php

示例7: _search

 /**
  * Search wordpress.org repo.
  *
  * @param  array $args       A arguments array containing the search term in the first element.
  * @param  array $assoc_args Data passed in from command.
  */
 protected function _search($args, $assoc_args)
 {
     $term = $args[0];
     $defaults = array('per-page' => 10, 'page' => 1, 'fields' => implode(',', array('name', 'slug', 'rating')));
     $assoc_args = array_merge($defaults, $assoc_args);
     $fields = array();
     foreach (explode(',', $assoc_args['fields']) as $field) {
         $fields[$field] = true;
     }
     $formatter = $this->get_formatter($assoc_args);
     $api_args = array('per_page' => (int) $assoc_args['per-page'], 'page' => (int) $assoc_args['page'], 'search' => $term, 'fields' => $fields);
     if ('plugin' == $this->item_type) {
         $api = plugins_api('query_plugins', $api_args);
     } else {
         $api = themes_api('query_themes', $api_args);
     }
     if (is_wp_error($api)) {
         \WP_CLI::error($api->get_error_message() . __(' Try again'));
     }
     $plural = $this->item_type . 's';
     if (!isset($api->{$plural})) {
         \WP_CLI::error(__('API error. Try Again.'));
     }
     $items = $api->{$plural};
     $count = \WP_CLI\Utils\get_flag_value($api->info, 'results', 'unknown');
     \WP_CLI::success(sprintf('Showing %s of %s %s.', count($items), $count, $plural));
     $formatter->display_items($items);
 }
开发者ID:ryanshoover,项目名称:wp-cli,代码行数:34,代码来源:CommandWithUpgrade.php

示例8: check_parent_theme_filter

 /**
  * Check if a child theme is being installed and we need to install its parent.
  *
  * Hooked to the {@see 'upgrader_post_install'} filter by {@see Theme_Upgrader::install()}.
  *
  * @since 3.4.0
  */
 public function check_parent_theme_filter($install_result, $hook_extra, $child_result)
 {
     // Check to see if we need to install a parent theme
     $theme_info = $this->theme_info();
     if (!$theme_info->parent()) {
         return $install_result;
     }
     $this->skin->feedback('parent_theme_search');
     if (!$theme_info->parent()->errors()) {
         $this->skin->feedback('parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version'));
         // We already have the theme, fall through.
         return $install_result;
     }
     // We don't have the parent theme, let's install it.
     $api = themes_api('theme_information', array('slug' => $theme_info->get('Template'), 'fields' => array('sections' => false, 'tags' => false)));
     //Save on a bit of bandwidth.
     if (!$api || is_wp_error($api)) {
         $this->skin->feedback('parent_theme_not_found', $theme_info->get('Template'));
         // Don't show activate or preview actions after install
         add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions'));
         return $install_result;
     }
     // Backup required data we're going to override:
     $child_api = $this->skin->api;
     $child_success_message = $this->strings['process_success'];
     // Override them
     $this->skin->api = $api;
     $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];
     //, $api->name, $api->version);
     $this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version);
     add_filter('install_theme_complete_actions', '__return_false', 999);
     // Don't show any actions after installing the theme.
     // Install the parent theme
     $parent_result = $this->run(array('package' => $api->download_link, 'destination' => get_theme_root(), 'clear_destination' => false, 'clear_working' => true));
     if (is_wp_error($parent_result)) {
         add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions'));
     }
     // Start cleaning up after the parents installation
     remove_filter('install_theme_complete_actions', '__return_false', 999);
     // Reset child's result and data
     $this->result = $child_result;
     $this->skin->api = $child_api;
     $this->strings['process_success'] = $child_success_message;
     return $install_result;
 }
开发者ID:sunyang3721,项目名称:wp-for-sae,代码行数:52,代码来源:class-wp-upgrader.php

示例9: wp3sixty_ping_theme_api

function wp3sixty_ping_theme_api($theme_slug)
{
    require_once ABSPATH . '/wp-admin/includes/theme.php';
    return themes_api('theme_information', array('slug' => wp_unslash($theme_slug)));
}
开发者ID:wp3sixty,项目名称:wp3sixty-extra,代码行数:5,代码来源:class-wp-3sixty-metabox.php

示例10: wp_ajax_query_themes

/**
 * Get themes from themes_api().
 *
 * @since 3.9.0
 */
function wp_ajax_query_themes() {
	global $themes_allowedtags, $theme_field_defaults;

	if ( ! current_user_can( 'install_themes' ) ) {
		wp_send_json_error();
	}

	$args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array(
		'per_page' => 20,
		'fields'   => $theme_field_defaults
	) );

	$old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search';

	/** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
	$args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args );

	$api = themes_api( 'query_themes', $args );

	if ( is_wp_error( $api ) ) {
		wp_send_json_error();
	}

	$update_php = network_admin_url( 'update.php?action=install-theme' );
	foreach ( $api->themes as &$theme ) {
		$theme->install_url = add_query_arg( array(
			'theme'    => $theme->slug,
			'_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug )
		), $update_php );

		$theme->name        = wp_kses( $theme->name, $themes_allowedtags );
		$theme->author      = wp_kses( $theme->author, $themes_allowedtags );
		$theme->version     = wp_kses( $theme->version, $themes_allowedtags );
		$theme->description = wp_kses( $theme->description, $themes_allowedtags );
		$theme->num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
	}

	wp_send_json_success( $api );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:44,代码来源:ajax-actions.php

示例11: wp_ajax_install_theme

/**
 * Ajax handler for installing a theme.
 *
 * @since 4.6.0
 *
 * @see Theme_Upgrader
 */
function wp_ajax_install_theme()
{
    check_ajax_referer('updates');
    if (empty($_POST['slug'])) {
        wp_send_json_error(array('slug' => '', 'errorCode' => 'no_theme_specified', 'errorMessage' => __('No theme specified.')));
    }
    $slug = sanitize_key(wp_unslash($_POST['slug']));
    $status = array('install' => 'theme', 'slug' => $slug);
    if (!current_user_can('install_themes')) {
        $status['errorMessage'] = __('Sorry, you are not allowed to install themes on this site.');
        wp_send_json_error($status);
    }
    include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    include_once ABSPATH . 'wp-admin/includes/theme.php';
    $api = themes_api('theme_information', array('slug' => $slug, 'fields' => array('sections' => false)));
    if (is_wp_error($api)) {
        $status['errorMessage'] = $api->get_error_message();
        wp_send_json_error($status);
    }
    $skin = new WP_Ajax_Upgrader_Skin();
    $upgrader = new Theme_Upgrader($skin);
    $result = $upgrader->install($api->download_link);
    if (defined('WP_DEBUG') && WP_DEBUG) {
        $status['debug'] = $skin->get_upgrade_messages();
    }
    if (is_wp_error($result)) {
        $status['errorCode'] = $result->get_error_code();
        $status['errorMessage'] = $result->get_error_message();
        wp_send_json_error($status);
    } elseif (is_wp_error($skin->result)) {
        $status['errorCode'] = $skin->result->get_error_code();
        $status['errorMessage'] = $skin->result->get_error_message();
        wp_send_json_error($status);
    } elseif ($skin->get_errors()->get_error_code()) {
        $status['errorMessage'] = $skin->get_error_messages();
        wp_send_json_error($status);
    } elseif (is_null($result)) {
        global $wp_filesystem;
        $status['errorCode'] = 'unable_to_connect_to_filesystem';
        $status['errorMessage'] = __('Unable to connect to the filesystem. Please confirm your credentials.');
        // Pass through the error from WP_Filesystem if one was raised.
        if ($wp_filesystem instanceof WP_Filesystem_Base && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
            $status['errorMessage'] = esc_html($wp_filesystem->errors->get_error_message());
        }
        wp_send_json_error($status);
    }
    $status['themeName'] = wp_get_theme($slug)->get('Name');
    if (current_user_can('switch_themes')) {
        if (is_multisite()) {
            $status['activateUrl'] = add_query_arg(array('action' => 'enable', '_wpnonce' => wp_create_nonce('enable-theme_' . $slug), 'theme' => $slug), network_admin_url('themes.php'));
        } else {
            $status['activateUrl'] = add_query_arg(array('action' => 'activate', '_wpnonce' => wp_create_nonce('switch-theme_' . $slug), 'stylesheet' => $slug), admin_url('themes.php'));
        }
    }
    if (!is_multisite() && current_user_can('edit_theme_options') && current_user_can('customize')) {
        $status['customizeUrl'] = add_query_arg(array('return' => urlencode(network_admin_url('theme-install.php', 'relative'))), wp_customize_url($slug));
    }
    /*
     * See WP_Theme_Install_List_Table::_get_theme_status() if we wanted to check
     * on post-install status.
     */
    wp_send_json_success($status);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:70,代码来源:ajax-actions.php

示例12: set_content

        public static function set_content()
        {
            ?>

			<div class="wrap">
				<div id="sc-settings">
					<div id="sc-settings-content">

						<h1><?php 
            _e('System Report', 'stripe');
            ?>
</h1>

						<div id="sc-system-status-report">
							<p>
								<?php 
            _e('Please copy and paste this information when contacting support:', 'stripe');
            ?>
							</p>

							<textarea readonly="readonly" onclick="this.select();"></textarea>

							<p>
								<?php 
            _e('You can also download your information as a text file to attach, or simply view it below.', 'stripe');
            ?>
							</p>
							<p>
								<a href="#" id="sc-system-status-report-download"
								   class="button button-primary"><?php 
            _e('Download System Report', 'stripe');
            ?>
</a>
							</p>
						</div>
						<hr>
						<?php 
            global $wpdb, $wp_version;
            $sections = array();
            $panels = array('wordpress' => array('label' => __('WordPress Installation', 'stripe'), 'export' => 'WordPress Installation'), 'simple_pay' => array('label' => __('Simple Pay Settings', 'stripe'), 'export' => 'Simple Pay Settings'), 'theme' => array('label' => __('Active Theme', 'stripe'), 'export' => 'Active Theme'), 'plugins' => array('label' => __('Active Plugins', 'stripe'), 'export' => 'Active Plugins'), 'server' => array('label' => __('Server Environment', 'stripe'), 'export' => 'Server Environment'), 'client' => array('label' => __('Client Information', 'stripe'), 'export' => 'Client Information'));
            global $sc_options;
            global $base_class;
            $simple_pay_settings = $sc_options->get_settings();
            $sections['simple_pay'] = array();
            // Show version from base class.
            $sections['simple_pay']['sc_version'] = array('label' => __('Plugin Version', 'stripe'), 'label_export' => 'Plugin Version', 'result' => $base_class->version);
            // Show Stripe TLS check.
            $sections['simple_pay']['stripe_tls'] = array('label' => __('Stripe TLS', 'stripe'), 'label_export' => 'Stripe TLS', 'result' => self::stripe_tls_check(false), 'result_export' => self::stripe_tls_check(true));
            foreach ($simple_pay_settings as $key => $value) {
                // Check to see if it's a live key. If it is then we want to hide it in the export.
                if ($key === 'live_secret_key' || $key === 'live_publish_key') {
                    $sections['simple_pay'][$key] = array('label' => $key, 'label_export' => '', 'result' => $value . ' ' . __('(hidden in downloadable report)', 'stripe'), 'result_export' => '');
                } else {
                    $sections['simple_pay'][$key] = array('label' => $key, 'label_export' => $key, 'result' => $value);
                }
            }
            /**
             * WordPress Installation
             * ======================
             */
            $debug_mode = $script_debug = __('No', 'stripe');
            if (defined('WP_DEBUG')) {
                $debug_mode = true === WP_DEBUG ? __('Yes', 'stripe') : $debug_mode;
            }
            if (defined('SCRIPT_DEBUG')) {
                $script_debug = true === SCRIPT_DEBUG ? __('Yes', 'stripe') : $script_debug;
            }
            $memory = self::let_to_num(WP_MEMORY_LIMIT);
            $memory_export = size_format($memory);
            if ($memory < 41943040) {
                $memory = '<mark class="error">' . sprintf(__('%1$s - It is recommendend to set memory to at least 40MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'stripe'), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>';
            } else {
                $memory = '<mark class="ok">' . $memory_export . '</mark>';
            }
            $permalinks = get_option('permalink_structure');
            $permalinks = empty($permalinks) ? '/?' : $permalinks;
            $is_multisite = is_multisite();
            $sections['wordpress'] = array('name' => array('label' => __('Site Name', 'stripe'), 'label_export' => 'Site Name', 'result' => get_bloginfo('name')), 'home_url' => array('label' => __('Home URL', 'stripe'), 'label_export' => 'Home URL', 'result' => home_url()), 'site_url' => array('label' => __('Site URL', 'stripe'), 'label_export' => 'Site URL', 'result' => site_url()), 'version' => array('label' => __('Version', 'stripe'), 'label_export' => 'Version', 'result' => $wp_version), 'locale' => array('label' => __('Locale', 'stripe'), 'label_export' => 'Locale', 'result' => get_locale()), 'multisite' => array('label' => __('Multisite', 'stripe'), 'label_export' => 'Multisite', 'result' => $is_multisite ? __('Yes', 'stripe') : __('No', 'stripe'), 'result_export' => $is_multisite ? 'Yes' : 'No'), 'permalink' => array('label' => __('Permalinks', 'stripe'), 'label_export' => 'Permalinks', 'result' => '<code>' . $permalinks . '</code>', 'result_export' => $permalinks), 'memory_limit' => array('label' => __('WP Memory Limit', 'stripe'), 'result' => $memory, 'result_export' => $memory_export), 'debug_mode' => array('label' => __('WP Debug Mode', 'stripe'), 'result' => $debug_mode), 'script_debug' => array('label' => 'Script Debug', 'result' => $script_debug));
            /**
             * Active Theme
             * ============
             */
            include_once ABSPATH . 'wp-admin/includes/theme-install.php';
            if (version_compare($wp_version, '3.4', '<')) {
                $active_theme = get_theme_data(get_stylesheet_directory() . '/style.css');
                $theme_name = '<a href="' . $active_theme['URI'] . '" target="_blank">' . $active_theme['Name'] . '</a>';
                $theme_version = $active_theme['Version'];
                $theme_author = '<a href="' . $active_theme['AuthorURI'] . '" target="_blank">' . $active_theme['Author'] . '</a>';
                $theme_export = $active_theme['Name'] . ' - ' . $theme_version;
            } else {
                $active_theme = wp_get_theme();
                $theme_name = '<a href="' . $active_theme->ThemeURI . '" target="_blank">' . $active_theme->Name . '</a>';
                $theme_version = $active_theme->Version;
                $theme_author = $active_theme->Author;
                $theme_export = $active_theme->Name . ' - ' . $theme_version;
            }
            $theme_update_version = $theme_version;
            $api = themes_api('theme_information', array('slug' => get_template(), 'fields' => array('sections' => false, 'tags' => false)));
            if ($api && !is_wp_error($api)) {
                $theme_update_version = $api->version;
//.........这里部分代码省略.........
开发者ID:pcuervo,项目名称:wp-yolcan,代码行数:101,代码来源:class-stripe-checkout-shared-system-status.php

示例13: _e

</table>
<table class="wc_status_table widefat" cellspacing="0">
	<thead>
		<tr>
			<th colspan="3" data-export-label="Theme"><?php 
_e('Theme', 'woocommerce');
?>
</th>
		</tr>
	</thead>
		<?php 
include_once ABSPATH . 'wp-admin/includes/theme-install.php';
$active_theme = wp_get_theme();
$theme_version = $active_theme->Version;
$update_theme_version = $active_theme->Version;
$api = themes_api('theme_information', array('slug' => get_template(), 'fields' => array('sections' => false, 'tags' => false)));
// Check .org
if ($api && !is_wp_error($api)) {
    $update_theme_version = $api->version;
    // Check WooThemes Theme Version
} elseif (strstr($active_theme->{'Author URI'}, 'woothemes')) {
    $theme_dir = substr(strtolower(str_replace(' ', '', $active_theme->Name)), 0, 45);
    if (false === ($theme_version_data = get_transient($theme_dir . '_version_data'))) {
        $theme_changelog = wp_safe_remote_get('http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $theme_dir . '/changelog.txt');
        $cl_lines = explode("\n", wp_remote_retrieve_body($theme_changelog));
        if (!empty($cl_lines)) {
            foreach ($cl_lines as $line_num => $cl_line) {
                if (preg_match('/^[0-9]/', $cl_line)) {
                    $theme_date = str_replace('.', '-', trim(substr($cl_line, 0, strpos($cl_line, '-'))));
                    $theme_version = preg_replace('~[^0-9,.]~', '', stristr($cl_line, "version"));
                    $theme_update = trim(str_replace("*", "", $cl_lines[$line_num + 1]));
开发者ID:nightbook,项目名称:woocommerce,代码行数:31,代码来源:html-admin-page-status-report.php

示例14: install_theme_information

/**
 * Display theme information in dialog box form.
 *
 * @since 2.8.0
 */
function install_theme_information()
{
    global $tab, $themes_allowedtags, $wp_list_table;
    $theme = themes_api('theme_information', array('slug' => wp_unslash($_REQUEST['theme'])));
    if (is_wp_error($theme)) {
        wp_die($theme);
    }
    iframe_header(__('Theme Install'));
    $wp_list_table->theme_installer_single($theme);
    iframe_footer();
    exit;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:17,代码来源:theme-install.php

示例15: bws_add_menu_render


//.........这里部分代码省略.........
" target="_blank"><?php 
                    _e("Learn more", 'bestwebsoft');
                    ?>
</a>
								<span> | </span>
								<a href="<?php 
                    echo $bws_plugins[$key_plugin]["wp_install"];
                    ?>
" target="_blank"><?php 
                    _e("Install now", 'bestwebsoft');
                    ?>
</a>
							</div>
						</div>
					<?php 
                }
            }
            ?>
			<?php 
        } elseif ('themes' == $_GET['action']) {
            ?>
				<div id="availablethemes">
					<?php 
            global $tabs, $tab, $paged, $type, $theme_field_defaults;
            include ABSPATH . 'wp-admin/includes/theme-install.php';
            include ABSPATH . 'wp-admin/includes/class-wp-themes-list-table.php';
            include ABSPATH . 'wp-admin/includes/class-wp-theme-install-list-table.php';
            $theme_class = new WP_Theme_Install_List_Table();
            $paged = $theme_class->get_pagenum();
            $per_page = 36;
            $args = array('page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults);
            $args['author'] = 'bestwebsoft';
            $args = apply_filters('install_themes_table_api_args_search', $args);
            $api = themes_api('query_themes', $args);
            if (is_wp_error($api)) {
                wp_die($api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __('Try again', 'bestwebsoft') . '</a>');
            }
            $theme_class->items = $api->themes;
            $theme_class->set_pagination_args(array('total_items' => $api->info['results'], 'per_page' => $per_page, 'infinite_scroll' => true));
            $themes = $theme_class->items;
            if ($wp_version < '3.9') {
                foreach ($themes as $theme) {
                    ?>
							<div class="available-theme installable-theme"><?php 
                    global $themes_allowedtags;
                    if (empty($theme)) {
                        return;
                    }
                    $name = wp_kses($theme->name, $themes_allowedtags);
                    $author = wp_kses($theme->author, $themes_allowedtags);
                    $preview_title = sprintf(__('Preview &#8220;%s&#8221;', 'bestwebsoft'), $name);
                    $preview_url = add_query_arg(array('tab' => 'theme-information', 'theme' => $theme->slug), self_admin_url('theme-install.php'));
                    $actions = array();
                    $install_url = add_query_arg(array('action' => 'install-theme', 'theme' => $theme->slug), self_admin_url('update.php'));
                    $update_url = add_query_arg(array('action' => 'upgrade-theme', 'theme' => $theme->slug), self_admin_url('update.php'));
                    $status = 'install';
                    $installed_theme = wp_get_theme($theme->slug);
                    if ($installed_theme->exists()) {
                        if (version_compare($installed_theme->get('Version'), $theme->version, '=')) {
                            $status = 'latest_installed';
                        } elseif (version_compare($installed_theme->get('Version'), $theme->version, '>')) {
                            $status = 'newer_installed';
                        } else {
                            $status = 'update_available';
                        }
                    }
开发者ID:brettex,项目名称:pspark,代码行数:67,代码来源:bws_menu.php


注:本文中的themes_api函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。