PluginProbe ʕ •ᴥ•ʔ
reSmush.it : The original free image compressor and optimizer plugin / 0.1.23
reSmush.it : The original free image compressor and optimizer plugin v0.1.23
1.0.6 trunk 0.1.1 0.1.10 0.1.11 0.1.12 0.1.13 0.1.14 0.1.15 0.1.16 0.1.17 0.1.18 0.1.19 0.1.2 0.1.20 0.1.21 0.1.22 0.1.23 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.1.8 0.1.9 0.2.0 0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 0.3.0 0.3.1 0.3.10 0.3.11 0.3.12 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.3.9 0.4.0 0.4.1 0.4.10 0.4.11 0.4.12 0.4.13 0.4.14 0.4.2 0.4.3 0.4.4 0.4.5 0.4.6 0.4.7 0.4.8 0.4.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5
resmushit-image-optimizer / resmushit.admin.php
resmushit-image-optimizer Last commit date
classes 6 years ago css 9 years ago images 7 years ago js 7 years ago languages 8 years ago readme.txt 6 years ago resmushit.admin.php 6 years ago resmushit.inc.php 7 years ago resmushit.php 6 years ago resmushit.settings.php 6 years ago
resmushit.admin.php
128 lines
1 <?php
2 /**
3 *
4 * Create menu entries and routing
5 *
6 * @param none
7 * @return none
8 */
9 function resmushit_create_menu() {
10 if ( is_super_admin() )
11 add_media_page( 'reSmush.it', 'reSmush.it', 'manage_options', 'resmushit_options', 'resmushit_settings_page');
12 }
13 add_action( 'admin_menu','resmushit_create_menu');
14
15
16
17
18
19 /**
20 *
21 * Declares settings entries
22 *
23 * @param none
24 * @return none
25 */
26 function resmushit_settings_declare() {
27 register_setting( 'resmushit-settings', 'resmushit_on_upload' );
28 register_setting( 'resmushit-settings', 'resmushit_qlty' );
29 register_setting( 'resmushit-settings', 'resmushit_statistics' );
30 register_setting( 'resmushit-settings', 'resmushit_logs' );
31 }
32 add_action( 'admin_init', 'resmushit_settings_declare' );
33
34
35
36 function resmushit_media_list_add_column( $columns ) {
37 $columns["resmushit_disable"] = __('Disable of reSmush.it', 'resmushit');
38 $columns["resmushit_status"] = __('reSmush.it status', 'resmushit');
39 return $columns;
40 }
41 add_filter( 'manage_media_columns', 'resmushit_media_list_add_column' );
42
43
44 function resmushit_media_list_sort_column( $columns ) {
45 $columns["resmushit_disable"] = "resmushit_disable";
46 $columns["resmushit_status"] = "resmushit_status";
47 return $columns;
48 }
49 add_filter( 'manage_upload_sortable_columns', 'resmushit_media_list_sort_column' );
50
51
52 function resmushit_media_list_add_column_value( $column_name, $id ) {
53 if ( $column_name == "resmushit_disable" )
54 reSmushitUI::mediaListCustomValuesDisable($id);
55 else if ( $column_name == "resmushit_status" )
56 reSmushitUI::mediaListCustomValuesStatus($id);
57 }
58 add_action( 'manage_media_custom_column', 'resmushit_media_list_add_column_value', 10, 2 );
59
60
61 /* Add custom field to attachment */
62 function resmushit_image_attachment_add_status_button($form_fields, $post) {
63 if ( !preg_match("/image.*/", $post->post_mime_type) )
64 return $form_fields;
65
66 $form_fields["rsmt-disabled-checkbox"] = array(
67 "label" => __("Disable of reSmush.it"),
68 "input" => "html",
69 "value" => '',
70 "html" => reSmushitUI::mediaListCustomValuesDisable($post->ID, true)
71 );
72
73 $form_fields["rsmt-status-button"] = array(
74 "label" => __("reSmush.it status"),
75 "input" => "html",
76 "value" => '',
77 "html" => reSmushitUI::mediaListCustomValuesStatus($post->ID, true)
78 );
79 return $form_fields;
80 }
81 add_filter("attachment_fields_to_edit", "resmushit_image_attachment_add_status_button", null, 2);
82
83
84
85 /**
86 *
87 * Settings page builder
88 *
89 * @param none
90 * @return none
91 */
92 function resmushit_settings_page() {
93 ?>
94 <div class='rsmt-panels'>
95 <div class="rsmt-cols w66 iln-block">
96 <?php reSmushitUI::headerPanel();?>
97 <?php reSmushitUI::bulkPanel();?>
98 <?php reSmushitUI::bigFilesPanel();?>
99 <?php reSmushitUI::statisticsPanel();?>
100 </div>
101 <div class="rsmt-cols w33 iln-block">
102 <?php reSmushitUI::settingsPanel();?>
103 <?php reSmushitUI::newsPanel();?>
104 </div>
105 </div>
106 <?php
107 }
108
109
110
111 /**
112 *
113 * Assets declaration
114 *
115 * @param none
116 * @return none
117 */
118 function resmushit_register_plugin_assets(){
119
120 wp_register_style( 'resmushit-css', plugins_url( 'css/resmushit.css', __FILE__ ) );
121 wp_enqueue_style( 'resmushit-css' );
122 wp_enqueue_style( 'prefix-style', esc_url_raw( 'https://fonts.googleapis.com/css?family=Roboto+Slab:700' ), array(), null );
123
124 wp_register_script( 'resmushit-js', plugins_url( 'js/script.js', __FILE__ ) );
125 wp_enqueue_script( 'resmushit-js' );
126 }
127 add_action( 'admin_head', 'resmushit_register_plugin_assets' );
128