Changeset 1748522
- Timestamp:
- 10/18/2017 08:56:35 AM (8 years ago)
- Location:
- finch/trunk
- Files:
-
- 6 edited
-
api/finch_api_client.class.php (modified) (1 diff)
-
classes/finch.class.php (modified) (3 diffs)
-
classes/finch_stylesheet.class.php (modified) (1 diff)
-
finch.php (modified) (1 diff)
-
lang/finch.pot (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
finch/trunk/api/finch_api_client.class.php
r1587432 r1748522 172 172 $response = wp_remote_get($cssUrl); 173 173 if(is_wp_error($response)) { 174 $error_code = $response->get_error_code(); 174 $error_code = $response->get_error_code(); 175 175 throw new Exception($response->get_error_message(), is_int($error_code) ? $error_code : 0); 176 176 } -
finch/trunk/classes/finch.class.php
r1659494 r1748522 52 52 53 53 private function setupHooks() { 54 if(is_admin()) { 55 add_action('admin_notices', [$this, 'activatePlugin']); 56 register_deactivation_hook(FINCH_PLUGIN_MAIN, [$this, 'deactivatePlugin']); 57 register_uninstall_hook(FINCH_PLUGIN_MAIN, ['Finch', 'uninstallPlugin']); 58 } 59 60 add_action('init', [$this, 'finchInit'], 1); 61 add_action('wp_logout', [$this, 'endSession']); 62 add_action('wp_login', [$this, 'endSession']); 63 64 add_action('admin_init', [$this, 'loadTextDomain']); 65 add_action('wp_enqueue_scripts', [$this, 'enqueueScripts'], 9999); 66 add_action('admin_enqueue_scripts', [$this, 'enqueueAdminScripts'],10,1); 67 54 if (FINCH_SUPPORTED == true) { 55 if(is_admin()) { 56 add_action('admin_notices', [$this, 'activatePlugin']); 57 register_deactivation_hook(FINCH_PLUGIN_MAIN, [$this, 'deactivatePlugin']); 58 register_uninstall_hook(FINCH_PLUGIN_MAIN, ['Finch', 'uninstallPlugin']); 59 } 60 61 add_action('init', [$this, 'finchInit'], 1); 62 add_action('wp_logout', [$this, 'endSession']); 63 add_action('wp_login', [$this, 'endSession']); 64 65 add_action('admin_init', [$this, 'loadTextDomain']); 66 add_action('wp_enqueue_scripts', [$this, 'enqueueScripts'], 9999); 67 add_action('admin_enqueue_scripts', [$this, 'enqueueAdminScripts'],10,1); 68 } else { 69 if (is_admin()) { 70 add_action('admin_notices', [$this, 'showOldVersionWarning']); 71 } 72 } 68 73 } 69 74 … … 107 112 108 113 if($activeVersion) { 109 $storedVersions = isset($this->options['stored-versions']) ? $this->options['stored-versions'] : [];114 $storedVersions = (isset($this->options['stored-versions']) ? $this->options['stored-versions'] : []); 110 115 $this->activeStylesheet = new FinchStylesheet($activeVersion, $storedVersions, $this->api); 111 116 } else { … … 193 198 } 194 199 200 public function showOldVersionWarning() { 201 ?> 202 <div class="notice notice-error"> 203 <h3><?php _e('Uh-oh! You are running an outdated version of PHP!', 'finch'); ?></h3> 204 <p><?php printf(__('Your current version of PHP %d.%d is not supported by Finch and is potentially not safe to use.', 'finch'), PHP_MAJOR_VERSION, PHP_MINOR_VERSION); ?></p> 205 </div> 206 <?php 207 } 208 195 209 196 210 public function getVersionManager() { -
finch/trunk/classes/finch_stylesheet.class.php
r1659494 r1748522 180 180 181 181 $css_content = $this->api->getStylesheet($projectStylesheetId); 182 $existing_content = file_get_contents($this->dir . $this->filename); 182 183 183 if($css_content ) {184 if($css_content && ($existing_content != $css_content)) { 184 185 if(file_put_contents($this->dir . $this->filename, $css_content) === false) { 185 186 error_log('Couldn\'t write to file'); 186 187 return false; 188 } else { 189 $finchOptions['stored-versions'][$this->versionId] = $this->activeRevisionTimestamp; 190 $finchOptions['last-updated'][$this->versionId] = time(); 191 return update_option(Finch::FINCH_OPTION_NAME, $finchOptions); 187 192 } 188 189 $finchOptions['stored-versions'][$this->versionId] = $this->activeRevisionTimestamp;190 $finchOptions['last-updated'][$this->versionId] = time();191 return update_option(Finch::FINCH_OPTION_NAME, $finchOptions);192 193 } 193 194 194 195 195 return false; -
finch/trunk/finch.php
r1659494 r1748522 27 27 } 28 28 29 if (!defined('PHP_MAJOR_VERSION')) { 30 $php_version = explode('.', PHP_VERSION); 31 32 define('PHP_MAJOR_VERSION', $php_version[0]); 33 define('PHP_MINOR_VERSION', $php_version[1]); 34 } 35 36 // Supporting PHP5.4 and up 37 define('FINCH_SUPPORTED', (PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4))); 38 29 39 $finch = new Finch($config); -
finch/trunk/lang/finch.pot
r1659494 r1748522 8 8 "Content-Transfer-Encoding: 8bit\n" 9 9 "X-Poedit-Basepath: ..\n" 10 "X-Poedit-SourceCharset: UTF-8\n" 11 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 10 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" 12 11 "X-Poedit-SearchPath-0: .\n" 13 12 "X-Poedit-SearchPathExcluded-0: *.js\n" 13 "X-Poedit-SourceCharset: UTF-8\n" 14 14 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 15 15 16 #: ../classes/finch.class.php:17 0, ../_dist/classes/finch.class.php:170, ../_svn/trunk/classes/finch.class.php:156, ../_svn/tags/0.1/classes/finch.class.php:15616 #: ../classes/finch.class.php:175 17 17 msgid "Hooray! Finch was successfully activated!" 18 18 msgstr "" 19 19 20 #: ../classes/finch.class.php:1 76, ../_dist/classes/finch.class.php:176, ../_svn/trunk/classes/finch.class.php:162, ../_svn/tags/0.1/classes/finch.class.php:16220 #: ../classes/finch.class.php:181 21 21 msgid "Now head down to <a href=\"%s\">Finch settings</a> page to set up your API credentials and you're all set!" 22 22 msgstr "" 23 23 24 #: ../classes/finch_settings.class.php:89, ../_dist/classes/finch_settings.class.php:89, ../_svn/trunk/classes/finch_settings.class.php:89, ../_svn/tags/0.1/classes/finch_settings.class.php:89 24 #: ../classes/finch.class.php:203 25 msgid "Uh-oh! You are running an outdated version of PHP!" 26 msgstr "" 27 28 #: ../classes/finch.class.php:204 29 msgid "Your current version of PHP %d.%d is not supported by Finch and is potentially not safe to use." 30 msgstr "" 31 32 #: ../classes/finch_settings.class.php:89 25 33 msgid "API Key" 26 34 msgstr "" 27 35 28 #: ../classes/finch_settings.class.php:102 , ../_dist/classes/finch_settings.class.php:102, ../_svn/trunk/classes/finch_settings.class.php:102, ../_svn/tags/0.1/classes/finch_settings.class.php:10236 #: ../classes/finch_settings.class.php:102 29 37 msgid "API Secret" 30 38 msgstr "" 31 39 32 #: ../classes/finch_settings.class.php:115 , ../_dist/classes/finch_settings.class.php:11540 #: ../classes/finch_settings.class.php:115 33 41 msgid "CSS Output method" 34 42 msgstr "" 35 43 36 #: ../classes/finch_settings.class.php:125 , ../_dist/classes/finch_settings.class.php:12544 #: ../classes/finch_settings.class.php:125 37 45 msgid "External Stylesheet" 38 46 msgstr "" 39 47 40 #: ../classes/finch_settings.class.php:130 , ../_dist/classes/finch_settings.class.php:13048 #: ../classes/finch_settings.class.php:130 41 49 msgid "Style Tags" 42 50 msgstr "" 43 51 44 #: ../classes/finch_stylesheet.class.php:70 , ../_dist/classes/finch_stylesheet.class.php:70, ../_svn/trunk/classes/finch_stylesheet.class.php:70, ../_svn/tags/0.1/classes/finch_stylesheet.class.php:7052 #: ../classes/finch_stylesheet.class.php:70 45 53 msgid "Finch plugin can't write files on your server. An external stylesheet located at <em>cdn.finch.io</em> will be used instead, which can affect load times. Read more <a href=\"%s\" target=\"_blank\">here</a> on how to fix that." 46 54 msgstr "" 47 55 48 #: ../classes/finch_version_manager.class.php:41, ../views/versions.php:4 , ../_dist/classes/finch_version_manager.class.php:41, ../_dist/views/versions.php:4, ../_svn/trunk/classes/finch_version_manager.class.php:41, ../_svn/trunk/views/versions.php:4, ../_svn/tags/0.1/classes/finch_version_manager.class.php:41, ../_svn/tags/0.1/views/versions.php:456 #: ../classes/finch_version_manager.class.php:41, ../views/versions.php:4 49 57 msgid "Versions" 50 58 msgstr "" 51 59 52 #: ../views/finch_settings.php:4 , ../_dist/views/finch_settings.php:4, ../_svn/trunk/views/finch_settings.php:4, ../_svn/tags/0.1/views/finch_settings.php:460 #: ../views/finch_settings.php:4 53 61 msgid "Finch settings" 54 62 msgstr "" 55 63 56 #: ../views/finch_settings.php:10 , ../_dist/views/finch_settings.php:10, ../_svn/trunk/views/finch_settings.php:10, ../_svn/tags/0.1/views/finch_settings.php:1064 #: ../views/finch_settings.php:10 57 65 msgid "Success!" 58 66 msgstr "" 59 67 60 #: ../views/finch_settings.php:15 , ../_dist/views/finch_settings.php:15, ../_svn/trunk/views/finch_settings.php:15, ../_svn/tags/0.1/views/finch_settings.php:1568 #: ../views/finch_settings.php:15 61 69 msgid "Finch is now connected to Wordpress. You can now switch versions at <a href=\"%s\">Appearance -> Versions</a>" 62 70 msgstr "" 63 71 64 #: ../views/finch_settings.php:23, ../views/versions.php:11 , ../_dist/views/finch_settings.php:23, ../_dist/views/versions.php:11, ../_svn/trunk/views/finch_settings.php:23, ../_svn/trunk/views/versions.php:11, ../_svn/tags/0.1/views/finch_settings.php:23, ../_svn/tags/0.1/views/versions.php:1172 #: ../views/finch_settings.php:23, ../views/versions.php:11 65 73 msgid "Oh snap!" 66 74 msgstr "" 67 75 68 #: ../views/finch_settings.php:26 , ../_dist/views/finch_settings.php:26, ../_svn/trunk/views/finch_settings.php:26, ../_svn/tags/0.1/views/finch_settings.php:2676 #: ../views/finch_settings.php:26 69 77 msgid "It seems the credentials you provided aren't quite right. <a href=\"%s\" target=\"_blank\">Need help</a> finding them?" 70 78 msgstr "" 71 79 72 #: ../views/finch_settings.php:36 , ../_dist/views/finch_settings.php:36, ../_svn/trunk/views/finch_settings.php:36, ../_svn/tags/0.1/views/finch_settings.php:3680 #: ../views/finch_settings.php:36 73 81 msgid "<a href=\"%s\" target=\"_blank\">Need help</a> finding your API credentials?" 74 82 msgstr "" 75 83 76 #: ../views/versions.php:17 , ../_dist/views/versions.php:17, ../_svn/trunk/views/versions.php:17, ../_svn/tags/0.1/views/versions.php:1784 #: ../views/versions.php:17 77 85 msgid "Your Wordpress site is not connected to your Finch project. You can do that in <a href=\"%s\">Finch settings</a> page!" 78 86 msgstr "" 79 87 80 #: ../views/versions.php:25 , ../_dist/views/versions.php:25, ../_svn/trunk/views/versions.php:25, ../_svn/tags/0.1/views/versions.php:2588 #: ../views/versions.php:25 81 89 msgid "Seems like there're no versions created yet, need <a href=\"%s\" target=\"_blank\">help making them?</a>" 82 90 msgstr "" 83 91 84 #: ../views/versions.php:75 , ../_dist/views/versions.php:7592 #: ../views/versions.php:75 85 93 msgid "Last update: " 86 94 msgstr "" -
finch/trunk/readme.txt
r1659494 r1748522 4 4 Tags: finch, design, change, style, without code, visual, editor, stylesheet, css, edit, magic 5 5 Requires at least: 3.8 6 Requires PHP: 5.4 6 7 Tested up to: 4.7 7 8 Stable tag: 0.1.1 … … 65 66 == Changelog == 66 67 68 = 0.1.2 = 69 * Reliability improvements for better stylesheet updates 70 * Minimum required PHP version now set to PHP 5.4 71 67 72 = 0.1.1 = 68 73 * Added option to change CSS output target (external stylsheet or HTML style tags)
Note: See TracChangeset
for help on using the changeset viewer.