Пример #1
0
 /**
  * Ensure the .htaccess file exists and doesn't reference the blog route
  *
  * @return $this
  */
 protected function _validateHtaccess()
 {
     if (($path = Mage::helper('wordpress')->getWordPressPath()) !== false) {
         $file = rtrim($path, DS) . DS . '.htaccess';
         if (!is_file($file)) {
             throw Fishpig_Wordpress_Exception::warning('.htaccess', 'You do not have a WordPress .htaccess file.');
         }
         if (is_readable($file) && ($data = @file_get_contents($file))) {
             $blogRoute = Mage::helper('wordpress')->getBlogRoute();
             if (preg_match('/\\nRewriteBase \\/' . preg_quote($blogRoute, '/') . '\\//i', $data)) {
                 throw Fishpig_Wordpress_Exception::warning('.htaccess', 'Your .htaccess file references your blog route but should reference your WordPress installation directory.');
             }
         }
     }
     return $this;
 }
 /**
  * Recommend installing Google XML Sitemap
  *
  * @return $this
  */
 protected function _recommendGoogleXmlSitemap()
 {
     if (!Mage::helper('wordpress')->isPluginEnabled('google-sitemap-generator')) {
         if (!Mage::helper('wordpress')->isAddonInstalled('Multisite')) {
             throw Fishpig_Wordpress_Exception::warning('Google Sitemap', $this->__('Install the <a href="%s" target="_blank">Google XML Sitemaps</a> plugin to generate an XML sitemap for your blog.', 'http://wordpress.org/plugins/google-sitemap-generator/'));
         }
     }
     return $this;
 }
 /**
  * Create a new instance of this object
  *
  * @param string $title
  * @param string $longMessage
  * @param int $status = 3
  * @return $this
  */
 public static function factory($title, $longMessage, $status = 3)
 {
     $e = new Fishpig_Wordpress_Exception($title, $status);
     return $e->addMessage(Mage::getModel('core/message')->error($longMessage));
 }
 /**
  * Ensure the L10n file is writable if using add-on extensions that use Core
  *
  * @return $this
  **/
 protected function _validateL10nPermissions()
 {
     if (($path = Mage::helper('wordpress')->getWordPressPath()) !== false) {
         $file = $path . 'wp-includes' . DS . 'l10n.php';
         if (Mage::getConfig()->getNode('wordpress/core/modules')) {
             if (is_file($file) && !is_writable($file)) {
                 throw Fishpig_Wordpress_Exception::error('Permissions', 'The following file must be writable: ' . $file);
             }
         }
     }
     return $this;
 }
Пример #5
0
 /**
  * Ensure Magento 1.7 is being used
  *
  * @return void
  */
 protected function _validateMagentoVersion()
 {
     if (!$this->hasValidCurlMethods()) {
         throw Fishpig_Wordpress_Exception::warning('Update Now', $this->__('Update Magento to version 1.7.0.0 to use the Auto-Login feature.'));
     }
 }