function update_option($option, $old, $new) { if ($option == PROSE_SETTINGS_FIELD) { $handle = @fopen(prose_get_stylesheet_location('dir') . 'buddypress.css', 'w'); @fwrite($handle, $this->css); // foreach( $new as $k => $v ) // if( substr( $k, 0, 6 ) == 'button') // @fwrite( $handle, sprintf( "/* %s => %s */\n", $k, $v ) ); $background_color = 'hex' == $new['button_background_color_select'] ? $new['button_background_color'] : $new['button_background_color_select']; $background_hover = 'hex' == $new['button_background_hover_color_select'] ? $new['button_background_hover_color'] : $new['button_background_hover_color_select']; @fwrite($handle, sprintf($this->buttons, $background_color, $new['button_font_color'], $new['button_font_size'], $new['button_font_family'], $new['button_text_transform'], $background_hover)); $nav_color = 'hex' == $new['secondary_nav_background_color_select'] ? $new['secondary_nav_background_color'] : $new['secondary_nav_background_color_select']; $nav_back_color = 'hex' == $new['secondary_nav_link_background_select'] ? $new['secondary_nav_link_background'] : $new['secondary_nav_link_background_select']; $nav_back_hover = 'hex' == $new['secondary_nav_link_hover_background_select'] ? $new['secondary_nav_link_hover_background'] : $new['secondary_nav_link_hover_background_select']; @fwrite($handle, sprintf($this->bpnav, $nav_color, $new['secondary_nav_font_family'], $new['secondary_nav_font_size'], $new['secondary_nav_border'], $new['secondary_nav_border_style'], $new['secondary_nav_border_color'], $new['secondary_nav_inner_border'], $new['secondary_nav_inner_border_style'], $new['secondary_nav_inner_border_color'], $nav_back_color, $new['secondary_nav_link_color'], $new['secondary_nav_link_decoration'], $nav_back_hover, $new['secondary_nav_link_hover'], $new['secondary_nav_link_hover_decoration'], $nav_back_hover, $new['secondary_nav_link_hover'], $nav_back_hover, $new['secondary_nav_link_hover'])); $input_back_color = 'hex' == $new['input_background_color_select'] ? $new['input_background_color'] : $new['input_background_color_select']; @fwrite($handle, sprintf($this->inputs, $input_back_color, $new['input_font_color'], $new['input_border'], $new['input_border_style'], $new['input_border_color'], $new['input_font_family'], $new['input_font_style'], $new['input_font_size'])); @fwrite($handle, sprintf($this->widgets, $new['sidebar_headline_font_color'], $new['sidebar_headline_text_transform'], $new['sidebar_headline_font_size'], $new['sidebar_headline_font_family'], $new['sidebar_headline_font_weight'], $new['sidebar_headline_border'], $new['sidebar_headline_border_style'], $new['sidebar_headline_border_color'])); @fclose($handle); } }
/** * Try and make stylesheet directory writable. May not work if safe-mode or * other server configurations are enabled. * * @author Gary Jones * @since 1.0 */ function prose_make_stylesheet_path_writable() { if (!is_writable(prose_get_stylesheet_location('path'))) { @chmod(prose_get_stylesheet_location('path'), 0777); } if (!is_writable(prose_get_stylesheet_location('path'))) { return true; } return false; }
/** * Return the full path to the custom.php file for editing and inclusion. * * @uses prose_get_stylesheet_location() * * @since 1.5.0 * */ function prose_get_custom_php_path() { return prose_get_stylesheet_location('path') . 'custom.php'; }
/** * Add notices to the top of the page when certain actions take place. * * Add default notices via parent::notices() as well as a few custom ones. * * @since 1.5.0 * */ function notices() { /** Check to verify we're on the right page */ if (!genesis_is_menu_page($this->page_id)) { return; } /** Show error if can't write to server */ if (!prose_make_stylesheet_path_writable()) { if (!is_multisite() || is_super_admin()) { $message = __('The %s folder does not exist or is not writeable. Please create it or <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a> to 777.', 'prose'); } else { $message = __('The %s folder does not exist or is not writeable. Please contact your network administrator.', 'prose'); } $css_path = prose_get_stylesheet_location('path'); echo '<div id="message-unwritable" class="error"><p><strong>' . sprintf($message, _get_template_edit_filename($css_path, dirname($css_path))) . '</strong></p></div>'; } /** Genesis_Admin notices */ parent::notices(); }
/** * Try and make stylesheet directory writable. May not work if safe-mode or * other server configurations are enabled. * * @author StudioPress * @since 1.0.0 */ function prose_make_stylesheet_path_writable() { $stylesheet_path = prose_get_stylesheet_location('path'); if (!is_dir($stylesheet_path)) { wp_mkdir_p($stylesheet_path); } if (!is_writable($stylesheet_path)) { @chmod($stylesheet_path, 0777); } if (!is_writable($stylesheet_path)) { return false; } return true; }
function prose_settings_notice() { if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'design-settings') { return; } if (isset($_REQUEST['reset']) && $_REQUEST['reset'] == 'true') { echo '<div id="message" class="updated"><p>' . __('Design Settings Reset', PROSE_DOMAIN) . '</p></div>'; } elseif (isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true') { echo '<div id="message" class="updated"><p>' . __('Design Settings Saved', PROSE_DOMAIN) . '</p></div>'; } elseif (isset($_REQUEST['prose']) && 'import' == $_REQUEST['prose']) { echo '<div id="message" class="updated"><p>' . __('Design Settings Imported', PROSE_DOMAIN) . '</p></div>'; } elseif (isset($_REQUEST['prose']) && 'wrongfile' == $_REQUEST['prose']) { echo '<div id="message" class="error"><p><strong>' . sprintf(__('You tried to import an incorrect file. The filename should start with "%s".', PROSE_DOMAIN), prose_get_export_filename_prefix()) . '</strong></p></div>'; } elseif (isset($_REQUEST['prose']) && 'file' == $_REQUEST['prose']) { echo '<div id="message" class="error"><p><strong>' . __('There was a problem with the file you uploaded.', PROSE_DOMAIN) . '</strong></p></div>'; } if (prose_make_stylesheet_path_writable()) { echo '<div id="message-unwritable" class="error"><p><strong>' . sprintf(__('The %s folder does not exist or is not writeable. Please create it or <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a> to 777.', PROSE_DOMAIN), _get_template_edit_filename(prose_get_stylesheet_location('path'), dirname(prose_get_stylesheet_location('path')))) . '</strong></p></div>'; } }