Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Is that coding correct? - A analytics plugin for google
mahesh
New
How do i post that php coding here?
It is very simple and very less line
How do i post coding in questions?
0
Comments
You can post readable code in a few different ways. You can use backticks
`
for inline code. You use three tildes (~~~) on their own line to indicate the start and end of a code block.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
plugins/analytics/default.php
I extened the gdn_plugin
I got plugin info
<script>
</script>
Does it do what you expect?
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
Yes. But is that right way?
I need to create more plugins
the right way is the way that works correctly, with the least amount of code, the best performance and the necessary amount of flexibility.
Does this meet those three criteria?
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
Use
$Sender
instead of&$Sender
!As far as I know, the leading & was necessary to pass a variable by reference to a function and that is now the default behavior of recent PHP versions.
You do not need to have the Setup function in your code. It is not wrong there, but it is simply not needed.
This is a valid question.
Yes it is an acceptable means for this case.
note you should really declare script like so
<script type="text/javascript">
rather than<script>
although browser are quite forgiving this is more correct.One sticker is as it is not included as a resource or module it can't be managed as such.
However in this case it is acceptable, becuase all that matter is it is included, but in general you wouldn't include javascript like this.
You might exclude certain parts of the forum from analytics, so you can put the logic for that.
There is more to it that that, there is also forward/backward compatibility, consistency, transportability/transplantability, standards and conventions, UI concerns, etc, etc.
grep is your friend.
variable can explicitly be passed by reference, except object which are always passed by reference.
only pass variables by reference if absolutely needed
PHP manual
if you do &Sender in 2.1 it will break. It has always been redundant the whole time. PHP hasn't not passed classes by refernce since it has been a viable language.
in recent version of php you can do this
but not this
grep is your friend.
i'd lump everything except standards and conventions into "the needed level of flexibility". As for standards and conventions, while it's important to have them, which ones you choose and how you implement when you are a one man show working on your own project really isnt all that important. if i choose strict hungarian notation for my plugins, it's not really wrong, it's just not necessarily consistent with the framework.
But yes, I was over-simplifying the situation. Intentionally, not out of ignorance.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained