_task_categories = array( 'metas' => __('METAs', _SQ_PLUGIN_NAME_), 'opengraph' => __('Open Graph', _SQ_PLUGIN_NAME_), 'twittercard' => __('Twitter Card', _SQ_PLUGIN_NAME_), 'visibility' => __('Visibility', _SQ_PLUGIN_NAME_), ); foreach ($this->_task_categories as $category => $title) { $this->_task_categories_labels[$category] = array( 'color' => '#dd3333', 'name' => $title, 'show' => false); } return $this; } public function parsePage(SQ_Models_Domain_Post $page, $labels = array()) { //set focus pages from API $this->_page = $page; //call focus page tasks for all categories $this->parseAllTasks(); $assistant_tasks = apply_filters('sq_assistant_tasks', array()); $this->_assistant_categories[$this->_page->hash] = apply_filters('sq_assistant_categories', array()); //remove the filters for the next focus page remove_all_filters('sq_assistant_tasks'); remove_all_filters('sq_assistant_categories'); $total_tasks = $total_tasks_completed = 0; foreach ($this->_task_categories as $category => $array) { //Build the tasks score foreach ($assistant_tasks[$category] as $task) { $total_tasks++; if ($task['completed'] || $task['error'] || !$task['active']) { //add task as completed $total_tasks_completed++; } } if (!empty($assistant_tasks[$category])) { $this->_assistant_categories[$this->_page->hash][$category]['assistant'] = $this->getAssistant($category, $assistant_tasks[$category], $this->_assistant_categories[$this->_page->hash][$category]); } //if the category is incomplete if (!$this->_assistant_categories[$this->_page->hash][$category]['completed']) { $this->_task_categories_labels[$category]['show'] = true; } elseif (is_array($labels) && !empty($labels)) { if (in_array($category, $labels)) { $this->_page = false; return $this; } } } //Set the total number of tasks $this->_page->setTotalTasts($total_tasks); $this->_page->setCompletedTasts($total_tasks_completed); //set the categories for this page add_filter('sq_assistant_categories_page', array($this, 'getAssistantCategories')); return $this; } public function getCategories() { return json_decode(json_encode($this->_task_categories)); } public function getAssistantCategories($hash) { return json_decode(json_encode($this->_assistant_categories[$hash])); } public function getLabels() { return json_decode(json_encode(apply_filters('sq_categories_labels', $this->_task_categories_labels))); } public function getPage() { return $this->_page; } public function getAssistant($category_name = '', $tasks = array(), $category = array()) { $content = ''; if (!empty($tasks) && !empty($category)) { $content .= ''; } return $content; } /** * Get the admin Menu Tabs */ public function parseAllTasks() { foreach ($this->_task_categories as $category => $title) { if ($bulkClass = SQ_Classes_ObjController::getNewClass('SQ_Models_Bulkseo_' . ucfirst($category))) { $bulkClass->setPost($this->_page)->init();//set the local post in focuspage model } } } }