_audit->data)) { $this->_error = true; return; } if (isset($this->_audit->data->sq_seo_keywords->value) && $this->_audit->data->sq_seo_keywords->value <> '') { $this->_keyword = $this->_audit->data->sq_seo_keywords->value; } if (isset($this->_audit->data->sq_seo_open_graph->value) && $this->_audit->data->sq_seo_open_graph->value <> '') { $og = json_decode($this->_audit->data->sq_seo_open_graph->value); if (isset($og->image)) { $this->_image = $og->image; } } elseif (isset($this->_audit->data->sq_seo_twittercard->value) && $this->_audit->data->sq_seo_twittercard->value <> '') { $tc = json_decode($this->_audit->data->sq_seo_twittercard->value); if (isset($tc->image)) { $this->_image = $tc->image; } } elseif ($this->_post->post_content <> '') { @preg_match_all('/]*src=[\'"]([^\'"]+)[\'"][^>]*>/i', stripslashes($this->_post->post_content), $out); if (!empty($out)) { if (is_array($out[1]) && count((array)$out[1]) > 0) { foreach ($out[1] as $row) { $this->_image = $row; break; } } } } } public function setTasks($tasks) { parent::setTasks($tasks); $this->_tasks[$this->_category] = array( 'filename' => array( 'title' => __("Keyword in filename", _SQ_PLUGIN_NAME_), 'value' => ($this->_image ? $this->_image : ''), 'penalty' => 5, 'description' => sprintf(__('Your filename for one of the images in this Focus Page should be: %s keyword.jpg %s Download a relevant image from your page. Change the filename. Then re-upload with the SEO filename and add it your page\'s content again. %s It\'s best to keep this at only one filename which contains the main keyword of the page. %s Why? %s Because Google could consider over-optimization if you used it more than once.', _SQ_PLUGIN_NAME_), '

', '

', '

', '

', '

'), ), ); } /** * @param $content * @param $task * @return string */ public function getHeader() { $edit_link = ''; $header = '
  • '; if ($this->_keyword) { $header .= '
    ' . __('Keyword', _SQ_PLUGIN_NAME_) . ': ' . $this->_keyword . '
    '; if (isset($this->_post->ID)) { if (isset($this->_post->ID)) { $edit_link = SQ_Classes_Helpers_Tools::getAdminUrl('sq_seosettings', 'bulkseo') . '&sid=' . $this->_post->ID . '&stype=' . $this->_post->post_type; } $header .= '' . __('Edit your snippet', _SQ_PLUGIN_NAME_) . ''; } } else { $header .= '
    ' . __('No Keyword Found', _SQ_PLUGIN_NAME_) . '
    '; $header .= '' . __('Do a research', _SQ_PLUGIN_NAME_) . ''; if (isset($this->_post->ID)) { $edit_link = SQ_Classes_Helpers_Tools::getAdminUrl('post.php?post=' . (int)$this->_post->ID . '&action=edit'); if ($this->_post->post_type <> 'profile') { $edit_link = get_edit_post_link($this->_post->ID, false); } $header .= '' . __('Optimize for a keyword', _SQ_PLUGIN_NAME_) . ''; } } $header .= '
  • '; return $header; } /*********************************************/ /** * Check if the keyword is in the file name | API keyword in filename * @return bool */ public function checkFilename($task) { $task['completed'] = false; if (!$this->_keyword) { $this->_tasks[$this->_category]['filename']['description'] = sprintf(__('Optimize the post first using a Keyword from Squirrly Briefcase', _SQ_PLUGIN_NAME_), '', ''); $task['completed'] = false; } elseif ($this->_image) { $image = str_replace(array('_', '-', '/', '.'), ' ', $this->_image); if (stripos($image, $this->_keyword) !== false) { $task['completed'] = true; } } return $task; } }