« first day (1502 days earlier)      last day (3431 days later) » 

12:21 AM
add_action( 'admin_menu', function() {
	add_submenu_page(
		'edit.php?post_type=foo',
		'',
		'Add Foo in Bar',
		'edit_posts',
		'post-new.php?post_type=foo&custom_tax_term=bar'
	);
});
works for me... @kaiser
 
12:36 AM
@G.M. that's how I solved it. Haven't updated here as I thought I wouldn't get any feedback anyway. Thanks :)
 
 
9 hours later…
9:59 AM
anyone here took zend certification exam?
 
10:52 AM
@sisir, what for?, does it give any benefit?
 
 
5 hours later…
4:26 PM
DI question. I have a directory path and Finder service. do I pass as dependency: (1) both separately or (2) Finder instance with directory path already set ?
 
4:37 PM
@Rarst detail? "Pass as dependency[...]" dependency to what
 
@Rarst (2) for me, as long as path is injected in finder.
 
$app['release.dir'] = __DIR__ . '/releases';

$app['finder'] = function (Application $app) {

    $finder = new Finder();
    return $finder->files()->in($app['release.dir']);
};

$app['parser'] = function (Application $app) {

    return new ReleaseParser($app['finder']);
};
this? or not this?
 
This.
 
Pass Finder and Dir separately to Parser - no chaining/not this
 
tie break, anyone?
 
4:40 PM
Parser might need to set one thing depending on the other.
 
but it doesn't need, it just needs finder to scour for specific files in fixed location
 
I don't think so. Parser need to parse files, without knowing from where they come from.
"I don't think so" was for @kaiser :)
 
In case Finder only returns list of files (or as instance of some DirectoryIterator), then I agree.
 
Parser does this inside: $this->finder->depth('== 2')->name('*.zip');
 
In case Finder is used to perform operations that are triggered from outside I tend to disagree.
@Rarst When the Parser already does part of the Finder configuration then it should also be responsible to set the actual path.
 
4:43 PM
but Parser itself doesn't need to know location, it's irrelevant to it
 
When you go with @G.M. suggestion, then you shouldn't do that.
Parser as well shouldn't know what depth or file type it parses.
 
I will likely have other uses of Finder which will do different search, but still constrained to same location
 
Why does the Parser know the depth and type? A parser parses no matter what.
 
Parser knows that because it's part of release input definition — files of certain type, located in certain way in file tree
 
Well I'm agree with both of you :) Set method on Finder for each type of search, and call that method on Finder, instead of configurate finder from parser.
 
4:45 PM
^ that
 
not following
"set method on..."
 
Finder always return a collection of files that Parser can parse
 
Finder finds (by path, type, depth, limit, etc.) Parser parses
 
but if I configure in finder service then I need multiple finder services for each kind of search
 
$finder->zip( $depth )
 
4:47 PM
? to both of you
 
Agree with @Rarst "I will likely have other uses of Finder which will do different search" and to @kaiser "A parser parses no matter what"
 
as I see it Parser knows what are valid inputs, Finder doesn't. so Parser uses Finder to gather valid inputs.
 
$finder = new Finder( $path );
$finder->setType( 'zip' );
$finder->setDepth( 2 );
$finder->setLimit( -1 );
$parser = new Parser( $finder );
$results = $parser->getResults();
foreach ( $results as $r )
    var_dump( $result->current->isFile() );
Why wouldn't the Finder know what's valid? You already told him the type and depth you are searching for.
The Parser maybe knows what contents are valid.
 
because Finder is a generic component, Parser is part of my project with project–specific knowledge
 
Ah, Parser is a Filter?
 
4:51 PM
my Parser input isn't array of files, my input is a directory location
 
gtg ... be back in 10 minutes
 
    public function getReleases()
    {
        $releases = [ ];

        $this->finder->depth('== 2')->name('*.zip');

        /** @var SplFileInfo $file */
        foreach ($this->finder as $file) {

            $releases[] = new Release($file);
        }

        return $releases;
    }
at the moment Parser is down to this pretty much
 
namespace Rarst;

use Symfony\Component\Finder\Finder as SymfonyFinder;

class Finder {

  function __construct(SymfonyFinder $finder ) {
    $this->finder = $finder;
  }

  function zip( $depth = 2 ) {
    return $this->finder->depth($depth)->name('*.zip');
  }

  function php( $depth = 2 ) {
    return $this->finder->depth($depth)->name('*.php');
  }
}
 
wasn't inheritance evil, etc? :)
 
inheritance?
where's inheritance?
 
4:54 PM
oops, never mind
slow brain
 
:)
 
I'll ponder once I get to additional uses of Finder
 
@G.M. No keyword before Finder? Is it a class?
 
@Sisir sure
chat is not best place to write code :)
 
5:07 PM
@G.M. fixed by mod power
Anyway, that would be a perfect use case for a Decorator - when I look at ->name(), zip() and php().
 
..and I thought I have learn something new :)
 
Well, if there are just 2 use cases doesn't worth it, IMHO. If possible use cases are more, yes, a Decorator is a good choice. @kaiser
and thatnk for edit :)
 
I need to finish up Fractal implementation first, additional Finder use cases will likely be later for caching (if any releases had changed since we last generated data)
 
5:47 PM
Fractal is verrry nice btw, recommended fractal.thephpleague.com
 
I am confused about the behaviour of the_excerpt(). I want the excerpt to show a read more link.

For that I understand that [this function is useful](http://codex.wordpress.org/Function_Reference/the_excerpt#Make_the_.22read_more.22_link_to_the_post):

function new_excerpt_more( $more ) {
return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'your-text-domain') . '</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );

But the behaviour is not was expected. When I don't add a excerpt in the post, it trims and adds a read more, (which is the desir
 
@Rarst thanks, I'll give it a read, the documentation looks like something that want's to be confusing by design :)
 
as you will see from chart when you have custom excerpt defined it never adds excerpt_more part
aside — I wrote that four years ago?.. nuts :)
 
ok, thanks for that, it's a little bit more clear but I'm still confused.

If I'm correct I'm in the case 2 of the diagram, since I have no teaser, and I have a manual excerpt.
If I understood correctly
I ahve to do something about $excerpt_lenght
 
no, if you have manual excerpt it's case 1
 
@Rarst ohh, right, silly me, so that way there's no way of doing a read more?
I mean without hacking away?
 
6:16 PM
use outer filter, like get_the_excerpt or just ignore that and add it in template
read more links weren't intended to be used with excerpts
confusing, I know
 
@Rarst Oh, ok, I just wanted a consistent behaviour, I want the continue reading whether or not the excerpt was set.
@Rarst Hmm, this is confusing :( So now I'm trying to use get_the_excerpt(), but that seems to get nothing.
 
make sure you append to output, not replace it
 
@Rarst haven't we found out at some point that there still is excerpt somewhere when the post is password protected to allow indexing by search engines?
 
not sure
 
@Rarst haha sorry if I driving you nuts! But I still get the same behaviour, no continue reading with get_the_excerpt()
 
6:26 PM
ask question on main I guess :)
 
@Rarst I will, thanks for the help.
 
6:40 PM
No need to push it. We are already aware that you asked a question.
@Rarst Quick question about johnblochs composer wp repo: I can't find the 4.0.1 tag anywhere, but got 4.1 beta available (as master). Is my build corrupted somehow or is it the same for you?
 
GH has 4.0.1 just fine?..
 
seeing it. must be my failure. thanks
ah, damn. overseen that composer got stuck because of changes in working tree :P
 
7:20 PM
I cannot believe anything like this could be this hard. I really don't know if I'm being stupid and missing something obvious or the excerpt functionality is just broken. Maybe both.
 
all those add up to one actual problem, shit design.
 
7:35 PM
@Wyck Up to now I've made almost 10 chat comments, one question in main and 20 comments, at least 6 people are involved and I still haven't figured it out.
Three cigarettes were also harmed in the making of the excerpt.
 
@Trufa and one flag on your question because of excessive comment usage. Please use updates/edits to your question to clarify thing.
 
7:55 PM
@kaiser you're right, sorry about that. The only problem I see with that is that if I use only updates, the people that are commenting wont get a notification and thus more unlikely to continue helping, I do understand that the comments are not meant for chatting though.
@kaiser am I supposed to see all the comments on the chat? I see only some. Also, can I post a comment linking to the chat?
 
I cleaned up those comments that weren't necessary anymore/already clarified and edited. And yes, you can post a comment that you are already sitting in this specific chat room.
Just make sure you don't disconnect/leave there. Not everyone will instantly have time for chat.
 
@kaiser thanks a lot! I will be online as long as I can. Thanks
 
8:15 PM
@all the trunk branch for the language files is the most up to date right i18n.svn.wordpress.org ?
doesn't seem like it though , huge diff between trunk i18n.svn.wordpress.org and translate.wordpress.org so confusing
 
> I think your rating is pathetic, Try reading the other ratings before giving it such a wank rating,
 
I never got the straight answer on language stuff
 
the codex and language site are a fucking confusing mess, so many links
 
ya I had to click export on the dev version, not easy to find
 
8:22 PM
That’s the WordPress Way™.
 
@Trufa looking at your Q, did you try another filter? include that attempt into Q?
 
don't forget to add answer to the Q
 
how do you even add words manually to this thing translate.wordpress.org/projects/wp/dev the parser missing a whole bunch of words
fucking shit fuck, why dont they just have the godamn files in a repo somewhere
 
I +1 this fucking shit fuck... I just take the translations from the releases and live with slightly outdated translations in between. terrible mess.
 
8:36 PM
translate says 100% yet it's missing about 60% of the words/sentences on the user profile page..I have to change them myself which is fine, but there no way to send these changes back to .org it seems.
 
log in and suggest your translations
 
my fault the admin translations are on another url, why I have no idea , translate.wordpress.org/projects/wp/dev/admin
apparently wordpress and wordpress admin are not the same and the link is fucking hard to find
what a godamn mess the 2 files translate different things in admin, the admin version is missing some words the wordpress version had working and vice versa
@toscho how do you suggest them, trac ticket?
 
no, just write a new translation. a human validator will approve or reject it
eventually
maybe
or not
 
8:52 PM
I literally don't know how to do that, svn is way out of date, even though it says The WordPress Localization Repository at i18n.svn.wordpress.org
and I dont know how to add a string to this wierd shit translate.wordpress.org/projects/wp/dev/admin
the word does not exists, it needs to be added
 
then the parser hasn't found it, that's a bug ticket
 
_e('(required) _e( 'Strength indicator' ) 2 examples of what parser missing
 
9:31 PM
ok, more DI balancing Q...
protected function getData(ReleaseParser $parser, Manager $fractal)
{
    $releases = $parser->getReleases();
    $resource = new Collection($releases, new ReleaseTransformer());
    $data     = $fractal->createData($resource);
    return $data->toArray();
}
I feel that fetching releases belongs inside controller, but creating collection outside?..
but I cannot make collection a service since it accepts releases in constructor?
 
Do you have different instances of Manager and ReleaseParser or they are services?
 
services
 
9:54 PM
    protected function getData(Manager $fractal)
    {
        // $this->factory is an instance of CollectionFactory
        // passed via DI

        $resource = $this->factory->factory(new ReleaseTransformer());
        return $fractal->createData($resource)->toArray();
    }


    class CollectionFactory {

        function __construct( ReleaseParser $parser ) {
            $this->parser = $parser;
        }

        function factory(ReleaseTransformer $transformer, $class = 'Collection') {
            return new $class($this->parser->getReleases(), $transformer);
something like that?
 
maybe. don't quite like.
 
Maybe CollectionFactory can receive releases in constructor instead of parser
 
ok, transformer needs to be a service too... maybe could as well stuff all of this into service
 
Can Collection be a service?
 
if it instantiates Parser and gets releases in server definition
should data retrieval even happen in server definitions?
 
10:01 PM
not really...
DI container is Pimple, right?
 
Silex, older Pimple ver
 
You can use Pimple factory method + invokable object to create Collection
 
please remind me?
 
In pimple you can register things using factory method
Normally tha method accepts a closure
but you can pass any object that has an __invoke method
that receives container
Nice thing is that this __invokable object can be registered in container too
 
older behavior is reverse. factory by default, share() method to singleton it
 
10:08 PM
It doesn't change too much... It accepts invokable objects?
 
do you have example of using invokable?
 
1 sec, tel
 
ok, I see what it's doing: $this->values[$id]($this)
don't see how it helps me to pass releases along yet
 
10:23 PM
Well, you said to put collection in service definition... that makes container like a mess and pretty untestable. I suggested to use a class to generate collection, via the __invoke method: regarding architecture it's the same (a bad thing) but at least container is a bit cleaner and code is better testable, because invokable object can be tested in isolation
 
yes, but how do I pass releases to invokable thing?
 
__invoke acts like the closure you normally use in Pimple: it receives pimple instance...
 
so do you suggest I put releases into container or something?
 
class InvokeMe {

    function __invoke(Pimple $pimple) {
        //
    }
}



$container['invokable'] = function() {
  return new InvokeMe;
};

$container['object'] =  $container['invokable'];
 
so far I just see roundabout way to write a service and no closer to dealing with constructor issue :)
but getting late...
 
10:31 PM
Pretty so. In addition while constructor + closure = no tests, invokable are testable in isolation.
And now going to sleep :)
 
yay, it's alive! finished last controller
I want to push it up today
 
what is it?
 
kind of a Composer repo for zips, see wpchat.com/t/…
 
10:53 PM
@Rarst everybody has to host his own or do you want to offer a centralized solution?
 
it's primarily for paid stuff, so their own. make it for people very easy to throw bunch of zips into it and seamlessly use in their sites
 
will there be an additional composer.json setting? something along the lines of private-repos?
 
it would need authentication implemented, but that's for later
I basically just wrote it from scratch in ~1 day total
 
so it's proof of concept?
 
well, it will work :)
if no one uses it then it's probably that :)
 
11:23 PM
Introducing Release Belt — Composer repo for ZIPs https://github.com/Rarst/release-belt
 
@Rarst would be way better if the releases dir would be configurable or at least outside that repo. that's what I previously meant to ask with private-repos.
 
it is already configurable, just hadn't got to testing and documenting
note that generated URLs aren't mapping to releases folder. they are virtual and to be secured later.
 

« first day (1502 days earlier)      last day (3431 days later) »