Ejemplo n.º 1
0
function qtranxf_admin_notice_plugin_integration($plugin, $integr_title, $integr_plugin)
{
    if (!is_plugin_active($plugin)) {
        return 0;
    }
    if (is_plugin_active($integr_plugin)) {
        return 0;
    }
    $integr_bnm = dirname($integr_plugin);
    //
    $messages = get_option('qtranslate_admin_notices');
    if (isset($messages['integration-' . $integr_bnm])) {
        return 0;
    }
    $plugin_file = qtranxf_find_plugin_file($plugin);
    if (!$plugin_file) {
        return 0;
    }
    $pd = get_plugin_data(WP_CONTENT_DIR . '/' . $plugin_file, false, true);
    $pluginName = $pd['Name'];
    $pluginURI = $pd['PluginURI'];
    $me = qtranxf_get_plugin_link();
    $plugin_link = '<a href="' . $pluginURI . '/" style="color:blue" target="_blank">' . $pluginName . '</a>';
    $integr_link = '<a href="https://wordpress.org/plugins/' . $integr_bnm . '/" style="color:magenta" target="_blank">' . $integr_title . '</a>';
    echo '<div class="update-nag notice is-dismissible" id="qtranxs-integration-' . $integr_bnm . '"><p style="font-size: larger">';
    printf(__('Plugin %s may be integrated with multilingual plugin %s with a help of plugin %s.', 'qtranslate'), $plugin_link, $me, $integr_link);
    echo ' ';
    echo __('Please, press an appropriate button below.', 'qtranslate');
    $integr_file = qtranxf_find_plugin_file($integr_plugin);
    if ($integr_file) {
        echo '</p><p> &nbsp; &nbsp; &nbsp; &nbsp;<a class="button" href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . urlencode($integr_plugin)), 'activate-plugin_' . $integr_plugin)) . '"><strong>' . sprintf(__('Activate plugin %s', 'qtranslate'), '<span style="color:magenta">' . $integr_title . '</span>') . '</strong></a>';
    } else {
        echo '</p><p> &nbsp; &nbsp; &nbsp; &nbsp;<a class="button" href="' . esc_url(wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . urlencode($integr_bnm)), 'install-plugin_' . $integr_bnm)) . '"><strong>' . sprintf(__('Install plugin %s', 'qtranslate'), '<span style="color:magenta">' . $integr_title . '</span>') . '</strong></a>';
    }
    echo '&nbsp;&nbsp;&nbsp;<a class="button" href="javascript:qtranxj_dismiss_admin_notice(\'integration-' . $integr_bnm . '\');">' . __('I am aware of that, dismiss this message.', 'qtranslate');
    echo '</a></p></div>';
    return 1;
}
Ejemplo n.º 2
0
function qtranxf_add_row_migrate($nm, $plugin, $args = null)
{
    $plugin_file = qtranxf_find_plugin_file($plugin);
    if (!$plugin_file) {
        return;
    }
    //$pd = get_plugin_data( $plugin_file.'/mqtranslate.php', false, true );
    //qtranxf_dbg_log('qtranxf_add_row_migrate: $pd:',$pd);
    $href = isset($args['href']) ? $args['href'] : 'https://wordpress.org/plugins/' . $plugin;
    ?>
<tr valign="top" id="qtranslate-<?php 
    echo $plugin;
    ?>
">
	<th scope="row"><?php 
    _e('Plugin');
    ?>
 <a href="<?php 
    echo $href;
    ?>
/" target="_blank"><?php 
    echo $nm;
    ?>
</a></th>
	<td>
<?php 
    if (!empty($args['compatible'])) {
        _e('There is no need to migrate any setting, the database schema is compatible with this plugin.', 'qtranslate');
    } else {
        if (!empty($args['text'])) {
            echo $args['text'];
        } else {
            ?>
		<label for="<?php 
            echo $plugin;
            ?>
_no_migration"><input type="radio" name="<?php 
            echo $plugin;
            ?>
-migration" id="<?php 
            echo $plugin;
            ?>
_no_migration" value="none" checked /> <?php 
            _e('Do not migrate any setting', 'qtranslate');
            ?>
</label>
		<br/>
		<label for="<?php 
            echo $plugin;
            ?>
_import_migration"><input type="radio" name="<?php 
            echo $plugin;
            ?>
-migration" id="<?php 
            echo $plugin;
            ?>
_import_migration" value="import" /> <?php 
            echo __('Import settings from ', 'qtranslate') . $nm;
            ?>
</label>
<?php 
            if (empty($args['no_export'])) {
                ?>
		<br/>
		<label for="<?php 
                echo $plugin;
                ?>
_export_migration"><input type="radio" name="<?php 
                echo $plugin;
                ?>
-migration" id="<?php 
                echo $plugin;
                ?>
_export_migration" value="export" /> <?php 
                echo __('Export settings to ', 'qtranslate') . $nm;
                ?>
</label>
<?php 
            }
        }
    }
    if (!empty($args['note'])) {
        echo '<p class="qtranxs_notes">' . $args['note'] . '</p>';
    }
    ?>
	</td>
</tr>
<?php 
}