Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version the class #21

Closed
ahansson89 opened this issue Jan 8, 2014 · 12 comments
Closed

Version the class #21

ahansson89 opened this issue Jan 8, 2014 · 12 comments

Comments

@ahansson89
Copy link

Right now I am using this class for multiple projects and I would love if I could see what version my class have compared to the version on github.

@ghost
Copy link

ghost commented Jan 8, 2014

+1 I'm all for this.

Also an extra var/define/constant/whatever to make the class unique would be great. Many times I need to tweet or add something project-specific that doesn't make sense to send in as pull request. It would be very handy in that case to not have conflicts with multiple plugins that use the class.

@tareq1988
Copy link
Owner

Version number added on 96f4373

@daankortenbach I am not sure what you meant, but doesn't the if ( !class_exists( 'WeDevs_Settings_API' ) ) makes it to not conflict?

@ghost
Copy link

ghost commented Jul 15, 2014

if ( !class_exists( 'WeDevs_Settings_API' ) ) makes it no conflict but if I use a modified version it will nullify the modifications. But renaming the class will solve that. Simple.

@tareq1988
Copy link
Owner

Okay got it. But if you have any idea to make the class unique, let me know :)

@ghost
Copy link

ghost commented Jul 15, 2014

Haha, you funny guy. Sorry dude, sometimes I have a brainfart that just doesn't make sense ;)

(extend class with basename that calls specific class with version number in classname)

@roidayan
Copy link
Contributor

roidayan commented Apr 9, 2015

My suggestion is to rename the class per plugin I use it with. this is what I do. this is to avoid any conflicts with other plugins that may use older or newer version. sometimes I also have small modifications in the class so this will also avoid problems to the other plugins in case my plugin loads first.

@ahansson89
Copy link
Author

Why would you want to load the class multiple times for multiple plugins? The cool thing about a class like this is that it can be loaded once and reused in different plugins. Now what I like to do is to use the latest version of the class no matter which plugins that are using it.

@roidayan
Copy link
Contributor

roidayan commented Apr 9, 2015

because I know I have changes. you can use 1 name for all your plugins as you can track and update the class for all your plugins but I think it should still be different than the default from whats in the git.
Other people might use this class with their changes or not and there might be a collision or bad behavior, etc.

I try to submit the changes I do but for example I added input type url which if my class won't load there will be a problem and a bad behavior.
if my pull request will be accepted then it will be fine but maybe other plugin uses the old class and will be loaded first. then there is still a bad behavior.
that's why my plugin uses a different name.

@ahansson89
Copy link
Author

So why don't you just rename your class? I really don't get your logic and the big problem here?

Just change line 13 in the main php file.

@roidayan
Copy link
Contributor

roidayan commented Apr 9, 2015

There is no problem. That's what I said. I renamed the class.

On Thu, Apr 9, 2015, 20:55 ahansson89 notifications@github.com wrote:

So why don't you just rename your class? I really don't get your logic and
the big problem here?

Reply to this email directly or view it on GitHub
#21 (comment)
.

@ahansson89
Copy link
Author

Well, then it is two different use cases. For other people using this class, without any modifications, they want the WP admin to load the latest version of the class no matter which plugin is using it. This is why I opened this ticket.

@tareq1988
Copy link
Owner

Just added initial composer support (see readme), so you can stay updated. Haven't added the version number yet. Also updated the directory structure. Added changelog too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants