Skip to content

Commit

Permalink
version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xxsimoxx committed Jan 9, 2020
1 parent 24b1536 commit 5e5d474
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 47 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ There is also an option (that affects every shortcode in your site) to **display
- bloginfo
- get\_post\_metadata


### Updating to 1.3.0
When you upgrade from a previous version to 1.3.0, please deactivate and reactivate the plugin to be sure that the migration is complete.


## Integration

### Security menu

If running ClassicPress 1.1.0 or newer those settings are moved to the Security menu: choose which users can manage vars, what to do with vars when uninstalling and apply shortcodes everywhere

### Functions
If you would like to **use in your theme/plugin**
`vars_do('name')`
and get _value_ displayed.

### Filters
There is a **filter** called *vars_output*

Expand All @@ -60,10 +59,16 @@ add_filter( 'vars_output', 'vars_output_exec_php' );
```

<a name="screenshots"></a>

## Screenshots
![Editing vars](images/screenshot-1.jpg)

![TinyMCE button](images/screenshot-3.jpg)

![Security settings](images/screenshot-2.jpg)

## Privacy

**To help us know the number of active installations of this plugin, we collect and store anonymized data when the plugin check in for updates. The date and unique plugin identifier are stored as plain text and the requesting URL is stored as a non-reversible hashed value. This data is stored for up to 28 days.**


27 changes: 18 additions & 9 deletions classes/UpdateClient.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
/**
* -----------------------------------------------------------------------------
* Purpose: Remote client to communicate with the Update Manager plugin.
* Package: CodePotent\UpdateManager
* Version: 1.0.0
* Author: Code Potent
* Author URI: https://codepotent.com
* -----------------------------------------------------------------------------
Expand All @@ -13,7 +11,7 @@
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Full
* text of the license is available at https://www.gnu.org/licenses/gpl-2.0.txt.
* -----------------------------------------------------------------------------
* Copyright © 2019 - CodePotent
* Copyright © 2019 - Code Potent
* -----------------------------------------------------------------------------
* ____ _ ____ _ _
* / ___|___ __| | ___| _ \ ___ | |_ ___ _ __ | |_
Expand All @@ -24,8 +22,16 @@
* -----------------------------------------------------------------------------
*/

/**
*
* Note: this is not the original file.
* It's modified to remove text domain.
*
*/


// EDIT: Make this unique. Example: YourDevName\YourPluginName;
namespace XXSimoXX\VarsUpdate;
namespace XXSimoXX\Vars\UpdateClient;

// EDIT: URL where Update Manager is installed; with trailing slash!
const UPDATE_SERVER = 'https://software.gieffeedizioni.it/';
Expand All @@ -42,8 +48,7 @@
* integrated update path for end-users of your ClassicPress plugins. This class
* is intended for plugins that will be receiving updates directly from a remote
* server, such as GitHub or your own site. The Update Manager ensures that your
* updates look great with all the right images and texts. If you need some more
* context, skip to: https://codepotent.com/classicpress/plugins/update-manager/
* updates look great with all the right images and texts.
*
* @author John Alarcon
*/
Expand Down Expand Up @@ -88,7 +93,7 @@ private function __construct() {
// Plugin identifier; ie, plugin-folder/plugin-file.php.
'id' => $this->get_plugin_identifier(),
// Leave as-is.
'api' => '1.0.0',
'api' => '1.1.0',
// Leave as-is – tutorial can be created with enough interest.
'post' => [],
];
Expand Down Expand Up @@ -138,7 +143,7 @@ private function init() {

// Print footer scripts; see comments on the method.
add_action('admin_print_footer_scripts', [$this, 'print_admin_scripts']);

// Filter the plugin admin row.
add_filter('plugin_row_meta', [$this, 'filter_plugin_row_meta'], 10, 2);

Expand Down Expand Up @@ -334,7 +339,7 @@ public function filter_plugin_row_meta($plugin_meta, $plugin_file) {
// Add the link to the plugin's own row, if not already existing.
if ($this->identifier === $plugin_file) {
$anchors_string = implode('', $plugin_meta);
$anchor_text = esc_html('View details', 'codepotent-update-manager');
$anchor_text = esc_html__('View details');
if (!preg_match('|(\<a[ \s\S\d]*)('.$anchor_text.')(<\/a>)|', $anchors_string)) {
$plugin_meta[] = '<a class="thickbox" href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$this->server_slug.'&TB_iframe=true&width=600&height=550').'">'.$anchor_text.'</a>';
}
Expand Down Expand Up @@ -556,6 +561,10 @@ public function get_plugin_images($type, $plugin) {
$image_path = untrailingslashit(WP_PLUGIN_DIR).'/'.$plugin.'/images';
$image_url = untrailingslashit(WP_PLUGIN_URL).'/'.$plugin.'/images';

// Allow directory location to be filtered.
$image_path = apply_filters('codepotent_update_manager_image_path', $image_path);
$image_url = apply_filters('codepotent_update_manager_image_url', $image_url);

// Banner and icon images are keyed differently; it's a core thing.
$image_qualities = [
'icon' => ['default', '1x', '2x'],
Expand Down
12 changes: 9 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== vars ===
Plugin Name: vars
Description: Vars in shortcodes
Version: 1.3.4
Version: 2.0.0
Text Domain: vars
Domain Path: /languages
Requires PHP: 5.6
Expand All @@ -10,7 +10,7 @@ Tested: 4.9.99
Author: Gieffe edizioni
Author URI: https://www.gieffeedizioni.it
Plugin URI: https://software.gieffeedizioni.it
Download link: https://github.com/xxsimoxx/vars/releases/download/v1.3.4/vars.zip
Download link: https://github.com/xxsimoxx/vars/releases/download/v2.0.0/vars.zip
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -29,14 +29,20 @@ It **integrates into TinyMCE** by adding a menu.

You can choose which users can manage vars.

*To help us know the number of active installations of this plugin, we collect and store anonymized data when the plugin check in for updates. The date and unique plugin identifier are stored as plain text and the requesting URL is stored as a non-reversible hashed value. This data is stored for up to 28 days.*

== Screenshots ==

1. Editing vars in backend
2. Security settings
3. TinyMCE button

== Changelog ==
= 1.3.3 =
= 2.0.0 =
* Removed deprecated functions
* Updated Update Manager client

= 1.3.4 =
Updated
* CSS tweaks

Expand Down
31 changes: 1 addition & 30 deletions vars.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: vars
* Plugin URI: https://software.gieffeedizioni.it
* Description: Vars in shortcodes
* Version: 1.3.4
* Version: 2.0.0
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Author: Gieffe edizioni srl
Expand Down Expand Up @@ -256,9 +256,6 @@ function vars_security_page() {
* shortcode section
*
*/
// left for compatibility
add_shortcode('cpv', 'cpv');

add_shortcode('vars', 'cpv');
function cpv( $atts, $content = null ) {
$coded_options = get_option( 'vars-vars' );
Expand All @@ -276,11 +273,6 @@ function cpv( $atts, $content = null ) {
}
}

// left for compatibility
function cpv_do ( $var ){
return cpv( '', $var );
};

function vars_do ( $var ){
return cpv( '', $var );
};
Expand Down Expand Up @@ -374,31 +366,10 @@ function vars_cleanup (){

register_activation_hook( __FILE__, 'vars_activate' );
function vars_activate() {
// Migrate options from old name and delete
if ( get_option( 'cpvars-whocanedit' ) && ! get_option( 'vars-whocanedit' )){
update_option( 'vars-whocanedit', get_option( 'cpvars-whocanedit' ) );
update_option( 'vars-cleanup', get_option( 'cpvars-cleanup' ) );
update_option( 'vars-doeverywhere', get_option( 'cpvars-doeverywhere' ) );
update_option( 'vars-vars', get_option( 'cpvars-vars' ) );
delete_option( 'cpvars-cleanup' );
delete_option( 'cpvars-doeverywhere' );
delete_option( 'cpvars-vars' );
delete_option( 'cpvars-whocanedit' );
};
// If permission options not set, let admin make changes
if ( FALSE === get_option( 'vars-whocanedit' ) ){
update_option ( 'vars-whocanedit', 'manage_options');
};
}

// on deactivation rename the old folder
register_deactivation_hook( __FILE__, 'vars_deactivate' );
function vars_deactivate() {
if ( "cpvars" == dirname( plugin_basename( __FILE__ ) ) ){
$name = plugin_dir_path( __FILE__ );
$rename = preg_replace('/cpvars\/$/',"vars/", $name);
rename( $name, $rename );
};
};

?>

0 comments on commit 5e5d474

Please sign in to comment.