admin-content.php
6 years ago
folder-deactivate-form.php
6 years ago
folder-popup.php
6 years ago
general-settings.php
6 years ago
help.php
6 years ago
update.php
6 years ago
upgrade-to-pro.php
6 years ago
general-settings.php
389 lines
| 1 | <?php |
| 2 | defined('ABSPATH') or wp_die('Nope, not accessing this'); |
| 3 | ?> |
| 4 | <!-- do not change here, Free/Pro URL Change --> |
| 5 | <link rel='stylesheet' href='<?php echo WCP_FOLDER_URL ?>assets/css/settings.css' type='text/css' media='all' /> |
| 6 | <link rel='stylesheet' href='<?php echo WCP_FOLDER_URL ?>assets/css/folder-icon.css' type='text/css' media='all' /> |
| 7 | <link rel='stylesheet' href='<?php echo WCP_FOLDER_URL ?>assets/css/spectrum.min.css' type='text/css' media='all' /> |
| 8 | <script src="<?php echo WCP_FOLDER_URL ?>assets/js/spectrum.min.js"></script> |
| 9 | <style> |
| 10 | <?php if ( function_exists( 'is_rtl' ) && is_rtl() ) { ?> |
| 11 | #setting-form { |
| 12 | float: right; |
| 13 | } |
| 14 | <?php } ?> |
| 15 | </style> |
| 16 | <script> |
| 17 | jQuery(document).ready(function(){ |
| 18 | jQuery(document).on("click",".folder-select",function(){ |
| 19 | if(jQuery(this).is(":checked")) { |
| 20 | jQuery(this).closest("tr").find(".hide-show-option").removeClass("hide-option"); |
| 21 | } else { |
| 22 | jQuery(this).closest("tr").find(".hide-show-option").addClass("hide-option"); |
| 23 | } |
| 24 | }); |
| 25 | jQuery(document).on("click", ".accordion-header", function(){ |
| 26 | if(jQuery(this).hasClass("active")) { |
| 27 | jQuery(this).closest(".accordion").find(".accordion-content").slideUp(); |
| 28 | jQuery(this).removeClass("active"); |
| 29 | } else { |
| 30 | jQuery(this).closest(".accordion").find(".accordion-content").slideDown(); |
| 31 | jQuery(this).addClass("active"); |
| 32 | } |
| 33 | }); |
| 34 | jQuery(".accordion-header:first").trigger("click"); |
| 35 | jQuery("#folder_font, #folder_size").change(function(){ |
| 36 | setCSSProperties(); |
| 37 | }); |
| 38 | setCSSProperties(); |
| 39 | jQuery('.color-field').spectrum({ |
| 40 | chooseText: "Submit", |
| 41 | preferredFormat: "hex", |
| 42 | showInput: true, |
| 43 | cancelText: "Cancel", |
| 44 | move: function (color) { |
| 45 | jQuery(this).val(color.toHexString()); |
| 46 | setCSSProperties(); |
| 47 | }, |
| 48 | change: function (color) { |
| 49 | jQuery(this).val(color.toHexString()); |
| 50 | setCSSProperties(); |
| 51 | } |
| 52 | }); |
| 53 | }); |
| 54 | |
| 55 | function setCSSProperties() { |
| 56 | if(jQuery("#new_folder_color").val() != "") { |
| 57 | jQuery("#add-new-folder").css("border-color", jQuery("#new_folder_color").val()); |
| 58 | jQuery("#add-new-folder").css("background-color", jQuery("#new_folder_color").val()); |
| 59 | } |
| 60 | if(jQuery("#bulk_organize_button_color").val() != "") { |
| 61 | jQuery(".organize-button").css("border-color", jQuery("#bulk_organize_button_color").val()); |
| 62 | jQuery(".organize-button").css("background-color", jQuery("#bulk_organize_button_color").val()); |
| 63 | jQuery(".organize-button").css("color", "#ffffff"); |
| 64 | } |
| 65 | if(jQuery("#dropdown_color").val() != "") { |
| 66 | jQuery(".media-select").css("border-color", jQuery("#dropdown_color").val()); |
| 67 | jQuery(".media-select").css("color", jQuery("#dropdown_color").val()); |
| 68 | } |
| 69 | if(jQuery("#folder_bg_color").val() != "") { |
| 70 | jQuery(".all-posts.active-item").css("border-color", jQuery("#folder_bg_color").val()); |
| 71 | jQuery(".all-posts.active-item").css("background-color", jQuery("#folder_bg_color").val()); |
| 72 | jQuery(".all-posts.active-item").css("color", "#ffffff"); |
| 73 | } |
| 74 | jQuery("#custom-css").html(""); |
| 75 | if(jQuery("#folder_font").val() != "") { |
| 76 | font_val = jQuery("#folder_font").val(); |
| 77 | jQuery('head').append('<link href="https://fonts.googleapis.com/css?family=' + font_val + ':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'); |
| 78 | jQuery('.preview-box').css('font-family', font_val); |
| 79 | } else { |
| 80 | jQuery('.preview-box').css('style', ""); |
| 81 | } |
| 82 | if(jQuery("#folder_size").val() != "") { |
| 83 | jQuery(".folder-list li a span, .header-posts a, .un-categorised-items a").css("font-size", jQuery("#folder_size").val()+"px"); |
| 84 | } else { |
| 85 | jQuery(".folder-list li a span, .header-posts a, .un-categorised-items a").css("font-size", "14px"); |
| 86 | } |
| 87 | } |
| 88 | </script> |
| 89 | <div id="custom-css"> |
| 90 | |
| 91 | </div> |
| 92 | <div class="wrap"> |
| 93 | <h1><?php esc_attr_e( 'Folders Settings', WCP_FOLDER ); ?></h1> |
| 94 | <form action="options.php" method="post" id="setting-form"> |
| 95 | <?php |
| 96 | settings_fields('folders_settings'); |
| 97 | settings_fields('default_folders'); |
| 98 | settings_fields('customize_folders'); |
| 99 | $options = get_option('folders_settings'); |
| 100 | $default_folders = get_option('default_folders'); |
| 101 | $customize_folders = get_option('customize_folders'); |
| 102 | $default_folders = (empty($default_folders) || !is_array($default_folders))?array():$default_folders; |
| 103 | do_settings_sections( __FILE__ ); |
| 104 | ?> |
| 105 | <div class="accordion"> |
| 106 | <div class="accordion-header">Folders Settings <span class="dashicons dashicons-arrow-down-alt2"></span></div> |
| 107 | <div class="accordion-content" style="display: block"> |
| 108 | <div class="accordion-left"> |
| 109 | <table class="form-table"> |
| 110 | <?php |
| 111 | $post_types = get_post_types( array( ), 'objects' ); |
| 112 | $post_array = array("page", "post", "attachment"); |
| 113 | foreach ( $post_types as $post_type ) : ?> |
| 114 | <?php |
| 115 | if ( ! $post_type->show_ui) continue; |
| 116 | $is_checked = !in_array( $post_type->name, $options )?"hide-option":""; |
| 117 | $selected_id = (isset($default_folders[$post_type->name]))?$default_folders[$post_type->name]:"all"; |
| 118 | if(in_array($post_type->name, $post_array)){ |
| 119 | ?> |
| 120 | <tr> |
| 121 | <th width="220px"> |
| 122 | <label for="folders_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Use folders with: ', WCP_FOLDER )." ".esc_html_e($post_type->label); ?></label> |
| 123 | </th> |
| 124 | <td> |
| 125 | <input type="checkbox" class="folder-select" id="folders_<?php echo esc_attr($post_type->name); ?>" name="folders_settings[]" value="<?php echo esc_attr($post_type->name); ?>"<?php if ( in_array( $post_type->name, $options ) ) echo ' checked="checked"'; ?>/> |
| 126 | </td> |
| 127 | <th class="default-folder"> |
| 128 | <label class="hide-show-option <?php echo esc_attr($is_checked) ?>" for="folders_for_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Default folder: ', WCP_FOLDER ) ?></label> |
| 129 | </th> |
| 130 | <td> |
| 131 | <select class="hide-show-option <?php echo esc_attr($is_checked) ?>" id="folders_for_<?php echo esc_attr($post_type->name); ?>" name="default_folders[<?php echo esc_attr($post_type->name); ?>]" ?>"> |
| 132 | <option value="">All <?php echo esc_attr($post_type->label) ?> Folder</option> |
| 133 | <option value="-1" <?php echo ($selected_id == -1)?"selected":"" ?>>Unassigned <?php echo esc_attr($post_type->label) ?></option> |
| 134 | <?php |
| 135 | if(isset($terms_data[$post_type->name]) && !empty($terms_data[$post_type->name])) { |
| 136 | foreach ($terms_data[$post_type->name] as $term) { |
| 137 | $selected = ($selected_id == $term->slug)?"selected":""; |
| 138 | echo "<option ".esc_attr($selected)." value='".esc_attr($term->slug)."'>".esc_attr($term->name)."</option>"; |
| 139 | } |
| 140 | } ?> |
| 141 | </select> |
| 142 | </td> |
| 143 | </tr> |
| 144 | <?php |
| 145 | } else { ?> |
| 146 | <tr> |
| 147 | <th> |
| 148 | <label for="folders_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Use folders with: ', WCP_FOLDER )." ".esc_html_e($post_type->label); ?></label> |
| 149 | </th> |
| 150 | <td> |
| 151 | <input type="checkbox" class="folder-select" id="folders_<?php echo esc_attr($post_type->name); ?>" name="folders_settings[]" value="<?php echo esc_attr($post_type->name); ?>"<?php if ( in_array( $post_type->name, $options ) ) echo ' checked="checked"'; ?>/> |
| 152 | </td> |
| 153 | <th class="default-folder"> |
| 154 | <label class="hide-show-option <?php echo esc_attr($is_checked) ?>" for="folders_for_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Default folder: ', WCP_FOLDER ) ?></label> |
| 155 | </th> |
| 156 | <td> |
| 157 | <select class="hide-show-option <?php echo esc_attr($is_checked) ?>" id="folders_for_<?php echo esc_attr($post_type->name); ?>" name="default_folders[<?php echo esc_attr($post_type->name); ?>]" ?>"> |
| 158 | <option value="">All <?php echo esc_attr($post_type->label) ?> Folder</option> |
| 159 | <option value="-1" <?php echo ($selected_id == -1)?"selected":"" ?>>Unassigned <?php echo esc_attr($post_type->label) ?></option> |
| 160 | <?php |
| 161 | if(isset($terms_data[$post_type->name]) && !empty($terms_data[$post_type->name])) { |
| 162 | foreach ($terms_data[$post_type->name] as $term) { |
| 163 | $selected = ($selected_id == $term->slug)?"selected":""; |
| 164 | echo "<option ".esc_attr($selected)." value='".esc_attr($term->slug)."'>".esc_attr($term->name)."</option>"; |
| 165 | } |
| 166 | } ?> |
| 167 | </select> |
| 168 | </td> |
| 169 | </tr> |
| 170 | <?php } endforeach; ?> |
| 171 | <tr> |
| 172 | <th> |
| 173 | <label for="folders_show_in_menu" ><?php esc_html_e( 'Show Folders in Menu:', WCP_FOLDER ); ?></label> |
| 174 | </th> |
| 175 | <td> |
| 176 | <?php $val = get_option("folders_show_in_menu"); ?> |
| 177 | <input type="hidden" name="folders_show_in_menu" value="off" /> |
| 178 | <input type="checkbox" id="folders_show_in_menu" name="folders_show_in_menu" value="on" <?php echo ($val == "on")?"checked='checked'":"" ?>/> |
| 179 | </td> |
| 180 | </tr> |
| 181 | <!-- Do not make changes here, Only for Free --> |
| 182 | |
| 183 | <tr> |
| 184 | <td colspan="2" style="padding: 10px 0"> |
| 185 | <?php |
| 186 | $tlfs = get_option("folder_old_plugin_folder_status"); |
| 187 | if($tlfs == false || $tlfs < 10) { |
| 188 | $tlfs = 10; |
| 189 | } |
| 190 | $total = WCP_Folders::get_ttl_fldrs(); |
| 191 | if($total > $tlfs) { |
| 192 | $tlfs = $total; |
| 193 | } |
| 194 | ?> |
| 195 | <span class="upgrade-message">You have used <span class='pink'><?php echo esc_attr($total) ?></span>/<?php echo esc_attr($tlfs) ?> Folders. <a class="pink" href="<?php echo esc_url(admin_url("admin.php?page=wcp_folders_upgrade")) ?>"><?php esc_html_e("Upgrade", WCP_FOLDER) ?></a></span> |
| 196 | </td> |
| 197 | </tr> |
| 198 | |
| 199 | </table> |
| 200 | <input type="hidden" name="folders_settings1[premio_folder_option]" value="yes" /> |
| 201 | </div> |
| 202 | <div class="accordion-right"> |
| 203 | <div class="premio-help"> |
| 204 | <a href="https://premio.io/help/folders/?utm_source=pluginspage" target="_blank"> |
| 205 | <img src="<?php echo esc_url(WCP_FOLDER_URL."assets/images/premio-help.png") ?>" alt="Premio Help" class="Premio Help" /> |
| 206 | </a> |
| 207 | </div> |
| 208 | </div> |
| 209 | <div class="clear"></div> |
| 210 | </div> |
| 211 | </div> |
| 212 | <div class="accordion"> |
| 213 | <div class="accordion-header">Customize Folders <span class="dashicons dashicons-arrow-down-alt2"></span></div> |
| 214 | <div class="accordion-content"> |
| 215 | <div class="accordion-left"> |
| 216 | <table class="form-table"> |
| 217 | <?php |
| 218 | $color = !isset($customize_folders['new_folder_color'])||empty($customize_folders['new_folder_color'])?"#F51366":$customize_folders['new_folder_color']; |
| 219 | ?> |
| 220 | <tr> |
| 221 | <th width="220px"> |
| 222 | <label for="new_folder_color" >New Folder button color</label> |
| 223 | </th> |
| 224 | <td width="32px"> |
| 225 | <input type="text" class="color-field" name="customize_folders[new_folder_color]" id="new_folder_color" value="<?php echo esc_attr($color) ?>" /> |
| 226 | </td> |
| 227 | <td rowspan="4" > |
| 228 | |
| 229 | </td> |
| 230 | </tr> |
| 231 | <?php |
| 232 | $color = !isset($customize_folders['bulk_organize_button_color'])||empty($customize_folders['bulk_organize_button_color'])?"#F51366":$customize_folders['bulk_organize_button_color']; |
| 233 | ?> |
| 234 | <tr> |
| 235 | <th> |
| 236 | <label for="bulk_organize_button_color" >Bulk Organize button color</label> |
| 237 | </th> |
| 238 | <td> |
| 239 | <input type="text" class="color-field" name="customize_folders[bulk_organize_button_color]" id="bulk_organize_button_color" value="<?php echo esc_attr($color) ?>" /> |
| 240 | </td> |
| 241 | </tr> |
| 242 | <?php |
| 243 | $color = !isset($customize_folders['dropdown_color'])||empty($customize_folders['dropdown_color'])?"#F51366":$customize_folders['dropdown_color']; |
| 244 | ?> |
| 245 | <tr> |
| 246 | <th> |
| 247 | <label for="dropdown_color" >Dropdown color</label> |
| 248 | </th> |
| 249 | <td> |
| 250 | <input type="text" class="color-field" name="customize_folders[dropdown_color]" id="dropdown_color" value="<?php echo esc_attr($color) ?>" /> |
| 251 | </td> |
| 252 | </tr> |
| 253 | <?php |
| 254 | $color = !isset($customize_folders['folder_bg_color'])||empty($customize_folders['folder_bg_color'])?"#008ec2":$customize_folders['folder_bg_color']; |
| 255 | ?> |
| 256 | <tr> |
| 257 | <th> |
| 258 | <label for="folder_bg_color" >Folders background color</label> |
| 259 | </th> |
| 260 | <td> |
| 261 | <input type="text" class="color-field" name="customize_folders[folder_bg_color]" id="folder_bg_color" value="<?php echo esc_attr($color) ?>" /> |
| 262 | </td> |
| 263 | </tr> |
| 264 | <tr> |
| 265 | <th> |
| 266 | <label for="folder_font" >Folders font</label> |
| 267 | </th> |
| 268 | <td colspan="2"> |
| 269 | <?php |
| 270 | $font = !isset($customize_folders['folder_font'])||empty($customize_folders['folder_font'])?"":$customize_folders['folder_font']; |
| 271 | $index = 0; |
| 272 | ?> |
| 273 | <select name="customize_folders[folder_font]" id="folder_font" > |
| 274 | <?php $group = ''; |
| 275 | foreach ($fonts as $key => $value): |
| 276 | $title = $key; |
| 277 | if($index == 0) { |
| 278 | $key = ""; |
| 279 | } |
| 280 | $index++; |
| 281 | if ($value != $group) { |
| 282 | echo '<optgroup label="' . $value . '">'; |
| 283 | $group = $value; |
| 284 | } |
| 285 | ?> |
| 286 | <option value="<?php echo $key; ?>" <?php selected($font, $key); ?>><?php echo $title; ?></option> |
| 287 | <?php endforeach; ?> |
| 288 | </select> |
| 289 | </td> |
| 290 | </tr> |
| 291 | <tr> |
| 292 | <th> |
| 293 | <label for="folder_size" >Folders size</label> |
| 294 | </th> |
| 295 | <td colspan="2"> |
| 296 | <?php |
| 297 | $sizes = array( |
| 298 | "12" => "Small", |
| 299 | "16" => "Medium", |
| 300 | "20" => "Large" |
| 301 | ); |
| 302 | $size = !isset($customize_folders['folder_size'])||empty($customize_folders['folder_size'])?"16":$customize_folders['folder_size']; |
| 303 | ?> |
| 304 | <select name="customize_folders[folder_size]" id="folder_size" > |
| 305 | <?php |
| 306 | foreach ($sizes as $key=>$value) { |
| 307 | $selected = ($key == $size)?"selected":""; |
| 308 | echo "<option ".$selected." value='".$key."'>".$value."</option>"; |
| 309 | } |
| 310 | ?> |
| 311 | </select> |
| 312 | </td> |
| 313 | </tr> |
| 314 | <?php |
| 315 | $show_in_page = !isset($customize_folders['show_in_page'])||empty($customize_folders['show_in_page'])?"show":$customize_folders['show_in_page']; |
| 316 | if(empty($show_in_page)) { |
| 317 | $show_in_page = "show"; |
| 318 | } |
| 319 | ?> |
| 320 | <tr> |
| 321 | <th><label for="">Show Folders in upper position</label></th> |
| 322 | <td colspan="2"> |
| 323 | <input type="hidden" name="customize_folders[show_in_page]" value="hide"> |
| 324 | <input <?php checked($show_in_page, "show") ?> type="checkbox" name="customize_folders[show_in_page]" value="show"> |
| 325 | </td> |
| 326 | </tr> |
| 327 | </table> |
| 328 | </div> |
| 329 | <div class="accordion-right"> |
| 330 | <div class="preview-text"> |
| 331 | Preview |
| 332 | <div class="preview-text-info">See the full functionality on your media library, posts, pages, and custom posts</div> |
| 333 | </div> |
| 334 | <div class="preview-inner-box"> |
| 335 | <div class="preview-box"> |
| 336 | <div class="wcp-custom-form"> |
| 337 | <div class="form-title"> |
| 338 | Folders |
| 339 | <a href="javascript:;" class="add-new-folder" id="add-new-folder"> |
| 340 | <span class="folder-icon-create_new_folder"></span> |
| 341 | <span>New Folder</span> |
| 342 | </a> |
| 343 | <div class="clear"></div> |
| 344 | </div> |
| 345 | <div class="form-options"> |
| 346 | <ul> |
| 347 | <li> |
| 348 | <a href="javascript:;" id="inline-update"><span class="icon folder-icon-border_color"><span class="path1"></span><span class="path2"></span></span> <span class="text">Rename</span> </a> |
| 349 | </li> |
| 350 | <li> |
| 351 | <a href="javascript:;" id="inline-remove"><span class="icon folder-icon-delete"></span> <span class="text">Delete</span> </a> |
| 352 | </li> |
| 353 | <li class="last"> |
| 354 | <a href="javascript:;" id="expand-collapse-list" class="folder-tooltip" data-tooltip="Expand"><span class="icon folder-icon-expand_more"></span></a> |
| 355 | </li> |
| 356 | </ul> |
| 357 | </div> |
| 358 | </div> |
| 359 | <div class="header-posts"> |
| 360 | <a href="javascript:;" class="all-posts active-item"><span class="wcp-icon folder-icon-insert_drive_file"></span> All Files <span class="total-count">0</span></a> |
| 361 | </div> |
| 362 | <div class="un-categorised-items ui-droppable"> |
| 363 | <a href="javascript:;" class="un-categorized-posts">Unassigned Files <span class="total-count total-empty">0</span> </a> |
| 364 | </div> |
| 365 | |
| 366 | <ul class="folder-list"> |
| 367 | <li><a href="javascript:;"><i class="wcp-icon folder-icon-folder"></i> <span>Folder 1</span></a></li> |
| 368 | <li><a href="javascript:;"><i class="wcp-icon folder-icon-folder"></i> <span>Folder 2</span></a></li> |
| 369 | <li><a href="javascript:;"><i class="wcp-icon folder-icon-folder"></i> <span>Folder 3</span></a></li> |
| 370 | </ul> |
| 371 | </div> |
| 372 | <div class="media-buttons"> |
| 373 | <select class="media-select"> |
| 374 | <option>All Files</option> |
| 375 | <option>Folder 1</option> |
| 376 | <option>Folder 2</option> |
| 377 | <option>Folder 3</option> |
| 378 | </select> |
| 379 | <button type="button" class="button organize-button">Bulk Organize</button> |
| 380 | <div style="clear: both;"></div> |
| 381 | </div> |
| 382 | </div> |
| 383 | </div> |
| 384 | <div class="clear"></div> |
| 385 | </div> |
| 386 | </div> |
| 387 | <?php submit_button(); ?> |
| 388 | </form> |
| 389 | </div> |