abspath_file = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'cforms' . DIRECTORY_SEPARATOR . 'abspath.php'; $this->cforms_js_file = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'cforms' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'cforms.js'; add_action( 'admin_menu', array(&$this, 'addMenu') ); } } function addMenu() { add_options_page( __('Adv Edit Cforms', 'adv-cforms'), __('Adv Edit Cforms', 'adv-cforms'), 10, 'adv-cforms', array( &$this, 'pageOptions' ) ); } function pageOptions() { if ( isset($_POST['submit_adv_cforms']) ) { if ( !current_user_can('manage_options') ) die(__( 'You cannot edit the Advanced Cforms options.' )); check_admin_referer( 'adv-cforms-options' ); // DB Options $current_options = get_option( $this->option_name ); $current_options = $this->array_merge_recursive_distinct( $current_options, $_POST['cforms'] ); update_option( $this->option_name, $current_options ); // File abs path if ( isset($_POST['abs-path-file']) && is_writable($this->abspath_file) ) { $_POST['abs-path-file'] = stripslashes($_POST['abs-path-file']); if ( file_get_contents( $this->abspath_file ) != $_POST['abs-path-file'] ) { file_put_contents( $this->abspath_file, $_POST['abs-path-file'] ); } } // JS File if ( isset($_POST['cforms-js-file']) && is_writable($this->cforms_js_file) ) { $new_file = array(); $_POST['cforms-js-file'] = stripslashes($_POST['cforms-js-file']); $lines = file( $this->cforms_js_file ); foreach ($lines as $line_num => $line) { if ( strpos( $line, 'var sajax_uri =' ) !== false ) { $new_file[] = $_POST['cforms-js-file']; } else { $new_file[] = $line; } } file_put_contents( $this->cforms_js_file, implode( '', $new_file ) ); } echo '
'.__('Options updated with succes !', 'adv-cforms').'