Beispiel #1
0
 /**
  * Get the admin options
  */
 function getAiAdminOptions()
 {
     $iframeAdminOptions = advancediFrame::iframe_defaults();
     $devOptions = get_option("advancediFrameAdminOptions");
     if (!empty($devOptions)) {
         foreach ($devOptions as $key => $option) {
             $iframeAdminOptions[$key] = $option;
         }
     }
     update_option("advancediFrameAdminOptions", $iframeAdminOptions);
     return $iframeAdminOptions;
 }
             }
         }
         if ($item == 'id') {
             $devOptions[$item] = preg_replace("/\\W/", "_", $text);
         }
         // we check if we have an invalid configuration!
         if ($devOptions['shortcode_attributes'] === 'false' && $devOptions['use_shortcode_attributes_only'] === 'true') {
             $devOptions['use_shortcode_attributes_only'] = 'false';
             printError(__('You have set "Allow shortcode attributes" to "No" and "Use shortcode attributes only" to "Yes". This combination is not valid. "Use shortcode attributes only" was set to "No" and now only the settings from the administration is used. Please check if this is what you really want, as all iframes do have the same configuration than.', "advanced-iframe"));
             $scrollposition = 0;
         }
     }
 } else {
     $securityKey = $devOptions['securitykey'];
     $it = $devOptions['install_date'];
     $devOptions = advancediFrame::iframe_defaults();
     $devOptions['securitykey'] = $securityKey;
     $devOptions['install_date'] = $it;
 }
 if ($evanto && empty($devOptions['install_date'])) {
     $devOptions['install_date'] = time();
 }
 update_option($this->adminOptionsName, $devOptions);
 // create the external js file with the url of the wordpress installation
 $template_name = dirname(__FILE__) . '/js/ai_external.template.js';
 $jquery_path = site_url() . '/wp-includes/js/jquery/jquery.js';
 $resize_path = site_url() . '/wp-content/plugins/advanced-iframe/includes/scripts/jquery.ba-resize.min.js';
 $content = file_get_contents($template_name);
 $new_content = str_replace('WORDPRESS_SITE_URL', get_site_url(), $content);
 $new_content = str_replace('PARAM_ID', $devOptions['id'], $new_content);
 $new_content = str_replace('PARAM_IFRAME_HIDE_ELEMENTS', $devOptions['iframe_hide_elements'], $new_content);
if (!function_exists('get_absolute_path')) {
    function get_absolute_path()
    {
        $domain = '';
        if (isset($_SERVER['HTTP_HOST'])) {
            $domain = $_SERVER['HTTP_HOST'];
        } else {
            if (isset($_SERVER['SERVER_NAME'])) {
                $domain = $_SERVER['SERVER_NAME'];
            }
        }
        $port = strpos($domain, ':');
        if ($port !== false) {
            $domain = substr($domain, 0, $port);
        }
        // Get the path to the file
        $path = substr(dirname(__FILE__), strlen($_SERVER["DOCUMENT_ROOT"]));
        $apath = "//" . $domain . $path;
        $apath = str_replace('\\', '/', $apath);
        return $apath . '/..';
    }
}
// set the defaults url
if (!isset($site_url)) {
    $site_url = get_absolute_path();
}
//  setup new instance of plugin if not standalone
if (class_exists("advancediFrame")) {
    $cons_advancediFrame = new advancediFrame();
    echo $cons_advancediFrame->do_iframe_script(null, null);
}