Plugin Directory

Changeset 1748522


Ignore:
Timestamp:
10/18/2017 08:56:35 AM (8 years ago)
Author:
finchio
Message:

0.1.2 update source added to trunk

Location:
finch/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • finch/trunk/api/finch_api_client.class.php

    r1587432 r1748522  
    172172            $response = wp_remote_get($cssUrl);
    173173            if(is_wp_error($response)) {
    174                 $error_code = $response->get_error_code();
     174                $error_code = $response->get_error_code(); 
    175175                throw new Exception($response->get_error_message(), is_int($error_code) ? $error_code : 0);
    176176            }
  • finch/trunk/classes/finch.class.php

    r1659494 r1748522  
    5252
    5353    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        }
    6873    }
    6974
     
    107112
    108113        if($activeVersion) {
    109             $storedVersions = isset($this->options['stored-versions']) ? $this->options['stored-versions'] : [];
     114            $storedVersions = (isset($this->options['stored-versions']) ? $this->options['stored-versions'] : []);
    110115            $this->activeStylesheet = new FinchStylesheet($activeVersion, $storedVersions, $this->api);
    111116        } else {
     
    193198    }
    194199
     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
    195209
    196210    public function getVersionManager() {
  • finch/trunk/classes/finch_stylesheet.class.php

    r1659494 r1748522  
    180180
    181181        $css_content = $this->api->getStylesheet($projectStylesheetId);
     182        $existing_content = file_get_contents($this->dir . $this->filename);
    182183           
    183         if($css_content) {
     184        if($css_content && ($existing_content != $css_content)) {
    184185            if(file_put_contents($this->dir . $this->filename, $css_content) === false) {
    185186                error_log('Couldn\'t write to file');
    186187                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);
    187192            }
    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);
    192193        }
    193        
    194194
    195195        return false;
  • finch/trunk/finch.php

    r1659494 r1748522  
    2727}
    2828
     29if (!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
     37define('FINCH_SUPPORTED', (PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4)));
     38
    2939$finch = new Finch($config);
  • finch/trunk/lang/finch.pot

    r1659494 r1748522  
    88"Content-Transfer-Encoding: 8bit\n"
    99"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"
    1211"X-Poedit-SearchPath-0: .\n"
    1312"X-Poedit-SearchPathExcluded-0: *.js\n"
     13"X-Poedit-SourceCharset: UTF-8\n"
    1414"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    1515
    16 #: ../classes/finch.class.php:170, ../_dist/classes/finch.class.php:170, ../_svn/trunk/classes/finch.class.php:156, ../_svn/tags/0.1/classes/finch.class.php:156
     16#: ../classes/finch.class.php:175
    1717msgid "Hooray! Finch was successfully activated!"
    1818msgstr ""
    1919
    20 #: ../classes/finch.class.php:176, ../_dist/classes/finch.class.php:176, ../_svn/trunk/classes/finch.class.php:162, ../_svn/tags/0.1/classes/finch.class.php:162
     20#: ../classes/finch.class.php:181
    2121msgid "Now head down to <a href=\"%s\">Finch settings</a> page to set up your API credentials and you're all set!"
    2222msgstr ""
    2323
    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
     25msgid "Uh-oh! You are running an outdated version of PHP!"
     26msgstr ""
     27
     28#: ../classes/finch.class.php:204
     29msgid "Your current version of PHP %d.%d is not supported by Finch and is potentially not safe to use."
     30msgstr ""
     31
     32#: ../classes/finch_settings.class.php:89
    2533msgid "API Key"
    2634msgstr ""
    2735
    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:102
     36#: ../classes/finch_settings.class.php:102
    2937msgid "API Secret"
    3038msgstr ""
    3139
    32 #: ../classes/finch_settings.class.php:115, ../_dist/classes/finch_settings.class.php:115
     40#: ../classes/finch_settings.class.php:115
    3341msgid "CSS Output method"
    3442msgstr ""
    3543
    36 #: ../classes/finch_settings.class.php:125, ../_dist/classes/finch_settings.class.php:125
     44#: ../classes/finch_settings.class.php:125
    3745msgid "External Stylesheet"
    3846msgstr ""
    3947
    40 #: ../classes/finch_settings.class.php:130, ../_dist/classes/finch_settings.class.php:130
     48#: ../classes/finch_settings.class.php:130
    4149msgid "Style Tags"
    4250msgstr ""
    4351
    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:70
     52#: ../classes/finch_stylesheet.class.php:70
    4553msgid "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."
    4654msgstr ""
    4755
    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:4
     56#: ../classes/finch_version_manager.class.php:41, ../views/versions.php:4
    4957msgid "Versions"
    5058msgstr ""
    5159
    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:4
     60#: ../views/finch_settings.php:4
    5361msgid "Finch settings"
    5462msgstr ""
    5563
    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:10
     64#: ../views/finch_settings.php:10
    5765msgid "Success!"
    5866msgstr ""
    5967
    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:15
     68#: ../views/finch_settings.php:15
    6169msgid "Finch is now connected to Wordpress. You can now switch versions at <a href=\"%s\">Appearance -> Versions</a>"
    6270msgstr ""
    6371
    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:11
     72#: ../views/finch_settings.php:23, ../views/versions.php:11
    6573msgid "Oh snap!"
    6674msgstr ""
    6775
    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:26
     76#: ../views/finch_settings.php:26
    6977msgid "It seems the credentials you provided aren't quite right. <a href=\"%s\" target=\"_blank\">Need help</a> finding them?"
    7078msgstr ""
    7179
    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:36
     80#: ../views/finch_settings.php:36
    7381msgid "<a href=\"%s\" target=\"_blank\">Need help</a> finding your API credentials?"
    7482msgstr ""
    7583
    76 #: ../views/versions.php:17, ../_dist/views/versions.php:17, ../_svn/trunk/views/versions.php:17, ../_svn/tags/0.1/views/versions.php:17
     84#: ../views/versions.php:17
    7785msgid "Your Wordpress site is not connected to your Finch project. You can do that in <a href=\"%s\">Finch settings</a> page!"
    7886msgstr ""
    7987
    80 #: ../views/versions.php:25, ../_dist/views/versions.php:25, ../_svn/trunk/views/versions.php:25, ../_svn/tags/0.1/views/versions.php:25
     88#: ../views/versions.php:25
    8189msgid "Seems like there're no versions created yet, need <a href=\"%s\" target=\"_blank\">help making them?</a>"
    8290msgstr ""
    8391
    84 #: ../views/versions.php:75, ../_dist/views/versions.php:75
     92#: ../views/versions.php:75
    8593msgid "Last update: "
    8694msgstr ""
  • finch/trunk/readme.txt

    r1659494 r1748522  
    44Tags: finch, design, change, style, without code, visual, editor, stylesheet, css, edit, magic
    55Requires at least: 3.8
     6Requires PHP: 5.4
    67Tested up to: 4.7
    78Stable tag: 0.1.1
     
    6566== Changelog ==
    6667
     68= 0.1.2 =
     69* Reliability improvements for better stylesheet updates
     70* Minimum required PHP version now set to PHP 5.4
     71
    6772= 0.1.1 =
    6873* Added option to change CSS output target (external stylsheet or HTML style tags)
Note: See TracChangeset for help on using the changeset viewer.