function test_insecure_embed_seearch() { $ssl = new SSL(); $insecure_stylesheet = 'http://media.giphy.com/media/oXWwl0eUy2mNW/giphy.css'; $secure_stylesheet = 'https://media.giphy.com/media/oXWwl0eUy2mNW/giphy.css'; $post_1 = $this->factory->post->create_and_get(array('post_content' => '<video src="' . $insecure_stylesheet . '"></video')); $post_2 = $this->factory->post->create_and_get(array('post_content' => '<video src="' . $secure_stylesheet . '"></video>')); // Positive match $urls_found_post_1 = $ssl->search_for_insecure_content($post_1->post_content); $this->assertContains($insecure_stylesheet, $post_1->post_content); $this->assertGreaterThan(0, count($urls_found_post_1)); // Negative match $urls_found_post_2 = $ssl->search_for_insecure_content($post_2->post_content); $this->assertContains($secure_stylesheet, $post_2->post_content); $this->assertEquals(0, count($urls_found_post_2)); }
/** * Setup the instance (singleton) * * @return SSL */ public static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
$GLOBALS['smarty']->config_dir = CC_SKIN_CACHE_DIR; $GLOBALS['smarty']->cache_dir = CC_SKIN_CACHE_DIR; $GLOBALS['smarty']->debugging = false; //Initialize language $GLOBALS['language'] = Language::getInstance(); //Initialize hooks $GLOBALS['hooks'] = HookLoader::getInstance(); //Initialize SEO $GLOBALS['seo'] = SEO::getInstance(); if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) { $_GET['seo_path'] = preg_replace('/(\\/\\~[a-z0-9]{1,}\\/)/', '', $_GET['seo_path']); // Remove /~username/ from seo_path $GLOBALS['seo']->getItem($_GET['seo_path']); } //Initialize SSL $GLOBALS['ssl'] = SSL::getInstance(); //Initialize GUI $GLOBALS['gui'] = GUI::getInstance(); //Initialize Taxes $GLOBALS['tax'] = Tax::getInstance(); //Initialize catalogue $GLOBALS['catalogue'] = Catalogue::getInstance(); //Initialize cubecart $GLOBALS['cubecart'] = Cubecart::getInstance(); //Initialize user $GLOBALS['user'] = User::getInstance(); //Initialize cart $GLOBALS['cart'] = Cart::getInstance(); // Set store timezone - default to UTC date_default_timezone_set($GLOBALS['config']->get('config', 'time_zone') ? $GLOBALS['config']->get('config', 'time_zone') : 'UTC'); if ($GLOBALS['config']->get('config', 'recaptcha') && !$GLOBALS['session']->get('confirmed', 'recaptcha')) {