PluginProbe ʕ •ᴥ•ʔ
AI Copilot – Content Generator / 1.5.4
AI Copilot – Content Generator v1.5.4
1.5.4 1.4.21 1.4.18 1.4.19 1.4.20 trunk 1.0.4 1.1.0 1.2.0 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.17 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.9
ai-copilot-content-generator / modules / postsfields / mod.php
ai-copilot-content-generator / modules / postsfields Last commit date
assets 1 week ago models 1 week ago views 1 week ago controller.php 1 week ago mod.php 1 week ago
mod.php
72 lines
1 <?php
2 class WaicPostsfields extends WaicModule {
3 public function init() {
4 WaicDispatcher::addFilter('mainAdminTabs', array($this, 'addAdminTab'));
5
6 WaicDispatcher::addFilter('addPostFields_postsfields', array($this, 'addPostFields'));
7 }
8
9 public function addAdminTab( $tabs ) {
10 $code = 'workspace';
11 $tabs['postsfields'] = array(
12 'label' => esc_html__( 'Bulk Field Generation for Existing Posts', 'ai-copilot-content-generator' ),
13 'callback' => array( $this, 'showFieldsTabContent' ),
14 'hidden' => 1,
15 'sort_order' => 0,
16 'bread' => true,
17 'last_Id' => 'waicTaskNameWrapper',
18 );
19 /*$tabs['postsfields-results'] = array(
20 'label' => esc_html__( 'Results', 'ai-copilot-content-generator' ),
21 'callback' => array( $this, 'showFieldsTabContent' ),
22 'hidden' => 1,
23 'hide_menu' => 1,
24 'bread' => array($code, 'postsfields'),
25 );*/
26 return $tabs;
27 }
28
29 public function showFieldsTabContent() {
30 $taskId = WaicReq::getVar('task_id');
31 $title = __( 'Your Scenario name', 'ai-copilot-content-generator' );
32 if (!empty($taskId)) {
33 $task = WaicFrame::_()->getModule('workspace')->getModel('tasks')->getTask($taskId);
34 if ($task && !empty($task['id'])) {
35 WaicFrame::_()->getModule('adminmenu')->setLastBread(WaicUtils::getArrayValue($task, 'title', $title));
36 $showSettings = WaicReq::getVar('show_settings') == 1;
37 if (empty($task['status']) || 9 == $task['status'] || $showSettings) {
38 return $this->getView()->showCreateTabContent($task['id'], $task, $showSettings);
39 }
40 return $this->getView()->showResultTabContent($task);
41 }
42 }
43 WaicFrame::_()->getModule('adminmenu')->setLastBread($title);
44 return $this->getView()->showCreateTabContent($taskId);
45 }
46 public function getFieldsTabsList( $current = '' ) {
47 $tabs = array(
48 'params' => array(
49 'class' => '',
50 'pro' => false,
51 'label' => __('Generation', 'ai-copilot-content-generator'),
52 ),
53 'api' => array(
54 'class' => '',
55 'pro' => false,
56 'label' => __('API settings', 'ai-copilot-content-generator'),
57 ),
58 );
59
60 if (empty($current) || !isset($tabs[$current])) {
61 reset($tabs);
62 $current = key($tabs);
63 }
64 $tabs[$current]['class'] .= ' current';
65
66 return $tabs;
67 }
68 public function addPostFields( $fields ) {
69 return $this->getModel()->addPostFields($fields);
70 }
71 }
72