Plugin Directory

Changeset 2117205


Ignore:
Timestamp:
07/03/2019 09:39:15 PM (7 years ago)
Author:
omertoledano
Message:

Release 0.0.2

Location:
power-abm/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • power-abm/trunk/abm.php

    r2117193 r2117205  
    2626
    2727    $lines = array();
    28     insert_with_markers($htaccess, "ABM", $lines);
     28    insert_with_markers($htaccess, "PowerABM", $lines);
    2929}
    3030
     
    8383    $utm_campaign = get_option('power_abm_utm_campaign');
    8484
    85     $htaccess = get_home_path().".htaccess";
     85    $htaccess = power_abm_get_htaccess_path();
    8686
    8787    $lines = array();
     
    8989    $lines[1] = "RedirectMatch 301 ^/$abm_vanity_url/(.*)$ /index.php/$abm_landing_page?utm_source=$utm_source&utm_medium=$utm_medium&utm_campaign=$utm_campaign&utm_content=$1";
    9090
    91     insert_with_markers($htaccess, "ABM", $lines);
     91    return insert_with_markers($htaccess, "PowerABM", $lines);
    9292}
    9393
     
    9797    if (in_array($option, $options)) {
    9898        error_log("Regenerating htaccess since $option changed");
    99         power_abm_regenerate_htaccess();
     99        $res = power_abm_regenerate_htaccess();
     100        if(!$res) {
     101            add_settings_error(
     102                'powerAbmSaveError',
     103                esc_attr( 'settings_not_updated' ),
     104                __( 'Cannot save settings', 'power-abm-domain' ),
     105                'error'
     106            );
     107        }
    100108    }
    101109}
    102110
     111function power_abm_get_htaccess_path() {
     112    return get_home_path().".htaccess";
     113}
     114
     115function power_abm_is_htaccess_writable() {
     116    $htaccess_path = power_abm_get_htaccess_path();
     117
     118    return is_writable($htaccess_path);
     119}
     120
    103121function power_abm_admin_view() {
     122    if (power_abm_is_htaccess_writable()) {
    104123?>
    105124<div class="wrap">
     
    166185</div>
    167186
    168 <?php }
     187<?php } else {
     188        print_r("htaccess file isn't writable");
     189    }
     190}
    169191?>
  • power-abm/trunk/readme.txt

    r2117193 r2117205  
    3434== Changelog ==
    3535
     36= 0.0.2 =
     37Added a few error checking (is .htaccess writable, did saving setting succeeded)
     38
    3639= 0.1 =
    3740First release. Allows redirect functionality for one campaign.
Note: See TracChangeset for help on using the changeset viewer.