Advertisement
fruffl

PHP6 Wordpress

May 22nd, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 19.80 KB | None | 0 0
  1. <?PHP
  2.     NAMESPACE tri4m\Wp;
  3.     USE tri4m\Wp\__const_Action;
  4.     USE tri4m\Wp\__const_AdminLink;
  5.     USE tri4m\Wp\__const_Filter;
  6.     USE tri4m\Wp\__type_Call;
  7.     USE tri4m\Wp\Hook;
  8.     USE tri4m\Wp\Inv;
  9.     USE tri4m\Wp\Theme;
  10.     USE tri4m\Wp\Trace;
  11.     USE tri4m\Wp\Wtf\__type_AdminBar;
  12.     USE tri4m\Wp\Wtf\__type_ContextualHelp;
  13.     USE tri4m\Wp\Wtf\__type_ManageColumns;
  14.     USE tri4m\Wp\Wtf\__type_Name;
  15.     USE tri4m\Wp\Wtf\__type_PostType;
  16.     USE tri4m\Wp\Wtf\__type_Settings;
  17.     USE tri4m\Wp\Wtf\__type_SideBar;
  18.     USE tri4m\Wp\Wtf\__type_Taxonomy;
  19.     USE tri4m\Wp\Wtf\AdminBar;
  20.     USE tri4m\Wp\Wtf\AdminBar\Child;
  21.     USE tri4m\Wp\Wtf\ContextualHelp;
  22.     USE tri4m\Wp\Wtf\ContextualHelp\__type_Tab;
  23.     USE tri4m\Wp\Wtf\ContextualHelp\Tabs;
  24.     USE tri4m\Wp\Wtf\ManageColumns;
  25.     USE tri4m\Wp\Wtf\PostType;
  26.     USE tri4m\Wp\Wtf\PostType\__flag_Support;
  27.     USE tri4m\Wp\Wtf\Settings;
  28.     USE tri4m\Wp\Wtf\Settings\__type_Field;
  29.     USE tri4m\Wp\Wtf\Settings\__type_Page;
  30.     USE tri4m\Wp\Wtf\Settings\__type_Section;
  31.     USE tri4m\Wp\Wtf\Settings\Fields;
  32.     USE tri4m\Wp\Wtf\Settings\Sections;
  33.     USE tri4m\Wp\Wtf\SideBar;
  34.     USE tri4m\Wp\Wtf\SubMenuPage;
  35.     USE tri4m\Wp\Wtf\__type_SubMenuPage;
  36.     USE tri4m\Wp\Wtf\Taxonomy;
  37.     USE ILLI\Core\Util\String;
  38.     USE WP_Post;
  39.    
  40.     CLASS Application
  41.     {
  42.         function boot()
  43.         {
  44.             Trace::add(__METHOD__);
  45.            
  46.                 (new SubMenuPage(new __type_SubMenuPage([
  47.                     __type_SubMenuPage::id      => 'bob',
  48.                     __type_SubMenuPage::title   => 'bob Options',
  49.                     __type_SubMenuPage::menuTitle   => 'bob',
  50.                     __type_SubMenuPage::content => new __type_Call([
  51.                         __type_Call::fn => function()
  52.                         {
  53.                             print 'hello';
  54.                         }
  55.                     ])
  56.                 ])))->install();
  57.            
  58.             #:options:
  59.            
  60.                 (new Settings(new __type_Settings([
  61.                     __type_Settings::id     => 'foobar',
  62.                     __type_Settings::deep       => TRUE,
  63.                     __type_Settings::page       => new __type_Page([
  64.                         __type_Page::title      => 'foobar Options',
  65.                     ]),
  66.                     __type_Settings::sections   => new Sections([
  67.                         new __type_Section([
  68.                             __type_Section::id  => 'FOO',
  69.                             __type_Section::title   => 'FOO VARS',
  70.                             __type_Section::content => '<p>trolololol</p>',
  71.                             __type_Section::fields  => new Fields([
  72.                                 new __type_Field([
  73.                                     __type_Field::id    => 'first_option',
  74.                                     __type_Field::title => '1st Option',
  75.                                     __type_Field::std   => '1st Value',
  76.                                     __type_Field::type  => 'text',
  77.                                     __type_Field::desc  => 'another textfield',
  78.                                 ]),
  79.                                 new __type_Field([
  80.                                     __type_Field::id    => 'second_option',
  81.                                     __type_Field::title => '2nd Option',
  82.                                     __type_Field::std   => '2nd Value',
  83.                                     __type_Field::type  => 'text',
  84.                                 ])
  85.                             ])
  86.                         ]),
  87.                         new __type_Section([
  88.                             __type_Section::id  => 'BAR',
  89.                             __type_Section::title   => 'BAR VARS',
  90.                             __type_Section::content => '<p>Hello world</p>',
  91.                             __type_Section::fields  => new Fields([
  92.                                 new __type_Field([
  93.                                     __type_Field::id    => 'third_option',
  94.                                     __type_Field::title => '3rd Option',
  95.                                     __type_Field::std   => '3rd Value',
  96.                                     __type_Field::type  => 'text',
  97.                                 ]),
  98.                                 new __type_Field([
  99.                                     __type_Field::id    => 'fourth_option',
  100.                                     __type_Field::title => '4th Option',
  101.                                     __type_Field::std   => '4th Value',
  102.                                     __type_Field::type  => 'text',
  103.                                 ])
  104.                             ])
  105.                         ])
  106.                     ])
  107.                 ])))->install();
  108.                
  109.                 (new Settings(new __type_Settings([
  110.                     __type_Settings::id     => 'foobaz',
  111.                     __type_Settings::deep       => FALSE,
  112.                     __type_Settings::page       => new __type_Page([
  113.                         __type_Page::title      => 'foobaz Options',
  114.                         __type_Page::parentId       => __const_AdminLink::PAGES,
  115.                     ]),
  116.                     __type_Settings::sections   => new Sections([
  117.                         new __type_Section([
  118.                             __type_Section::id  => 'FOO',
  119.                             __type_Section::title   => 'FOO VARS',
  120.                             __type_Section::content => '<p>trolololol</p>',
  121.                             __type_Section::fields  => new Fields([
  122.                                 new __type_Field([
  123.                                     __type_Field::id    => 'first_option',
  124.                                     __type_Field::title => '1st Option',
  125.                                     __type_Field::std   => '1st Value',
  126.                                     __type_Field::type  => 'text',
  127.                                     __type_Field::desc  => 'another textfield',
  128.                                 ]),
  129.                                 new __type_Field([
  130.                                     __type_Field::id    => 'second_option',
  131.                                     __type_Field::title => '2nd Option',
  132.                                     __type_Field::std   => '2nd Value',
  133.                                     __type_Field::type  => 'text',
  134.                                 ])
  135.                             ])
  136.                         ]),
  137.                         new __type_Section([
  138.                             __type_Section::id  => 'BAR',
  139.                             __type_Section::title   => 'BAR VARS',
  140.                             __type_Section::content => '<p>Hello world</p>',
  141.                             __type_Section::fields  => new Fields([
  142.                                 new __type_Field([
  143.                                     __type_Field::id    => 'third_option',
  144.                                     __type_Field::title => '3rd Option',
  145.                                     __type_Field::std   => '3rd Value',
  146.                                     __type_Field::type  => 'text',
  147.                                 ]),
  148.                                 new __type_Field([
  149.                                     __type_Field::id    => 'fourth_option',
  150.                                     __type_Field::title => '4th Option',
  151.                                     __type_Field::std   => '4th Value',
  152.                                     __type_Field::type  => 'text',
  153.                                 ])
  154.                             ])
  155.                         ])
  156.                     ])
  157.                 ])))->install();
  158.             #::
  159.            
  160.             #:config:
  161.                
  162.                 Hook::enqueue(new __type_Call([
  163.                     __type_Call::fn     => ['tri4m\Wp\Inv', 'addThemeSupport'],
  164.                     __type_Call::arguments  => ['post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'status', 'audio', 'video', 'chat']]
  165.                 ]));
  166.                
  167.                 Hook::enqueue(new __type_Call([
  168.                     __type_Call::fn     => ['tri4m\Wp\Inv', 'addThemeSupport'],
  169.                     __type_Call::arguments  => ['post-thumbnails']
  170.                 ]));
  171.                
  172.                 Hook::enqueue(new __type_Call([
  173.                     __type_Call::fn     => ['tri4m\Wp\Inv', 'addThemeSupport'],
  174.                     __type_Call::arguments  => ['automatic-feed-links']
  175.                 ]));
  176.                
  177.                 Hook::enqueue(new __type_Call([
  178.                     __type_Call::fn     => ['tri4m\Wp\Inv', 'addImageSize'],
  179.                     __type_Call::arguments  => ['edit-screen-thumbnail', 100, 100, TRUE]
  180.                 ]));
  181.                
  182.                 Hook::enqueue(new __type_Call([
  183.                     __type_Call::fn     => ['tri4m\Wp\Inv', 'addThemeSupport'],
  184.                     __type_Call::arguments  => [720, 240, true]
  185.                 ]));
  186.                
  187.                 Hook::enqueue(new __type_Call([
  188.                     __type_Call::fn     => ['tri4m\Wp\Inv', 'addEditorStyle']
  189.                 ]));
  190.            
  191.             #::
  192.            
  193.             #:posttypes:
  194.            
  195.                 #! capabilities not implemented
  196.                
  197.                 #:events:
  198.                
  199.                     $Event = new __type_PostType([
  200.                         __type_PostType::name => new __type_Name([
  201.                             __type_Name::singular       => 'Event',
  202.                             __type_Name::plural     => 'Events',
  203.                             __type_Name::slugSingular   => 'event',
  204.                             __type_Name::slugPlural     => 'events'
  205.                         ])
  206.                     ]);
  207.                    
  208.                     $EventType = new __type_Taxonomy([
  209.                         __type_Taxonomy::type => $Event->name->slugSingular,
  210.                         __type_Taxonomy::name => new __type_Name([
  211.                             __type_Name::singular       => 'Type',
  212.                             __type_Name::plural     => 'Types',
  213.                             __type_Name::slugSingular   => 'event_type',
  214.                             __type_Name::slugPlural     => 'event_types'
  215.                         ])
  216.                     ]);
  217.                    
  218.                     $Event->env->supports           = 11 + __flag_Support::POST_FORMATS;
  219.                     $Event->env->hierarchical       = TRUE;
  220.                     $Event->env->taxonomies         = [$EventType->name->slugSingular];
  221.                     $Event->env->rewrite->slug      = 'event';
  222.                     (new PostType($Event))->install();
  223.                    
  224.                     $EventType->args->rewrite->slug     = 'events/by-type';
  225.                     (new Taxonomy($EventType))->install();
  226.                
  227.                 #::
  228.                
  229.                 #:members:
  230.                
  231.                     $Member = new __type_PostType([
  232.                         __type_PostType::name => new __type_Name([
  233.                             __type_Name::singular       => 'Member',
  234.                             __type_Name::plural     => 'Members',
  235.                             __type_Name::slugSingular   => 'member',
  236.                             __type_Name::slugPlural     => 'members'
  237.                         ])
  238.                     ]);
  239.                    
  240.                     $MemberProfession = new __type_Taxonomy([
  241.                         __type_Taxonomy::type => $Member->name->slugSingular,
  242.                         __type_Taxonomy::name => new __type_Name([
  243.                             __type_Name::singular       => 'Profession',
  244.                             __type_Name::plural     => 'Professions',
  245.                             __type_Name::slugSingular   => 'profession',
  246.                             __type_Name::slugPlural     => 'professions'
  247.                         ])
  248.                     ]);
  249.                    
  250.                     $MemberLevel = new __type_Taxonomy([
  251.                         __type_Taxonomy::type => $Member->name->slugSingular,
  252.                         __type_Taxonomy::name => new __type_Name([
  253.                             __type_Name::singular       => 'Level',
  254.                             __type_Name::plural     => 'Levels',
  255.                             __type_Name::slugSingular   => 'level',
  256.                             __type_Name::slugPlural     => 'levels'
  257.                         ])
  258.                     ]);
  259.                    
  260.                     $Member->env->supports          = 11 + __flag_Support::POST_FORMATS;
  261.                     $Member->env->hierarchical      = FALSE;
  262.                     $Member->env->taxonomies        = [$MemberProfession->name->slugSingular, $MemberLevel->name->slugSingular];
  263.                     $Member->env->rewrite->slug     = 'member';
  264.                     (new PostType($Member))->install();
  265.                    
  266.                     $MemberProfession->args->rewrite->slug  = 'members/by-profession';
  267.                     (new Taxonomy($MemberProfession))->install();
  268.                    
  269.                     $MemberLevel->args->rewrite->slug   = 'members/by-level';
  270.                     (new Taxonomy($MemberLevel))->install();
  271.                    
  272.                     #:test:
  273.                    
  274.                         #+ contextual help from __type_Call
  275.                    
  276.                         (new ContextualHelp(new __type_ContextualHelp([
  277.                             __type_ContextualHelp::name => $Member->name,
  278.                             __type_ContextualHelp::id   => 'edit-'.$Member->name->slugSingular,
  279.                             __type_ContextualHelp::content  => new __type_Call([
  280.                                 __type_Call::fn     => function()
  281.                                 {
  282.                                     return [
  283.                                         '<h2>Edit {:singular}</h2>',
  284.                                         '<p>This page allows you to view/modify {:singular} details. Please make sure to fill out the available boxes with the appropriate details and <strong>not</strong> add these details to the {:singular} description.</p>'
  285.                                     ];
  286.                                 }
  287.                             ])
  288.                         ])))->install();
  289.                        
  290.                         #+ contextual help tabs from __type_Call, SPL_ARRAY
  291.                        
  292.                         (new ContextualHelp(new __type_ContextualHelp([
  293.                             __type_ContextualHelp::name => $Member->name,
  294.                             __type_ContextualHelp::id   => $Member->name->slugSingular,
  295.                             __type_ContextualHelp::content  => new Tabs([
  296.                                 new __type_Tab([
  297.                                     __type_Tab::id      => 'welcome',
  298.                                     __type_Tab::label   => 'edit {:plural}',
  299.                                     __type_Tab::content =>
  300.                                     [
  301.                                         '<h2>{:plural}</h2>',
  302.                                         '<p>{:plural} show the details of the items that we sell on the website. You can see a list of them on this page in reverse chronological order - the latest one we added is first.</p>',
  303.                                         '<p>You can view/edit the details of each {:singular} by clicking on its name, or you can perform bulk actions using the dropdown menu and selecting multiple items.</p>'
  304.                                     ]
  305.                                 ]),
  306.                                 new __type_Tab([
  307.                                     __type_Tab::id      => 'test',
  308.                                     __type_Tab::label   => 'Test',
  309.                                     __type_Tab::content =>
  310.                                     [
  311.                                         '<h2>Testertesting</h2>',
  312.                                         '<p>This page allows you to view/modify {:singular} details. Please make sure to fill out the available boxes with the appropriate details and <strong>not</strong> add these details to the {:singular} description.</p>'
  313.                                     ],
  314.                                 ]),
  315.                                 new __type_Tab([
  316.                                     __type_Tab::id      => 'ctest',
  317.                                     __type_Tab::label   => 'Callable Test',
  318.                                     __type_Tab::content => new __type_Call([
  319.                                         __type_Call::fn => function()
  320.                                         {
  321.                                             return 'hello {:singular}';
  322.                                         }
  323.                                     ])
  324.                                 ]),
  325.                             ])
  326.                         ])))->install();
  327.                        
  328.                     #::
  329.                
  330.                 #::
  331.                
  332.                 #:skills:
  333.                    
  334.                     $Skill = new __type_PostType([
  335.                         __type_PostType::name => new __type_Name([
  336.                             __type_Name::singular       => 'Skill',
  337.                             __type_Name::plural     => 'Skills',
  338.                             __type_Name::slugSingular   => 'skill',
  339.                             __type_Name::slugPlural     => 'skills'
  340.                         ])
  341.                     ]);
  342.                    
  343.                     $SkillTechnology = new __type_Taxonomy([
  344.                         __type_Taxonomy::type => $Skill->name->slugSingular,
  345.                         __type_Taxonomy::name => new __type_Name([
  346.                             __type_Name::singular       => 'Technology',
  347.                             __type_Name::plural     => 'Technologies',
  348.                             __type_Name::slugSingular   => 'skill_technology',
  349.                             __type_Name::slugPlural     => 'skill_technologies'
  350.                         ])
  351.                     ]);
  352.                    
  353.                     $SkillPlotKW = new __type_Taxonomy([
  354.                         __type_Taxonomy::type => $Skill->name->slugSingular,
  355.                         __type_Taxonomy::name => new __type_Name([
  356.                             __type_Name::singular       => 'Plot Keyword',
  357.                             __type_Name::plural     => 'Plot Keywords',
  358.                             __type_Name::slugSingular   => 'skill_plot_keyword',
  359.                             __type_Name::slugPlural     => 'skill_plot_keywords'
  360.                         ])
  361.                     ]);
  362.                    
  363.                     $SkillType = new __type_Taxonomy([
  364.                         __type_Taxonomy::type => $Skill->name->slugSingular,
  365.                         __type_Taxonomy::name => new __type_Name([
  366.                             __type_Name::singular       => 'Type',
  367.                             __type_Name::plural     => 'Types',
  368.                             __type_Name::slugSingular   => 'skill_type',
  369.                             __type_Name::slugPlural     => 'skill_types'
  370.                         ])
  371.                     ]);
  372.                    
  373.                     $SkillYear = new __type_Taxonomy([
  374.                         __type_Taxonomy::type => $Skill->name->slugSingular,
  375.                         __type_Taxonomy::name => new __type_Name([
  376.                             __type_Name::singular       => 'Year',
  377.                             __type_Name::plural     => 'Years',
  378.                             __type_Name::slugSingular   => 'skill_year',
  379.                             __type_Name::slugPlural     => 'skill_years'
  380.                         ])
  381.                     ]);
  382.                    
  383.                     $SkillClient = new __type_Taxonomy([
  384.                         __type_Taxonomy::type => $Skill->name->slugSingular,
  385.                         __type_Taxonomy::name => new __type_Name([
  386.                             __type_Name::singular       => 'Client',
  387.                             __type_Name::plural     => 'Clients',
  388.                             __type_Name::slugSingular   => 'skill_client',
  389.                             __type_Name::slugPlural     => 'skill_clients'
  390.                         ])
  391.                     ]);
  392.                    
  393.                     $SkillLocation = new __type_Taxonomy([
  394.                         __type_Taxonomy::type => $Skill->name->slugSingular,
  395.                         __type_Taxonomy::name => new __type_Name([
  396.                             __type_Name::singular       => 'Location',
  397.                             __type_Name::plural     => 'Location',
  398.                             __type_Name::slugSingular   => 'skill_location',
  399.                             __type_Name::slugPlural     => 'skill_locations'
  400.                         ])
  401.                     ]);
  402.                    
  403.                     $Skill->env->supports           = 11 + __flag_Support::PAGE_ATTRIBUTES | __flag_Support::POST_FORMATS;
  404.                     $Skill->env->hierarchical       = TRUE;
  405.                     $Skill->env->taxonomies         =
  406.                     [
  407.                         $SkillTechnology->name->slugSingular,
  408.                         $SkillType->name->slugSingular,
  409.                         $SkillYear->name->slugSingular,
  410.                         $SkillClient->name->slugSingular
  411.                     ];
  412.                     $Skill->env->rewrite->slug      = 'skill';
  413.                     (new PostType($Skill))->install();
  414.                    
  415.                     $SkillTechnology->args->rewrite->slug   = 'skills/by-technology';
  416.                     (new Taxonomy($SkillTechnology))->install();
  417.                    
  418.                     $SkillType->args->rewrite->slug     = 'skills/by-plot-keyword';
  419.                     (new Taxonomy($SkillPlotKW))->install();
  420.                    
  421.                     $SkillType->args->rewrite->slug     = 'skills/by-type';
  422.                     (new Taxonomy($SkillType))->install();
  423.                    
  424.                     $SkillYear->args->rewrite->slug     = 'skills/by-year';
  425.                     (new Taxonomy($SkillYear))->install();
  426.                    
  427.                     $SkillClient->args->rewrite->slug   = 'skills/by-client';
  428.                     (new Taxonomy($SkillClient))->install();
  429.                    
  430.                     $SkillLocation->args->rewrite->slug = 'skills/by-location';
  431.                     (new Taxonomy($SkillLocation))->install();
  432.                    
  433.                 #::
  434.             #::
  435.            
  436.             #:sidebar:
  437.            
  438.                 #:test:
  439.                    
  440.                     (new SideBar(new __type_SideBar([
  441.                         __type_Sidebar::name    => 'Left',
  442.                         __type_Sidebar::id  => '{:slug}_sidebar_left',
  443.                         __type_Sidebar::desc    => 'The {:name} sidebar.'
  444.                     ])))->install();
  445.                
  446.                     (new SideBar(new __type_SideBar([
  447.                         __type_Sidebar::name    => 'Right',
  448.                         __type_Sidebar::id  => '{:slug}_sidebar_right',
  449.                         __type_Sidebar::desc    => 'The {:name} sidebar.'
  450.                     ])))->install();
  451.                    
  452.                     (new SideBar(new __type_SideBar([
  453.                         __type_Sidebar::name    => '2nd Right',
  454.                         __type_Sidebar::id  => '{:slug}_sidebar_right_2',
  455.                         __type_Sidebar::desc    => 'The {:name} sidebar.'
  456.                     ])))->install();
  457.                    
  458.                     (new SideBar(new __type_SideBar([
  459.                         __type_Sidebar::name    => 'Footer',
  460.                         __type_Sidebar::id  => '{:slug}_sidebar_footer',
  461.                         __type_Sidebar::desc    => 'The {:name} sidebar.'
  462.                     ])))->install();
  463.                    
  464.                 #::
  465.            
  466.             #::
  467.                
  468.             #:adminbar:
  469.            
  470.                 #:test:
  471.            
  472.                     (new AdminBar(new __type_AdminBar([
  473.                         __type_AdminBar::title  => Theme::fullName(),
  474.                         __type_AdminBar::id => Theme::fullName(),
  475.                         __type_AdminBar::href   => '#',
  476.                         __type_AdminBar::child  => new Child([
  477.                             new AdminBar(new __type_AdminBar([
  478.                                 __type_AdminBar::title  => 'foo'
  479.                             ]))
  480.                         ])
  481.                     ])))->install();
  482.                    
  483.                     (new AdminBar(new __type_AdminBar([
  484.                         __type_AdminBar::title  => Theme::name(),
  485.                         __type_AdminBar::id => Theme::name(),
  486.                         __type_AdminBar::href   => '#',
  487.                         __type_AdminBar::child  => new Child([
  488.                             new AdminBar(new __type_AdminBar([
  489.                                 __type_AdminBar::title  => 'baz'
  490.                             ]))
  491.                         ])
  492.                     ])))->install();
  493.                
  494.                 #::
  495.                
  496.             #::
  497.            
  498.             #:manageColumns:
  499.            
  500.                 #:posts:
  501.            
  502.                     #:test:
  503.                
  504.                         #+ remove column 'tags' from postType 'post'
  505.                    
  506.                         (new ManageColumns(new __type_ManageColumns([
  507.                             __type_ManageColumns::filterEvent   => String::insert(__const_Filter::MANAGE_POST_TYPE_POSTS_COLUMNS__, ['postType' => 'post']),
  508.                             __type_ManageColumns::filter        => new __type_Call([
  509.                                 __type_Call::fn         => function($__columns)
  510.                                 {
  511.                                     unset($__columns['tags']);
  512.                                     return $__columns;
  513.                                 }
  514.                             ])
  515.                         ])))->install();
  516.                    
  517.                     #::
  518.                    
  519.                     #:featuredImage:
  520.                    
  521.                         #+ add featuredImage to multiple postTypes
  522.                    
  523.                         (new ManageColumns(new __type_ManageColumns([
  524.                             __type_ManageColumns::id        => 'featured_image',
  525.                             __type_ManageColumns::title     => 'Featured Image',
  526.                             __type_ManageColumns::index     => 0,
  527.                             __type_ManageColumns::filterEvent   =>
  528.                             [
  529.                                 String::insert(__const_Filter::MANAGE_POST_TYPE_POSTS_COLUMNS__, ['postType' => 'post']),
  530.                                 String::insert(__const_Filter::MANAGE_POST_TYPE_POSTS_COLUMNS__, ['postType' => $Event->name->slugSingular]),
  531.                                 String::insert(__const_Filter::MANAGE_POST_TYPE_POSTS_COLUMNS__, ['postType' => $Member->name->slugSingular]),
  532.                                 String::insert(__const_Filter::MANAGE_POST_TYPE_POSTS_COLUMNS__, ['postType' => $Skill->name->slugSingular]),
  533.                             ],
  534.                             __type_ManageColumns::actionEvent   =>
  535.                             [
  536.                                 String::insert(__const_Action::MANAGE_POST_TYPE_POSTS_CUSTOM_COLUMN__, ['postType' => 'post']),
  537.                                 String::insert(__const_Action::MANAGE_POST_TYPE_POSTS_CUSTOM_COLUMN__, ['postType' => $Event->name->slugSingular]),
  538.                                 String::insert(__const_Action::MANAGE_POST_TYPE_POSTS_CUSTOM_COLUMN__, ['postType' => $Member->name->slugSingular]),
  539.                                 String::insert(__const_Action::MANAGE_POST_TYPE_POSTS_CUSTOM_COLUMN__, ['postType' => $Skill->name->slugSingular]),
  540.                             ],
  541.                             __type_ManageColumns::action        => new __type_Call([
  542.                                 __type_Call::fn         => function($__column, WP_Post $__WpPost)
  543.                                 {
  544.                                     print Inv::getThePostThumbnail($__WpPost->ID, 'edit-screen-thumbnail');
  545.                                 }
  546.                             ])
  547.                         ])))->install();
  548.                        
  549.                     #::
  550.                    
  551.                     #:wordCount:
  552.                    
  553.                         #+ add wordCount to postType 'post'
  554.                    
  555.                         (new ManageColumns(new __type_ManageColumns([
  556.                             __type_ManageColumns::id        => 'word_count',
  557.                             __type_ManageColumns::title     => 'Word Count',
  558.                             __type_ManageColumns::index     => 2,
  559.                             __type_ManageColumns::filterEvent   => String::insert(__const_Filter::MANAGE_POST_TYPE_POSTS_COLUMNS__, ['postType' => 'post']),
  560.                             __type_ManageColumns::actionEvent   => String::insert(__const_Action::MANAGE_POST_TYPE_POSTS_CUSTOM_COLUMN__, ['postType' => 'post']),
  561.                             __type_ManageColumns::action        => new __type_Call([
  562.                                 __type_Call::fn         => function($__column, WP_Post $__WpPost)
  563.                                 {
  564.                                     print Inv::strWordCount($__WpPost->post_content);
  565.                                 }
  566.                             ])
  567.                         ])))->install();
  568.                    
  569.                     #::
  570.                
  571.                 #::
  572.                
  573.             #::
  574.         }
  575.        
  576.         function run()
  577.         {
  578.             Trace::add(__METHOD__);
  579.             Hook::dequeue();
  580.         }
  581.        
  582.         function shutdown()
  583.         {
  584.             Trace::add(__METHOD__);
  585.         }
  586.        
  587.         function install()
  588.         {
  589.             Trace::add(__METHOD__);
  590.         }
  591.        
  592.         function uninstall()
  593.         {
  594.             Trace::add(__METHOD__);
  595.         }
  596.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement