本文整理汇总了PHP中WP_Installer函数的典型用法代码示例。如果您正苦于以下问题:PHP WP_Installer函数的具体用法?PHP WP_Installer怎么用?PHP WP_Installer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WP_Installer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_ts_referal
/**
* Retrieve the referring translation service (if any)
*
* @since 1.6.5
*
* @param string The repository id (e.g. wpml)
* @return string The translation service id or false
*/
public static function get_ts_referal($repository_id = 'wpml')
{
if (isset(WP_Installer()->settings['repositories'][$repository_id]['ts_info']['referal'])) {
return WP_Installer()->settings['repositories'][$repository_id]['ts_info']['referal'];
}
return false;
}
示例2: wpml_installer_instance_delegator
function wpml_installer_instance_delegator()
{
global $wp_installer_instances;
// version based election
foreach ($wp_installer_instances as $instance) {
if (!isset($delegate)) {
$delegate = $instance;
continue;
}
if (version_compare($instance['version'], $delegate['version'], '>')) {
$delegate = $instance;
}
}
// priority based election
$highest_priority = null;
foreach ($wp_installer_instances as $instance) {
if (isset($instance['args']['high_priority'])) {
if (is_null($highest_priority) || $instance['args']['high_priority'] <= $highest_priority) {
$highest_priority = $instance['args']['high_priority'];
$delegate = $instance;
}
}
}
include_once $delegate['bootfile'];
// set configuration
if (strpos(realpath($delegate['bootfile']), realpath(TEMPLATEPATH)) === 0) {
$delegate['args']['in_theme_folder'] = dirname(ltrim(str_replace(realpath(TEMPLATEPATH), '', realpath($delegate['bootfile'])), '\\/'));
}
if (isset($delegate['args']) && is_array($delegate['args'])) {
foreach ($delegate['args'] as $key => $value) {
WP_Installer()->set_config($key, $value);
}
}
}
示例3: check_register
public static function check_register()
{
if (!function_exists('WP_Installer')) {
return false;
}
$repos = array('toolset');
foreach ($repos as $repository_id) {
$key = WP_Installer()->repository_has_subscription($repository_id);
if (empty($key)) {
continue;
}
return true;
}
return false;
}
示例4: save_info
function save_info($data, $repository_id)
{
$ts_info = isset(WP_Installer()->settings['repositories'][$repository_id]['ts_info']) ? WP_Installer()->settings['repositories'][$repository_id]['ts_info'] : false;
$save_settings = false;
if (isset($data->ts_info['preferred']) && empty($ts_info['preferred'])) {
WP_Installer()->settings['repositories'][$repository_id]['ts_info']['preferred'] = $data->ts_info['preferred'];
$save_settings = true;
}
if (isset($data->ts_info['referal']) && empty($ts_info['referal'])) {
WP_Installer()->settings['repositories'][$repository_id]['ts_info']['referal'] = $data->ts_info['referal'];
$save_settings = true;
}
if ($save_settings) {
WP_Installer()->save_settings();
}
}
示例5: create
/**
* Create and configure project (Translation Service)
*
* @param string $url
* @param string $name
* @param string $description
* @param string $delivery
*
* @return bool
* @throws TranslationProxy_Api_Error
* @throws Exception
*/
public function create($url, $name, $description, $delivery = 'xmlrpc')
{
global $sitepress;
$networking = wpml_tm_load_tp_networking();
$project_creation = new WPML_TP_Project_Creation($this, $sitepress, $networking, array('name' => $name, 'description' => $description, 'url' => $url, 'delivery_method' => $delivery, 'sitekey' => WP_Installer()->get_site_key('wpml')));
$response_project = $project_creation->run();
$this->id = $response_project->id;
$this->access_key = $response_project->accesskey;
$this->ts_id = $response_project->ts_id;
$this->ts_access_key = $response_project->ts_accesskey;
if (isset($response_project->polling_method) && $response_project->polling_method != $delivery) {
$this->update_delivery_method($response_project->polling_method);
$this->service->delivery_method = $response_project->polling_method;
}
return true;
}
示例6: wpml_installer_instance_delegator
function wpml_installer_instance_delegator()
{
global $wp_installer_instances;
// version based election
foreach ($wp_installer_instances as $instance) {
if (!isset($delegate)) {
$delegate = $instance;
continue;
}
if (version_compare($instance['version'], $delegate['version'], '>')) {
$delegate = $instance;
}
}
// priority based election
$highest_priority = null;
foreach ($wp_installer_instances as $instance) {
if (isset($instance['args']['high_priority'])) {
if (is_null($highest_priority) || $instance['args']['high_priority'] <= $highest_priority) {
$highest_priority = $instance['args']['high_priority'];
$delegate = $instance;
}
}
}
// Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
// Case 2: WPML loaded after Types
if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '<')) {
foreach ($wp_installer_instances as $key => $instance) {
if (isset($instance['args']['site_key_nags'])) {
$delegate = $instance;
$wp_installer_instances = array($key => $delegate);
//Eliminate other instances
break;
}
}
}
include_once $delegate['bootfile'];
// set configuration
if (strpos(realpath($delegate['bootfile']), realpath(TEMPLATEPATH)) === 0) {
$delegate['args']['in_theme_folder'] = dirname(ltrim(str_replace(realpath(TEMPLATEPATH), '', realpath($delegate['bootfile'])), '\\/'));
}
if (isset($delegate['args']) && is_array($delegate['args'])) {
foreach ($delegate['args'] as $key => $value) {
WP_Installer()->set_config($key, $value);
}
}
}
示例7: sprintf
if ($_POST['button_action'] == 'later') {
//success
$ret['success'] = sprintf(__('WPML will work on your site, but you will not receive updates. WPML updates are essential for keeping your site running smoothly and secure. To receive automated updates, you need to complete the registration, in the %splugins admin%s page.', 'sitepress'), '<a href="' . admin_url('plugin-install.php?tab=commercial') . '">', '</a>');
} elseif ($_POST['button_action'] == 'finish') {
$iclsettings['setup_complete'] = 1;
} else {
if (empty($_POST['installer_site_key'])) {
$ret['error'] = __('Missing site key.');
} else {
$iclsettings['site_key'] = $_POST['installer_site_key'];
if (class_exists('WP_Installer')) {
$args['repository_id'] = 'wpml';
$args['nonce'] = wp_create_nonce('save_site_key_' . $args['repository_id']);
$args['site_key'] = $_POST['installer_site_key'];
$args['return'] = 1;
$r = WP_Installer()->save_site_key($args);
if (!empty($r['error'])) {
$ret['error'] = $r['error'];
} else {
//success
$ret['success'] = __('Thank you for registering WPML on this site. You will receive automatic updates when new versions are available.', 'sitepress');
}
}
}
}
if (!empty($iclsettings)) {
$this->save_settings($iclsettings);
}
echo json_encode($ret);
break;
case 'icl_admin_language_options':
示例8: is_uploading_allowed
public function is_uploading_allowed()
{
if (!isset($this->uploading_allowed)) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
require_once WP_Installer()->plugin_path() . '/includes/installer-upgrader-skins.php';
$upgrader_skins = new Installer_Upgrader_Skins();
//use our custom (mute) Skin
$upgrader = new Plugin_Upgrader($upgrader_skins);
ob_start();
$res = $upgrader->fs_connect(array(WP_CONTENT_DIR, WP_PLUGIN_DIR));
ob_end_clean();
if (!$res || is_wp_error($res)) {
$this->uploading_allowed = false;
} else {
$this->uploading_allowed = true;
}
}
return $this->uploading_allowed;
}
示例9: WP_Installer_Show_Products
function WP_Installer_Show_Products($args = array())
{
WP_Installer()->show_products($args);
}
示例10: elseif
}
?>
/>
</div>
<?php
}
?>
</div> <!-- .wcml-section-content -->
</div> <!-- .wpml-section-languages -->
<?php
} elseif ($setup_wizard_step == 4) {
?>
<?php
$site_key = WP_Installer()->get_site_key('wpml');
?>
<div class="wpml-section" id="lang-sec-0">
<div class="wpml-section-header">
<h3><?php
_e('Registration', 'sitepress');
?>
</h3>
</div>
<div class="wpml-section-content">
<?php
if (is_multisite() && !empty($site_key)) {
?>
示例11: site_key_exist
private function site_key_exist()
{
if (class_exists('WP_Installer')) {
$repository_id = 'wpml';
$site_key = WP_Installer()->get_site_key($repository_id);
}
return $does_exist = $site_key !== false ? true : false;
}
示例12: printf
<br />
<div class="installer-error-box">
<?php
if (!WP_Installer()->dependencies->is_uploading_allowed()) {
?>
<p><?php
printf(__('Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s.', 'installer'), '<a href="http://codex.wordpress.org/Changing_File_Permissions">', '</a>');
?>
</p>
<?php
} elseif (WP_Installer()->dependencies->is_win_paths_exception($repository_id)) {
?>
<p><?php
echo WP_Installer()->dependencies->win_paths_exception_message();
?>
</p>
<?php
}
?>
</div>
<input type="submit" class="button-secondary" value="<?php
esc_attr_e('Download', 'installer');
?>
" disabled="disabled" />
<label><input name="activate" type="checkbox" value="1" disabled="disabled" /> <?php
_e('Activate after download', 'installer');
?>
示例13: printf
?>
</span>
</td>
<td class="for_spinner_js"><span class="spinner"></span></td>
</tr>
<?php
}
?>
</tbody>
</table>
<br />
<div class="installer-error-box">
<?php
if (!WP_Installer()->is_uploading_allowed()) {
?>
<p>
<?php
printf(__('Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s.', 'installer'), '<a href="http://codex.wordpress.org/Changing_File_Permissions">', '</a>');
?>
</p>
<?php
}
?>
</div>
<input type="submit" class="button-secondary" value="<?php
esc_attr_e('Download', 'installer');
?>
" disabled="disabled" />
示例14: prevent_plugins_update_on_updates_screen
public function prevent_plugins_update_on_updates_screen()
{
if (isset($_REQUEST['action'])) {
$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
$installer_settings = WP_Installer()->settings;
//bulk mode
if ('update-selected' == $action) {
global $plugins;
if (isset($plugins) && is_array($plugins)) {
foreach ($plugins as $k => $plugin) {
$wp_plugin_slug = dirname($plugin);
foreach ($installer_settings['repositories'] as $repository_id => $repository) {
if ($this->is_win_paths_exception($repository_id)) {
foreach ($repository['data']['packages'] as $package) {
foreach ($package['products'] as $product) {
foreach ($product['plugins'] as $plugin_slug) {
$download = $installer_settings['repositories'][$repository_id]['data']['downloads']['plugins'][$plugin_slug];
if ($download['slug'] == $wp_plugin_slug && empty($download['free-on-wporg'])) {
echo '<div class="updated error"><p>' . $this->win_paths_exception_message() . ' <strong>(' . $download['name'] . ')</strong>' . '</p></div>';
unset($plugins[$k]);
break 3;
}
}
}
}
}
}
}
}
}
if ('upgrade-plugin' == $action || 'update-plugin' == $action) {
$plugin = isset($_REQUEST['plugin']) ? trim(sanitize_text_field($_REQUEST['plugin'])) : '';
$wp_plugin_slug = dirname($plugin);
foreach ($installer_settings['repositories'] as $repository_id => $repository) {
if ($this->is_win_paths_exception($repository_id)) {
foreach ($repository['data']['packages'] as $package) {
foreach ($package['products'] as $product) {
foreach ($product['plugins'] as $plugin_slug) {
$download = $installer_settings['repositories'][$repository_id]['data']['downloads']['plugins'][$plugin_slug];
//match by folder, will change to match by name and folder
if ($download['slug'] == $wp_plugin_slug && empty($download['free-on-wporg'])) {
echo '<div class="updated error"><p>' . $this->win_paths_exception_message() . '</p></div>';
echo '<div class="wrap">';
echo '<h2>' . __('Update Plugin') . '</h2>';
echo '<a href="' . admin_url('update-core.php') . '">' . __('Return to the updates page', 'installer') . '</a>';
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
}
}
}
}
}
}
}
}
}
示例15: create_project
/**
* @param TranslationProxy_Service $service
* @param bool $force
*
* @throw TranslationProxy_Project
* @return TranslationProxy_Project
*/
private static function create_project($service, $force = false)
{
$icl_translation_projects = self::get_translation_projects();
$delivery_method = self::get_delivery_method();
$delivery = $delivery_method == ICL_PRO_TRANSLATION_PICKUP_XMLRPC ? "xmlrpc" : "polling";
$project_index = TranslationProxy_Project::generate_service_index($service);
if (!$force && isset($icl_translation_projects[$project_index])) {
$project = self::load_existing_project($service, $delivery);
} else {
$url = get_option('siteurl');
$name = get_option('blogname');
$description = get_option('blogdescription');
$project = new TranslationProxy_Project($service);
$site_key = WP_Installer()->get_site_key('wpml');
$result = $project->create($url, $name, $description, $delivery, $site_key);
if (!$result || count($project->errors)) {
self::append_errors($project->errors);
$project = false;
}
}
return $project;
}