/** * This function check if Magic Fields has all the requirements for his use * * @return void */ function CheckInstallation() { global $mf_domain; if (!empty($_GET['page']) && stripos($_GET['page'], "mf") === false && $_GET['page'] != "RCCWP_OptionsPage.php" && !isset($_GET['custom-write-panel-id'])) { return; } $dir_list = ""; $dir_list2 = ""; wp_mkdir_p(MF_UPLOAD_FILES_DIR); wp_mkdir_p(MF_CACHE_DIR); // Giving full rights to folders. thanks Akis Kesoglou if (!is_dir(MF_CACHE_DIR)) { $dir_list2 .= "<li>" . MF_CACHE_DIR . "</li>"; } elseif (!is_writable(MF_CACHE_DIR)) { $dir_list .= "<li>" . MF_CACHE_DIR . "</li>"; } if (!is_dir(MF_UPLOAD_FILES_DIR)) { $dir_list2 .= "<li>" . MF_UPLOAD_FILES_DIR . "</li>"; } elseif (!is_writable(MF_UPLOAD_FILES_DIR)) { $dir_list .= "<li>" . MF_UPLOAD_FILES_DIR . "</li>"; } if ($dir_list2 != "") { echo "<div id='magic-fields-install-error-message' class='error'><p><strong>" . __('Magic Fields is not ready yet.', $mf_domain) . "</strong> " . __('must create the following folders (and must chmod 777):', $mf_domain) . "</p><ul>"; echo $dir_list2; echo "</ul></div>"; } if ($dir_list != "") { echo "<div id='magic-fields-install-error-message-2' class='error'><p><strong>" . __('Magic Fields is not ready yet.', $mf_domain) . "</strong> " . __('The following folders must be writable (usually chmod 777 is neccesary):', $mf_domain) . "</p><ul>"; echo $dir_list; echo "</ul></div>"; } if (empty($dir_list) && empty($dir_list2)) { /* the directory exists and is writable * we can create the css and js files for the EIP feature */ $EnPCSS = RCCWP_Application::create_EditnPlace_css(); $EnPJS = RCCWP_Application::create_EditnPlace_js(); if (!$EnPCSS || !$EnPJS) { echo "<div id='magic-fields-install-error-message-2' class='error'><p><strong>" . __('There was an error creating the CSS file for edit in place, please check the permissions on the files_mf directory.', $mf_domain) . "</strong> " . "</p>"; echo "</div>"; } } }