From 2194207b3e808b3d742615d8639e8fe283a29330 Mon Sep 17 00:00:00 2001 From: Matth_eu Date: Tue, 7 Jul 2015 14:40:09 +0100 Subject: [PATCH 1/2] Define per page setting. Plus consistent naming --- inc/class-mexp-resource-space-service.php | 2 +- inc/class-resource-space-admin.php | 11 +-- inc/class-resource-space-loader.php | 2 +- readme.txt | 114 ++++++++++++++++++++++ resourcespace.php | 10 +- 5 files changed, 125 insertions(+), 14 deletions(-) create mode 100644 readme.txt diff --git a/inc/class-mexp-resource-space-service.php b/inc/class-mexp-resource-space-service.php index f8d09c1..92a2cd3 100644 --- a/inc/class-mexp-resource-space-service.php +++ b/inc/class-mexp-resource-space-service.php @@ -57,7 +57,7 @@ public function request( array $request ) { 'previewsize' => 'pre', 'prettyfieldnames' => true, 'original' => true, - 'results_per_page' => 20, + 'results_per_page' => PJ_RESOURCE_SPACE_RESULTS_PER_PAGE, 'page' => absint( $request['page'] ), 'restypes' => 1, // Restrict to images only. ) ), diff --git a/inc/class-resource-space-admin.php b/inc/class-resource-space-admin.php index 893acf5..f61e945 100644 --- a/inc/class-resource-space-admin.php +++ b/inc/class-resource-space-admin.php @@ -49,7 +49,7 @@ function admin_menu() { } function render_page() { - include( RESOURCE_SPACE_PLUGIN_DIR . '/templates/admin-page.php' ); + include( PJ_RESOURCE_SPACE_PLUGIN_DIR . '/templates/admin-page.php' ); } function admin_enqueue_scripts() { @@ -63,13 +63,8 @@ function admin_enqueue_scripts() { wp_enqueue_script( 'media' ); $deps = array( 'jquery', 'backbone', 'media' ); - wp_enqueue_script( 'resource-space-admin', RESOURCE_SPACE_PLUGIN_URL . '/js/admin.js', $deps, RESOURCESPACE_PLUGIN_VERSION, true ); - - // wp_localize_script( 'resource-space-admin', 'resourceSpace', array( - // 'queryVars' => (object) array( - // ), - // ) ); - + wp_enqueue_script( 'resource-space-admin', PJ_RESOURCE_SPACE_PLUGIN_URL . '/js/admin.js', $deps, PJ_RESOURCESPACE_PLUGIN_VERSION, true ); + } } diff --git a/inc/class-resource-space-loader.php b/inc/class-resource-space-loader.php index eccec00..249bf2e 100644 --- a/inc/class-resource-space-loader.php +++ b/inc/class-resource-space-loader.php @@ -20,7 +20,7 @@ public static function get_instance() { } public function __construct() { - add_action( 'wp_ajax_' . RESOURCE_SPACE_AJAX_ACTION, array( $this, 'ajax_get_image' ) ); + add_action( 'wp_ajax_' . PJ_RESOURCE_SPACE_AJAX_ACTION, array( $this, 'ajax_get_image' ) ); } /** diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..2625c94 --- /dev/null +++ b/readme.txt @@ -0,0 +1,114 @@ +=== Resourcespace Explorer === +Contributors: (this should be a list of wordpress.org userid's) +Donate link: http://example.com/ +Tags: comments, spam +Requires at least: 3.0.1 +Tested up to: 3.4 +Stable tag: 4.3 +License: GPLv2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + +Here is a short description of the plugin. This should be no more than 150 characters. No markup here. + +== Description == + +This is the long description. No limit, and you can use Markdown (as well as in the following sections). + +For backwards compatibility, if this section is missing, the full length of the short description will be used, and +Markdown parsed. + +A few notes about the sections above: + +* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames +* "Tags" is a comma separated list of tags that apply to the plugin +* "Requires at least" is the lowest version that the plugin will work on +* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on +higher versions... this is just the highest one you've verified. +* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for +stable. + + Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so +if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used +for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt` +is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in +your in-development version, without having that information incorrectly disclosed about the current stable version +that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag. + + If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where +you put the stable version, in order to eliminate any doubt. + +== Installation == + +This section describes how to install the plugin and get it working. + +e.g. + +1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory +1. Activate the plugin through the 'Plugins' menu in WordPress +1. Place `` in your templates + +== Frequently Asked Questions == + += A question that someone might have = + +An answer to that question. + += What about foo bar? = + +Answer to foo bar dilemma. + +== Screenshots == + +1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from +the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets +directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` +(or jpg, jpeg, gif). +2. This is the second screen shot + +== Changelog == + += 1.0 = +* A change since the previous version. +* Another change. + += 0.5 = +* List versions from most recent at top to oldest at bottom. + +== Upgrade Notice == + += 1.0 = +Upgrade notices describe the reason a user should upgrade. No more than 300 characters. + += 0.5 = +This version fixes a security related bug. Upgrade immediately. + +== Arbitrary section == + +You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated +plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or +"installation." Arbitrary sections will be shown below the built-in sections outlined above. + +== A brief Markdown Example == + +Ordered list: + +1. Some feature +1. Another feature +1. Something else about the plugin + +Unordered list: + +* something +* something else +* third thing + +Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax]. +Titles are optional, naturally. + +[markdown syntax]: http://daringfireball.net/projects/markdown/syntax + "Markdown is what the parser uses to process much of the readme file" + +Markdown uses email style notation for blockquotes and I've been told: +> Asterisks for *emphasis*. Double it up for **strong**. + +`` diff --git a/resourcespace.php b/resourcespace.php index 3f46634..ba0d4c8 100644 --- a/resourcespace.php +++ b/resourcespace.php @@ -9,10 +9,12 @@ Domain Path: /languages */ -define( 'RESOURCESPACE_PLUGIN_VERSION', '0.1' ); -define( 'RESOURCE_SPACE_AJAX_ACTION', 'pj_rs_get_resource' ); -define( 'RESOURCE_SPACE_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); -define( 'RESOURCE_SPACE_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); +define( 'PJ_RESOURCESPACE_PLUGIN_VERSION', '0.1' ); +define( 'PJ_RESOURCE_SPACE_AJAX_ACTION', 'pj_rs_get_resource' ); +define( 'PJ_RESOURCE_SPACE_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); +define( 'PJ_RESOURCE_SPACE_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); + +defined( 'PJ_RESOURCE_SPACE_RESULTS_PER_PAGE' ) or define( 'PJ_RESOURCE_SPACE_RESULTS_PER_PAGE', 20 ); if ( ! class_exists( 'MEXP_Service' ) ) { wp_die( __( 'Media Explorer plugin must be enabled.', 'resourcespace' ) ); From ee11de5af3c2c7eab64d8f3f42609fa1acc1e9b3 Mon Sep 17 00:00:00 2001 From: Matth_eu Date: Tue, 7 Jul 2015 17:20:30 +0100 Subject: [PATCH 2/2] delete readme --- readme.txt | 114 ----------------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 readme.txt diff --git a/readme.txt b/readme.txt deleted file mode 100644 index 2625c94..0000000 --- a/readme.txt +++ /dev/null @@ -1,114 +0,0 @@ -=== Resourcespace Explorer === -Contributors: (this should be a list of wordpress.org userid's) -Donate link: http://example.com/ -Tags: comments, spam -Requires at least: 3.0.1 -Tested up to: 3.4 -Stable tag: 4.3 -License: GPLv2 or later -License URI: http://www.gnu.org/licenses/gpl-2.0.html - -Here is a short description of the plugin. This should be no more than 150 characters. No markup here. - -== Description == - -This is the long description. No limit, and you can use Markdown (as well as in the following sections). - -For backwards compatibility, if this section is missing, the full length of the short description will be used, and -Markdown parsed. - -A few notes about the sections above: - -* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames -* "Tags" is a comma separated list of tags that apply to the plugin -* "Requires at least" is the lowest version that the plugin will work on -* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on -higher versions... this is just the highest one you've verified. -* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for -stable. - - Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so -if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used -for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt` -is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in -your in-development version, without having that information incorrectly disclosed about the current stable version -that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag. - - If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where -you put the stable version, in order to eliminate any doubt. - -== Installation == - -This section describes how to install the plugin and get it working. - -e.g. - -1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory -1. Activate the plugin through the 'Plugins' menu in WordPress -1. Place `` in your templates - -== Frequently Asked Questions == - -= A question that someone might have = - -An answer to that question. - -= What about foo bar? = - -Answer to foo bar dilemma. - -== Screenshots == - -1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from -the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets -directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` -(or jpg, jpeg, gif). -2. This is the second screen shot - -== Changelog == - -= 1.0 = -* A change since the previous version. -* Another change. - -= 0.5 = -* List versions from most recent at top to oldest at bottom. - -== Upgrade Notice == - -= 1.0 = -Upgrade notices describe the reason a user should upgrade. No more than 300 characters. - -= 0.5 = -This version fixes a security related bug. Upgrade immediately. - -== Arbitrary section == - -You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated -plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or -"installation." Arbitrary sections will be shown below the built-in sections outlined above. - -== A brief Markdown Example == - -Ordered list: - -1. Some feature -1. Another feature -1. Something else about the plugin - -Unordered list: - -* something -* something else -* third thing - -Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax]. -Titles are optional, naturally. - -[markdown syntax]: http://daringfireball.net/projects/markdown/syntax - "Markdown is what the parser uses to process much of the readme file" - -Markdown uses email style notation for blockquotes and I've been told: -> Asterisks for *emphasis*. Double it up for **strong**. - -``