: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
self.setInterval = function (callback, time, timeout) {
var interval = window.setInterval(function () {
if (elapsed <= timeout) {
callback(iteraction, elapsed);
self.stopInterval(interval);
self.stopInterval = function (interval) {
window.clearInterval(interval);
* Configure unconfigured embed wrappers, adding events and css
self.configureWrappers = function (editorInstance) {
function configureWrappersTimeOut () {
var doc = editorInstance.getDoc(),
var wrappers = doc.getElementsByClassName('embedpress_wrapper');
if (wrappers.length > 0) {
for (var i = 0; i < wrappers.length; i++) {
$wrapper = $(wrappers[i]);
// Check if the wrapper wasn't already configured
if ($wrapper.data('configured') != true) {
// A timeout was set to avoid block the content loading
window.setTimeout(function () {
// @todo: Check if we need a limit of levels to avoid use too much resources
self.recursivelyAddClass($wrapper, 'embedpress_ignore_mouseout');
// Fix the wrapper size. Wait until find the child iframe. L
var interval = self.setInterval(function (iteraction) {
var $childIframes = $wrapper.find('iframe');
if ($childIframes.length > 0) {
$.each($childIframes, function (index, iframe) {
// Facebook has more than one iframe, we need to ignore the Cross Domain Iframes
if ($(iframe).attr('id') !== 'fb_xdm_frame_https'
&& $(iframe).attr('id') !== 'fb_xdm_frame_http'
$wrapper.css('width', $(iframe).width() + 'px');
self.stopInterval(interval);
$wrapper.data('configured', true);
* Hide the controller panel
self.hidePreviewControllerPanel = function () {
if (self.controllerPanelIsActive()) {
$(self.activeControllerPanel).addClass('hidden');
self.activeControllerPanel = null;
self.activeWrapper = null;
* Get an element by id in the editor's content
* @param String id The element id
* @return Element The found element or null, wrapped by jQuery
self.getElementInContentById = function (id, editorInstance) {
var doc = editorInstance.getDoc();
return $(doc.getElementById(id));
* Show the controller panel
* @param element $wrapper The wrapper which will be activate
self.displayPreviewControllerPanel = function ($wrapper, editorInstance) {
if (self.controllerPanelIsActive() && $wrapper !== self.activeWrapper) {
self.hidePreviewControllerPanel();
if (!self.controllerPanelIsActive() && !$wrapper.hasClass('is-loading')) {
var uid = $wrapper.data('uid');
var $panel = self.getElementInContentById('embedpress_controller_panel_' + uid, editorInstance);
if (!$panel.data('event-set')) {
var $editButton = self.getElementInContentById('embedpress_button_edit_' + uid, editorInstance);
var $removeButton = self.getElementInContentById('embedpress_button_remove_' + uid, editorInstance);
self.addEvent('mousedown', $editButton, function (e) {
self.onClickEditButton(e, editorInstance);
self.addEvent('mousedown', $removeButton, function (e) {
self.onClickRemoveButton(e, editorInstance);
$panel.data('event-set', true);
// Update the position of the control bar
var next = $panel.next()[0];
if (typeof next !== 'undefined') {
if (next.nodeName.toLowerCase() === 'iframe') {
$panel.css('left', ($(next).width() / 2));
$panel.removeClass('hidden');
self.activeControllerPanel = $panel;
self.activeWrapper = $wrapper;
if (!window.EmbedPress) {
window.EmbedPress = new EmbedPress();
// Initialize EmbedPress for all the current editors.
window.EmbedPress.init($data.previewSettings);
})(jQuery, String, $data);